diff options
Diffstat (limited to 'kpersonalizer')
37 files changed, 5436 insertions, 0 deletions
diff --git a/kpersonalizer/Makefile.am b/kpersonalizer/Makefile.am new file mode 100644 index 000000000..d6ec8281a --- /dev/null +++ b/kpersonalizer/Makefile.am @@ -0,0 +1,53 @@ +bin_PROGRAMS = kpersonalizer +kpersonalizer_SOURCES = stylepreview.ui krefinepage.cpp \ + kstylepage.cpp keyecandypage.cpp kospage.cpp kcountrypage.cpp kpersonalizer.cpp \ + main.cpp kfindlanguage.cpp \ + kcountrypagedlg.ui kospagedlg.ui keyecandypagedlg.ui kstylepagedlg.ui \ + krefinepagedlg.ui ksysinfo.cpp + +kpersonalizer_LDADD = $(LIB_KIO) + +EXTRA_DIST = main.cpp kpersonalizer.cpp kpersonalizer.h kpersonalizer.desktop kcountrypage.cpp kcountrypage.h kospage.cpp kospage.h keyecandypage.cpp keyecandypage.h kstylepage.cpp kstylepage.h krefinepage.cpp krefinepage.h cr16-app-kpersonalizer.png cr32-app-kpersonalizer.png README kcountrypagedlg.ui kospage.ui keyecandypagedlg.ui kstylepagedlg.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 + +####### kdevelop 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) + +# 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..96224a955 --- /dev/null +++ b/kpersonalizer/README @@ -0,0 +1,230 @@ +KPersonalizer - Whitepaper +=================== + +Questions & Answers: + +Torsten Rahn <torsten@kde.org> +Carsten Wolff <wolff@kde.org> +Ralf Nolden <nolden@kde.org> +Daniel Molkentin <danimo@kde.org> + + +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 kwin 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..fdc0bf705 --- /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 kstylepage: + - 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..699739580 --- /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 : nolden@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <qstringlist.h> +#include <qlabel.h> +#include <qmap.h> + +#include <kapplication.h> +#include <ksimpleconfig.h> +#include <klocale.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(QWidget *parent, const char *name ) : KCountryPageDlg(parent,name) { + + px_introSidebar->setPixmap(UserIcon("step1.png")); + + connect(cb_country, SIGNAL(activated(const QString &)), SLOT(setLangForCountry(const QString &))); + connect(cb_language, SIGNAL(activated(const QString &)), SLOT(setLanguageChanged())); + + // naturally, the language is not changed on startup + b_savedLanguageChanged = false; + b_startedLanguageChanged = false; + + // set appropriate KDE version (kapplication.h) + txt_welcome->setText(i18n("<h3>Welcome to KDE %1</h3>").arg(KDE_VERSION_STRING)); + + flang = new KFindLanguage(); + + // need this ones for decision over restarts of kp, kicker, etc + s_oldlocale = KGlobal::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) { + + QString sub = QString::fromLatin1("l10n/"); + + // clear the list + combo->clear(); + + QStringList regionfiles = KGlobal::dirs()->findAllResources("locale", sub + "*.desktop"); + QMap<QString,QString> regionnames; + + for ( QStringList::ConstIterator it = regionfiles.begin(); it != regionfiles.end(); ++it ) { + KSimpleConfig entry(*it); + entry.setGroup(QString::fromLatin1("KCM Locale")); + QString name = entry.readEntry(QString::fromLatin1("Name"), i18n("without name")); + + QString 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 ( QMap<QString,QString>::ConstIterator mit = regionnames.begin(); mit != regionnames.end(); ++mit ) { + combo->insertSubmenu( mit.key(), '-' + mit.data(), sub ); + } + + // add all languages to the list + QStringList countrylist = KGlobal::dirs()->findAllResources("locale", sub + "*/entry.desktop"); + countrylist.sort(); + + for ( QStringList::ConstIterator it = countrylist.begin(); it != countrylist.end(); ++it ) { + KSimpleConfig entry(*it); + entry.setGroup(QString::fromLatin1("KCM Locale")); + QString name = entry.readEntry(QString::fromLatin1("Name"), i18n("without name")); + QString submenu = '-' + entry.readEntry("Region"); + + QString tag = *it; + int index = tag.findRev('/'); + tag.truncate(index); + index = tag.findRev('/'); + tag = tag.mid(index+1); + + QPixmap flag( locate( "locale", QString::fromLatin1("l10n/%1/flag.png").arg(tag) ) ); + QIconSet icon( flag ); + combo->insertItem( icon, name, tag, submenu ); + } +} + +void KCountryPage::fillLanguageMenu(KLanguageButton *combo) { + combo->clear(); + QString submenu; // we are working on this menu + QStringList langlist = flang->getLangList(); + QMap<QString,QString> langmap = flang->getLangMap(); + QStringList::ConstIterator it; + for ( it = langlist.begin(); it != langlist.end(); ++it ) { + if ((*it).isNull()) { + combo->insertSeparator(); + submenu = QString::fromLatin1("all"); + combo->insertSubmenu(i18n("All"), submenu, QString::null); + continue; + } + combo->insertItem(langmap[(*it)], (*it), submenu ); + } +} + +/** No descriptions */ +bool KCountryPage::save(KLanguageButton *comboCountry, KLanguageButton *comboLang) { + kdDebug() << "KCountryPage::save()" << endl; + KConfigBase *config = KGlobal::config(); + + config->setGroup(QString::fromLatin1("Locale")); + config->writeEntry(QString::fromLatin1("Country"), comboCountry->current(), true, true); + config->writeEntry(QString::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 + QCString replyType; QByteArray replyData; + QByteArray data, da; + QDataStream stream( data, IO_WriteOnly ); + stream << comboLang->current(); + if ( !kapp->dcopClient()->isAttached() ) + kapp->dcopClient()->attach(); + // ksycoca needs to be rebuilt + KProcess proc; + proc << QString::fromLatin1("kbuildsycoca"); + proc.start(KProcess::DontCare); + kdDebug() << "KLocaleConfig::save : sending signal to kdesktop" << endl; + // inform kicker and kdeskop about the new language + kapp->dcopClient()->send( "kicker", "Panel", "restart()", QString::null); + // call, not send, so that we know it's done before coming back + // (we both access kdeglobals...) + kapp->dcopClient()->call( "kdesktop", "KDesktopIface", "languageChanged(QString)", data, replyType, replyData ); + } + // KPersonalizer::next() probably waits for a return-value + return true; +} + +void KCountryPage::setLangForCountry(const QString &country) { + KSimpleConfig ent(locate("locale", "l10n/" + country + "/entry.desktop"), true); + ent.setGroup(QString::fromLatin1("KCM Locale")); + langs = ent.readListEntry(QString::fromLatin1("Languages")); + + QString lang = QString::fromLatin1("en_US"); + // use the first INSTALLED langauge in the list, or default to C + for ( QStringList::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..7b30b5ba4 --- /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 : nolden@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KCOUNTRYPAGE_H +#define KCOUNTRYPAGE_H + +#include "kcountrypagedlg.h" + +class QStringList; +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(QWidget *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: + QStringList langs; + QString s_oldlocale; + KFindLanguage *flang; + +private slots: // Private slots + void setLangForCountry(const QString &); + void setLanguageChanged(); + +}; + +#endif diff --git a/kpersonalizer/kcountrypagedlg.ui b/kpersonalizer/kcountrypagedlg.ui new file mode 100644 index 000000000..47b9a97e7 --- /dev/null +++ b/kpersonalizer/kcountrypagedlg.ui @@ -0,0 +1,242 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>KCountryPageDlg</class> +<widget class="QWidget"> + <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="QLayoutWidget" 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="QLabel" 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="QLabel" 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 KDE 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 KDE 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 KDE 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="QLabel" row="0" column="1"> + <property name="name"> + <cstring>txt_welcome</cstring> + </property> + <property name="text"> + <string><h3>Welcome to KDE %VERSION%!</h3></string> + </property> + </widget> + <widget class="QLayoutWidget" 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="QLabel" row="3" column="1"> + <property name="name"> + <cstring>TextLabel10</cstring> + </property> + <property name="text"> + <string>Please choose your country:</string> + </property> + </widget> + <widget class="QLabel" 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..f7794724c --- /dev/null +++ b/kpersonalizer/keyecandypage.cpp @@ -0,0 +1,853 @@ +/*************************************************************************** + keyecandypage.cpp - description + ------------------- + begin : Tue May 22 2001 + copyright : (C) 2001 by Ralf Nolden + email : nolden@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#include <qpushbutton.h> +#include <qbuttongroup.h> +#include <qlabel.h> +#include <qstring.h> +#include <qstringlist.h> +#include <qslider.h> +#include <qcolor.h> +#include <qsettings.h> +#include <qfont.h> + +#include <ksimpleconfig.h> +#include <kglobal.h> +#include <kstandarddirs.h> +#include <klocale.h> +#include <dcopclient.h> +#include <kipc.h> +#include <kapplication.h> +#include <klistview.h> +#include <krun.h> +#include <kmessagebox.h> +#include <kiconloader.h> +#include <ktrader.h> +#include <kglobalsettings.h> + +#include <stdlib.h> + +#include <kdebug.h> + +#include "ksysinfo.h" +#include "keyecandypage.h" + +KEyeCandyPage::KEyeCandyPage(QWidget *parent, const char *name ) : KEyeCandyPageDlg(parent,name) { + + kwinconf = new KConfig("kwinrc", false, true); + kwineventconf = new KConfig("kwin.eventsrc", false, false); + kickerconf = new KConfig("kickerrc",false, false); + konquerorconf = new KConfig("konquerorrc",false, false); + konqiconconf = new KConfig("konqiconviewrc",false,false); + kdesktopconf = new KConfig("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 QCheckListItem(klv_features, i18n("Desktop Wallpaper"), + QCheckListItem::CheckBox); + desktop_window_effects= new QCheckListItem(klv_features, i18n("Window Moving/Resizing Effects"), + QCheckListItem::CheckBox); + desktop_window_moving_contents= new QCheckListItem(klv_features, i18n("Display Contents in Moving/Resizing Windows"), + QCheckListItem::CheckBox); + // Level 2 + backgrounds_konqueror= new QCheckListItem(klv_features, i18n("File Manager Background Picture"), + QCheckListItem::CheckBox); + backgrounds_panel= new QCheckListItem(klv_features, i18n("Panel Background Picture"), + QCheckListItem::CheckBox); + // Level 3 + icon_zooming_panel = new QCheckListItem(klv_features, i18n("Panel Icon Popups"), + QCheckListItem::CheckBox); + icon_effect_gamma = new QCheckListItem(klv_features, i18n("Icon Highlighting"), + QCheckListItem::CheckBox); + icon_mng_animation = new QCheckListItem(klv_features, i18n("File Manager Icon Animation"), + QCheckListItem::CheckBox); + + sound_scheme = new QCheckListItem(klv_features, i18n("Sound Theme"), + QCheckListItem::CheckBox); + + // Level 4 + /////////////////////////////////////////////////////////////////////////////////// + /// DEPENDEND ON RESOLUTION; DEFAULT: DON`T USE IN LEVELS + icon_effect_size_desktop = new QCheckListItem(klv_features, i18n("Large Desktop Icons"), + QCheckListItem::CheckBox); + icon_effect_size_panel = new QCheckListItem(klv_features, i18n("Large Panel Icons"), + QCheckListItem::CheckBox); + /// DEPENDEND ON RESOLUTION; DEFAULT: DON`T USE IN LEVELS + /////////////////////////////////////////////////////////////////////////////////// + antialiasing_fonts = new QCheckListItem(klv_features, i18n("Smoothed Fonts " + "(Antialiasing)"), QCheckListItem::CheckBox); + + // Level 5 + preview_images = new QCheckListItem(klv_features, i18n("Preview Images"), + QCheckListItem::CheckBox); + pushbutton_icons = new QCheckListItem(klv_features, i18n("Icons on Buttons"), + QCheckListItem::CheckBox); + + // Level 6 + animated_combo = new QCheckListItem(klv_features, i18n("Animated Combo Boxes"), + QCheckListItem::CheckBox); + + // Level 7 + fading_tooltips = new QCheckListItem(klv_features, i18n("Fading Tooltips"), QCheckListItem::CheckBox); + + // Level 8 + preview_text = new QCheckListItem(klv_features, i18n("Preview Text Files"), + QCheckListItem::CheckBox); + // Level 9 + fading_menus= new QCheckListItem(klv_features, i18n("Fading Menus"), + QCheckListItem::CheckBox); + preview_other = new QCheckListItem(klv_features, i18n("Preview Other Files"), + QCheckListItem::CheckBox); + + getUserDefaults(); // get user's current settings + setDefaults(); // set the initial level on the slider and checkboxes +} + +KEyeCandyPage::~KEyeCandyPage(){ + delete kwinconf; + delete kwineventconf; + 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 < QApplication::desktop()->numScreens(); i++) { + if(QApplication::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(QApplication::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 < QApplication::desktop()->numScreens(); i++) { + if(QApplication::desktop()->screenGeometry(i).width() >= 1024) + icon_effect_size_desktop->setOn(true); + if(QApplication::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="KDE34.png"; + + 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 == "KDE34.png"){ + 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", QColor("#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 /kdebase/kcontrol/kwm module, KAdvancedConfig class. Used are: +// -Animate minimize and restore +// -Animate shade +// -Enable Hover +//-Enable move/resize on maximised windows + kwinconf->setGroup( "Windows" ); + if(!restore){ + kwinconf->writeEntry("AnimateMinimize", enable ); + kwinconf->writeEntry("AnimateShade", enable ); + kwinconf->writeEntry("MoveResizeMaximizedWindows",enable); + kwinconf->writeEntry("ShadeHover", enable ); + } else { + kwinconf->writeEntry("AnimateMinimize", b_AnimateMinimize ); + kwinconf->writeEntry("AnimateShade", b_AnimateShade ); + kwinconf->writeEntry("MoveResizeMaximizedWindows",b_MoveResizeMaximizedWindows); + kwinconf->writeEntry("ShadeHover", b_ShadeHover); + } +} + +/** enable/disable window moving with contents shown */ +void KEyeCandyPage::enableDesktopWindowMovingContents(bool enable, bool restore){ +// see /kdebase/kcontrol/kwm module, KAdvancedConfig class. Used are: +// -Display content in moving window +// -Display content in resizing window +// And KGlobalSettings::opaqueResize() for QSplitters + + kwinconf->setGroup( "Windows" ); + KGlobal::config()->setGroup("KDE"); + if (enable){ + kwinconf->writeEntry("ResizeMode","Opaque"); + kwinconf->writeEntry("MoveMode","Opaque"); + KGlobal::config()->writeEntry("OpaqueResize", true, true, true); + } else { + kwinconf->writeEntry("ResizeMode","Transparent"); + kwinconf->writeEntry("MoveMode","Transparent"); + KGlobal::config()->writeEntry("OpaqueResize", false, true, true); + } + if(restore){ + kwinconf->writeEntry("ResizeMode",s_ResizeMode); + kwinconf->writeEntry("MoveMode",s_MoveMode); + KGlobal::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="kde4ever.png"; + konquerorconf->writePathEntry("BgImage", konqbgimage); + } else + konquerorconf->writePathEntry("BgImage", QString::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 /kdebase/kcontrol/kicker, LookAndFeelTab + kickerconf->setGroup("buttons"); + kickerconf->writeEntry("EnableIconZoom", enable); +} + +/** enable Icon highlighting, Level 3 */ +void KEyeCandyPage::enableIconEffectGamma(bool enable, bool user){ + if(enable){ + KGlobal::config()->setGroup("DesktopIcons"); + KGlobal::config()->writeEntry("ActiveEffect", "togamma", true, true); + KGlobal::config()->writeEntry("ActiveValue", "0.7", true, true); + KGlobal::config()->setGroup("PanelIcons"); + KGlobal::config()->writeEntry("ActiveEffect", "togamma", true, true); + KGlobal::config()->writeEntry("ActiveValue", "0.7", true, true); + } else { + if(user){ + KGlobal::config()->setGroup("DesktopIcons"); + KGlobal::config()->writeEntry("ActiveEffect", st_UserGamma.EffectDesktop, true, true); + KGlobal::config()->writeEntry("ActiveValue", st_UserGamma.ValueDesktop, true, true); + KGlobal::config()->setGroup("PanelIcons"); + KGlobal::config()->writeEntry("ActiveEffect", st_UserGamma.EffectPanel, true, true); + KGlobal::config()->writeEntry("ActiveValue", st_UserGamma.ValuePanel, true, true); + } else { + KGlobal::config()->setGroup("DesktopIcons"); + KGlobal::config()->writeEntry("ActiveEffect", "none", true, true); + KGlobal::config()->setGroup("PanelIcons"); + KGlobal::config()->writeEntry("ActiveEffect", "none", true, true); + } + } +} + +void KEyeCandyPage::enableIconMngAnimation(bool enable) { + KGlobal::config()->setGroup("DesktopIcons"); + KGlobal::config()->writeEntry("Animated", enable, true, true); +} + +/** No descriptions */ +void KEyeCandyPage::enableIconEffectSizePanel(bool enable){ + QByteArray data; + QDataStream 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){ + KGlobal::config()->setGroup("DesktopIcons"); + if( enable ) { // use 48x48 icons + KGlobal::config()->writeEntry("Size", 48, true, true); + } else { + KGlobal::config()->writeEntry("Size", desktopiconsize, true, true); + } +} +//----------------------------ICON STUFF------------------------------------------------- + + +//----------------------------STYLE EFFECTS------------------------------------------------- + +/** Enable fading tooltips in Level 7 */ +void KEyeCandyPage::enableFadingToolTips(bool enable){ + KGlobal::config()->setGroup("KDE"); + KGlobal::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){ + KGlobal::config()->setGroup("KDE"); + KGlobal::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){ + KGlobal::config()->setGroup("KDE"); + KGlobal::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){ + KGlobal::config()->setGroup("KDE"); + KGlobal::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){ + KGlobal::config()->setGroup("KDE"); + KGlobal::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){ + QStringList desktopPreviews; + QStringList konquerorNoPreviews; + KTrader::OfferList plugins = KTrader::self()->query("ThumbCreator"); + for (KTrader::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) { + kwineventconf->setGroup("desktop1"); + kwineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.desktop1 : 0) ); + kwineventconf->setGroup("desktop2"); + kwineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.desktop2 : 0) ); + kwineventconf->setGroup("desktop3"); + kwineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.desktop3 : 0) ); + kwineventconf->setGroup("desktop4"); + kwineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.desktop4 : 0) ); + kwineventconf->setGroup("desktop5"); + kwineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.desktop5 : 0) ); + kwineventconf->setGroup("desktop6"); + kwineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.desktop6 : 0) ); + kwineventconf->setGroup("desktop7"); + kwineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.desktop7 : 0) ); + kwineventconf->setGroup("desktop8"); + kwineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.desktop8 : 0) ); + + kwineventconf->setGroup("new"); + kwineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.notold : 0) ); + kwineventconf->setGroup("close"); + kwineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.close : 0) ); + + kwineventconf->setGroup("transnew"); + kwineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.transnew : 0) ); + kwineventconf->setGroup("transdelete"); + kwineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.transdelete : 0) ); + + kwineventconf->setGroup("iconify"); + kwineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.iconify : 0) ); + kwineventconf->setGroup("deiconify"); + kwineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.deiconify : 0) ); + kwineventconf->setGroup("maximize"); + kwineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.maximize : 0) ); + kwineventconf->setGroup("unmaximize"); + kwineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.unmaximize : 0) ); + kwineventconf->setGroup("shadeup"); + kwineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.shadeup : 0) ); + kwineventconf->setGroup("shadedown"); + kwineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.shadedown : 0) ); + kwineventconf->setGroup("sticky"); + kwineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.sticky : 0) ); + kwineventconf->setGroup("unsticky"); + kwineventconf->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()) { + QSettings().writeEntry("/qt/useXft", enable); + QSettings().writeEntry("/qt/enableXft", enable); + } + } else { + QSettings().writeEntry("/qt/useXft", b_useXft); + QSettings().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 KConfig-objects to their respective files + kwinconf->sync(); + kwineventconf->sync(); + konquerorconf->sync(); + konqiconconf->sync(); + kickerconf->sync(); + kdesktopconf->sync(); + KGlobal::config()->sync(); + // restart kwin for window effects + kapp->dcopClient()->send("knotify", "Notify", "reconfigure()", ""); + kapp->dcopClient()->send("kwin*", "", "reconfigure()", ""); + // set the display options (style effects) + KIPC::sendMessageAll(KIPC::SettingsChanged); + QApplication::syncX(); + // kicker stuff: Iconzooming etc. + kapp->dcopClient()->send( "kicker", "Panel", "configure()", "" ); + // Icon stuff + for (int i=0; i<KIcon::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()", "" ); + kapp->dcopClient()->send( "kdesktop", "KDesktopIface", "configure()", "" ); + kapp->dcopClient()->send( "kdesktop", "KBackgroundIface", "configure()", "" ); + kapp->dcopClient()->send( "kdesktop", "KDesktopIface", "lineupIcons()", "" ); +} + +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(){ + QByteArray replydata; + QByteArray data; + QCString replytype; + kapp->dcopClient()->call( "kicker", "Panel", "panelSize()",data, replytype, replydata); + QDataStream stream( replydata, IO_ReadOnly ); + stream >> panelsize; + + // Wallpaper-User-Defaults + kdesktopconf->setGroup("FMSettings"); + QColor tempcolor=KGlobalSettings::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", "KDE34.png"); + // Wallpaper-User-Defaults (END) + + KGlobal::config()->setGroup("KDE"); + + // Font-User-Defaults + b_useXft=QSettings().readBoolEntry("/qt/useXft"); + b_enableXft=QSettings().readBoolEntry("/qt/enableXft"); + + KGlobal::config()->setGroup("PanelIcons"); + st_UserGamma.EffectPanel=KGlobal::config()->readEntry("ActiveEffect", "none"); + st_UserGamma.ValuePanel=KGlobal::config()->readEntry("ActiveValue", "0.7"); + + KGlobal::config()->setGroup("DesktopIcons"); + st_UserGamma.EffectDesktop=KGlobal::config()->readEntry("ActiveEffect", "none"); + st_UserGamma.ValueDesktop=KGlobal::config()->readEntry("ActiveValue", "0.7"); + desktopiconsize=KGlobal::config()->readNumEntry("Size", 32); + b_iconMngAnim = KGlobal::config()->readBoolEntry( "Animated", true ); + + KGlobal::config()->setGroup("KDE"); + b_EffectFadeTooltip=KGlobal::config()->readBoolEntry( "EffectFadeTooltip", false ); + b_PushButtonIcons=KGlobal::config()->readBoolEntry("ShowIconsOnPushButtons", false); + b_EffectFadeMenu=KGlobal::config()->readBoolEntry("EffectFadeMenu", false); + b_EffectAnimateCombo=KGlobal::config()->readBoolEntry("EffectAnimateCombo", false); + b_EffectsEnabled=KGlobal::config()->readBoolEntry("EffectsEnabled", false); + b_OpaqueResize=KGlobal::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); + kwinconf->setGroup( "Windows" ); + s_ResizeMode=kwinconf->readEntry("ResizeMode", "Transparent"); + s_MoveMode=kwinconf->readEntry("MoveMode", "Opaque"); + + b_AnimateMinimize=kwinconf->readBoolEntry("AnimateMinimize", true ); + b_AnimateShade=kwinconf->readBoolEntry("AnimateShade", true ); + b_MoveResizeMaximizedWindows=kwinconf->readBoolEntry("MoveResizeMaximizedWindows",true); + b_ShadeHover = kwinconf->readBoolEntry("ShadeHover", false); + + getUserSoundScheme(); +} + +/** gets the users sound-settings */ +void KEyeCandyPage::getUserSoundScheme() { + kwineventconf->setGroup("desktop1"); + st_UserSnd.desktop1 = kwineventconf->readNumEntry("presentation", 0); + kwineventconf->setGroup("desktop2"); + st_UserSnd.desktop2 = kwineventconf->readNumEntry("presentation", 0); + kwineventconf->setGroup("desktop3"); + st_UserSnd.desktop3 = kwineventconf->readNumEntry("presentation", 0); + kwineventconf->setGroup("desktop4"); + st_UserSnd.desktop4 = kwineventconf->readNumEntry("presentation", 0); + kwineventconf->setGroup("desktop5"); + st_UserSnd.desktop5 = kwineventconf->readNumEntry("presentation", 0); + kwineventconf->setGroup("desktop6"); + st_UserSnd.desktop6 = kwineventconf->readNumEntry("presentation", 0); + kwineventconf->setGroup("desktop7"); + st_UserSnd.desktop7 = kwineventconf->readNumEntry("presentation", 0); + kwineventconf->setGroup("desktop8"); + st_UserSnd.desktop8 = kwineventconf->readNumEntry("presentation", 0); + + kwineventconf->setGroup("new"); + st_UserSnd.notold = kwineventconf->readNumEntry("presentation", 0); + kwineventconf->setGroup("close"); + st_UserSnd.close = kwineventconf->readNumEntry("presentation", 0); + + kwineventconf->setGroup("transnew"); + st_UserSnd.transnew = kwineventconf->readNumEntry("presentation", 0); + kwineventconf->setGroup("transdelete"); + st_UserSnd.transdelete = kwineventconf->readNumEntry("presentation", 0); + + kwineventconf->setGroup("iconify"); + st_UserSnd.iconify = kwineventconf->readNumEntry("presentation", 0 ); + kwineventconf->setGroup("deiconify"); + st_UserSnd.deiconify = kwineventconf->readNumEntry("presentation", 0); + kwineventconf->setGroup("maximize"); + st_UserSnd.maximize = kwineventconf->readNumEntry("presentation", 0); + kwineventconf->setGroup("unmaximize"); + st_UserSnd.unmaximize = kwineventconf->readNumEntry("presentation", 0); + kwineventconf->setGroup("shadeup"); + st_UserSnd.shadeup = kwineventconf->readNumEntry("presentation", 0); + kwineventconf->setGroup("shadedown"); + st_UserSnd.shadedown = kwineventconf->readNumEntry("presentation", 0); + kwineventconf->setGroup("sticky"); + st_UserSnd.sticky = kwineventconf->readNumEntry("presentation", 0); + kwineventconf->setGroup("unsticky"); + st_UserSnd.unsticky = kwineventconf->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 QString& 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..9cb0e4596 --- /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 : nolden@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KEYECANDYPAGE_H +#define KEYECANDYPAGE_H + +#include "keyecandypagedlg.h" + +class QCheckListItem; +class QColor; +class KSysInfo; + +/**Abstract class for the eyecandy page. Applies the accoring eyecandy settings + *@author Ralf Nolden + */ + +class KEyeCandyPage : public KEyeCandyPageDlg { + Q_OBJECT +public: + KEyeCandyPage(QWidget *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 KDE. 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 KDE 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 (KDE 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 KDE, 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 QString& 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; + QString 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; + + QString konqbgimage, s_ResizeMode, s_MoveMode, deskbgimage; + QStringList konq_dont_prev, kdesktop_prev; + QColor desktopTextColor; + + struct st_Gamma{ + QString EffectDesktop; + QString EffectPanel; + QString ValueDesktop; + QString ValuePanel; + } st_UserGamma; + + struct st_Wallpaper{ + bool CommonDesktop; + QString MultiWallpaperMode; + QString WallpaperMode; + QString 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) + + KConfig* kwinconf; + KConfig* kwineventconf; + KConfig* kickerconf; + KConfig* konquerorconf; + KConfig* konqiconconf; + KConfig* kdesktopconf; + KConfig* kdeglobals; + + KSysInfo* sys; + + bool prevImage, prevText, prevOther; + + QCheckListItem* alpha_blending_desktop; + QCheckListItem* alpha_blending_panel; + + QCheckListItem* animated_combo; + + QCheckListItem* antialiasing_fonts; + + QCheckListItem* backgrounds_konqueror; + QCheckListItem* backgrounds_panel; + + QCheckListItem* desktop_wallpaper; + QCheckListItem* desktop_window_effects; + QCheckListItem* desktop_window_moving_contents; + + QCheckListItem* icon_effect_gamma; + QCheckListItem* icon_effect_size_desktop; + QCheckListItem* icon_effect_size_panel; + + QCheckListItem* icon_zooming_panel; + QCheckListItem* icon_mng_animation; + + QCheckListItem* fading_menus; + QCheckListItem* fading_tooltips; + + QCheckListItem* pushbutton_icons; + + QCheckListItem* preview_text; + QCheckListItem* preview_images; + QCheckListItem* preview_other; + + QCheckListItem* sound_scheme; +}; + +#endif diff --git a/kpersonalizer/keyecandypagedlg.ui b/kpersonalizer/keyecandypagedlg.ui new file mode 100644 index 000000000..c2437b0b2 --- /dev/null +++ b/kpersonalizer/keyecandypagedlg.ui @@ -0,0 +1,263 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>KEyeCandyPageDlg</class> +<widget class="QWidget"> + <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="QLabel" 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="QLabel" 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>KDE 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="QLayoutWidget" row="1" column="1"> + <property name="name"> + <cstring>Layout8</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <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="QLabel"> + <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="QSlider" 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="QLayoutWidget" row="3" column="1"> + <property name="name"> + <cstring>Layout7</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QPushButton"> + <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="KListView" 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> +<slots> + <slot>slotEyeCandyShowDetails(bool)</slot> + <slot>slotEyeCandySliderMoved(int)</slot> +</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..b1ebb419b --- /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 : wolff@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <stdlib.h> + +#include <qstring.h> +#include <qstringlist.h> +#include <qmap.h> + +#include <ksimpleconfig.h> +#include <kglobal.h> +#include <kstandarddirs.h> +#include <klocale.h> + +#include "kfindlanguage.h" + +KFindLanguage::KFindLanguage() { + KConfig *config = KGlobal::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 = QString::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", QString::fromLatin1("l10n/%1/entry.desktop").arg(m_country)), true); + ent.setGroup("KCM Locale"); + QStringList langs = ent.readListEntry("Languages"); + if (langs.isEmpty()) + langs.append("en_US"); + + // add the primary languages for the country to the list + QStringList prilang; + for ( QStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it ) { + QString str = locate("locale", *it + "/entry.desktop"); + if (!str.isNull()) + prilang << str; + } + + // add all languages to the list + QStringList alllang = KGlobal::dirs()->findAllResources("locale", "*/entry.desktop", false, true); + alllang.sort(); + QStringList langlist = prilang; + if (langlist.count() > 0) + langlist << QString::null; // separator + langlist += alllang; + + for ( QStringList::ConstIterator it = langlist.begin(); it != langlist.end(); ++it ) { + KSimpleConfig entry(*it); + entry.setGroup("KCM Locale"); + QString name = entry.readEntry("Name", i18n("without name")); + + QString 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 + QString compare = m_oldlang; + if (m_oldlang.isEmpty()) { + compare = langs.first(); + for(QStringList::Iterator it = langs.begin(); it != langs.end(); ++it) { + if (*it == QString::fromLatin1(getenv("LANG")).mid(3, 2).lower()) + compare = *it; + } + } + if(compare == "c") + compare = "C"; + + // Find the users's language + int bestmatch = -1; + + QStringList::ConstIterator it; + for( it = m_langlist.begin(); it != m_langlist.end(); ++it) { + int match=0; + QString 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() { +} + +QStringList KFindLanguage::getLangList() const { + return m_langlist; +} + +QMap<QString,QString> KFindLanguage::getLangMap() const { + return m_langmap; +} + +QString KFindLanguage::getBestLang() const { + return m_bestlang; +} + +QString KFindLanguage::getOldLang() const { + return m_oldlang; +} + +QString KFindLanguage::getCountry() const { + return m_country; +} diff --git a/kpersonalizer/kfindlanguage.h b/kpersonalizer/kfindlanguage.h new file mode 100644 index 000000000..1c57f3017 --- /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 : wolff@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KFINDLANGUAGE_H +#define KFINDLANGUAGE_H + +class KFindLanguage { +public: + KFindLanguage(); + ~KFindLanguage(); + QStringList getLangList() const; + QMap<QString,QString> getLangMap() const; + QString getBestLang() const; + QString getOldLang() const; + QString getCountry() const; +private: + QStringList m_langlist; // stores tags like "en_US" + QMap<QString,QString> m_langmap; // stores tag -> name pairs + QString m_country; + QString m_oldlang; + QString m_bestlang; +}; + +#endif diff --git a/kpersonalizer/kospage.cpp b/kpersonalizer/kospage.cpp new file mode 100644 index 000000000..81c2e57b6 --- /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 : nolden@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <qlabel.h> +#include <qcheckbox.h> +#include <qradiobutton.h> +#include <qtextview.h> +#include <qmap.h> + +#include <ksimpleconfig.h> +#include <kstandarddirs.h> +#include <kapplication.h> +#include <klocale.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(QWidget *parent, const char *name ) : KOSPageDlg(parent,name) { + px_osSidebar->setPixmap(UserIcon("step2.png")); + // initialize the textview with the default description - KDE of course + slotKDEDescription(); + // Set the configfiles + cglobal = new KConfig("kdeglobals"); + claunch = new KConfig("klaunchrc", false, false); + cwin = new KConfig("kwinrc"); + cdesktop = new KConfig("kdesktoprc"); + ckcminput = new KConfig("kcminputrc"); + ckcmdisplay = new KConfig("kcmdisplayrc"); + ckonqueror = new KConfig("konquerorrc"); + cklipper = new KConfig("klipperrc", false, false); + ckaccess = new KConfig("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); + QApplication::syncX(); + // enable/disable the mac menu, call dcop + // Tell kdesktop about the new config file + kapp->dcopClient()->send("kdesktop", "KDesktopIface", "configure()", QByteArray()); + /////////////////////////////////////////// + /// restart kwin for window effects + kapp->dcopClient()->send("kwin*", "", "reconfigure()", ""); + /////////////////////////////////////////// + + // 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 + KGlobal::dirs()->addResourceType("keys", KStandardDirs::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 KStylePage 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 KStylePage 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 KStylePage 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 KStylePage 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", true, true, true); + + claunch->setGroup("FeedbackStyle"); + claunch->writeEntry("BusyCursor", true); + + 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", "kde3.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", true); + + 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(QString 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", "kde3.kksrc"), true); + + // we need the entries from the default - file, so we can compare with them + QMap<QString, QString> 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"); + QMap<QString, QString> givenMap = scheme->entryMap("Global Shortcuts"); + for ( QMap<QString, QString>::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 ( QMap<QString, QString>::Iterator it = givenMap.begin(); it != givenMap.end(); ++it ) { + // only write the entry, if it defers from kde3.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>Single click</i><br>" + "<b>Application startup notification:</b> <i>busy cursor</i><br>" + "<b>Keyboard scheme:</b> <i>KDE 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>busy cursor</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 KDE */ +void KOSPage::getUserDefaults(){ + ckcmdisplay->setGroup("KDE"); + b_MacMenuBar = ckcmdisplay->readBoolEntry("macStyle", false); + + cglobal->setGroup("KDE"); + b_SingleClick = cglobal->readBoolEntry("SingleClick", true); + + claunch->setGroup("FeedbackStyle"); + b_BusyCursor = claunch->readBoolEntry("BusyCursor", true); + + 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"); + QMap<QString, QString>::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..05756e887 --- /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 : nolden@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#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(QWidget *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(QString 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 QString&); +private: + KConfig* cglobal; + KConfig* claunch; + KConfig* cwin; + KConfig* cdesktop; + KConfig* ckcminput; + KConfig* ckcmdisplay; + KConfig* ckonqueror; + KConfig* cklipper; + KConfig* 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; + QString s_TitlebarDCC, s_FocusPolicy, s_AltTabStyle, s_MMB, + s_TitlebarMMB, s_TitlebarRMB; + QMap<QString, QString> 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..68888b1a6 --- /dev/null +++ b/kpersonalizer/kospagedlg.ui @@ -0,0 +1,221 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>KOSPageDlg</class> +<widget class="QWidget"> + <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="QTextView" row="4" column="1"> + <property name="name"> + <cstring>textview_ospage</cstring> + </property> + </widget> + <widget class="QLabel" 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="QLabel" row="3" column="1"> + <property name="name"> + <cstring>TextLabel9</cstring> + </property> + <property name="text"> + <string>Description:</string> + </property> + </widget> + <widget class="QButtonGroup" 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="QRadioButton" row="0" column="0"> + <property name="name"> + <cstring>rb_kde</cstring> + </property> + <property name="text"> + <string>KDE (TM)</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QRadioButton" row="1" column="0"> + <property name="name"> + <cstring>rb_unix</cstring> + </property> + <property name="text"> + <string>UNIX (R)</string> + </property> + </widget> + <widget class="QRadioButton" row="0" column="1"> + <property name="name"> + <cstring>rb_windows</cstring> + </property> + <property name="text"> + <string>Microsoft Windows (R)</string> + </property> + </widget> + <widget class="QRadioButton" 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="QLabel" 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. +KDE 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="QLabel" row="6" column="1"> + <property name="name"> + <cstring>TextLabel2</cstring> + </property> + <property name="text"> + <string>For motion impaired users, KDE provides keyboard gestures to activate special keyboard settings.</string> + </property> + <property name="alignment"> + <set>WordBreak|AlignVCenter</set> + </property> + </widget> + <widget class="QCheckBox" 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> +<slots> + <slot>slotWindowsDescription()</slot> + <slot>slotKDEDescription()</slot> + <slot>slotMacDescription()</slot> + <slot>slotUnixDescription()</slot> +</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..0f92f8bb1 --- /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 : nolden@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 <qpushbutton.h> +#include <qlabel.h> +#include <qstring.h> +#include <qstringlist.h> +#include <qfile.h> +#include <qtimer.h> +#include <qcursor.h> + +#include <ksimpleconfig.h> +#include <kglobal.h> +#include <kglobalsettings.h> +#include <kstandarddirs.h> +#include <klocale.h> +#include <kapplication.h> +#include <klistview.h> +#include <krun.h> +#include <kmessagebox.h> +#include <kconfig.h> + +#include <stdlib.h> + +#include <kdebug.h> + +#include "kcountrypage.h" +#include "kospage.h" +#include "keyecandypage.h" +#include "kstylepage.h" +#include "krefinepage.h" + +#include "kpersonalizer.h" +#include "kpersonalizer.moc" + + + +bool KPersonalizer::before_session = false; + +KPersonalizer::KPersonalizer(QWidget *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(QWizard::page(0), false); + + ospage= new KOSPage(this); + addPage(ospage, i18n( "Step 2: I want it my Way..." ) ); + setHelpEnabled(QWizard::page(1), false); + + eyecandy= new KEyeCandyPage(this); + addPage( eyecandy, i18n( "Step 3: Eyecandy-O-Meter" ) ); + setHelpEnabled(QWizard::page(2), false); + + stylepage= new KStylePage(this); + addPage( stylepage, i18n( "Step 4: Everybody loves Themes" ) ); + setHelpEnabled(QWizard::page(3), false); + + refinepage=new KRefinePage(this); + addPage( refinepage, i18n( "Step 5: Time to Refine" ) ); + setHelpEnabled(QWizard::page(4), false); + + cancelButton()->setText(i18n("S&kip Wizard")); + + setFinishEnabled(QWizard::page(4), true); + + locale = new KLocale("kpersonalizer"); + locale->setLanguage(KLocale::defaultLanguage()); + + connect(ospage, SIGNAL(selectedOS(const QString&)), stylepage, SLOT(presetStyle(const QString&))); + connect(ospage, SIGNAL(selectedOS(const QString&)), eyecandy, SLOT(slotPresetSlider(const QString&))); + connect(refinepage->pb_kcontrol, SIGNAL(clicked()), this, 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); + QWizard::next(); + } + } + else if(currentPage()==ospage){ + os_dirty=true; // set the dirty flag, changes done that need reverting + ospage->save(); + QWizard::next(); + } + else if(currentPage()==eyecandy){ + eye_dirty=true; // set the dirty flag, changes done that need reverting + eyecandy->save(); + QTimer::singleShot(0, this, SLOT(slotNext())); + } + else if(currentPage()==stylepage){ + style_dirty=true; // set the dirty flag, changes done that need reverting + stylepage->save(); + QWizard::next(); + } + if(currentPage()==refinepage) { + finishButton()->setFocus(); + } +} + +void KPersonalizer::slotNext() { + QWizard::next(); + stylepage->switchPrevStyle(); // We need to update the preview-widget, after the page changed +} + +void KPersonalizer::back() { + QWizard::back(); +} + +bool KPersonalizer::askClose(){ + QString 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 KDE 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 QDialog, + * 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(QCloseEvent* 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 KDE 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() { + QTimer::singleShot(0, this, SLOT(slotRestart())); +} + +/** this session is restarted, so we want to start with ospage */ +void KPersonalizer::restarted(){ + showPage(ospage); +} + +/** when kpersonalizer is started before KDE 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 QWizard, that makes this evil hack necessary */ +void KPersonalizer::setPosition() { + QSize hint = countrypage->sizeHint(); + QSize os_size = ospage->sizeHint(); + QSize candy_size = eyecandy->sizeHint(); + QSize style_size = stylepage->sizeHint(); + QSize 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 + QRect rect = KGlobalSettings::desktopGeometry(QCursor::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..b61ca680e --- /dev/null +++ b/kpersonalizer/kpersonalizer.desktop @@ -0,0 +1,88 @@ +# KDE Config File +[Desktop Entry] +Type=Application +Exec=kpersonalizer -caption "%c" %i %m +Icon=kpersonalizer +Terminal=false +Name=Desktop Settings Wizard +Name[af]=Werkskerm Instellings Assistent +Name[ar]=مرشد تعيين ŘłŘ·Ř Ř§Ů„Ů…Ůتب +Name[az]=Masa ĂśstĂĽ QurÄźuları Sehirbazı +Name[be]=Чараўнік наŃтаўленняў працоўнага Đ°Ńяроддзя +Name[bg]=НаŃтройване на работното ĐĽŃŹŃŃ‚Đľ +Name[bn]=ডেস্কটপ সেটিংস উইজার্ড +Name[br]=Skoazeller kefluniadur ar burev +Name[bs]=Podešavanje radne površine +Name[ca]=Assistent de configuraciĂł de l'escriptori +Name[cs]=PrĹŻvodce nastavenĂ pracovnĂ plochy +Name[csb]=Asystenta nastĂ´wĂą òkrĂŁĹĽegò +Name[cy]=Dewin Gosodiadau Penbwrdd +Name[da]=Guide til opsætning af desktoppen +Name[de]=Einrichtungsassistent +Name[el]=Μάγος ĎυθμίĎεων της επιφάνειας εĎγαĎίας +Name[eo]=Asistilo por la tabulagordo +Name[es]=Asistente para las preferencias del escritorio +Name[et]=Töölaua seadistuste abimees +Name[eu]=Mahaigaineko ezarpenetarako morroia +Name[fa]=جادŮگر تنظیمات رŮمیزی +Name[fi]=Työpöydän ohjattu asettaminen +Name[fr]=KPersonalizer +Name[fy]=KDE's Ynstellings Assistent +Name[gl]=Asistente para a ConfiguraciĂłn do EscritĂłrio +Name[he]=×שף הגדרות שולחן העבודה +Name[hi]=डेस्कटॉप विन्यास विजार्ड +Name[hr]=ÄŚarobnjak za postavke radne površine +Name[hu]=KDE beállĂtásvarázslĂł +Name[is]=SkjáborĂ°sálfur +Name[it]=Procedura guidata delle impostazioni del desktop +Name[ja]=ă‡ă‚ąă‚Żăăă—č¨ĺ®šă‚¦ă‚Łă‚¶ăĽă‰ +Name[ka]=áˇáá›áŁá¨ááť á“áá¤áᡠá™áťáśá¤áá’áŁá áá á”á‘áᡠáťáˇá˘áá˘á +Name[kk]=Ň®Ńтелді Đ±Đ°ĐżŃ‚Đ°Ń Ńебері +Name[km]=អ្នក​ជំនួយការ​ការ​កំណត់​ផ្ទáźážŹáž» +Name[lo]=ຕົວຊŕ»ŕş§ŕşŤŕ»€ŕş«ŕşĄŕş·ŕşŕşŕş˛ŕş™ŕş•ŕş±ŕ»‰ŕş‡ŕş„ŕ»ŕş˛ŕşžŕş·ŕ»‰ŕş™ŕş—ŕşµŕ»ŕş—ຳງານ +Name[lt]=Darbastalio nustatymĹł asistentas +Name[lv]=Darbvirsmas UzstÄdÄ«jumu Meistars +Name[mk]=ВолŃебник Đ·Đ° поŃтавŃвања на поврŃината +Name[mn]=ТохирŃŃлга-ТŃŃлагч +Name[ms]=Wizard Seting Desktop +Name[mt]=Saħħar għas-setings tad-desktop +Name[nb]=Veiviser for skrivebordsoppsett +Name[nds]=Schriefdischinstellen-Hölper +Name[ne]=डेस्कटप सेटिङ विजार्ड +Name[nl]=KDE's Configuratie Assistent +Name[nn]=Vegvisar for skrivebordsoppsett +Name[nso]=Wizard ya Dipeakanyo tsa Desktop +Name[pa]=ਡŕ©ŕ¨¸ŕ¨•ŕ¨źŕ¨ľŕ¨Ş ਸŕ©ŕ¨źŕ¨żŕ©°ŕ¨— ਸਹਾਇਕ +Name[pl]=Asystent ustawieĹ„ Ĺ›rodowiska +Name[pt]=Assistente de Configuração do Ambiente de Trabalho +Name[pt_BR]=Assistente de Configurações para a Ărea de Trabalho +Name[ro]=Expert de setare KDE +Name[ru]=МаŃтер наŃтройки рабочего Ńтола +Name[rw]=Inyobora y'Amagenamiterere y'Ibiro +Name[se]=Heivehanofelaš čállinbeavddi várás +Name[sk]=Sprievodca nastavenĂm plochy +Name[sl]=ÄŚarovnik za nastavitve namizja +Name[sr]=Чаробњак Đ·Đ° подеŃавање радне поврŃине +Name[sr@Latn]=ÄŚarobnjak za podešavanje radne površine +Name[sv]=Guide för skrivbordsinställningar +Name[ta]=மேல்மேச௠அமŕŻŕ®ŞŕŻŤŕ®ŞŕŻŕ®•ŕ®łŕŻŤ பகŕŻŕ®¤ŕ®ż +Name[te]=రంగస్థల అమరికల విజార్డ్ +Name[tg]=Танзими ŃŃтоди мизи корӣ +Name[th]=ชŕąŕ¸§ŕ¸˘ŕ¸•ŕ¸±ŕą‰ŕ¸‡ŕ¸„ŕąŕ¸˛ŕ¸žŕ¸·ŕą‰ŕ¸™ŕ¸—ีŕąŕ¸«ŕ¸™ŕą‰ŕ¸˛ŕ¸ŕ¸ +Name[tr]=MasaĂĽstĂĽ Ayarları Sihirbazı +Name[tt]=Ă–stäl Caylaw Xikmätçese +Name[uk]=МайŃтер параметрів Ńтільниці +Name[uz]=Ish stolini moslash uchun yordamchi +Name[uz@cyrillic]=ĐŃ Ńтолини ĐĽĐľŃĐ»Đ°Ń ŃчŃĐ˝ ёрдамчи +Name[ven]=Wizadi ya mavhekanyele a desikithopo +Name[vi]=Trình giĂşp Thiáşżt láşp MĂ n hình ná»n +Name[wa]=Macrea des apontiaedjes do scribanne +Name[xh]=Wizard Yezicwangciso ze Desktop +Name[zh_CN]=桌面设置ĺ‘导 +Name[zh_TW]=桌面č¨ĺ®šç˛ľéť +Name[zu]=I-Wizard yezilungiselelo ze-Desktop +X-KDE-autostart-after=kdesktop +X-KDE-autostart-condition=kpersonalizerrc:General:FirstLogin:true +X-DCOP-ServiceType=Multi +Categories=Qt;KDE;Settings; +OnlyShowIn=KDE; diff --git a/kpersonalizer/kpersonalizer.h b/kpersonalizer/kpersonalizer.h new file mode 100644 index 000000000..00bd5ed03 --- /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 : nolden@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KPERSONALIZER_H +#define KPERSONALIZER_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <kapplication.h> +#include <kwizard.h> + + +/** prototypes */ +class KLanguageCombo; +class KLocale; +class KCountryPage; +class KOSPage; +class KEyeCandyPage; +class KStylePage; +class KRefinePage; + +/** KPersonalizer is the base class of the project */ +class KPersonalizer : public KWizard { + Q_OBJECT +public: + /** construtor */ + KPersonalizer(QWidget* 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 KDE 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 KDE default */ + void setDefaults(); + /** the cancel button is connected to the reject() slot of QDialog, + * 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 QTimer */ + void slotNext(); + +private: + void setPosition(); + void delayedRestart(); + +private: + KCountryPage* countrypage; + KOSPage* ospage; + KEyeCandyPage* eyecandy; + KStylePage* stylepage; + KRefinePage* refinepage; + KLocale* 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(QCloseEvent*); + bool askClose(); +}; + +#endif diff --git a/kpersonalizer/krefinepage.cpp b/kpersonalizer/krefinepage.cpp new file mode 100644 index 000000000..ce748caa3 --- /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 : nolden@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#include <qlabel.h> +#include <qpushbutton.h> + +#include <krun.h> +#include <kconfig.h> +#include <kapplication.h> +#include <kglobal.h> +#include <kiconloader.h> +#include "krefinepage.h" +#include "kpersonalizer.h" + + +KRefinePage::KRefinePage(QWidget *parent, const char *name ) : KRefinePageDlg(parent,name) { + px_finishSidebar->setPixmap(UserIcon("step5.png")); + connect( pb_kcontrol, SIGNAL(clicked()), SLOT(startKControl()) ); + if( KPersonalizer::beforeSession()) { + pb_kcontrol->hide(); + lb_kcontrol->hide(); + } + px_kcontrol->setPixmap(KGlobal::iconLoader()->loadIcon("kcontrol", KIcon::Panel, KIcon::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..dda893b93 --- /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 : nolden@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#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(QWidget *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..b40a82294 --- /dev/null +++ b/kpersonalizer/krefinepagedlg.ui @@ -0,0 +1,249 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>KRefinePageDlg</class> +<widget class="QWidget"> + <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="QLabel" 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="QFrame" 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="QLabel"> + <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="QLabel"> + <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 KDE Control Center by choosing the entry <b>Control Center</b> in the K menu.</string> + </property> + <property name="alignment"> + <set>WordBreak|AlignTop|AlignLeft</set> + </property> + </widget> + </hbox> + </widget> + <widget class="QLabel" 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="QLabel" 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 KDE 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="QLayoutWidget" 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="QPushButton"> + <property name="name"> + <cstring>pb_kcontrol</cstring> + </property> + <property name="text"> + <string>&Launch KDE 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/kstylepage.cpp b/kpersonalizer/kstylepage.cpp new file mode 100644 index 000000000..b634acaff --- /dev/null +++ b/kpersonalizer/kstylepage.cpp @@ -0,0 +1,584 @@ +/*************************************************************************** + kstylepage.cpp - description + ------------------- + begin : Tue May 22 2001 + copyright : (C) 2001 by Ralf Nolden + email : nolden@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#include <stdlib.h> + +#include <qdir.h> +#include <qlabel.h> +#include <qlistview.h> +#include <qcolor.h> +#include <qstylefactory.h> +#include <qpixmapcache.h> +#include <qstyle.h> +#include <qobjectlist.h> + +#include <kconfig.h> +#include <kstandarddirs.h> +#include <kapplication.h> +#include <kglobal.h> +#include <kdebug.h> +#include <kdesktopfile.h> +#include <klocale.h> +#include <klistview.h> +#include <kipc.h> +#include <ksimpleconfig.h> +#include <dcopclient.h> +#include <kstyle.h> +#include <kicontheme.h> +#include <kiconloader.h> + +#include "stylepreview.h" +#include "kstylepage.h" + +KStylePage::KStylePage(QWidget *parent, const char *name ) : KStylePageDlg(parent,name) { + + px_stylesSidebar->setPixmap(UserIcon("step4.png")); + + klv_styles->addColumn(i18n("Style")); + klv_styles->addColumn( i18n( "Description" ) ); + klv_styles->setAllColumnsShowFocus(true); + + kde = new QListViewItem( klv_styles); + kde->setText( 0, QPixmap::defaultDepth() > 8 ? i18n( "Plastik" ) : i18n( "Light" ) ); + kde->setText( 1, i18n( "KDE default style" ) ); + + classic = new QListViewItem( klv_styles); + classic->setText( 0, i18n( "KDE Classic" ) ); + classic->setText( 1, i18n( "Classic KDE style" ) ); + + keramik = new QListViewItem( klv_styles ); + keramik->setText( 0, i18n( "Keramik" ) ); + keramik->setText( 1, i18n( "The previous default style" ) ); + + cde = new QListViewItem( klv_styles); + cde->setText( 0, i18n( "Sunshine" ) ); + cde->setText( 1, i18n( "A very common desktop" ) ); + + win = new QListViewItem( klv_styles ); + win->setText( 0, i18n( "Redmond" ) ); + win->setText( 1, i18n( "A style from the northwest of the USA" ) ); + + platinum = new QListViewItem( klv_styles ); + platinum->setText( 0, i18n( "Platinum" ) ); + platinum->setText( 1, i18n( "The platinum style" ) ); + + connect(klv_styles, SIGNAL(selectionChanged()), + this, SLOT(slotCurrentChanged())); + + // Note: if the default is changed here it needs to be changed in kdebase/kwin/plugins.cpp + // and kdebase/kwin/kcmkwin/kwindecoration/kwindecoration.cpp as well. + defaultKWinStyle = QPixmap::defaultDepth() > 8 ? "kwin_plastik" : "kwin_quartz"; + appliedStyle = NULL; + + getAvailability(); + getUserDefaults(); + initColors(); +} + +KStylePage::~KStylePage(){ + delete ckwin; + delete appliedStyle; +} + +void KStylePage::save(bool curSettings){ + kdDebug() << "KStylePage::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 KStylePage::saveStyle(bool curSettings){ + QString style = curSettings ? currentStyle : origStyle; + KConfig cfg( "kdeglobals" ); + cfg.setGroup("General"); + cfg.writeEntry( "widgetStyle", style, true, true ); + cfg.sync(); + kdDebug() << "KStylePage::saveStyle(): " << style << endl; +} + +/** save the KWin-style*/ +void KStylePage::saveKWin(bool curSettings){ + QString kwin = origKWinStyle; + if(curSettings) { + KDesktopFile* kdf = 0L; + KStandardDirs* kstd = KGlobal::dirs(); + if (cde->isSelected() && kwin_cde_exist) + kdf = new KDesktopFile(kstd->findResource("data", "kwin/cde.desktop")); + else if (win->isSelected() && kwin_win_exist) + kdf = new KDesktopFile(kstd->findResource("data", "kwin/redmond.desktop")); + else if (platinum->isSelected() && kwin_system_exist) + kdf = new KDesktopFile(kstd->findResource("data", "kwin/system.desktop")); + else if (keramik->isSelected() && kwin_keramik_exist) + kdf = new KDesktopFile(kstd->findResource("data", "kwin/keramik.desktop")); + else if (kde->isSelected()) { + if (kwin_plastik_exist && (QColor::numBitPlanes() > 8)) + kdf = new KDesktopFile(kstd->findResource("data", "kwin/plastik.desktop")); + else if (kwin_quartz_exist) + kdf = new KDesktopFile(kstd->findResource("data", "kwin/quartz.desktop")); + } + + if (kdf) { + kdf->setGroup("Desktop Entry"); + kwin = kdf->readEntry("X-KDE-Library", defaultKWinStyle); + delete kdf; + } + else { + // if we get here classic is selected (there's no .desktop file for the + // kde2 kwin style), or none of the other kwin styles were found. + kwin = "kwin_default"; + } + } + ckwin->writeEntry("PluginLib", kwin); + ckwin->sync(); + kdDebug() << "KStylePage::saveKWin(): " << kwin << endl; +} + +/** Save the color-scheme */ +void KStylePage::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) + KConfig *config = KGlobal::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 KGlobal 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 *kconfig = + new KSimpleConfig( QDir::homeDirPath() + "/.kderc" ); + kconfig->setGroup( "General" ); + kconfig->writeEntry("background", toSave->background ); + kconfig->writeEntry("selectBackground", toSave->selectBackground ); + kconfig->writeEntry("foreground", toSave->foreground ); + kconfig->writeEntry("windowForeground", toSave->windowForeground ); + kconfig->writeEntry("windowBackground", toSave->windowBackground ); + kconfig->writeEntry("selectForeground", toSave->selectForeground ); + kconfig->sync(); + delete kconfig; + + 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 + KConfig 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() << "KStylePage::saveColors(): colorFile: " << toSave->colorFile << endl; +} + +/** save the icon-theme*/ +void KStylePage::saveIcons(bool curSettings) { + QString theme = origIcons; + if (curSettings) { + if ( (kde->isSelected() || platinum->isSelected() || keramik->isSelected()) + && icon_crystalsvg_exist) + theme = "crystalsvg"; + else if ( (classic->isSelected() || cde->isSelected() || win->isSelected()) + && (QColor::numBitPlanes() > 8) && icon_kdeclassic_exist) + theme = "kdeclassic"; + else if ( (classic->isSelected() || cde->isSelected() || win->isSelected()) + && (QColor::numBitPlanes() <= 8) && icon_Locolor_exist) + theme = "Locolor"; + } + // save, what we got + KGlobal::config()->setGroup("Icons"); + KGlobal::config()->writeEntry("Theme", theme, true, true); + KIconTheme icontheme(theme); + const char * const groups[] = { "Desktop", "Toolbar", "MainToolbar", "Small", 0L }; + for (KIcon::Group i=KIcon::FirstGroup; i<KIcon::LastGroup; i++) { + if (groups[i] == 0L) + break; + KGlobal::config()->setGroup(QString::fromLatin1(groups[i]) + "Icons"); + KGlobal::config()->writeEntry("Size", icontheme.defaultSize(i)); + } + KGlobal::config()->sync(); + kdDebug() << "KStylePage::saveIcons(): " << theme << endl; +} + +/** called whenever the selection in the listview changes */ +void KStylePage::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 KStylePage::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 ( (QColor::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 ( (QColor::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() << "KStylePage::changeCurrentStyle(): "<< currentStyle << endl; +} + +/** to be connected to the OS page. Catches + * either KDE, CDE, win or mac and pre-sets the style. + */ +void KStylePage::presetStyle(const QString& style){ + kdDebug() << "KStylePage::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 KStylePage::setDefaults(){ +} + +/** Fill a colorSet with a colorfile, or the default. */ +void KStylePage::getColors(colorSet *set, bool colorfile ){ + KConfig* config; + bool deleteConfig = false; + // get the color scheme file and go to the color scheme group + if(colorfile){ + KGlobal::dirs()->addResourceType("colors", KStandardDirs::kde_default("data")+"kdisplay/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() << "KStylePage::getColors(): schemefile: " << set->colorFile << endl; + deleteConfig = true; + } + else { + KConfig kdesktop("kdesktoprc"); + kdesktop.setGroup("Desktop0"); + // set Background (userSettings if available, else default) + set->bgMode=kdesktop.readEntry("BackgroundMode", "Flat"); + QColor tmp1("#003082"); + QColor 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=KGlobal::config(); + config->setGroup("KDE"); + set->colorFile=config->readEntry("colorScheme", "<default>"); + set->contrast=config->readNumEntry("contrast", 7); + config->setGroup( "General" ); + kdDebug() << "KStylePage::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", &kde34Blue ); + 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 kwin- styles for availability */ +void KStylePage::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; + QStringList styles = QStyleFactory::keys(); + for (QStringList::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 || QPixmap::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 + kwin_keramik_exist = kwin_system_exist = kwin_plastik_exist + = kwin_default_exist = kwin_win_exist + = kwin_cde_exist = kwin_quartz_exist = false; + KStandardDirs* kstd = KGlobal::dirs(); + if (!kstd->findResource("data", "kwin/keramik.desktop").isNull()) + kwin_keramik_exist = true; + if (!kstd->findResource("data", "kwin/plastik.desktop").isNull()) + kwin_plastik_exist = true; + if (!kstd->findResource("data", "kwin/system.desktop").isNull()) + kwin_system_exist = true; + if (!kstd->findResource("data", "kwin/redmond.desktop").isNull()) + kwin_win_exist = true; + if (!kstd->findResource("data", "kwin/cde.desktop").isNull()) + kwin_cde_exist = true; + if (!kstd->findResource("data", "kwin/quartz.desktop").isNull()) + kwin_quartz_exist = true; + kwin_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; + QStringList icons(KIconTheme::list()); + for (QStringList::iterator it=icons.begin(); it != icons.end(); it++) { + KIconTheme 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 KStylePage::getUserDefaults() { + // Get the user's current widget-style + KGlobal::config()->setGroup("General"); + origStyle = KGlobal::config()->readEntry( "widgetStyle", KStyle::defaultStyle() ); + + // get the user's current KWin-style + ckwin = new KConfig("kwinrc"); + ckwin->setGroup("Style"); + origKWinStyle = ckwin->readEntry("PluginLib", defaultKWinStyle); + + // get the users current colors + getColors(&usrColors, false); + + // Get the user's current iconset + KGlobal::config()->setGroup("Icons"); + origIcons = KGlobal::config()->readEntry("Theme"); + + kdDebug() << "KStylePage::getUserDefaults(): style: " << origStyle << endl; + kdDebug() << "KStylePage::getUserDefaults(): KWinStyle: " << origKWinStyle << endl; + kdDebug() << "KStylePage::getUserDefaults(): Colors: " << usrColors.colorFile << endl; + kdDebug() << "KStylePage::getUserDefaults(): Icons: " << origIcons << endl; +} + +/** initialize KDE default color values */ +void KStylePage::initColors() { + widget.setRgb(239, 239, 239); + kde34Blue.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 (QPixmap::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 KStylePage::liveUpdate() { + // tell all apps about the changed icons + for (int i=0; i<KIcon::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); + // kwin-style + kapp->dcopClient()->send("kwin*", "", "reconfigure()", ""); + // kdesktop-background + kapp->dcopClient()->send("kdesktop", "KBackgroundIface", "configure()", ""); +} + +/** show the previewWidget styled with the selected one */ +void KStylePage::switchPrevStyle() { + QStyle* style = QStyleFactory::create(currentStyle); + if (!style) return; + + stylePreview->unsetPalette(); + QPalette palette = createPalette(); + style->polish(palette); + stylePreview->setPalette(palette); + + // Prevent Qt from wrongly caching radio button images + QPixmapCache::clear(); + // go ahead + setStyleRecursive( stylePreview, palette, style ); + // this flickers, but reliably draws the widgets corretly. + stylePreview->resize( stylePreview->sizeHint() ); + + delete appliedStyle; + appliedStyle = style; +} + +void KStylePage::setStyleRecursive(QWidget* w, QPalette &palette, QStyle* s) { + // Apply the new style. + w->setStyle(s); + // Recursively update all children. + const QObjectList *children = w->children(); + if (!children) + return; + // Apply the style to each child widget. + QPtrListIterator<QObject> childit(*children); + QObject *child; + while ((child = childit.current()) != 0) { + ++childit; + if (child->isWidgetType()) + setStyleRecursive((QWidget *) child, palette, s); + } +} + +/** create a QPalette of our current colorset */ +QPalette KStylePage::createPalette() { + colorSet *cc = ¤tColors; + QColorGroup disabledgrp(cc->windowForeground, cc->background, cc->background.light(150), + cc->background.dark(), cc->background.dark(120), cc->background.dark(120), + cc->windowBackground); + QColorGroup colgrp(cc->windowForeground, cc->background, cc->background.light(150), + cc->background.dark(), cc->background.dark(120), cc->foreground, + cc->windowBackground); + colgrp.setColor(QColorGroup::Highlight, cc->selectBackground); + colgrp.setColor(QColorGroup::HighlightedText, cc->selectForeground); + colgrp.setColor(QColorGroup::Button, cc->buttonBackground); + colgrp.setColor(QColorGroup::ButtonText, cc->buttonForeground); + return QPalette( colgrp, disabledgrp, colgrp); +} + +#include "kstylepage.moc" diff --git a/kpersonalizer/kstylepage.h b/kpersonalizer/kstylepage.h new file mode 100644 index 000000000..f017f5b99 --- /dev/null +++ b/kpersonalizer/kstylepage.h @@ -0,0 +1,128 @@ +/*************************************************************************** + kstylepage.h - description + ------------------- + begin : Tue May 22 2001 + copyright : (C) 2001 by Ralf Nolden + email : nolden@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KSTYLEPAGE_H +#define KSTYLEPAGE_H + +#include <qcolor.h> +#include "kstylepagedlg.h" + +/**Abstract class for the style page + *@author Ralf Nolden + */ +class QListViewItem; + +class KStylePage : public KStylePageDlg { + Q_OBJECT + +public: + KStylePage(QWidget *parent=0, const char *name=0); + ~KStylePage(); + 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: + QString origStyle; + QString origKWinStyle; + QString origIcons; + QString defaultKWinStyle; + QString currentStyle; + KConfig* ckwin; + struct colorSet { + QString colorFile, bgMode; + int contrast; + QColor usrCol1, usrCol2; + QColor foreground; + QColor background; + QColor windowForeground; + QColor windowBackground; + QColor selectForeground; + QColor selectBackground; + QColor buttonForeground; + QColor buttonBackground; + QColor linkColor; + QColor visitedLinkColor; + QColor activeForeground; + QColor inactiveForeground; + QColor activeBackground; + QColor inactiveBackground; + QColor activeBlend; + QColor inactiveBlend; + QColor activeTitleBtnBg; + QColor inactiveTitleBtnBg; + QColor alternateBackground; + } usrColors, currentColors; + // first, the KDE 2 default color values + QColor widget; + QColor kde34Blue; + QColor inactiveBackground; + QColor activeBackground; + QColor button; + QColor link; + QColor visitedLink; + QColor activeBlend; + QColor activeTitleBtnBg; + QColor inactiveTitleBtnBg; + QColor inactiveForeground; + QColor alternateBackground; + + QListViewItem * kde; + QListViewItem * classic; + QListViewItem * keramik; + QListViewItem * cde; + QListViewItem * win; + QListViewItem * platinum; + + QStyle *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; + + // kwin-style-existence + bool kwin_keramik_exist, kwin_default_exist, kwin_system_exist, + kwin_win_exist, kwin_cde_exist, kwin_quartz_exist, kwin_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 QString& 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(QWidget* w, QPalette &, QStyle* s); + void changeCurrentStyle(); + QPalette createPalette(); + +private slots: + void slotCurrentChanged(); +}; + +#endif diff --git a/kpersonalizer/kstylepagedlg.ui b/kpersonalizer/kstylepagedlg.ui new file mode 100644 index 000000000..e32074ca3 --- /dev/null +++ b/kpersonalizer/kstylepagedlg.ui @@ -0,0 +1,127 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>KStylePageDlg</class> +<widget class="QWidget"> + <property name="name"> + <cstring>KStylePageDlg</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="QLabel" 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="QLabel" 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="QLabel" row="2" column="1"> + <property name="name"> + <cstring>TextLabel2</cstring> + </property> + <property name="text"> + <string>Preview</string> + </property> + </widget> + <widget class="KListView" 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">klistview.h</include> + <include location="local" impldecl="in implementation">kdialog.h</include> +</includes> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +</UI> diff --git a/kpersonalizer/ksysinfo.cpp b/kpersonalizer/ksysinfo.cpp new file mode 100644 index 000000000..a16c707be --- /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 : wolff@kde.org, c-held@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +/* + * Code partly taken from kcontrol/info and kcontrol/fonts + */ + +#include <qfontdatabase.h> +#include <qfont.h> +#include <qstring.h> +#include <qstringlist.h> + +#include <kdebug.h> + +#include <X11/Xlib.h> + +#include "ksysinfo.h" + +KSysInfo::KSysInfo() { + m_fdb = new QFontDatabase(); + 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 ? QString::null : (QString)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; + QString extension; + char **extensions = XListExtensions( dpy, &extCount ); + for (int i = 0; i < extCount; i++ ) { + extension=QString( 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() { + QFontDatabase fdb; + QStringList families = fdb.families(); + m_normal_font = QString::null; + m_fixed_font = QString::null; + int normal_priority = 0, fixed_priority = 0; + for (uint i=0; i < families.count(); i++) { + QString 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; + } + } +} + +QFont KSysInfo::getNormalFont() { + return m_fdb->font(m_normal_font,"Normal",12); // this will return the current font, if !m_normal_font +} + +QFont KSysInfo::getSmallFont(){ + return m_fdb->font(m_normal_font,"Normal",11); +} + +QFont KSysInfo::getBoldFont(){ + return m_fdb->font(m_normal_font,"Bold",12); +} + +QFont KSysInfo::getFixedWidthFont(){ + return m_fdb->font(m_fixed_font,"Normal",10); +} + +/** + * Hardware - Info + * (Architecture - dependent code) + */ + +/////////////////// +#ifdef __linux__ +/////////////////// + + #include <qfile.h> + #include <math.h> + + void KSysInfo::initHWInfo() { + char buf[512]; + QFile *file = new QFile("/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) { + QString s1 = QString::fromLocal8Bit(buf); + QString 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..2d6fcddb8 --- /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 : wolff@kde.org, c-held@web.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KSYSINFO_H +#define KSYSINFO_H + +class QString; +class QFont; +class QFontDatabase; + +class KSysInfo { +public: + KSysInfo(); + ~KSysInfo(); + /* XServer - info */ + bool isXfromXFreeInc(); + bool isXfromXOrg(); + int getXRelease(); + bool getRenderSupport(); + /* font - info */ + QFont getNormalFont(); + QFont getSmallFont(); + QFont getBoldFont(); + QFont getFixedWidthFont(); + /* Hardware - info */ + int getCpuSpeed(); +private: + void initXInfo(); + void initFontFamilies(); + void initHWInfo(); +private: + /* XServer - info */ + QString m_xvendor; + bool m_xfree_inc; + bool m_xorg; + int m_xrelease; + bool m_xrender; + /* font - info */ + QFontDatabase* m_fdb; + QString m_normal_font; + QString 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..09b6b394e --- /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 : nolden@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <kcmdlineargs.h> +#include <kaboutdata.h> +#include <klocale.h> +#include <dcopclient.h> +#include <kglobal.h> + +#include "kpersonalizer.h" +#include "kfindlanguage.h" + +static const char description[] = I18N_NOOP("KPersonalizer"); + +static KCmdLineOptions options[] = +{ + { "r", I18N_NOOP("Personalizer is restarted by itself"), 0 }, + { "before-session", I18N_NOOP("Personalizer is running before KDE session"), 0 }, + KCmdLineLastOption +}; + +int main(int argc, char *argv[]) +{ + KAboutData aboutData( "kpersonalizer", I18N_NOOP("KPersonalizer"), + VERSION, description, KAboutData::License_GPL, + "(c) 2001, Ralf Nolden", 0, 0, "nolden@kde.org"); + aboutData.addAuthor("Ralf Nolden",0, "nolden@kde.org"); + aboutData.addAuthor("Carsten Wolff",0, "wolff@kde.org"); + aboutData.addAuthor("qwertz",0, "kraftw@gmx.de"); + aboutData.addAuthor("Bernhard Rosenkraenzer", 0, "bero@redhat.com"); + KCmdLineArgs::init( argc, argv, &aboutData ); + KCmdLineArgs::addCmdLineOptions( options ); // Add our own options. + + KLocale::setMainCatalogue("kpersonalizer"); + + KApplication a; + if ( !kapp->dcopClient()->isAttached() ) + kapp->dcopClient()->attach(); + + KCmdLineArgs *args = KCmdLineArgs::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 + KGlobal::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/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..f77b5b534 --- /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..13edeba98 --- /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..df9741f38 --- /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..3881357bb --- /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..deec5d189 --- /dev/null +++ b/kpersonalizer/pics/step5.png diff --git a/kpersonalizer/stylepreview.ui b/kpersonalizer/stylepreview.ui new file mode 100644 index 000000000..0f0972b8a --- /dev/null +++ b/kpersonalizer/stylepreview.ui @@ -0,0 +1,186 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>StylePreview</class> +<widget class="QWidget"> + <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="QFrame"> + <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="QTabWidget" row="0" column="0"> + <property name="name"> + <cstring>TabWidget2</cstring> + </property> + <widget class="QWidget"> + <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="QProgressBar" 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="QPushButton" row="2" column="2"> + <property name="name"> + <cstring>PushButton1</cstring> + </property> + <property name="text"> + <string>Button</string> + </property> + </widget> + <widget class="QSpinBox" row="2" column="1"> + <property name="name"> + <cstring>SpinBox1</cstring> + </property> + </widget> + <widget class="QComboBox" 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="QSlider" 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="QButtonGroup" 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="QRadioButton"> + <property name="name"> + <cstring>RadioButton1</cstring> + </property> + <property name="text"> + <string>RadioButton</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QRadioButton"> + <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="QCheckBox"> + <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="QScrollBar" 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="QWidget"> + <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> +<slots> + <slot>init()</slot> + <slot returnType="bool">eventFilter( QObject * obj, QEvent * ev )</slot> +</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..6bd47d62a --- /dev/null +++ b/kpersonalizer/stylepreview.ui.h @@ -0,0 +1,77 @@ +/* + * Style Preview Widget + * Copyright (C) 2002 Karol Szwed <gallium@kde.org> + * Copyright (C) 2002 Daniel Molkentin <molkentin@kde.org> + * + * 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 <qobjectlist.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. + QObjectList* l = queryList("QWidget"); + QObjectListIt it(*l); + QObject* obj; + while ((obj = it.current()) != 0) + { + ++it; + obj->installEventFilter(this); + ((QWidget*)obj)->setFocusPolicy(NoFocus); + } + delete l; +} + +bool StylePreview::eventFilter( QObject* /* obj */, QEvent* ev ) +{ + switch( ev->type() ) + { + case QEvent::MouseButtonPress: + case QEvent::MouseButtonRelease: + case QEvent::MouseButtonDblClick: + case QEvent::MouseMove: + case QEvent::KeyPress: + case QEvent::KeyRelease: + case QEvent::Enter: + case QEvent::Leave: + case QEvent::Wheel: + case QEvent::ContextMenu: + return TRUE; // ignore + default: + break; + } + return FALSE; +} + +// vim: set noet ts=4: 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 |