Page MenuHomePhorge

No OneTemporary

diff --git a/kdecore/localization/klocale.cpp b/kdecore/localization/klocale.cpp
index 499bf112d6..02aa77a499 100644
--- a/kdecore/localization/klocale.cpp
+++ b/kdecore/localization/klocale.cpp
@@ -1,782 +1,787 @@
/* This file is part of the KDE libraries
Copyright (c) 1997,2001 Stephan Kulow <coolo@kde.org>
Copyright (c) 1999 Preston Brown <pbrown@kde.org>
Copyright (c) 1999-2002 Hans Petter Bieker <bieker@kde.org>
Copyright (c) 2002 Lukas Tinkl <lukas@kde.org>
Copyright (C) 2007 Bernhard Loos <nhuh.put@web.de>
Copyright (C) 2009, 2010 John Layt <john@layt.net>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "klocale.h"
#if defined Q_WS_WIN
#include "klocale_win_p.h"
#elif defined Q_OS_MAC
#include "klocale_mac_p.h"
#else
#include "klocale_unix_p.h"
#endif
#include <QtCore/QDateTime>
#include <QtCore/QTextCodec>
#include "kcatalog_p.h"
#include "kglobal.h"
#include "kconfig.h"
#include "kdebug.h"
#include "kdatetime.h"
#include "kcalendarsystem.h"
#include "kdayperiod_p.h"
#include "kcurrencycode.h"
#include "kcatalogname_p.h"
#include "common_helpers_p.h"
KLocale::KLocale(const QString &catalog, KSharedConfig::Ptr config)
#if defined Q_WS_WIN
: d(new KLocaleWindowsPrivate(this, catalog, config))
#elif defined Q_OS_MAC
: d(new KLocaleMacPrivate(this, catalog, config))
#else
: d(new KLocaleUnixPrivate(this, catalog, config))
#endif
{
}
KLocale::KLocale(const QString& catalog, const QString &language, const QString &country, KConfig *config)
#if defined Q_WS_WIN
: d(new KLocaleWindowsPrivate(this, catalog, language, country, config))
#elif defined Q_OS_MAC
: d(new KLocaleMacPrivate(this, catalog, language, country, config))
#else
: d(new KLocaleUnixPrivate(this, catalog, language, country, config))
#endif
{
}
KLocale::~KLocale()
{
delete d;
}
bool KLocale::setCountry(const QString &country, KConfig *config)
{
return d->setCountry(country, config);
}
bool KLocale::setCountryDivisionCode(const QString &countryDivisionCode)
{
return d->setCountryDivisionCode(countryDivisionCode);
}
bool KLocale::setLanguage(const QString &language, KConfig *config)
{
return d->setLanguage(language, config);
}
bool KLocale::setLanguage(const QStringList &languages)
{
return d->setLanguage(languages);
}
void KLocale::setCurrencyCode(const QString &newCurrencyCode)
{
d->setCurrencyCode(newCurrencyCode);
}
bool KLocale::isApplicationTranslatedInto(const QString &lang)
{
return d->isApplicationTranslatedInto(lang);
}
void KLocale::splitLocale(const QString &locale, QString &language, QString &country, QString &modifier,
QString &charset)
{
KLocalePrivate::splitLocale(locale, language, country, modifier, charset);
}
QString KLocale::language() const
{
return d->language();
}
QString KLocale::country() const
{
return d->country();
}
QString KLocale::countryDivisionCode() const
{
return d->countryDivisionCode();
}
KCurrencyCode *KLocale::currency() const
{
return d->currency();
}
QString KLocale::currencyCode() const
{
return d->currencyCode();
}
void KLocale::insertCatalog(const QString &catalog)
{
d->insertCatalog(catalog);
}
void KLocale::removeCatalog(const QString &catalog)
{
d->removeCatalog(catalog);
}
void KLocale::setActiveCatalog(const QString &catalog)
{
d->setActiveCatalog(catalog);
}
void KLocale::translateRawFrom(const char *catname, const char *ctxt, const char *singular, const char *plural,
unsigned long n, QString *lang, QString *trans) const
{
d->translateRawFrom(catname, ctxt, singular, plural, n, lang, trans);
}
//Convenience versions
void KLocale::translateRawFrom(const char *catname, const char *msg, QString *lang, QString *trans) const
{
d->translateRawFrom(catname, 0, msg, 0, 0, lang, trans);
}
void KLocale::translateRaw(const char *msg, QString *lang, QString *trans) const
{
d->translateRawFrom(0, 0, msg, 0, 0, lang, trans);
}
void KLocale::translateRawFrom(const char *catname, const char *ctxt, const char *msg, QString *lang,
QString *trans) const
{
d->translateRawFrom(catname, ctxt, msg, 0, 0, lang, trans);
}
void KLocale::translateRaw(const char *ctxt, const char *msg, QString *lang, QString *trans) const
{
d->translateRawFrom(0, ctxt, msg, 0, 0, lang, trans);
}
void KLocale::translateRawFrom(const char *catname, const char *singular, const char *plural,
unsigned long n, QString *lang, QString *trans) const
{
d->translateRawFrom(catname, 0, singular, plural, n, lang, trans);
}
void KLocale::translateRaw(const char *singular, const char *plural, unsigned long n, QString *lang,
QString *trans) const
{
d->translateRawFrom(0, 0, singular, plural, n, lang, trans);
}
void KLocale::translateRaw(const char *ctxt, const char *singular, const char *plural,
unsigned long n, QString *lang, QString *trans) const
{
d->translateRawFrom(0, ctxt, singular, plural, n, lang, trans);
}
QString KLocale::translateQt(const char *context, const char *sourceText, const char *comment) const
{
return d->translateQt(context, sourceText, comment);
}
QList<KLocale::DigitSet> KLocale::allDigitSetsList() const
{
return d->allDigitSetsList();
}
QString KLocale::digitSetToName(KLocale::DigitSet digitSet, bool withDigits) const
{
return d->digitSetToName(digitSet, withDigits);
}
QString KLocale::convertDigits(const QString &str, DigitSet digitSet, bool ignoreContext) const
{
return d->convertDigits(str, digitSet, ignoreContext);
}
bool KLocale::nounDeclension() const
{
return d->nounDeclension();
}
bool KLocale::dateMonthNamePossessive() const
{
return d->dateMonthNamePossessive();
}
int KLocale::weekStartDay() const
{
return d->weekStartDay();
}
int KLocale::workingWeekStartDay() const
{
return d->workingWeekStartDay();
}
int KLocale::workingWeekEndDay() const
{
return d->workingWeekEndDay();
}
int KLocale::weekDayOfPray() const
{
return d->weekDayOfPray();
}
int KLocale::decimalPlaces() const
{
return d->decimalPlaces();
}
QString KLocale::decimalSymbol() const
{
return d->decimalSymbol();
}
QString KLocale::thousandsSeparator() const
{
return d->thousandsSeparator();
}
QString KLocale::currencySymbol() const
{
return d->currencySymbol();
}
QString KLocale::monetaryDecimalSymbol() const
{
return d->monetaryDecimalSymbol();
}
QString KLocale::monetaryThousandsSeparator() const
{
return d->monetaryThousandsSeparator();
}
QString KLocale::positiveSign() const
{
return d->positiveSign();
}
QString KLocale::negativeSign() const
{
return d->negativeSign();
}
int KLocale::fracDigits() const
{
return monetaryDecimalPlaces();
}
int KLocale::monetaryDecimalPlaces() const
{
return d->monetaryDecimalPlaces();
}
bool KLocale::positivePrefixCurrencySymbol() const
{
return d->positivePrefixCurrencySymbol();
}
bool KLocale::negativePrefixCurrencySymbol() const
{
return d->negativePrefixCurrencySymbol();
}
KLocale::SignPosition KLocale::positiveMonetarySignPosition() const
{
return d->positiveMonetarySignPosition();
}
KLocale::SignPosition KLocale::negativeMonetarySignPosition() const
{
return d->negativeMonetarySignPosition();
}
QString KLocale::formatMoney(double num, const QString &symbol, int precision) const
{
return d->formatMoney(num, symbol, precision);
}
QString KLocale::formatNumber(double num, int precision) const
{
return d->formatNumber(num, precision);
}
QString KLocale::formatLong(long num) const
{
return d->formatLong(num);
}
QString KLocale::formatNumber(const QString &numStr, bool round, int precision) const
{
return d->formatNumber(numStr, round, precision);
}
QString KLocale::formatByteSize(double size, int precision, KLocale::BinaryUnitDialect dialect,
KLocale::BinarySizeUnits specificUnit) const
{
return d->formatByteSize(size, precision, dialect, specificUnit);
}
QString KLocale::formatByteSize(double size) const
{
return d->formatByteSize(size);
}
KLocale::BinaryUnitDialect KLocale::binaryUnitDialect() const
{
return d->binaryUnitDialect();
}
void KLocale::setBinaryUnitDialect(KLocale::BinaryUnitDialect newDialect)
{
d->setBinaryUnitDialect(newDialect);
}
QString KLocale::formatDuration(unsigned long mSec) const
{
return d->formatDuration(mSec);
}
QString KLocale::prettyFormatDuration(unsigned long mSec) const
{
return d->prettyFormatDuration(mSec);
}
QString KLocale::formatDate(const QDate &date, KLocale::DateFormat format) const
{
return d->formatDate(date, format);
}
void KLocale::setMainCatalog(const char *catalog)
{
KLocalePrivate::setMainCatalog(catalog);
}
double KLocale::readNumber(const QString &_str, bool * ok) const
{
return d->readNumber(_str, ok);
}
double KLocale::readMoney(const QString &_str, bool *ok) const
{
return d->readMoney(_str, ok);
}
QDate KLocale::readDate(const QString &intstr, bool *ok) const
{
return d->readDate(intstr, ok);
}
QDate KLocale::readDate(const QString &intstr, ReadDateFlags flags, bool *ok) const
{
return d->readDate(intstr, flags, ok);
}
QDate KLocale::readDate(const QString &intstr, const QString &fmt, bool *ok) const
{
return d->readDate(intstr, fmt, ok);
}
QTime KLocale::readTime(const QString &intstr, bool *ok) const
{
return d->readTime(intstr, ok);
}
QTime KLocale::readTime(const QString &intstr, KLocale::ReadTimeFlags flags, bool *ok) const
{
return d->readTime(intstr, flags, ok);
}
QTime KLocale::readLocaleTime(const QString &intstr, bool *ok, TimeFormatOptions options,
TimeProcessingOptions processing) const
{
return d->readLocaleTime(intstr, ok, options, processing);
}
QString KLocale::formatTime(const QTime &time, bool includeSecs, bool isDuration) const
{
return d->formatTime(time, includeSecs, isDuration);
}
QString KLocale::formatLocaleTime(const QTime &time, TimeFormatOptions options) const
{
return d->formatLocaleTime(time, options);
}
bool KLocale::use12Clock() const
{
return d->use12Clock();
}
QString KLocale::dayPeriodText(const QTime &time, DateTimeComponentFormat format) const
{
return d->dayPeriodForTime(time).periodName(format);
}
QStringList KLocale::languageList() const
{
return d->languageList();
}
QStringList KLocale::currencyCodeList() const
{
return d->currencyCodeList();
}
/* Just copy in for now to keep diff clean, remove later
QString KLocalePrivate::formatDateTime(const KLocale *locale, const QDateTime &dateTime, KLocale::DateFormat format,
bool includeSeconds, int daysTo, int secsTo)
{
}
*/
QString KLocale::formatDateTime(const QDateTime &dateTime, KLocale::DateFormat format, bool includeSeconds) const
{
return d->formatDateTime(dateTime, format, includeSeconds);
}
QString KLocale::formatDateTime(const KDateTime &dateTime, KLocale::DateFormat format, DateTimeFormatOptions options) const
{
return d->formatDateTime(dateTime, format, options);
}
QString KLocale::langLookup(const QString &fname, const char *rtype)
{
return KLocalePrivate::langLookup(fname, rtype);
}
void KLocale::setDateFormat(const QString &format)
{
d->setDateFormat(format);
}
void KLocale::setDateFormatShort(const QString &format)
{
d->setDateFormatShort(format);
}
void KLocale::setDateMonthNamePossessive(bool possessive)
{
d->setDateMonthNamePossessive(possessive);
}
void KLocale::setTimeFormat(const QString &format)
{
d->setTimeFormat(format);
}
void KLocale::setWeekStartDay(int day)
{
d->setWeekStartDay(day);
}
void KLocale::setWorkingWeekStartDay(int day)
{
d->setWorkingWeekStartDay(day);
}
void KLocale::setWorkingWeekEndDay(int day)
{
d->setWorkingWeekEndDay(day);
}
void KLocale::setWeekDayOfPray(int day)
{
d->setWeekDayOfPray(day);
}
QString KLocale::dateFormat() const
{
return d->dateFormat();
}
QString KLocale::dateFormatShort() const
{
return d->dateFormatShort();
}
QString KLocale::timeFormat() const
{
return d->timeFormat();
}
void KLocale::setDecimalPlaces(int digits)
{
d->setDecimalPlaces(digits);
}
void KLocale::setDecimalSymbol(const QString &symbol)
{
d->setDecimalSymbol(symbol);
}
void KLocale::setThousandsSeparator(const QString &separator)
{
d->setThousandsSeparator(separator);
}
void KLocale::setPositiveSign(const QString &sign)
{
d->setPositiveSign(sign);
}
void KLocale::setNegativeSign(const QString &sign)
{
d->setNegativeSign(sign);
}
void KLocale::setPositiveMonetarySignPosition(KLocale::SignPosition signpos)
{
d->setPositiveMonetarySignPosition(signpos);
}
void KLocale::setNegativeMonetarySignPosition(KLocale::SignPosition signpos)
{
d->setNegativeMonetarySignPosition(signpos);
}
void KLocale::setPositivePrefixCurrencySymbol(bool prefix)
{
d->setPositivePrefixCurrencySymbol(prefix);
}
void KLocale::setNegativePrefixCurrencySymbol(bool prefix)
{
d->setNegativePrefixCurrencySymbol(prefix);
}
void KLocale::setFracDigits(int digits)
{
setMonetaryDecimalPlaces(digits);
}
void KLocale::setMonetaryDecimalPlaces(int digits)
{
d->setMonetaryDecimalPlaces(digits);
}
void KLocale::setMonetaryThousandsSeparator(const QString &separator)
{
d->setMonetaryThousandsSeparator(separator);
}
void KLocale::setMonetaryDecimalSymbol(const QString &symbol)
{
d->setMonetaryDecimalSymbol(symbol);
}
void KLocale::setCurrencySymbol(const QString & symbol)
{
d->setCurrencySymbol(symbol);
}
int KLocale::pageSize() const
{
return d->pageSize();
}
void KLocale::setPageSize(int size)
{
d->setPageSize(size);
}
KLocale::MeasureSystem KLocale::measureSystem() const
{
return d->measureSystem();
}
void KLocale::setMeasureSystem(KLocale::MeasureSystem value)
{
d->setMeasureSystem(value);
}
QString KLocale::defaultLanguage()
{
return KLocalePrivate::defaultLanguage();
}
QString KLocale::defaultCountry()
{
return KLocalePrivate::defaultCountry();
}
QString KLocale::defaultCurrencyCode()
{
return KLocalePrivate::defaultCurrencyCode();
}
bool KLocale::useTranscript() const
{
return d->useTranscript();
}
const QByteArray KLocale::encoding() const
{
return d->encoding();
}
int KLocale::encodingMib() const
{
return d->encodingMib();
}
int KLocale::fileEncodingMib() const
{
return d->fileEncodingMib();
}
QTextCodec *KLocale::codecForEncoding() const
{
return d->codecForEncoding();
}
bool KLocale::setEncoding(int mibEnum)
{
return d->setEncoding(mibEnum);
}
QStringList KLocale::allLanguagesList() const
{
return d->allLanguagesList();
}
QStringList KLocale::installedLanguages() const
{
return d->installedLanguages();
}
QString KLocale::languageCodeToName(const QString &language) const
{
return d->languageCodeToName(language);
}
QStringList KLocale::allCountriesList() const
{
return d->allCountriesList();
}
QString KLocale::countryCodeToName(const QString &country) const
{
return d->countryCodeToName(country);
}
void KLocale::setCalendar(const QString &calendarType)
{
d->setCalendar(calendarType);
}
void KLocale::setCalendarSystem(KLocale::CalendarSystem calendarSystem)
{
d->setCalendarSystem(calendarSystem);
}
QString KLocale::calendarType() const
{
return d->calendarType();
}
KLocale::CalendarSystem KLocale::calendarSystem() const
{
return d->calendarSystem();
}
const KCalendarSystem * KLocale::calendar() const
{
return d->calendar();
}
void KLocale::setWeekNumberSystem(KLocale::WeekNumberSystem weekNumberSystem)
{
d->setWeekNumberSystem(weekNumberSystem);
}
KLocale::WeekNumberSystem KLocale::weekNumberSystem()
{
return d->weekNumberSystem();
}
KLocale::WeekNumberSystem KLocale::weekNumberSystem() const
{
return d->weekNumberSystem();
}
KLocale::KLocale(const KLocale &rhs)
: d(new KLocalePrivate(*rhs.d))
{
d->q = this;
}
KLocale & KLocale::operator=(const KLocale & rhs)
{
// the assignment operator works here
*d = *rhs.d;
d->q = this;
return *this;
}
void KLocale::copyCatalogsTo(KLocale *locale)
{
d->copyCatalogsTo(locale);
}
QString KLocale::localizedFilePath(const QString &filePath) const
{
return d->localizedFilePath(filePath);
}
QString KLocale::removeAcceleratorMarker(const QString &label) const
{
return d->removeAcceleratorMarker(label);
}
void KLocale::setDigitSet(KLocale::DigitSet digitSet)
{
d->setDigitSet(digitSet);
}
KLocale::DigitSet KLocale::digitSet() const
{
return d->digitSet();
}
void KLocale::setMonetaryDigitSet(KLocale::DigitSet digitSet)
{
d->setMonetaryDigitSet(digitSet);
}
KLocale::DigitSet KLocale::monetaryDigitSet() const
{
return d->monetaryDigitSet();
}
void KLocale::setDateTimeDigitSet(KLocale::DigitSet digitSet)
{
d->setDateTimeDigitSet(digitSet);
}
KLocale::DigitSet KLocale::dateTimeDigitSet() const
{
return d->dateTimeDigitSet();
}
+
+void KLocale::reparseConfiguration()
+{
+ d->initFormat();
+}
diff --git a/kdecore/localization/klocale.h b/kdecore/localization/klocale.h
index 3495431a6b..3a05b5e856 100644
--- a/kdecore/localization/klocale.h
+++ b/kdecore/localization/klocale.h
@@ -1,2129 +1,2137 @@
/* This file is part of the KDE libraries
Copyright (C) 1997 Stephan Kulow <coolo@kde.org>
Copyright (C) 1999-2003 Hans Petter Bieker <bieker@kde.org>
Copyright (c) 2002 Lukas Tinkl <lukas@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KLOCALE_H
#define KLOCALE_H
#include <kdecore_export.h>
#include <klocalizedstring.h>
#include <ksharedconfig.h>
#include <QtCore/QString>
#include <QtCore/QList>
class QStringList;
class QTextCodec;
class QDate;
class QTime;
class QDateTime;
class KDateTime;
class KCalendarSystem;
class KCurrencyCode;
class KDayPeriod;
class KLocalePrivate;
/**
* \file klocale.h
*/
/**
*
* KLocale provides support for country specific stuff like
* the national language.
*
* KLocale supports translating, as well as specifying the format
* for numbers, currency, time, and date.
*
* Use KGlobal::locale() to get pointer to the global KLocale object,
* containing the applications current locale settings.
*
* For example, to format the date May 17, 1995 in the current locale, use:
*
* \code
* QString date = KGlobal::locale()->formatDate(QDate(1995,5,17));
* \endcode
*
* @author Stephan Kulow <coolo@kde.org>, Preston Brown <pbrown@kde.org>,
* Hans Petter Bieker <bieker@kde.org>, Lukas Tinkl <lukas.tinkl@suse.cz>
* @short class for supporting locale settings and national language
*/
class KDECORE_EXPORT KLocale
{
public:
/**
* Constructs a KLocale with the given catalog name
*
* The constructor looks for an entry Language in the group Locale in the
* configuration file.
*
* If no configuration file is specified, it will also look for languages
* using the environment variables (KDE_LANG, LC_MESSAGES, LC_ALL, LANG),
* as well as the global configuration file. If KLocale is not able to use
* any of the specified languages, the default language (en_US) will be
* used.
*
* If you specify a configuration file, it has to be valid until the KLocale
* object is destroyed. Note that a setLocale() will be performed on the
* config using the current locale language, which may cause a sync()
* and reparseConfiguration() which will save any changes you have made and
* load any changes other shared copies have made.
*
* @param catalog the name of the main language file
* @param config a configuration file with a Locale group detailing
* locale-related preferences (such as language and
* formatting options).
*/
explicit KLocale(const QString& catalog, KSharedConfig::Ptr config = KSharedConfig::Ptr());
/**
* Constructs a KLocale with the given catalog name
*
* Allows you to override the language and, optionally, the
* country of this locale.
*
* If you specify a configuration file, a setLocale() will be performed on
* the config using the current locale language, which may cause a sync()
* and reparseConfiguration() which will save any changes you have made.
*
* @param catalog the name of the main language file
* @param language the ISO Language Code for the locale, e.g. "en" for English
* @param country the ISO Country Code for the locale, e.g. "us" for USA
* @param config a configuration file with a Locale group detailing
* locale-related preferences (such as language and
* formatting options).
*/
KLocale(const QString& catalog, const QString &language, const QString &country = QString(),
KConfig *config = 0);
/**
* Copy constructor
*/
KLocale(const KLocale & rhs);
/**
* Assignment operator
*/
KLocale& operator= (const KLocale & rhs);
/**
* Destructor
*/
virtual ~KLocale();
/**
* @since 4.5
*
* Raw translation from a message catalog.
* If catalog name is null or empty,
* all loaded catalogs are searched for the translation.
*
* Never use this directly to get message translations. See the i18n and ki18n
* family of calls related to KLocalizedString.
*
* @param catname the catalog name. Must be UTF-8 encoded.
* @param msg the message. Must not be null or empty. Must be UTF-8 encoded.
* @param lang language in which the translation was found. If no translation
* was found, KLocale::defaultLanguage() is reported. If null,
* the language is not reported.
* @param trans raw translation, or original if not found. If no translation
* was found, original message is reported. If null, the
* translation is not reported.
*
* @see KLocalizedString
*/
void translateRawFrom(const char* catname, const char* msg, QString *lang, QString *trans) const;
/**
* Like translateRawFrom, with implicit lookup through all loaded catalogs.
*
* @deprecated Use translateRawFrom with null or empty catalog name.
*/
void translateRaw(const char* msg, QString *lang, QString *trans) const;
/**
* @since 4.5
*
* Raw translation from a message catalog, with given context.
* Context + message are used as the lookup key in the catalog.
* If catalog name is null or empty,
* all loaded catalogs are searched for the translation.
*
* Never use this directly to get message translations. See i18n* and ki18n*
* calls related to KLocalizedString.
*
* @param catname the catalog name. Must be UTF-8 encoded.
* @param ctxt the context. Must not be null. Must be UTF-8 encoded.
* @param msg the message. Must not be null or empty. Must be UTF-8 encoded.
* @param lang language in which the translation was found. If no translation
* was found, KLocale::defaultLanguage() is reported. If null,
* the language is not reported.
* @param trans raw translation, or original if not found. If no translation
* was found, original message is reported. If null, the
* translation is not reported.
*
* @see KLocalizedString
*/
void translateRawFrom(const char *catname, const char *ctxt, const char *msg, QString *lang, QString *trans) const;
/**
* Like translateRawFrom, with implicit lookup through all loaded catalogs.
*
* @deprecated Use translateRawFrom with null or empty catalog name.
*/
void translateRaw(const char *ctxt, const char *msg, QString *lang, QString *trans) const;
/**
* @since 4.5
*
* Raw translation from a message catalog, with given singular/plural form.
* Singular form is used as the lookup key in the catalog.
* If catalog name is null or empty,
* all loaded catalogs are searched for the translation.
*
* Never use this directly to get message translations. See i18n* and ki18n*
* calls related to KLocalizedString.
*
* @param catname the catalog name. Must be UTF-8 encoded.
* @param singular the singular form. Must not be null or empty. Must be UTF-8 encoded.
* @param plural the plural form. Must not be null. Must be UTF-8 encoded.
* @param n number on which the forms are decided.
* @param lang language in which the translation was found. If no translation
* was found, KLocale::defaultLanguage() is reported. If null,
* the language is not reported.
* @param trans raw translation, or original if not found. If no translation
* was found, original message is reported (either plural or
* singular, as determined by @p n ). If null, the
* translation is not reported.
*
* @see KLocalizedString
*/
void translateRawFrom(const char *catname, const char *singular, const char *plural, unsigned long n,
QString *lang, QString *trans) const;
/**
* Like translateRawFrom, with implicit lookup through all loaded catalogs.
*
* @deprecated Use translateRawFrom with null or empty catalog name.
*/
void translateRaw(const char *singular, const char *plural, unsigned long n, QString *lang,
QString *trans) const;
/**
* @since 4.5
*
* Raw translation from a message catalog, with given context and
* singular/plural form.
* Context + singular form is used as the lookup key in the catalog.
* If catalog name is null or empty,
* all loaded catalogs are searched for the translation.
*
* Never use this directly to get message translations. See i18n* and ki18n*
* calls related to KLocalizedString.
*
* @param catname the catalog name. Must be UTF-8 encoded.
* @param ctxt the context. Must not be null. Must be UTF-8 encoded.
* @param singular the singular form. Must not be null or empty. Must be UTF-8 encoded.
* @param plural the plural form. Must not be null. Must be UTF-8 encoded.
* @param n number on which the forms are decided.
* @param lang language in which the translation was found. If no translation
* was found, KLocale::defaultLanguage() is reported. If null,
* the language is not reported.
* @param trans raw translation, or original if not found. If no translation
* was found, original message is reported (either plural or
* singular, as determined by @p n ). If null, the
* translation is not reported.
*
* @see KLocalizedString
*/
void translateRawFrom(const char *catname, const char *ctxt, const char *singular, const char *plural,
unsigned long n, QString *lang, QString *trans) const;
/**
* Like translateRawFrom, with implicit lookup through all loaded catalogs.
*
* @deprecated Use translateRawFrom with null or empty catalog name.
*/
void translateRaw(const char *ctxt, const char *singular, const char *plural, unsigned long n,
QString *lang, QString *trans) const;
/**
* Changes the current encoding.
*
* @param mibEnum The mib of the preferred codec
*
* @return True on success.
*/
bool setEncoding(int mibEnum);
/**
* Various positions for where to place the positive or negative
* sign when they are related to a monetary value.
*/
enum SignPosition {
/**
* Put parantheses around the quantity, e.g. "$ (217)"
*/
ParensAround = 0,
/**
* Prefix the quantity with the sign, e.g. "$ -217"
*/
BeforeQuantityMoney = 1,
/**
* Suffix the quanitity with the sign, e.g. "$ 217-"
*/
AfterQuantityMoney = 2,
/**
* Prefix the currency symbol with the sign, e.g. "-$ 217"
*/
BeforeMoney = 3,
/**
* Suffix the currency symbol with the sign, e.g. "$- 217"
*/
AfterMoney = 4
};
/**
* @since 4.3
*
* The set of digit characters used to display and enter numbers.
*/
enum DigitSet {
ArabicDigits, /**< 0123456789 (European and some Asian
languages and western Arabic dialects) */
ArabicIndicDigits, /**< ٠١٢٣٤٥٦٧٨٩ (eastern Arabic dialects) */
EasternArabicIndicDigits, /**< ۰۱۲۳۴۵۶۷۸۹ (Persian and Urdu) */
DevenagariDigits, /**< ०१२३४५६७८९ (Hindi) */
BengaliDigits, /**< ০১২৩৪৫৬৭৮৯ (Bengali and Assamese) */
GujaratiDigits, /**< ૦૧૨૩૪૫૬૭૮૯ (Gujarati) */
GurmukhiDigits, /**< ੦੧੨੩੪੫੬੭੮੯ (Punjabi) */
KannadaDigits, /**< ೦೧೨೩೪೫೬೭೮೯ (Kannada) */
KhmerDigits, /**< ០១២៣៤៥៦៧៨៩ (Khmer) */
MalayalamDigits, /**< ൦൧൨൩൪൫൬൭൮൯ (Malayalam) */
OriyaDigits, /**< ୦୧୨୩୪୫୬୭୮୯ (Oriya) */
TamilDigits, /**< ௦௧௨௩௪௫௬௭௮ (Tamil) */
TeluguDigits, /**< ౦౧౨౩౪౫౬౭౯ (Telugu) */
ThaiDigits /**< ๐๑๒๓๔๕๖๗๘๙ (Thai) */
// The following Decimal Digit Sets are defined in Unicode but the associated
// languages are not yet translated in KDE, so are not yet enabled.
// The script names are taken from the Unicode standard, the associated
// languages from Wikipedia.
// BalineseDigits, /**< ᭐᭑᭒᭓᭔᭕᭖᭗᭘᭙ (Balinese) */
// ChamDigits, /**< ꩐꩑꩒꩓꩔꩕꩖꩗꩘꩙ (Cham) */
// JavaneseDigits, /**< ꧐꧑꧒꧓꧔꧕꧖꧗꧘꧙ (Javanese) */
// KayahLiDigits, /**< ꤀꤁꤂꤃꤄꤅꤆꤇꤈꤉ (Kayah) */
// LaoDigits, /**< ໐໑໒໓໔໕໖໗໘໙ (Lao) */
// LepchaDigits, /**< ᱀᱁᱂᱃᱄᱅᱆᱇᱈᱉ (Lepcha) */
// LimbuDigits, /**< ᥆᥇᥈᥉᥊᥋᥌᥍᥎᥏ (Limbu) */
// MeeteiMayekDigits, /**< ꯰꯱꯲꯳꯴꯵꯶꯷꯸꯹ (Meitei) */
// MongolianDigits, /**< ᠐᠑᠒᠓᠔᠕᠖᠗᠘᠙ (Mongolian) */
// MyanmarDigits, /**< ၀၁၂၃၄၅၆၇၈၉ (Myanmar/Burmese ) */
// MyanmarShanDigits, /**< ႐႑႒႓႔႕႖႗႘႙ (Shan) */
// NewTaiLueDigits, /**< ᧐᧑᧒᧓᧔᧕᧖᧗᧘᧙ (Tai Lü) */
// NKoDigits, /**< ߀߁߂߃߄߅߆߇߈߉ (Mande and N'Ko) */
// OlChikiDigits, /**< ᱐᱑᱒᱓᱔᱕᱖᱗᱘᱙ (Santali) */
// OsmanyaDigits, /**< ҠҡҢңҤҥҦҧҨҩ (Somali) */
// SaurashtraDigits, /**< ꣐꣑꣒꣓꣔꣕꣖꣗꣘꣙ (Saurashtra) */
// SundaneseDigits, /**< ᮰᮱᮲᮳᮴᮵᮶᮷᮸᮹ (Sundanese) */
// TaiThamDigits, /**< ᪐᪑᪒᪓᪔᪕᪖᪗᪘᪙ (Tai Lü) */
// TibetanDigits, /**< ༠༡༢༣༤༥༦༧༨༩ (Tibetan) */
// VaiDigits, /**< ꘠꘡꘢꘣꘤꘥꘦꘧꘨꘩ (Vai) */
};
/**
* @since 4.3
*
* Convert a digit set identifier to a human readable, localized name.
*
* @param digitSet the digit set identifier
* @param withDigits whether to add the digits themselves to the name
*
* @return the human readable and localized name of the digit set
*
* @see DigitSet
*/
QString digitSetToName(DigitSet digitSet, bool withDigits = false) const;
/**
* @since 4.3
*
* Provides list of all known digit set identifiers.
*
* @return list of all digit set identifiers
* @see DigitSet
* @see digitSetToName
*/
QList<DigitSet> allDigitSetsList() const;
/**
* Returns what a decimal point should look like ("." or "," etc.)
* according to the current locale or user settings.
*
* @return The decimal symbol used by locale.
*/
QString decimalSymbol() const;
/**
* Returns what the thousands separator should look
* like ("," or "." etc.)
* according to the current locale or user settings.
*
* @return The thousands separator used by locale.
*/
QString thousandsSeparator() const;
/**
* @since 4.3
*
* Returns the identifier of the digit set used to display numbers.
*
* @return the digit set identifier
* @see DigitSet
* @see digitSetToName
*/
DigitSet digitSet() const;
/**
* @since 4.4
*
* Returns the ISO 4217 Currency Code for the current locale
*
* @return The default ISO Currency Code used by locale.
*/
QString currencyCode() const;
/**
* @since 4.4
*
* Returns the Currency Code object for the current locale
*
* @return The default Currency Code object used by locale.
*/
KCurrencyCode *currency() const;
/**
* Returns what the symbol denoting currency in the current locale
* as as defined by user settings should look like.
*
* @return The default currency symbol used by locale.
*/
QString currencySymbol() const;
/**
* Returns what a decimal point should look like ("." or "," etc.)
* for monetary values, according to the current locale or user
* settings.
*
* @return The monetary decimal symbol used by locale.
*/
QString monetaryDecimalSymbol() const;
/**
* Returns what a thousands separator for monetary values should
* look like ("," or " " etc.) according to the current locale or
* user settings.
*
* @return The monetary thousands separator used by locale.
*/
QString monetaryThousandsSeparator() const;
/**
* Returns what a positive sign should look like ("+", " ", etc.)
* according to the current locale or user settings.
*
* @return The positive sign used by locale.
*/
QString positiveSign() const;
/**
* Returns what a negative sign should look like ("-", etc.)
* according to the current locale or user settings.
*
* @return The negative sign used by locale.
*/
QString negativeSign() const;
/**
* @deprecated use decimalPlaces() or monetaryDecimalPlaces()
*
* The number of fractional digits to include in monetary values (usually 2).
*
* @return Default number of fractional digits used by locale.
*/
KDE_DEPRECATED int fracDigits() const;
/**
* @since 4.4
*
* The number of decimal places to include in numeric values (usually 2).
*
* @return Default number of numeric decimal places used by locale.
*/
int decimalPlaces() const;
/**
* @since 4.4
*
* The number of decimal places to include in monetary values (usually 2).
*
* @return Default number of monetary decimal places used by locale.
*/
int monetaryDecimalPlaces() const;
/**
* If and only if the currency symbol precedes a positive value,
* this will be true.
*
* @return Where to print the currency symbol for positive numbers.
*/
bool positivePrefixCurrencySymbol() const;
/**
* If and only if the currency symbol precedes a negative value,
* this will be true.
*
* @return True if the currency symbol precedes negative numbers.
*/
bool negativePrefixCurrencySymbol() const;
/**
* Returns the position of a positive sign in relation to a
* monetary value.
*
* @return Where/how to print the positive sign.
* @see SignPosition
*/
SignPosition positiveMonetarySignPosition() const;
/**
* Denotes where to place a negative sign in relation to a
* monetary value.
*
* @return Where/how to print the negative sign.
* @see SignPosition
*/
SignPosition negativeMonetarySignPosition() const;
/**
* @since 4.3
*
* Retuns the digit set used to display monetary values.
*
* @return the digit set identifier
* @see DigitSet
* @see digitSetToName
*/
DigitSet monetaryDigitSet() const;
/**
* Given a double, converts that to a numeric string containing
* the localized monetary equivalent.
*
* e.g. given 123456, return "$ 123,456.00".
*
* If precision isn't specified or is < 0, then the default monetaryDecimalPlaces() is used.
*
* @param num The number we want to format
* @param currency The currency symbol you want.
* @param precision Number of decimal places displayed
*
* @return The number of money as a localized string
* @see monetaryDecimalPlaces()
*/
QString formatMoney(double num, const QString &currency = QString(), int precision = -1) const;
/**
* Given a double, converts that to a numeric string containing
* the localized numeric equivalent.
*
* e.g. given 123456.78F, return "123,456.78" (for some European country).
*
* If precision isn't specified or is < 0, then the default decimalPlaces() is used.
*
* This function is a wrapper that is provided for convenience.
*
* @param num The number to convert
* @param precision Number of decimal places used.
*
* @return The number as a localized string
* @see formatNumber(const QString, bool, int)
* @see decimalPlaces()
*/
QString formatNumber(double num, int precision = -1) const;
/**
* Given a string representing a number, converts that to a numeric
* string containing the localized numeric equivalent.
*
* e.g. given 123456.78F, return "123,456.78" (for some European country).
*
* If precision isn't specified or is < 0, then the default decimalPlaces() is used.
*
* @param numStr The number to format, as a string.
* @param round Round fractional digits. (default true)
* @param precision Number of fractional digits used for rounding. Unused if round=false.
*
* @return The number as a localized string
*/
QString formatNumber(const QString &numStr, bool round = true, int precision = -1) const;
/**
* Given an integer, converts that to a numeric string containing
* the localized numeric equivalent.
*
* e.g. given 123456L, return "123,456" (for some European country).
*
* @param num The number to convert
*
* @return The number as a localized string
*/
QString formatLong(long num) const;
/**
* These binary units are used in KDE by the formatByteSize()
* functions.
*
* NOTE: There are several different units standards:
* 1) SI (i.e. metric), powers-of-10.
* 2) IEC, powers-of-2, with specific units KiB, MiB, etc.
* 3) JEDEC, powers-of-2, used for solid state memory sizing which
* is why you see flash cards labels as e.g. 4GB. These (ab)use
* the metric units. Although JEDEC only defines KB, MB, GB, if
* JEDEC is selected all units will be powers-of-2 with metric
* prefixes for clarity in the event of sizes larger than 1024 GB.
*
* Although 3 different dialects are possible this enum only uses
* metric names since adding all 3 different names of essentially the same
* unit would be pointless. Use BinaryUnitDialect to control the exact
* units returned.
*
* @since 4.4
* @see binaryUnitDialect
*/
enum BinarySizeUnits {
/// Auto-choose a unit such that the result is in the range [0, 1000 or 1024)
DefaultBinaryUnits = -1,
// The first real unit must be 0 for the current implementation!
UnitByte, ///< B 1 byte
UnitKiloByte, ///< KiB/KB/kB 1024/1000 bytes.
UnitMegaByte, ///< MiB/MB/MB 2^20/10^06 bytes.
UnitGigaByte, ///< GiB/GB/GB 2^30/10^09 bytes.
UnitTeraByte, ///< TiB/TB/TB 2^40/10^12 bytes.
UnitPetaByte, ///< PiB/PB/PB 2^50/10^15 bytes.
UnitExaByte, ///< EiB/EB/EB 2^60/10^18 bytes.
UnitZettaByte, ///< ZiB/ZB/ZB 2^70/10^21 bytes.
UnitYottaByte, ///< YiB/YB/YB 2^80/10^24 bytes.
UnitLastUnit = UnitYottaByte
};
/**
* This enum chooses what dialect is used for binary units.
*
* Note: Although JEDEC abuses the metric prefixes and can therefore be
* confusing, it has been used to describe *memory* sizes for quite some time
* and programs should therefore use either Default, JEDEC, or IEC 60027-2
* for memory sizes.
*
* On the other hand network transmission rates are typically in metric so
* Default, Metric, or IEC (which is unambiguous) should be chosen.
*
* Normally choosing DefaultBinaryUnits is the best option as that uses
* the user's selection for units.
*
* @since 4.4
* @see binaryUnitDialect
* @see setBinaryUnitDialect
*/
enum BinaryUnitDialect {
DefaultBinaryDialect = -1, ///< Used if no specific preference
IECBinaryDialect, ///< KDE Default, KiB, MiB, etc. 2^(10*n)
JEDECBinaryDialect, ///< KDE 3.5 default, KB, MB, etc. 2^(10*n)
MetricBinaryDialect, ///< SI Units, kB, MB, etc. 10^(3*n)
LastBinaryDialect = MetricBinaryDialect
};
/**
* Converts @p size from bytes to the string representation using the
* user's default binary unit dialect. The default unit dialect is
* IEC 60027-2.
*
* Example:
* formatByteSize(1024) returns "1.0 KiB" by default.
*
* @param size size in bytes
* @return converted size as a string - e.g. 123.4 KiB , 12.0 MiB
* @see BinaryUnitDialect
* @todo KDE 5: Remove in favor of overload added in KDE 4.4.
*/
QString formatByteSize(double size) const;
/**
* @since 4.4
*
* Converts @p size from bytes to the appropriate string representation
* using the binary unit dialect @p dialect and the specific units @p specificUnit.
*
* Example:
* formatByteSize(1000, unit, KLocale::BinaryUnitKilo) returns:
* for KLocale::MetricBinaryUnits, "1.0 kB",
* for KLocale::IECBinaryUnits, "0.9 KiB",
* for KLocale::JEDECBinaryUnits, "0.9 KB".
*
* @param size size in bytes
* @param precision number of places after the decimal point to use. KDE uses
* 1 by default so when in doubt use 1.
* @param dialect binary unit standard to use. Use DefaultBinaryUnits to
* use the localized user selection unless you need to use a specific
* unit type (such as displaying a flash memory size in JEDEC).
* @param specificUnit specific unit size to use in result. Use
* DefaultBinarySize to automatically select a unit that will return
* a sanely-sized number.
* @return converted size as a translated string including the units.
* E.g. "1.23 KiB", "2 GB" (JEDEC), "4.2 kB" (Metric).
*/
QString formatByteSize(double size, int precision,
BinaryUnitDialect dialect = KLocale::DefaultBinaryDialect,
BinarySizeUnits specificUnit = KLocale::DefaultBinaryUnits) const;
/**
* Returns the user's default binary unit dialect.
*
* @since 4.4
* @return User's default binary unit dialect
* @see BinaryUnitDialect
*/
BinaryUnitDialect binaryUnitDialect() const;
/**
* Sets @p newDialect to be the default dialect for this locale (and only
* this locale). Newly created KLocale objects will continue to default
* to the user's choice.
*
* @param newDialect the new dialect to set as default for this locale object.
* @since 4.4
*/
void setBinaryUnitDialect(BinaryUnitDialect newDialect);
/**
* Given a number of milliseconds, converts that to a string containing
* the localized equivalent
*
* e.g. given formatDuration(60000), returns "1.0 minutes"
*
* @param mSec Time duration in milliseconds
* @return converted duration as a string - e.g. "5.5 seconds" "23.0 minutes"
*/
QString formatDuration(unsigned long mSec) const;
/**
* Given a number of milliseconds, converts that to a pretty string containing
* the localized equivalent.
*
* e.g. given prettyFormatDuration(60001) returns "1 minute"
* given prettyFormatDuration(62005) returns "1 minute and 2 seconds"
* given prettyFormatDuration(90060000) returns "1 day and 1 hour"
*
* @param mSec Time duration in milliseconds
* @return converted duration as a string.
* Units not interesting to the user, for example seconds or minutes when the first
* unit is day, are not returned because they are irrelevant. The same applies for
* seconds when the first unit is hour.
* @since 4.2
*/
QString prettyFormatDuration(unsigned long mSec) const;
/**
* @deprecated
*
* Use this to determine whether nouns are declined in
* locale's language. This property should remain
* read-only (no setter function)
*
* @return If nouns are declined
*/
KDE_DEPRECATED bool nounDeclension() const;
//KDE5 move to KDateTime namespace
/**
* @since 4.6
*
* Available Calendar Systems
*
* @see setCalendarSystem()
* @see calendarSystem()
*/
enum CalendarSystem {
QDateCalendar = 1, /**< KDE Default, hybrid of Gregorian and Julian as used by QDate */
//BahaiCalendar = 2, /**< Baha'i Calendar */
//BuddhistLunarCalendar = 3, /**< Buddhist Lunar Calendar*/
//ChineseCalendar = 4, /**< Chinese Calendar */
CopticCalendar = 5, /**< Coptic Calendar as used Coptic Church and some parts of Egypt */
EthiopianCalendar = 6, /**< Ethiopian Calendar, aka Ethiopic Calendar */
//EthiopianAmeteAlemCalendar = 7, /**< Ethiopian Amete Alem version, aka Ethiopic Amete Alem */
GregorianCalendar = 8, /**< Gregorian Calendar, pure proleptic implementation */
HebrewCalendar = 9, /**< Hebrew Calendar, aka Jewish Calendar */
//HinduCalendar = 10, /**< Hindu Lunar Calendar */
//IslamicLunarCalendar = 11, /**< Islamic Lunar Calendar */
IslamicCivilCalendar = 12, /**< Islamic Civil Calendar, aka Hijri, not the Lunar Calendar */
//IslamicUmAlQuraCalendar = 13, /**< Islamic Lunar Calendar, Um Al Qura varient used in Saudi Arabia */
IndianNationalCalendar = 14, /**< Indian National Calendar, not the Lunar Calendar */
//Iso8601Calendar = 15, /**< ISO 8601 Standard Calendar */
JalaliCalendar = 16, /**< Jalali Calendar, aka Persian or Iranian, also used in Afghanistan */
//JalaliBirashkCalendar = 17, /**< Jalali Calendar, Birashk Algorythm variant */
//Jalali33YearCalendar = 18, /**< Jalali Calendar, 33 Year cycle variant */
JapaneseCalendar= 19, /**< Japanese Calendar, Gregorian calculation using Japanese Era (Nengô) */
//JucheCalendar = 20, /**< Juche Calendar, used in North Korea */
JulianCalendar = 21, /**< Julian Calendar, as used in Orthodox Churches */
MinguoCalendar= 22, /**< Minguo Calendar, aka ROC, Republic of China or Taiwanese */
ThaiCalendar = 23 /**< Thai Calendar, aka Buddhist or Thai Buddhist */
};
//KDE5 move to KDateTime namespace
/**
* @since 4.6
*
* System used for Week Numbers
*
* @see setWeekNumberSystem()
* @see weekNumberSystem()
*/
enum WeekNumberSystem {
DefaultWeekNumber = -1, /**< The system locale default */
IsoWeekNumber = 0, /**< ISO Week Number */
FirstFullWeek = 1, /**< Week 1 starts on the first Week Start Day in year ends after 7 days */
FirstPartialWeek = 2, /**< Week 1 starts Jan 1st ends day before first Week Start Day in year */
SimpleWeek = 3 /**< Week 1 starts Jan 1st ends after 7 days */
};
//KDE5 move to KDateTime namespace
/**
* @since 4.4
*
* Standard used for Date Time Format String
*/
enum DateTimeFormatStandard {
KdeFormat, /**< KDE Standard */
PosixFormat, /**< POSIX Standard */
UnicodeFormat /**< UNICODE Standard (Qt/Java/OSX/Windows) */
};
//KDE5 move to KDateTime namespace
/**
* @since 4.6
*
* Mode to use when parsing a Date Time input string
*/
enum DateTimeParseMode {
LiberalParsing /**< Parse Date/Time liberally. So long as the
input string contains at least a reconizable
month and day the input will be accepted. */
//ModerateParsing, /**< Parse Date/Time with modeate tolerance.
// The date components in the format must all
// occur in the input and in the same order,
// but the spacing and the componants themselves
// may vary from the strict format. */
//StrictParsing /**< Parse Date/Time strictly to the format. */
};
//KDE5 move to KDateTime namespace
/**
* @since 4.6
*
* The various Components that make up a Date / Time
* In the future the Components may be combined as flags for dynamic
* generation of Date Formats.
*
* @see KCalendarSystem
* @see KLocalizedDate
* @see DateTimeComponentFormat
*/
enum DateTimeComponent {
Year = 0x1, /**< The Year portion of a date, may be number or name */
YearName = 0x2, /**< The Year Name portion of a date */
Month = 0x4, /**< The Month portion of a date, may be number or name */
MonthName = 0x8, /**< The Month Name portion of a date */
Day = 0x10, /**< The Day portion of a date, may be number or name */
DayName = 0x20, /**< The Day Name portion of a date */
JulianDay = 0x40, /**< The Julian Day of a date */
EraName = 0x80, /**< The Era Name portion of a date */
EraYear = 0x100, /**< The Era and Year portion of a date */
YearInEra = 0x200, /**< The Year In Era portion of a date */
DayOfYear = 0x400, /**< The Day Of Year portion of a date, may be number or name */
DayOfYearName = 0x800, /**< The Day Of Year Name portion of a date */
DayOfWeek = 0x1000, /**< The Day Of Week / Weekday portion of a date, may be number or name */
DayOfWeekName = 0x2000, /**< The Day Of Week Name / Weekday Name portion of a date */
Week = 0x4000, /**< The Week Number portion of a date */
WeekYear = 0x8000, /**< The Week Year portion of a date */
MonthsInYear = 0x10000, /**< The Months In Year portion of a date */
WeeksInYear = 0x20000, /**< The Weeks In Year portion of a date */
DaysInYear = 0x40000, /**< The Days In Year portion of a date */
DaysInMonth = 0x80000, /**< The Days In Month portion of a date */
DaysInWeek = 0x100000, /**< The Days In Week portion of a date */
Hour = 0x200000, /**< The Hours portion of a date */
Minute = 0x400000, /**< The Minutes portion of a date */
Second = 0x800000, /**< The Seconds portion of a date */
Millisecond = 0x1000000, /**< The Milliseconds portion of a date */
DayPeriod = 0x2000000, /**< The Day Period portion of a date, e.g. AM/PM */
DayPeriodHour = 0x4000000, /**< The Day Period Hour portion of a date */
Timezone = 0x8000000, /**< The Time Zone portion of a date, may be offset or name */
TimezoneName = 0x10000000, /**< The Time Zone Name portion of a date */
UnixTime = 0x20000000 /**< The UNIX Time portion of a date */
};
Q_DECLARE_FLAGS(DateTimeComponents, DateTimeComponent)
//KDE5 move to KDateTime namespace
/**
* @since 4.6
*
* Format used for individual Date/Time Components when converted to/from a string
* Largely equivalent to the UNICODE CLDR format width definitions 1..5
*
* @see DateTimeComponentFormat
*/
enum DateTimeComponentFormat {
DefaultComponentFormat = -1, /**< The system locale default for the componant */
ShortNumber = 0, /**< Number at its natural width, e.g. 2 for the 2nd*/
LongNumber, /**< Number padded to a required width, e.g. 02 for the 2nd*/
//OrdinalNumber /**< Ordinal number format, e.g. "2nd" for the 2nd */
NarrowName = 3, /**< Narrow text format, may not be unique, e.g. M for Monday */
ShortName, /**< Short text format, e.g. Mon for Monday */
LongName /**< Long text format, e.g. Monday for Monday */
};
//KDE5 move to KDateTime namespace
/**
* Format for date string.
*/
enum DateFormat {
ShortDate, /**< Locale Short date format, e.g. 08-04-2007 */
LongDate, /**< Locale Long date format, e.g. Sunday 08 April 2007 */
FancyShortDate, /**< Same as ShortDate for dates a week or more ago. For more
recent dates, it is represented as Today, Yesterday, or
the weekday name. */
FancyLongDate, /**< Same as LongDate for dates a week or more ago. For more
recent dates, it is represented as Today, Yesterday, or
the weekday name. */
IsoDate, /**< ISO-8601 Date format YYYY-MM-DD, e.g. 2009-12-31 */
IsoWeekDate, /**< ISO-8601 Week Date format YYYY-Www-D, e.g. 2009-W01-1 */
IsoOrdinalDate /**< ISO-8601 Ordinal Date format YYYY-DDD, e.g. 2009-001 */
};
//KDE5 move to KDateTime namespace
/**
* Returns a string formatted to the current locale's conventions
* regarding dates.
*
* @param date the date to be formatted
* @param format category of date format to use
*
* @return the date as a string
*/
QString formatDate(const QDate &date, DateFormat format = LongDate) const;
//KDE5 move to KDateTime namespace
/**
* Returns a string formatted to the current locale's conventions
* regarding both date and time.
*
* @param dateTime the date and time to be formatted
* @param format category of date format to use
* @param includeSecs if @c true, the string will include the seconds part
* of the time; otherwise, the seconds will be omitted
*
* @return the date and time as a string
*/
QString formatDateTime(const QDateTime &dateTime, DateFormat format = ShortDate,
bool includeSecs = false) const;
//KDE5 move to KDateTime namespace
/**
* Options for formatting date-time values.
*/
enum DateTimeFormatOption {
TimeZone = 0x01, /**< Include a time zone string */
Seconds = 0x02 /**< Include the seconds value */
};
Q_DECLARE_FLAGS(DateTimeFormatOptions, DateTimeFormatOption)
//KDE5 move to KDateTime namespace
/**
* Returns a string formatted to the current locale's conventions
* regarding both date and time.
*
* @param dateTime the date and time to be formatted
* @param format category of date format to use
* @param options additional output options
*
* @return The date and time as a string
*/
QString formatDateTime(const KDateTime &dateTime, DateFormat format = ShortDate,
DateTimeFormatOptions options = 0) const;
/**
* Use this to determine whether in dates a possessive form of month
* name is preferred ("of January" rather than "January")
*
* @return If possessive form should be used
*/
bool dateMonthNamePossessive() const;
/**
* @deprecated replaced by formatLocaleTime()
*
* Returns a string formatted to the current locale's conventions
* regarding times.
*
* @param pTime The time to be formatted.
* @param includeSecs if true, seconds are included in the output,
* otherwise only hours and minutes are formatted.
* @param isDuration if true, the given time is a duration, not a clock time.
* This means "am/pm" shouldn't be displayed.
*
* @return The time as a string
*/
QString formatTime(const QTime &pTime, bool includeSecs = false, bool isDuration = false) const;
//KDE5 move to KDateTime namespace
/**
* @since 4.4
*
* Format flags for readLocaleTime() and formatLocaleTime()
*/
enum TimeFormatOption {
TimeDefault = 0x0, ///< Default formatting using seconds and the format
///< as specified by the locale.
TimeWithoutSeconds = 0x1, ///< Exclude the seconds part of the time from display
TimeWithoutAmPm = 0x2, ///< Read/format time string without am/pm suffix but
///< keep the 12/24h format as specified by locale time
///< format, eg. "07.33.05" instead of "07.33.05 pm" for
///< time format "%I.%M.%S %p".
TimeDuration = 0x6, ///< Read/format time string as duration. This will strip
///< the am/pm suffix and read/format times with an hour
///< value of 0-23 hours, eg. "19.33.05" instead of
///< "07.33.05 pm" for time format "%I.%M.%S %p".
///< This automatically implies @c TimeWithoutAmPm.
TimeFoldHours = 0xE ///< Read/format time string as duration. This will not
///< not output the hours part of the duration but will
///< add the hours (times sixty) to the number of minutes,
///< eg. "70.23" instead of "01.10.23" for time format
///< "%I.%M.%S %p".
};
Q_DECLARE_FLAGS(TimeFormatOptions, TimeFormatOption)
//KDE5 move to KDateTime namespace
/**
* @since 4.4
*
* Returns a string formatted to the current locale's conventions
* regarding times.
*
* @param pTime the time to be formatted
* @param options format option to use when formatting the time
* @return The time as a string
*/
QString formatLocaleTime(const QTime &pTime,
TimeFormatOptions options = KLocale::TimeDefault) const;
/**
* @since 4.3
*
* Returns the identifier of the digit set used to display dates and time.
*
* @return the digit set identifier
* @see DigitSet
* @see digitSetToName
*/
DigitSet dateTimeDigitSet() const;
/**
* Use this to determine if the user wants a 12 hour clock.
*
* @return If the user wants 12h clock
*/
bool use12Clock() const;
/**
* @since 4.6
*
* Returns the Day Period matching the time given
*
* @param time the time to return the day period for
* @param format the format to return teh day period in
* @return the Day Period for the given time
*/
QString dayPeriodText(const QTime &time, DateTimeComponentFormat format = DefaultComponentFormat) const;
/**
* Use this to determine which day is the first day of the week.
*
* @return an integer (Monday=1..Sunday=7)
*/
int weekStartDay() const;
/**
* Use this to determine which day is the first working day of the week.
*
* @since 4.2
* @return an integer (Monday=1..Sunday=7)
*/
int workingWeekStartDay() const;
/**
* Use this to determine which day is the last working day of the week.
*
* @since 4.2
* @return an integer (Monday=1..Sunday=7)
*/
int workingWeekEndDay() const;
/**
* Use this to determine which day is reserved for religious observance
*
* @since 4.2
* @return day number (None = 0, Monday = 1, ..., Sunday = 7)
*/
int weekDayOfPray() const;
/**
* Returns a pointer to the calendar system object.
*
* @return the current calendar system instance
*/
const KCalendarSystem * calendar() const;
//KDE5 remove
/**
* @deprecated use calendarSystem() instead
*
* Returns the name of the calendar system that is currently being
* used by the system.
*
* @see calendarSystem()
* @return the name of the calendar system
*/
KDE_DEPRECATED QString calendarType() const;
/**
* @since 4.6
*
* Returns the type of Calendar System used in this Locale
*
* @see KLocale::CalendarSystem
* @see KCalendarSystem
* @return the type of Calendar System
*/
KLocale::CalendarSystem calendarSystem() const;
//KDE5 remove
/**
* @deprecated use setCalendarSystem() instead
*
* Changes the current calendar system to the calendar specified.
* If the calendar system specified is not found, gregorian will be used.
*
* @see setCalendarSystem()
* @param calendarType the name of the calendar type
*/
KDE_DEPRECATED void setCalendar(const QString & calendarType);
/**
* @since 4.6
*
* Sets the type of Calendar System to use in this Locale
*
* @see KLocale::CalendarSystem
* @see KCalendarSystem
* @param calendarSystem the Calendar System to use
*/
void setCalendarSystem(KLocale::CalendarSystem calendarSystem);
/**
* @since 4.6
*
* Sets the type of Week Number System to use in this Locale
*
* @see Klocale::WeekNumberSystem
* @see weekNumberSystem()
* @param weekNumberSystem the Week Number System to use
*/
void setWeekNumberSystem(KLocale::WeekNumberSystem weekNumberSystem);
//KDE5 remove in favour of const version
/**
* @since 4.6
*
* Returns the type of Week Number System used in this Locale
*
* @see Klocale::WeekNumberSystem
* @see setWeekNumberSystem()
* @returns the Week Number System used
*/
KLocale::WeekNumberSystem weekNumberSystem();
/**
* @since 4.7
*
* Returns the type of Week Number System used in this Locale
*
* @see Klocale::WeekNumberSystem
* @see setWeekNumberSystem()
* @returns the Week Number System used
*/
KLocale::WeekNumberSystem weekNumberSystem() const;
/**
* Converts a localized monetary string to a double.
*
* @param numStr the string we want to convert.
* @param ok the boolean that is set to false if it's not a number.
* If @p ok is 0, it will be ignored
*
* @return The string converted to a double
*/
double readMoney(const QString &numStr, bool * ok = 0) const;
/**
* Converts a localized numeric string to a double.
*
* @param numStr the string we want to convert.
* @param ok the boolean that is set to false if it's not a number.
* If @p ok is 0, it will be ignored
*
* @return The string converted to a double
*/
double readNumber(const QString &numStr, bool * ok = 0) const;
//KDE5 move to KDateTime namespace
/**
* Converts a localized date string to a QDate. This method will try all
* ReadDateFlag formats in preferred order to read a valid date.
*
* The bool pointed by ok will be invalid if the date entered was not valid.
*
* @param str the string we want to convert.
* @param ok the boolean that is set to false if it's not a valid date.
* If @p ok is 0, it will be ignored
*
* @return The string converted to a QDate
* @see KCalendarSystem::readDate()
*/
QDate readDate(const QString &str, bool* ok = 0) const;
//KDE5 move to KDateTime namespace
/**
* Converts a localized date string to a QDate, using the specified format.
* You will usually not want to use this method.
* @see KCalendarSystem::readDate()
*/
QDate readDate(const QString &intstr, const QString &fmt, bool* ok = 0) const;
//KDE5 move to KDateTime namespace
/**
* Flags for readDate()
*/
enum ReadDateFlags {
NormalFormat = 1, /**< Only accept a date string in
the locale LongDate format */
ShortFormat = 2, /**< Only accept a date string in
the locale ShortDate format */
IsoFormat = 4, /**< Only accept a date string in
ISO date format (YYYY-MM-DD) */
IsoWeekFormat = 8, /**< Only accept a date string in
ISO Week date format (YYYY-Www-D) */
IsoOrdinalFormat = 16 /**< Only accept a date string in
ISO Week date format (YYYY-DDD) */
};
//KDE5 move to KDateTime namespace
/**
* Converts a localized date string to a QDate.
* This method is stricter than readDate(str,&ok): it will only accept
* a date in a specific format, depending on @p flags.
*
* @param str the string we want to convert.
* @param flags what format the the date string will be in
* @param ok the boolean that is set to false if it's not a valid date.
* If @p ok is 0, it will be ignored
*
* @return The string converted to a QDate
* @see KCalendarSystem::readDate()
*/
QDate readDate(const QString &str, ReadDateFlags flags, bool *ok = 0) const;
/**
* Converts a localized time string to a QTime.
* This method will try to parse it with seconds, then without seconds.
* The bool pointed to by @p ok will be set to false if the time entered was
* not valid.
*
* @param str the string we want to convert.
* @param ok the boolean that is set to false if it's not a valid time.
* If @p ok is 0, it will be ignored
*
* @return The string converted to a QTime
*/
QTime readTime(const QString &str, bool* ok = 0) const;
/**
* Flags for the old version of readTime()
*
* @deprecated replaced by TimeFormatOptions
*/
enum ReadTimeFlags {
WithSeconds = 0, ///< Only accept a time string with seconds. Default (no flag set)
WithoutSeconds = 1 ///< Only accept a time string without seconds.
}; // (maybe use this enum as a bitfield, if adding independent features?)
/**
* @deprecated replaced readLocaleTime()
*
* Converts a localized time string to a QTime.
* This method is stricter than readTime(str,&ok): it will either accept
* a time with seconds or a time without seconds.
* Use this method when the format is known by the application.
*
* @param str the string we want to convert.
* @param flags whether the time string is expected to contain seconds or not.
* @param ok the boolean that is set to false if it's not a valid time.
* If @p ok is 0, it will be ignored
*
* @return The string converted to a QTime
*/
QTime readTime(const QString &str, ReadTimeFlags flags, bool *ok = 0) const;
/**
* Additional processing options for readLocaleTime().
*
* @remarks This is currently used as an enum but declared as a flag
* to be extensible
*/
enum TimeProcessingOption {
ProcessStrict = 0x1, ///< Process time in a strict manner, ie.
///< a read time string has to exactly match
///< the defined time format.
ProcessNonStrict = 0x2 ///< Process time in a lax manner, ie.
///< allow spaces in the time-format to be
///< left out when entering a time string.
};
Q_DECLARE_FLAGS(TimeProcessingOptions, TimeProcessingOption)
/**
* @since 4.4
*
* Converts a localized time string to a QTime.
* This method is stricter than readTime(str, &ok) in that it will either
* accept a time with seconds or a time without seconds.
*
* @param str the string we want to convert
* @param ok the boolean that is set to false if it's not a valid time.
* If @p ok is 0, it will be ignored.
* @param options format option to apply when formatting the time
* @param processing if set to @c ProcessStrict, checking will be strict
* and the read time string has to have the exact time format
* specified. If set to @c ProcessNonStrict processing the time
* is lax and spaces in the time string can be left out.
*
* @return The string converted to a QTime
*/
QTime readLocaleTime(const QString &str, bool *ok = 0,
TimeFormatOptions options = KLocale::TimeDefault,
TimeProcessingOptions processing = ProcessNonStrict) const;
/**
* Returns the language code used by this object. The domain AND the
* library translation must be available in this language.
* defaultLanguage() is returned by default, if no other available.
*
* Use languageCodeToName(language) to get human readable, localized
* language name.
*
* @return the currently used language code
*
* @see languageCodeToName
*/
QString language() const;
/**
* Returns the country code of the country where the user lives.
*
* The returned code complies with the ISO 3166-1 alpha-2 standard,
* except by KDE convention it is returned in lowercase whereas the
* official standard is uppercase.
* See http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 for details.
*
* defaultCountry() is returned by default, if no other available,
* this will always be uppercase 'C'.
*
* Use countryCodeToName(country) to get human readable, localized
* country names.
*
* @return the country code for the user
*
* @see countryCodeToName
*/
QString country() const;
/**
* @since 4.6
*
* Returns the Country Division Code of the Country where the user lives.
* When no value is set, then the Country Code will be returned.
*
* The returned code complies with the ISO 3166-2 standard.
* See http://en.wikipedia.org/wiki/ISO_3166-2 for details.
*
* Note that unlike country() this method will return the correct case,
* i.e. normally uppercase..
*
* In KDE 4.6 it is the apps responsibility to obtain a translation for the
* code, translation and other services will be priovided in KDE 4.7.
*
* @return the Country Division Code for the user
* @see setCountryDivisionCode
*/
QString countryDivisionCode() const;
/**
* Returns the language codes selected by user, ordered by decreasing
* priority.
*
* Use languageCodeToName(language) to get human readable, localized
* language name.
*
* @return list of language codes
*
* @see languageCodeToName
*/
QStringList languageList() const;
/**
* @since 4.4
*
* Returns the ISO Currency Codes used in the locale, ordered by decreasing
* priority.
*
* Use KCurrency::currencyCodeToName(currencyCode) to get human readable,
* localized language name.
*
* @return list of ISO Currency Codes
*
* @see currencyCodeToName
*/
QStringList currencyCodeList() const;
/**
* Returns the user's preferred encoding.
*
* @return The name of the preferred encoding
*
* @see codecForEncoding
* @see encodingMib
*/
const QByteArray encoding() const;
/**
* Returns the user's preferred encoding.
*
* @return The Mib of the preferred encoding
*
* @see encoding
* @see codecForEncoding
*/
int encodingMib() const;
/**
* Returns the user's preferred encoding. Should never be NULL.
*
* @return The codec for the preferred encoding
*
* @see encoding
* @see encodingMib
*/
QTextCodec * codecForEncoding() const;
/**
* Returns the file encoding.
*
* @return The Mib of the file encoding
*
* @see QFile::encodeName
* @see QFile::decodeName
*/
int fileEncodingMib() const;
/**
* Changes the current date format.
*
* The format of the date is a string which contains variables that will
* be replaced:
* @li %Y with the whole year (e.g. "2004" for "2004")
* @li %y with the lower 2 digits of the year (e.g. "04" for "2004")
* @li %n with the month (January="1", December="12")
* @li %m with the month with two digits (January="01", December="12")
* @li %e with the day of the month (e.g. "1" on the first of march)
* @li %d with the day of the month with two digits (e.g. "01" on the first of march)
* @li %b with the short form of the month (e.g. "Jan" for January)
* @li %B with the long form of the month (e.g. "January")
* @li %a with the short form of the weekday (e.g. "Wed" for Wednesday)
* @li %A with the long form of the weekday (e.g. "Wednesday" for Wednesday)
*
* Everything else in the format string will be taken as is.
* For example, March 20th 1989 with the format "%y:%m:%d" results
* in "89:03:20".
*
* @param format The new date format
*/
void setDateFormat(const QString & format);
/**
* Changes the current short date format.
*
* The format of the date is a string which contains variables that will
* be replaced:
* @li %Y with the whole year (e.g. "1984" for "1984")
* @li %y with the lower 2 digits of the year (e.g. "84" for "1984")
* @li %n with the month (January="1", December="12")
* @li %m with the month with two digits (January="01", December="12")
* @li %e with the day of the month (e.g. "1" on the first of march)
* @li %d with the day of the month with two digits(e.g. "01" on the first of march)
* @li %b with the short form of the month (e.g. "Jan" for January)
* @li %B with the long form of the month (e.g. "January")
* @li %a with the short form of the weekday (e.g. "Wed" for Wednesday)
* @li %A with the long form of the weekday (e.g. "Wednesday" for Wednesday)
*
* Everything else in the format string will be taken as is.
* For example, March 20th 1989 with the format "%y:%m:%d" results
* in "89:03:20".
*
* @param format The new short date format
*/
void setDateFormatShort(const QString & format);
/**
* Changes the form of month name used in dates.
*
* @param possessive True if possessive forms should be used
*/
void setDateMonthNamePossessive(bool possessive);
/**
* Changes the current time format.
*
* The format of the time is string a which contains variables that will
* be replaced:
* @li %H with the hour in 24h format and 2 digits (e.g. 5pm is "17", 5am is "05")
* @li %k with the hour in 24h format and one digits (e.g. 5pm is "17", 5am is "5")
* @li %I with the hour in 12h format and 2 digits (e.g. 5pm is "05", 5am is "05")
* @li %l with the hour in 12h format and one digits (e.g. 5pm is "5", 5am is "5")
* @li %M with the minute with 2 digits (e.g. the minute of 07:02:09 is "02")
* @li %S with the seconds with 2 digits (e.g. the minute of 07:02:09 is "09")
* @li %p with pm or am (e.g. 17.00 is "pm", 05.00 is "am")
*
* Everything else in the format string will be taken as is.
* For example, 5.23pm with the format "%H:%M" results
* in "17:23".
*
* @param format The new time format
*/
void setTimeFormat(const QString & format);
/**
* @since 4.3
*
* Set digit characters used to display dates and time.
*
* @param digitSet the digit set identifier
* @see DigitSet
*/
void setDateTimeDigitSet(DigitSet digitSet);
/**
* Changes how KLocale defines the first day in week.
*
* @param day first day of the week (Monday=1..Sunday=7) as integer
*/
void setWeekStartDay(int day);
/**
* Changes how KLocale defines the first working day in week.
*
* @since 4.2
* @param day first working day of the week (Monday=1..Sunday=7) as integer
*/
void setWorkingWeekStartDay(int day);
/**
* Changes how KLocale defines the last working day in week.
*
* @since 4.2
* @param day last working day of the week (Monday=1..Sunday=7) as integer
*/
void setWorkingWeekEndDay(int day);
/**
* Changes how KLocale defines the day reserved for religious observance.
*
* @since 4.2
* @param day day of the week for religious observance (None=0,Monday=1..Sunday=7) as integer
*/
void setWeekDayOfPray(int day);
/**
* Returns the currently selected date format.
*
* @return Current date format.
* @see setDateFormat()
*/
QString dateFormat() const;
/**
* Returns the currently selected short date format.
*
* @return Current short date format.
* @see setDateFormatShort()
*/
QString dateFormatShort() const;
/**
* Returns the currently selected time format.
*
* @return Current time format.
* @see setTimeFormat()
*/
QString timeFormat() const;
/**
* Changes the symbol used to identify the decimal pointer.
*
* @param symbol The new decimal symbol.
*/
void setDecimalSymbol(const QString & symbol);
/**
* Changes the separator used to group digits when formating numbers.
*
* @param separator The new thousands separator.
*/
void setThousandsSeparator(const QString & separator);
/**
* Changes the sign used to identify a positive number. Normally this is
* left blank.
*
* @param sign Sign used for positive numbers.
*/
void setPositiveSign(const QString & sign);
/**
* Changes the sign used to identify a negative number.
*
* @param sign Sign used for negative numbers.
*/
void setNegativeSign(const QString & sign);
/**
* @since 4.3
*
* Changes the set of digit characters used to display numbers.
*
* @param digitSet the digit set identifier
* @see DigitSet
*/
void setDigitSet(DigitSet digitSet);
/**
* Changes the sign position used for positive monetary values.
*
* @param signpos The new sign position
*/
void setPositiveMonetarySignPosition(SignPosition signpos);
/**
* Changes the sign position used for negative monetary values.
*
* @param signpos The new sign position
*/
void setNegativeMonetarySignPosition(SignPosition signpos);
/**
* Changes the position where the currency symbol should be printed for
* positive monetary values.
*
* @param prefix True if the currency symbol should be prefixed instead of
* postfixed
*/
void setPositivePrefixCurrencySymbol(bool prefix);
/**
* Changes the position where the currency symbol should be printed for
* negative monetary values.
*
* @param prefix True if the currency symbol should be prefixed instead of
* postfixed
*/
void setNegativePrefixCurrencySymbol(bool prefix);
/**
* @deprecated use setDecimalPlaces() or setMonetaryDecimalPlaces()
*
* Changes the number of digits used when formating numbers.
*
* @param digits The default number of digits to use.
*/
KDE_DEPRECATED void setFracDigits(int digits);
/**
* @since 4.4
*
* Changes the number of decimal places used when formating numbers.
*
* @param digits The default number of digits to use.
*/
void setDecimalPlaces(int digits);
/**
* @since 4.4
*
* Changes the number of decimal places used when formating money.
*
* @param digits The default number of digits to use.
*/
void setMonetaryDecimalPlaces(int digits);
/**
* Changes the separator used to group digits when formating monetary values.
*
* @param separator The new thousands separator.
*/
void setMonetaryThousandsSeparator(const QString & separator);
/**
* Changes the symbol used to identify the decimal pointer for monetary
* values.
*
* @param symbol The new decimal symbol.
*/
void setMonetaryDecimalSymbol(const QString & symbol);
/**
* @since 4.4
*
* Changes the current ISO Currency Code.
*
* @param newCurrencyCode The new Currency Code
*/
void setCurrencyCode(const QString &newCurrencyCode);
/**
* Changes the current currency symbol.
*
* This symbol should be consistant with the selected Currency Code
*
* @param symbol The new currency symbol
* @see currencyCode, KCurrency::currencySymbols
*/
void setCurrencySymbol(const QString & symbol);
/**
* @since 4.3
*
* Set digit characters used to display monetary values.
*
* @param digitSet the digit set identifier
* @see DigitSet
*/
void setMonetaryDigitSet(DigitSet digitSet);
/**
* Returns the preferred page size for printing.
*
* @return The preferred page size, cast it to QPrinter::PageSize
*/
int pageSize() const;
/**
* Changes the preferred page size when printing.
*
* @param paperFormat the new preferred page size in the format QPrinter::PageSize
*/
void setPageSize(int paperFormat);
/**
* The Metric system will give you information in mm, while the
* Imperial system will give you information in inches.
*/
enum MeasureSystem {
Metric, ///< Metric system (used e.g. in Europe)
Imperial ///< Imperial system (used e.g. in the United States)
};
/**
* Returns which measuring system we use.
*
* @return The preferred measuring system
*/
MeasureSystem measureSystem() const;
/**
* Changes the preferred measuring system.
*
* @return value The preferred measuring system
*/
void setMeasureSystem(MeasureSystem value);
/**
* Adds another catalog to search for translation lookup.
* This function is useful for extern libraries and/or code,
* that provide their own messages.
*
* If the catalog does not exist for the chosen language,
* it will be ignored and en_US will be used.
*
* @param catalog The catalog to add.
*/
void insertCatalog(const QString& catalog);
/**
* Removes a catalog for translation lookup.
* @param catalog The catalog to remove.
* @see insertCatalog()
*/
void removeCatalog(const QString &catalog);
/**
* Sets the active catalog for translation lookup.
* @param catalog The catalog to activate.
*/
void setActiveCatalog(const QString &catalog);
/**
* Translates a message as a QTranslator is supposed to.
* The parameters are similar to i18n(), but the result
* value has other semantics (it can be QString())
*/
QString translateQt(const char *context, const char *sourceText, const char *comment) const;
/**
* Provides list of all known language codes.
*
* Use languageCodeToName(language) to get human readable, localized
* language names.
*
* @return list of all language codes
*
* @see languageCodeToName
* @see installedLanguages
*/
QStringList allLanguagesList() const;
/**
* @since 4.6
*
* Provides list of all installed KDE Language Translations.
*
* Use languageCodeToName(language) to get human readable, localized
* language names.
*
* @return list of all installed language codes
*
* @see languageCodeToName
*/
QStringList installedLanguages() const;
/**
* Convert a known language code to a human readable, localized form.
* If an unknown language code is supplied, empty string is returned;
* this will never happen if the code has been obtained by one of the
* KLocale methods.
*
* @param language the language code
*
* @return the human readable and localized form if the code is known,
* empty otherwise
*
* @see language
* @see languageList
* @see allLanguagesList
* @see installedLanguages
*/
QString languageCodeToName(const QString &language) const;
/**
* Provides list of all known country codes.
*
* Use countryCodeToName(country) to get human readable, localized
* country names.
*
* @return a list of all country codes
*
* @see countryCodeToName
*/
QStringList allCountriesList() const;
/**
* Convert a known country code to a human readable, localized form.
*
* If an unknown country code is supplied, empty string is returned;
* this will never happen if the code has been obtained by one of the
* KLocale methods.
*
* @param country the country code
*
* @return the human readable and localized form of the country name
*
* @see country
* @see allCountriesList
*/
QString countryCodeToName(const QString &country) const;
/**
* Parses locale string into distinct parts.
* The format of locale is language_COUNTRY@modifier.CHARSET
*
* @param locale the locale string to split
* @param language set to the language part of the locale
* @param country set to the country part of the locale
* @param modifier set to the modifer part of the locale
* @param charset set to the charset part of the locale
*/
static void splitLocale(const QString &locale, QString &language, QString &country,
QString &modifier, QString &charset);
/**
* Use this as main catalog for *all* KLocales, if not the appname
* will be used. This function is best to be the very first instruction
* in your program's main function as it only has an effect before the
* first KLocale object is created.
*
* @param catalog Catalog to override all other main Catalogs.
*/
static void setMainCatalog(const char *catalog);
/**
* @deprecated
*
* Finds localized resource in resourceDir( rtype ) + \<lang> + fname.
*
* Since KDE 4.1, this service is provided in a slightly different form,
* automatically by e.g. KStandardDirs::locate() and other KDE core classes
* dealing with paths. For manual use, it is replaced by localizedFilePath().
*
* @param fname relative path to find
* @param rtype resource type to use
*
* @return path to localized resource
*
* @see localizedFilePath
*/
static QString langLookup(const QString &fname, const char *rtype = "html");
/**
* Returns the name of the internal language.
*
* @return Name of the default language
*/
static QString defaultLanguage();
/**
* Returns the code of the default country, i.e. "C"
*
* This function will not provide a sensible value to use in your app,
* please use country() instead.
*
* @see country
*
* @return Name of the default country
*/
static QString defaultCountry();
/**
* @since 4.4
*
* Returns the ISO Code of the default currency.
*
* @return ISO Currency Code of the default currency
*/
static QString defaultCurrencyCode();
/**
* Reports whether evaluation of translation scripts is enabled.
*
* @return true if script evaluation is enabled, false otherwise.
*/
bool useTranscript() const;
/**
* Checks whether or not the active catalog is found for the given language.
*
* @param language language to check
*/
bool isApplicationTranslatedInto(const QString & language);
/**
* Copies the catalogs of this object to an other KLocale object.
*
* @param locale the destination KLocale object
*/
void copyCatalogsTo(KLocale *locale);
/**
* Changes the current country. The current country will be left
* unchanged if failed. It will force a reload of the country specific
* configuration.
*
* An empty country value will set the country to the system default.
*
* If you specify a configuration file, a setLocale() will be performed on
* the config using the current locale language, which may cause a sync()
* and reparseConfiguration() which will save any changes you have made.
*
* @param country the ISO 3166 country code
* @param config a configuration file with a Locale group detailing
* locale-related preferences (such as language and
* formatting options).
*
* @return @c true on success, @c false on failure
*/
bool setCountry(const QString & country, KConfig *config);
/**
* @since 4.6
*
* Sets the Country Division Code of the Country where the user lives.
*
* The code must comply with the ISO 3166-2 standard.
* See http://en.wikipedia.org/wiki/ISO_3166-2 for details.
*
* In KDE 4.6 it is the apps responsibility to validate the input,
* full validation and other services will be provided in KDE 4.7.
*
* @param countryDivision the Country Division Code for the user
* @return @c true on success, @c false on failure
* @see countryDivisionCode
*/
bool setCountryDivisionCode(const QString & countryDivision);
/**
* Changes the current language. The current language will be left
* unchanged if failed. It will force a reload of the country specific
* configuration as well.
*
* If you specify a configuration file, a setLocale() will be performed on
* the config using the current locale language, which may cause a sync()
* and reparseConfiguration() which will save any changes you have made.
*
* @param language the language code
* @param config a configuration file with a Locale group detailing
* locale-related preferences (such as language and
* formatting options).
*
* @return true on success
*/
bool setLanguage(const QString &language, KConfig *config);
/**
* Changes the list of preferred languages for the locale. The first valid
* language in the list will be used, or the default language (en_US)
* if none of the specified languages were available.
*
* @param languages the list of language codes
*
* @return true if one of the specified languages were used
*/
bool setLanguage(const QStringList &languages);
/**
* @since 4.1
*
* Tries to find a path to the localized file for the given original path.
* This is intended mainly for non-text resources (images, sounds, etc.),
* whereas text resources should be handled in more specific ways.
*
* The possible localized paths are checked in turn by priority of set
* languages, in form of dirname/l10n/ll/basename, where dirname and
* basename are those of the original path, and ll is the language code.
*
* KDE core classes which resolve paths internally (e.g. KStandardDirs)
* will usually perform this lookup behind the scene.
* In general, you should pipe resource paths through this method only
* on explicit translators' request, or when a resource is an obvious
* candidate for localization (e.g. a splash screen or a custom icon
* with some text drawn on it).
*
* @param filePath path to the original file
*
* @return path to the localized file if found, original path otherwise
*/
QString localizedFilePath(const QString &filePath) const;
/**
* @since 4.2
*
* Removes accelerator marker from a UI text label.
*
* Accelerator marker is not always a plain ampersand (&),
* so it is not enough to just remove it by @c QString::remove().
* The label may contain escaped markers ("&&") which must be resolved
* and skipped, as well as CJK-style markers ("Foo (&F)") where
* the whole parenthesis construct should be removed.
* Therefore always use this function to remove accelerator marker
* from UI labels.
*
* @param label UI label which may contain an accelerator marker
* @return label without the accelerator marker
*/
QString removeAcceleratorMarker(const QString &label) const;
/**
* @since 4.3
*
* Convert all digits in the string to the given digit set.
*
* Conversion is normally not performed if the given digit set
* is not appropriate in the current locale and language context.
* Unconditional conversion may be requested by setting
* @p ignoreContext to @c true.
*
* @param str the string to convert
* @param digitSet the digit set identifier
* @param ignoreContext unconditional conversion if @c true
*
* @return string with converted digits
*
* @see DigitSet
*/
QString convertDigits(const QString &str, DigitSet digitSet,
bool ignoreContext = false) const;
+ /**
+ * @since 4.8
+ *
+ * Reparse locale configuration files for the current selected
+ * language.
+ */
+ void reparseConfiguration();
+
private:
friend class KLocalePrivate;
friend class KLocaleTest;
friend class KDateTimeFormatter;
KLocalePrivate * const d;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(KLocale::DateTimeFormatOptions)
Q_DECLARE_OPERATORS_FOR_FLAGS(KLocale::DateTimeComponents)
Q_DECLARE_OPERATORS_FOR_FLAGS(KLocale::TimeFormatOptions)
Q_DECLARE_OPERATORS_FOR_FLAGS(KLocale::TimeProcessingOptions)
#endif
diff --git a/kdecore/localization/klocale_p.h b/kdecore/localization/klocale_p.h
index 4ed8e3f4fb..af4a768904 100644
--- a/kdecore/localization/klocale_p.h
+++ b/kdecore/localization/klocale_p.h
@@ -1,1230 +1,1230 @@
/* This file is part of the KDE libraries
* Copyright 2009 David Faure <faure@kde.org>
* Copyright 2010 John Layt <john@layt.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KLOCALE_P_H
#define KLOCALE_P_H
#include "klocale.h"
class QMutex;
class KCatalog;
class KDayPeriod;
// Used by both KLocale and KLocalizedString, since they call each other.
QMutex* kLocaleMutex();
class KLocalePrivate
{
public:
/**
* Constructors
*
* This class should not be instantited directly, it is intended as a base class for each
* platform to provide a common KDE fallback implementation. Instead use the relevant
* derived system class for Unix, Win, or Mac which will prefer the local platform settings
* where possible.
*/
KLocalePrivate(KLocale *q_ptr);
/**
* Copy constructor
*/
KLocalePrivate(const KLocalePrivate &rhs);
/**
* Assignment operator
*/
KLocalePrivate &operator=(const KLocalePrivate &rhs);
/**
* Destructor
*/
virtual ~KLocalePrivate();
/**************************
** Initialization **
**************************/
+ /**
+ * Reads the format configuration from disk.
+ */
+ virtual void initFormat();
+
protected:
/**
* @internal Returns config object
*/
KConfig *config();
/**
* @internal Copies object members
*/
virtual void copy(const KLocalePrivate &rhs);
- /**
- * @internal Reads the format configuration from disk.
- */
- virtual void initFormat();
-
/**
* @internal Main init function, needs to be called by appropriate child constructor.
*/
virtual void init(const QString& catalogName, const QString &language, const QString &country,
KSharedConfig::Ptr persistantconfig, KConfig *tempConfig);
/**
* @internal Init config.
*/
virtual void initConfig(KConfig *config);
/**************************
** Country settings **
**************************/
protected:
/**
* @internal Initializes the country if not already explicitly set when calling the constructor
* Will default to any value set in the config, otherwise will attempt to use the host system
* country, or finally fall back to the default C.
*/
virtual void initCountry(const QString &country, const QString &configCountry);
/**
* @internal Returns the host system country ISO code
* If country could not be determined then may return an empty string or "C"
*/
virtual QString systemCountry() const;
public:
/**
* @internal Sets the Locale Country
* The worker of the same-name KLocale API function.
*/
virtual bool setCountry(const QString &country, KConfig *config);
/**
* @internal Returns the Locale ISO Country Code
* The worker of the same-name KLocale API function.
*/
virtual QString country() const;
/**
* @internal Returns the name of the default country.
* The worker of the same-name KLocale API function.
*/
static QString defaultCountry();
/**
* @internal Returns a list of all known country codes.
* The worker of the same-name KLocale API function.
*/
virtual QStringList allCountriesList() const;
/**
* @internal Convert a known country code to a human readable, localized form.
* The worker of the same-name KLocale API function.
*/
virtual QString countryCodeToName(const QString &country) const;
/**
* @internal Sets the Country Division Code
* The worker of the same-name KLocale API function.
*/
bool setCountryDivisionCode(const QString & countryDivision);
/**
* @internal Returns the Country Division Code
* The worker of the same-name KLocale API function.
*/
QString countryDivisionCode() const;
/**************************
** Language settings **
**************************/
protected:
/**
* @internal Converts a language variable in a list of languages
*/
static void getLanguagesFromVariable(QStringList &list, const char *variable, bool isLanguageList = false);
/**
* @internal Returns the list of host system languages
*/
virtual QStringList systemLanguageList() const;
/**
* @internal Initializes the list of valid languages from the user's point of view. This is the
* list of languages that the user picks in kcontrol. The config object should be valid and
* contain the global entries.
*
* @param language The defualt language to use
* @param configLanguages The "Language" setting from the current config
* @param useEnv Whether to use the envvars
*/
virtual void initLanguageList(const QString &language, const QString &configLanguages, bool useEnv);
/**
* @internal function used to determine if we are using the en_US translation
*/
virtual bool useDefaultLanguage() const;
public:
/**
* @internal Sets the Locale Language
* The worker of the same-name KLocale API function.
*/
virtual bool setLanguage(const QString &language, KConfig *config);
/**
* @internal Sets the list of preferred languages for the locale.
* The worker of the same-name KLocale API function.
*/
virtual bool setLanguage(const QStringList &languages);
/**
* @internal Returns the Locale Language
* The worker of the same-name KLocale API function.
*/
virtual QString language() const;
/**
* @internal Returns the language codes selected by user
* The worker of the same-name KLocale API function.
*/
virtual QStringList languageList() const;
/**
* @internal Returns a list of all known language codes.
* The worker of the same-name KLocale API function.
*/
virtual QStringList allLanguagesList();
/**
* @internal Returns a list of all installed KDE languages.
* The worker of the same-name KLocale API function.
*/
virtual QStringList installedLanguages();
/**
* @internal Returns the name of the internal language.
* The worker of the same-name KLocale API function.
*/
static QString defaultLanguage();
/**
* @internal Convert a known language code to a human readable, localized form.
* The worker of the same-name KLocale API function.
*/
virtual QString languageCodeToName(const QString &language);
/**
* @deprecated
* @internal Returns if nouns are declined in the locale language.
* The worker of the same-name KLocale API function.
*/
virtual bool nounDeclension() const;
/**
* @deprecated
* @internal Finds localized resource in resourceDir( rtype ) + \<lang> + fname.
* The worker of the same-name KLocale API function.
*/
static QString langLookup(const QString &fname, const char *rtype = "html");
/**
* @internal Returns whether evaluation of translation scripts is enabled.
* The worker of the same-name KLocale API function.
*/
virtual bool useTranscript() const;
/**************************
** Catalog settings **
**************************/
protected:
/**
* @internal Initializes the catalogs appname, kdelibs and kio for all chosen languages.
*/
virtual void initMainCatalogs();
/**
* @internal evaluate the list of catalogs and check that all instances for all languages are
* loaded and that they are sorted according to the catalog names
*
* Callers must lock the mutex first.
*/
virtual void updateCatalogs();
public:
/**
* @internal Set the main catalog for *all* KLocales
* The worker of the same-name KLocale API function.
*/
static void setMainCatalog(const char *catalog);
/**
* Sets the active catalog for translation lookup.
* @param catalog The catalog to activate.
*/
virtual void setActiveCatalog(const QString &catalog);
/**
* @internal Adds another catalog to search for translation lookup.
* The worker of the same-name KLocale API function.
*/
virtual void insertCatalog(const QString &catalog);
/**
* @internal Removes a catalog for translation lookup.
* The worker of the same-name KLocale API function.
*/
virtual void removeCatalog(const QString &catalog);
/**
* @internal Copies the catalogs of this object to an other KLocale object.
* The worker of the same-name KLocale API function.
*/
virtual void copyCatalogsTo(KLocale *locale);
/**
* @internal Function used by the translate versions
* The worker of the same-name KLocale API function.
*/
virtual void translateRawFrom(const char *catname, const char *msgctxt, const char *msgid, const char *msgid_plural = 0,
unsigned long n = 0, QString *language = 0, QString *translation = 0) const;
/**
* @internal Translates a message as a QTranslator is supposed to.
* The worker of the same-name KLocale API function.
*/
virtual QString translateQt(const char *context, const char *sourceText, const char *comment) const;
/**
* @internal Checks whether or not the active catalog is found for the given language.
* The worker of the same-name KLocale API function.
*/
virtual bool isApplicationTranslatedInto(const QString &language);
/***************************
** Calendar settings **
***************************/
protected:
/**
* @internal Converts a CalendarType into a CalendarSystem
*/
virtual KLocale::CalendarSystem calendarTypeToCalendarSystem(const QString &calendarType) const;
/**
* @internal Converts a CalendarSystem into a CalendarType
*/
virtual QString calendarSystemToCalendarType(KLocale::CalendarSystem) const;
public:
/**
* @internal Sets the current calendar system to the calendar specified.
* The worker of the same-name KLocale API function.
*/
virtual void setCalendar(const QString &calendarType);
/**
* @internal Sets the current calendar system to the calendar specified.
* The worker of the same-name KLocale API function.
*/
virtual void setCalendarSystem(KLocale::CalendarSystem);
/**
* @internal Returns the name of the calendar system that is currently being used by the system.
* The worker of the same-name KLocale API function.
*/
virtual QString calendarType() const;
/**
* @internal Returns the type of the calendar system that is currently being used by the system.
* The worker of the same-name KLocale API function.
*/
KLocale::CalendarSystem calendarSystem() const;
/**
* @internal Returns a pointer to the calendar system object.
* The worker of the same-name KLocale API function.
*/
virtual const KCalendarSystem *calendar();
/**
* @internal Sets the Week Number System to use
* The worker of the same-name KLocale API function.
*/
void setWeekNumberSystem(KLocale::WeekNumberSystem weekNumberSystem);
/**
* @internal Returns the Week Number System used
* The worker of the same-name KLocale API function.
*/
KLocale::WeekNumberSystem weekNumberSystem();
/**
* @internal Changes how KLocale defines the first day in week.
* The worker of the same-name KLocale API function.
*/
virtual void setWeekStartDay(int day);
/**
* @internal Returns which day is the first day of the week.
* The worker of the same-name KLocale API function.
*/
virtual int weekStartDay() const;
/**
* @internal Changes how KLocale defines the first working day in week.
* The worker of the same-name KLocale API function.
*/
virtual void setWorkingWeekStartDay(int day);
/**
* @internal Returns which day is the first working day of the week.
* The worker of the same-name KLocale API function.
*/
virtual int workingWeekStartDay() const;
/**
* @internal Changes how KLocale defines the last working day in week.
* The worker of the same-name KLocale API function.
*/
virtual void setWorkingWeekEndDay(int day);
/**
* @internal Returns which day is the last working day of the week.
* The worker of the same-name KLocale API function.
*/
virtual int workingWeekEndDay() const;
/**
* @internal Changes how KLocale defines the day reserved for religious observance.
* The worker of the same-name KLocale API function.
*/
virtual void setWeekDayOfPray(int day);
/**
* @internal Returns which day is reserved for religious observance
* The worker of the same-name KLocale API function.
*/
virtual int weekDayOfPray() const;
/***************************
** Date/Time settings **
***************************/
protected:
/**
* @internal initialises the Day Periods
*/
virtual void initDayPeriods(const KConfigGroup &cg);
public:
/**
* @internal Sets the current date format.
* The worker of the same-name KLocale API function.
*/
virtual void setDateFormat(const QString &format);
/**
* @internal Returns the currently selected date format.
* The worker of the same-name KLocale API function.
*/
virtual QString dateFormat() const;
/**
* @internal Sets the current short date format.
* The worker of the same-name KLocale API function.
*/
virtual void setDateFormatShort(const QString &format);
/**
* @internal Returns the currently selected short date format.
* The worker of the same-name KLocale API function.
*/
virtual QString dateFormatShort() const;
/**
* @internal Changes the current time format.
* The worker of the same-name KLocale API function.
*/
virtual void setTimeFormat(const QString &format);
/**
* @internal Returns the currently selected time format.
* The worker of the same-name KLocale API function.
*/
virtual QString timeFormat() const;
/**
* @internal Set digit characters used to display dates and time.
* The worker of the same-name KLocale API function.
*/
virtual void setDateTimeDigitSet(KLocale::DigitSet digitSet);
/**
* @internal Returns the identifier of the digit set used to display dates and time.
* The worker of the same-name KLocale API function.
*/
virtual KLocale::DigitSet dateTimeDigitSet() const;
/**
* @internal Sets of the possessive form of month name should be used in dates.
* The worker of the same-name KLocale API function.
*/
virtual void setDateMonthNamePossessive(bool possessive);
/**
* @internal Returns if possessive form of month name should be used
* The worker of the same-name KLocale API function.
*/
virtual bool dateMonthNamePossessive() const;
/**
* @internal Returns if the user wants 12h clock
* The worker of the same-name KLocale API function.
*/
virtual bool use12Clock() const;
/**
* @internal
* The worker of the same-name KLocale API function.
*/
virtual void setDayPeriods(const QList<KDayPeriod> &dayPeriods);
/**
* @internal
* The worker of the same-name KLocale API function.
*/
virtual QList<KDayPeriod> dayPeriods() const;
/**
* @internal
* The worker of the same-name KLocale API function.
*/
virtual KDayPeriod dayPeriodForTime(const QTime &time) const;
/**
* @internal Returns a string formatted to the current locale's conventions
* The worker of the same-name KLocale API function.
*/
virtual QString formatDate(const QDate &date, KLocale::DateFormat format = KLocale::LongDate);
/**
* @internal Converts a localized date string to a QDate.
* The worker of the same-name KLocale API function.
*/
virtual QDate readDate(const QString &str, bool *ok = 0);
/**
* @internal Converts a localized date string to a QDate, using the specified format.
* The worker of the same-name KLocale API function.
*/
virtual QDate readDate(const QString &intstr, const QString &fmt, bool *ok = 0);
/**
* @internal Converts a localized date string to a QDate.
* The worker of the same-name KLocale API function.
*/
virtual QDate readDate(const QString &str, KLocale::ReadDateFlags flags, bool *ok = 0);
/**
* @deprecated replaced by formatLocaleTime()
* @internal Returns a string formatted to the current locale's conventions regarding times.
* The worker of the same-name KLocale API function.
*/
virtual QString formatTime(const QTime &pTime, bool includeSecs = false, bool isDuration = false) const;
/**
* @internal Returns a string formatted to the current locale's conventions regarding times.
* The worker of the same-name KLocale API function.
*/
virtual QString formatLocaleTime(const QTime &pTime, KLocale::TimeFormatOptions options = KLocale::TimeDefault) const;
/**
* @internal Converts a localized time string to a QTime.
* The worker of the same-name KLocale API function.
*/
virtual QTime readTime(const QString &str, bool *ok = 0) const;
/**
* @deprecated replaced by readLocaleTime()
* @internal Converts a localized time string to a QTime.
* The worker of the same-name KLocale API function.
*/
virtual QTime readTime(const QString &str, KLocale::ReadTimeFlags flags, bool *ok = 0) const;
/**
* @internal Converts a localized time string to a QTime.
* The worker of the same-name KLocale API function.
*/
virtual QTime readLocaleTime(const QString &str, bool *ok = 0,
KLocale::TimeFormatOptions options = KLocale::TimeDefault,
KLocale::TimeProcessingOptions processing = KLocale::ProcessNonStrict) const;
/**
* @internal Formats a date/time according to specified format.
* The worker of the same-name KLocale API function.
*/
static QString formatDateTime(const KLocale *locale, const QDateTime &dateTime, KLocale::DateFormat,
bool includeSeconds, int daysToNow, int secsToNow);
/**
* @internal Return the date and time as a string
* The worker of the same-name KLocale API function.
*/
virtual QString formatDateTime(const QDateTime &dateTime, KLocale::DateFormat format = KLocale::ShortDate,
bool includeSecs = false) const;
/**
* @internal Return the date and time as a string
* The worker of the same-name KLocale API function.
*/
virtual QString formatDateTime(const KDateTime &dateTime, KLocale::DateFormat format = KLocale::ShortDate,
KLocale::DateTimeFormatOptions options = 0);
/**
* @internal Returns converted duration as a string
* The worker of the same-name KLocale API function.
*/
virtual QString formatDuration(unsigned long mSec) const;
/**
* @internal Returns converted duration as a string.
* The worker of the same-name KLocale API function.
*/
virtual QString prettyFormatDuration(unsigned long mSec) const;
/***************************
** Digit Set settings **
***************************/
protected:
/**
* @internal Converts a number string in any digit set into Arabic digits
*/
static QString toArabicDigits(const QString &str);
/**
* @internal Returns the digits for a digit set as a string, e.g. "0123456789"
*/
static QString digitSetString(KLocale::DigitSet digitSet);
public:
/**
* @internal Provides list of all known digit set identifiers.
* The worker of the same-name KLocale API function.
*/
virtual QList<KLocale::DigitSet> allDigitSetsList() const;
/**
* @internal Convert a digit set identifier to a human readable, localized name.
* The worker of the same-name KLocale API function.
*/
virtual QString digitSetToName(KLocale::DigitSet digitSet, bool withDigits = false) const;
/**
* @internal Convert all digits in the string to the given digit set.
* The worker of the same-name KLocale API function.
*/
virtual QString convertDigits(const QString &str, KLocale::DigitSet digitSet, bool ignoreContext = false) const;
/***************************
** Number settings **
***************************/
public:
/**
* @internal Sets the number of decimal places used when formating numbers.
* The worker of the same-name KLocale API function.
*/
virtual void setDecimalPlaces(int digits);
/**
* @internal Returns the number of numeric decimal places used by locale.
* The worker of the same-name KLocale API function.
*/
virtual int decimalPlaces() const;
/**
* @internal Sets the symbol used to identify the decimal pointer.
* The worker of the same-name KLocale API function.
*/
virtual void setDecimalSymbol(const QString &symbol);
/**
* @internal Returns the decimal symbol used by locale.
* The worker of the same-name KLocale API function.
*/
virtual QString decimalSymbol() const;
/**
* @internal Sets the separator used to group digits when formating numbers.
* The worker of the same-name KLocale API function.
* KDE5 Rename to setNumericDigitGroupSeparator()
*/
virtual void setThousandsSeparator(const QString &separator);
/**
* @internal Returns the digit group separator used by locale.
* The worker of the same-name KLocale API function.
* KDE5 Rename to numericDigitGroupSeparator()
*/
virtual QString thousandsSeparator() const;
/**
* @internal Sets the digit grouping to apply to numbers
* For now internal only api designed for processing efficiency, if needed publicly then may
* need to review if this is the best way.
*/
virtual void setNumericDigitGrouping(QList<int> groupList);
/**
* @internal Returns the digit grouping to apply to numbers
* For now internal only api designed for processing efficiency, if needed publicly then may
* need to review if this is the best way.
*/
virtual QList<int> numericDigitGrouping() const;
/**
* @internal Sets the sign used to identify a positive number.
* The worker of the same-name KLocale API function.
*/
virtual void setPositiveSign(const QString &sign);
/**
* @internal Returns the positive sign used by locale.
* The worker of the same-name KLocale API function.
*/
virtual QString positiveSign() const;
/**
* @internal Sets the sign used to identify a negative number.
* The worker of the same-name KLocale API function.
*/
virtual void setNegativeSign(const QString &sign);
/**
* @internal Returns the negative sign used by locale.
* The worker of the same-name KLocale API function.
*/
virtual QString negativeSign() const;
/**
* @internal Sets the set of digit characters used to display numbers.
* The worker of the same-name KLocale API function.
*/
virtual void setDigitSet(KLocale::DigitSet digitSet);
/**
* @internal Returns the identifier of the digit set used to display numbers.
* The worker of the same-name KLocale API function.
*/
virtual KLocale::DigitSet digitSet() const;
/**
* @internal Returns a number as a localized string
* The worker of the same-name KLocale API function.
*/
virtual QString formatNumber(double num, int precision = -1) const;
/**
* @internal Returns a number as a localized string
* The worker of the same-name KLocale API function.
*/
virtual QString formatNumber(const QString &numStr, bool round = true, int precision = -1) const;
/**
* @internal Returns a number as a localized string
* The worker of the same-name KLocale API function.
*/
virtual QString formatLong(long num) const;
/**
* @internal Converts a localized numeric string to a double.
* The worker of the same-name KLocale API function.
*/
virtual double readNumber(const QString &numStr, bool *ok = 0) const;
/**************************
** Currency settings **
**************************/
protected:
/**
* @internal Initialises the Currency
*/
virtual void initCurrency();
public:
/**
* @internal Sets the Locale Currency Code
* The worker of the same-name KLocale API function.
*/
virtual void setCurrencyCode(const QString &newCurrencyCode);
/**
* @internal Returns the Locale ISO Currency Code
* The worker of the same-name KLocale API function.
*/
virtual QString currencyCode() const;
/**
* @internal Returns the Locale Currency object
* The worker of the same-name KLocale API function.
*/
virtual KCurrencyCode *currency();
/**
* @internal Returns the ISO Code of the default currency.
* The worker of the same-name KLocale API function.
*/
static QString defaultCurrencyCode();
/**
* @internal Returns the ISO Currency Codes used in the locale
* The worker of the same-name KLocale API function.
*/
virtual QStringList currencyCodeList() const;
/***************************
** Money settings **
***************************/
public:
/**
* @internal Sets the current currency symbol.
* The worker of the same-name KLocale API function.
*/
virtual void setCurrencySymbol(const QString &symbol);
/**
* @internal Returns the default currency symbol used by locale.
* The worker of the same-name KLocale API function.
*/
virtual QString currencySymbol() const;
/**
* @internal Sets the symbol used to identify the decimal pointer for monetary values.
* The worker of the same-name KLocale API function.
*/
virtual void setMonetaryDecimalSymbol(const QString &symbol);
/**
* @internal Returns the monetary decimal symbol used by locale.
* The worker of the same-name KLocale API function.
*/
virtual QString monetaryDecimalSymbol() const;
/**
* @internal Sets the separator used to group digits when formating monetary values.
* The worker of the same-name KLocale API function.
* KDE5 Rename to setMonetaryDigitGroupSeparator()
*/
virtual void setMonetaryThousandsSeparator(const QString &separator);
/**
* @internal Returns the monetary thousands separator used by locale.
* The worker of the same-name KLocale API function.
* KDE5 Rename to monetaryDigitGroupSeparator()
*/
virtual QString monetaryThousandsSeparator() const;
/**
* @internal Sets the digit grouping to apply to numbers
* For now internal only api designed for processing efficiency, if needed publicly then may
* need to review if this is the best way.
*/
virtual void setMonetaryDigitGrouping(QList<int> groupList);
/**
* @internal Returns the digit grouping to apply to numbers
* For now internal only api designed for processing efficiency, if needed publicly then may
* need to review if this is the best way.
*/
virtual QList<int> monetaryDigitGrouping() const;
/**
* @internal Sets the number of decimal places used when formating money.
* The worker of the same-name KLocale API function.
*/
virtual void setMonetaryDecimalPlaces(int digits);
/**
* @internal Returns the number of monetary decimal places used by locale.
* The worker of the same-name KLocale API function.
*/
virtual int monetaryDecimalPlaces() const;
/**
* @internal Sets the position where the currency symbol should be printed for
* positive monetary values.
* The worker of the same-name KLocale API function.
*/
virtual void setPositivePrefixCurrencySymbol(bool prefix);
/**
* @internal Returns where to print the currency symbol for positive numbers.
* The worker of the same-name KLocale API function.
*/
virtual bool positivePrefixCurrencySymbol() const;
/**
* @internal Sets the position where the currency symbol should be printed for
* negative monetary values.
* The worker of the same-name KLocale API function.
*/
virtual void setNegativePrefixCurrencySymbol(bool prefix);
/**
* @internal Returns if the currency symbol precedes negative numbers.
* The worker of the same-name KLocale API function.
*/
virtual bool negativePrefixCurrencySymbol() const;
/**
* @internal Sets the sign position used for positive monetary values.
* The worker of the same-name KLocale API function.
*/
virtual void setPositiveMonetarySignPosition(KLocale::SignPosition signpos);
/**
* @internal Returns where/how to print the positive sign.
* The worker of the same-name KLocale API function.
*/
virtual KLocale::SignPosition positiveMonetarySignPosition() const;
/**
* @internal Sets the sign position used for negative monetary values.
* The worker of the same-name KLocale API function.
*/
virtual void setNegativeMonetarySignPosition(KLocale::SignPosition signpos);
/**
* @internal Returns where/how to print the negative sign.
* The worker of the same-name KLocale API function.
*/
virtual KLocale::SignPosition negativeMonetarySignPosition() const;
/**
* @internal Set digit characters used to display monetary values.
* The worker of the same-name KLocale API function.
*/
virtual void setMonetaryDigitSet(KLocale::DigitSet digitSet);
/**
* @internal Retuns the digit set used to display monetary values.
* The worker of the same-name KLocale API function.
*/
virtual KLocale::DigitSet monetaryDigitSet() const;
/**
* @internal Returns an amount of money as a localized string
* The worker of the same-name KLocale API function.
*/
virtual QString formatMoney(double num, const QString &currency = QString(), int precision = -1) const;
/**
* @internal Converts a localized monetary string to a double.
* The worker of the same-name KLocale API function.
*/
virtual double readMoney(const QString &numStr, bool *ok = 0) const;
/***************************
** Units settings **
***************************/
protected:
/**
* @internal
* @return list of translated binary unit for @p dialect.
*/
QList<QString> dialectUnitsList(KLocale::BinaryUnitDialect dialect);
enum DurationType {
DaysDurationType = 0,
HoursDurationType,
MinutesDurationType,
SecondsDurationType
};
/**
* @internal Formats a duration according to the given type and number
*/
static QString formatSingleDuration(KLocalePrivate::DurationType durationType, int n);
public:
/**
* @internal Returns the user's default binary unit dialect.
* The worker of the same-name KLocale API function.
*/
virtual KLocale::BinaryUnitDialect binaryUnitDialect() const;
/**
* @internal Sets the default dialect for this locale
* The worker of the same-name KLocale API function.
*/
virtual void setBinaryUnitDialect(KLocale::BinaryUnitDialect newDialect);
/**
* @internal Returns converted size as a string
* The worker of the same-name KLocale API function.
*/
virtual QString formatByteSize(double size);
/**
* @internal Returns converted size as a translated string including the units.
* The worker of the same-name KLocale API function.
*/
virtual QString formatByteSize(double size, int precision,
KLocale::BinaryUnitDialect dialect = KLocale::DefaultBinaryDialect,
KLocale:: BinarySizeUnits specificUnit = KLocale::DefaultBinaryUnits);
/**
* @internal Sets the preferred page size when printing.
* The worker of the same-name KLocale API function.
*/
virtual void setPageSize(int paperFormat);
/**
* @internal Returns the preferred page size for printing.
* The worker of the same-name KLocale API function.
*/
virtual int pageSize() const;
/**
* @internal Sets the preferred measuring system.
* The worker of the same-name KLocale API function.
*/
virtual void setMeasureSystem(KLocale::MeasureSystem value);
/**
* @internal Returns which measuring system we use.
* The worker of the same-name KLocale API function.
*/
virtual KLocale::MeasureSystem measureSystem() const;
/***************************
** Encoding settings **
***************************/
protected:
/**
* @internal Figures out which encoding the user prefers.
*/
virtual void initEncoding();
/**
* @internal Figures out which encoding the user prefers for filenames
* and sets up the appropriate QFile encoding and decoding functions.
*/
virtual void initFileNameEncoding();
/**
* @internal Returns the system codeset.
*/
virtual QByteArray systemCodeset() const;
/**
* @internal A QFile filename encoding function (QFile::encodeFn).
*/
static QByteArray encodeFileNameUTF8(const QString &fileName);
/**
* @internal QFile filename decoding function (QFile::decodeFn).
*/
static QString decodeFileNameUTF8(const QByteArray &localFileName);
public:
/**
* @internal Sets the current encoding
* The worker of the same-name KLocale API function.
*/
virtual bool setEncoding(int mibEnum);
/**
* @internal Returns the user's preferred encoding.
* The worker of the same-name KLocale API function.
*/
virtual const QByteArray encoding();
/**
* @internal Returns the user's preferred encoding.
* The worker of the same-name KLocale API function.
*/
virtual int encodingMib() const;
/**
* @internal Returns the file encoding.
* The worker of the same-name KLocale API function.
*/
virtual int fileEncodingMib() const;
/**
* @internal Returns the user's preferred encoding.
* The worker of the same-name KLocale API function.
*/
virtual QTextCodec *codecForEncoding() const;
/***************************
** Utilities **
***************************/
public:
/**
* @internal Parses locale string into distinct parts.
* The worker of the same-name KLocale API function.
*/
static void splitLocale(const QString &locale, QString &language, QString &country,
QString &modifier, QString &charset);
/**
* @internal Tries to find a path to the localized file for the given original path.
* The worker of the same-name KLocale API function.
*/
virtual QString localizedFilePath(const QString &filePath) const;
/**
* @internal Removes accelerator marker from a UI text label.
* The worker of the same-name KLocale API function.
*/
virtual QString removeAcceleratorMarker(const QString &label) const;
private:
/**
* @internal COnvert digit group format string to digit group list
*/
QList<int> digitGroupFormatToList(const QString &digitGroupFormat) const;
/**
* @internal Insert digit group separator
*/
QString formatDigitGroup(const QString &number, const QString &groupSeparator, const QString &decimalSeperator, QList<int> groupList) const;
/**
* @internal Remove digit group separator, return ok if valid format
*/
QString parseDigitGroup(const QString &number, const QString &groupSeparator, const QString &decimalSeperator, QList<int> groupList, bool *ok) const;
public:
// Parent KLocale, public needed for copy ctor
KLocale *q;
private:
// Config file containing locale config
KSharedConfig::Ptr m_config;
// Country settings
QString m_country;
QString m_countryDivisionCode;
// Language settings
QString m_language;
KConfig *m_languages;
QStringList m_languageList;
bool m_languageSensitiveDigits; // FIXME: Temporary until full language-sensitivity implemented.
bool m_nounDeclension;
// Catalog settings
QString m_catalogName; // catalogName ("app name") used by this KLocale object
QList<KCatalogName> m_catalogNames; // list of all catalogs (regardless of language)
QList<KCatalog> m_catalogs; // list of all found catalogs, one instance per catalog name and language
int m_numberOfSysCatalogs; // number of catalogs that each app draws from
bool m_useTranscript; // indicates if scripted messages are to be executed
// Calendar settings
KLocale::CalendarSystem m_calendarSystem;
KCalendarSystem *m_calendar;
KLocale::WeekNumberSystem m_weekNumberSystem;
int m_weekStartDay;
int m_workingWeekStartDay;
int m_workingWeekEndDay;
int m_weekDayOfPray;
// Date/Time settings
QString m_dateFormat;
QString m_dateFormatShort;
QString m_timeFormat;
KLocale::DigitSet m_dateTimeDigitSet;
bool m_dateMonthNamePossessive;
mutable QList<KDayPeriod> m_dayPeriods;
// Number settings
int m_decimalPlaces;
QString m_decimalSymbol;
QString m_thousandsSeparator;
QList<int> m_numericDigitGrouping;
QString m_positiveSign;
QString m_negativeSign;
KLocale::DigitSet m_digitSet;
// Currency settings
QString m_currencyCode;
KCurrencyCode *m_currency;
QStringList m_currencyCodeList;
// Money settings
QString m_currencySymbol;
QString m_monetaryDecimalSymbol;
QString m_monetaryThousandsSeparator;
QList<int> m_monetaryDigitGrouping;
int m_monetaryDecimalPlaces;
KLocale::SignPosition m_positiveMonetarySignPosition;
KLocale::SignPosition m_negativeMonetarySignPosition;
bool m_positivePrefixCurrencySymbol;
bool m_negativePrefixCurrencySymbol;
KLocale::DigitSet m_monetaryDigitSet;
// Units settings
KLocale::BinaryUnitDialect m_binaryUnitDialect;
QList<QString> m_byteSizeFmt;
int m_pageSize;
KLocale::MeasureSystem m_measureSystem;
// Encoding settings
QString m_encoding;
QTextCodec *m_codecForEncoding;
bool m_utf8FileEncoding;
};
#endif /* KLOCALE_P_H */
diff --git a/kdeui/kernel/kglobalsettings.cpp b/kdeui/kernel/kglobalsettings.cpp
index 819b3149fa..6f26582b5c 100644
--- a/kdeui/kernel/kglobalsettings.cpp
+++ b/kdeui/kernel/kglobalsettings.cpp
@@ -1,1154 +1,1158 @@
/* This file is part of the KDE libraries
Copyright (C) 2000, 2006 David Faure <faure@kde.org>
Copyright 2008 Friedrich W. H. Kossebau <kossebau@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "kglobalsettings.h"
#include <config.h>
#include <kconfig.h>
#include <kdebug.h>
#include <kglobal.h>
+#include <klocale.h>
#include <kstandarddirs.h>
#include <kprotocolinfo.h>
#include <kcolorscheme.h>
#include <kstyle.h>
#include <QtGui/QColor>
#include <QtGui/QCursor>
#include <QtGui/QDesktopWidget>
#include <QtCore/QDir>
#include <QtGui/QFont>
#include <QtGui/QFontDatabase>
#include <QtGui/QFontInfo>
#include <QtGui/QKeySequence>
#include <QtGui/QPixmap>
#include <QtGui/QPixmapCache>
#include <QApplication>
#include <QtDBus/QtDBus>
#include <QtGui/QStyleFactory>
#include <QDesktopServices>
#include "qplatformdefs.h"
// next two needed so we can set their palettes
#include <QtGui/QToolTip>
#include <QtGui/QWhatsThis>
#ifdef Q_WS_WIN
#include <windows.h>
#include <kkernel_win.h>
static QRgb qt_colorref2qrgb(COLORREF col)
{
return qRgb(GetRValue(col),GetGValue(col),GetBValue(col));
}
#endif
#ifdef Q_WS_X11
#include <X11/Xlib.h>
#ifdef HAVE_XCURSOR
#include <X11/Xcursor/Xcursor.h>
#endif
#include "fixx11h.h"
#include <QX11Info>
#endif
#include <stdlib.h>
#include <kconfiggroup.h>
//static QColor *_buttonBackground = 0;
static KGlobalSettings::GraphicEffects _graphicEffects = KGlobalSettings::NoEffects;
// TODO: merge this with KGlobalSettings::Private
//
// F. Kossebau: KDE5: think to make all methods static and not expose an object,
// making KGlobalSettings rather a namespace
// D. Faure: how would people connect to signals, then?
class KGlobalSettingsData
{
public:
// if adding a new type here also add an entry to DefaultFontData
enum FontTypes
{
GeneralFont = 0,
FixedFont,
ToolbarFont,
MenuFont,
WindowTitleFont,
TaskbarFont ,
SmallestReadableFont,
FontTypesCount
};
public:
KGlobalSettingsData();
~KGlobalSettingsData();
public:
static KGlobalSettingsData* self();
public: // access, is not const due to caching
QFont font( FontTypes fontType );
QFont largeFont( const QString& text );
KGlobalSettings::KMouseSettings& mouseSettings();
public:
void dropFontSettingsCache();
void dropMouseSettingsCache();
protected:
QFont* mFonts[FontTypesCount];
QFont* mLargeFont;
KGlobalSettings::KMouseSettings* mMouseSettings;
};
KGlobalSettingsData::KGlobalSettingsData()
: mLargeFont( 0 ),
mMouseSettings( 0 )
{
for( int i=0; i<FontTypesCount; ++i )
mFonts[i] = 0;
}
KGlobalSettingsData::~KGlobalSettingsData()
{
for( int i=0; i<FontTypesCount; ++i )
delete mFonts[i];
delete mLargeFont;
delete mMouseSettings;
}
K_GLOBAL_STATIC( KGlobalSettingsData, globalSettingsDataSingleton )
inline KGlobalSettingsData* KGlobalSettingsData::self()
{
return globalSettingsDataSingleton;
}
class KGlobalSettings::Private
{
public:
Private(KGlobalSettings *q)
: q(q), activated(false), paletteCreated(false)
{
kdeFullSession = !qgetenv("KDE_FULL_SESSION").isEmpty();
}
QPalette createApplicationPalette(const KSharedConfigPtr &config);
QPalette createNewApplicationPalette(const KSharedConfigPtr &config);
void _k_slotNotifyChange(int, int);
void propagateQtSettings();
void kdisplaySetPalette();
void kdisplaySetStyle();
void kdisplaySetFont();
void applyGUIStyle();
/**
* @internal
*
* Ensures that cursors are loaded from the theme KDE is configured
* to use. Note that calling this function doesn't cause existing
* cursors to be reloaded. Reloading already created cursors is
* handled by the KCM when a cursor theme is applied.
*
* It is not necessary to call this function when KGlobalSettings
* is initialized.
*/
void applyCursorTheme();
/**
* drop cached values for settings that aren't in any of the previous groups
*/
static void rereadOtherSettings();
KGlobalSettings *q;
bool activated;
bool paletteCreated;
bool kdeFullSession;
QPalette applicationPalette;
};
KGlobalSettings* KGlobalSettings::self()
{
K_GLOBAL_STATIC(KGlobalSettings, s_self)
return s_self;
}
KGlobalSettings::KGlobalSettings()
: QObject(0), d(new Private(this))
{
}
KGlobalSettings::~KGlobalSettings()
{
delete d;
}
void KGlobalSettings::activate()
{
activate(ApplySettings | ListenForChanges);
}
void KGlobalSettings::activate(ActivateOptions options)
{
if (!d->activated) {
d->activated = true;
if (options & ListenForChanges) {
QDBusConnection::sessionBus().connect( QString(), "/KGlobalSettings", "org.kde.KGlobalSettings",
"notifyChange", this, SLOT(_k_slotNotifyChange(int,int)) );
}
if (options & ApplySettings) {
d->kdisplaySetStyle(); // implies palette setup
d->kdisplaySetFont();
d->propagateQtSettings();
}
}
}
int KGlobalSettings::dndEventDelay()
{
KConfigGroup g( KGlobal::config(), "General" );
return g.readEntry("StartDragDist", QApplication::startDragDistance());
}
bool KGlobalSettings::singleClick()
{
KConfigGroup g( KGlobal::config(), "KDE" );
return g.readEntry("SingleClick", KDE_DEFAULT_SINGLECLICK );
}
bool KGlobalSettings::smoothScroll()
{
KConfigGroup g( KGlobal::config(), "KDE" );
return g.readEntry("SmoothScroll", KDE_DEFAULT_SMOOTHSCROLL );
}
KGlobalSettings::TearOffHandle KGlobalSettings::insertTearOffHandle()
{
int tearoff;
bool effectsenabled;
KConfigGroup g( KGlobal::config(), "KDE" );
effectsenabled = g.readEntry( "EffectsEnabled", false);
tearoff = g.readEntry("InsertTearOffHandle", KDE_DEFAULT_INSERTTEAROFFHANDLES);
return effectsenabled ? (TearOffHandle) tearoff : Disable;
}
bool KGlobalSettings::changeCursorOverIcon()
{
KConfigGroup g( KGlobal::config(), "KDE" );
return g.readEntry("ChangeCursor", KDE_DEFAULT_CHANGECURSOR);
}
int KGlobalSettings::autoSelectDelay()
{
KConfigGroup g( KGlobal::config(), "KDE" );
return g.readEntry("AutoSelectDelay", KDE_DEFAULT_AUTOSELECTDELAY);
}
KGlobalSettings::Completion KGlobalSettings::completionMode()
{
int completion;
KConfigGroup g( KGlobal::config(), "General" );
completion = g.readEntry("completionMode", -1);
if ((completion < (int) CompletionNone) ||
(completion > (int) CompletionPopupAuto))
{
completion = (int) CompletionPopup; // Default
}
return (Completion) completion;
}
bool KGlobalSettings::showContextMenusOnPress ()
{
KConfigGroup g(KGlobal::config(), "ContextMenus");
return g.readEntry("ShowOnPress", true);
}
#ifndef KDE_NO_DEPRECATED
int KGlobalSettings::contextMenuKey ()
{
KConfigGroup g(KGlobal::config(), "Shortcuts");
QString s = g.readEntry ("PopupMenuContext", "Menu");
// this is a bit of a code duplication with KShortcut,
// but seeing as that is all in kdeui these days there's little choice.
// this is faster for what we're really after here anyways
// (less allocations, only processing the first item always, etc)
if (s == QLatin1String("none")) {
return QKeySequence()[0];
}
const QStringList shortCuts = s.split(';');
if (shortCuts.count() < 1) {
return QKeySequence()[0];
}
s = shortCuts.at(0);
if ( s.startsWith( QLatin1String("default(") ) ) {
s = s.mid( 8, s.length() - 9 );
}
return QKeySequence::fromString(s)[0];
}
#endif
// NOTE: keep this in sync with kdebase/workspace/kcontrol/colors/colorscm.cpp
QColor KGlobalSettings::inactiveTitleColor()
{
#ifdef Q_WS_WIN
return qt_colorref2qrgb(GetSysColor(COLOR_INACTIVECAPTION));
#else
KConfigGroup g( KGlobal::config(), "WM" );
return g.readEntry( "inactiveBackground", QColor(224,223,222) );
#endif
}
// NOTE: keep this in sync with kdebase/workspace/kcontrol/colors/colorscm.cpp
QColor KGlobalSettings::inactiveTextColor()
{
#ifdef Q_WS_WIN
return qt_colorref2qrgb(GetSysColor(COLOR_INACTIVECAPTIONTEXT));
#else
KConfigGroup g( KGlobal::config(), "WM" );
return g.readEntry( "inactiveForeground", QColor(75,71,67) );
#endif
}
// NOTE: keep this in sync with kdebase/workspace/kcontrol/colors/colorscm.cpp
QColor KGlobalSettings::activeTitleColor()
{
#ifdef Q_WS_WIN
return qt_colorref2qrgb(GetSysColor(COLOR_ACTIVECAPTION));
#else
KConfigGroup g( KGlobal::config(), "WM" );
return g.readEntry( "activeBackground", QColor(48,174,232));
#endif
}
// NOTE: keep this in sync with kdebase/workspace/kcontrol/colors/colorscm.cpp
QColor KGlobalSettings::activeTextColor()
{
#ifdef Q_WS_WIN
return qt_colorref2qrgb(GetSysColor(COLOR_CAPTIONTEXT));
#else
KConfigGroup g( KGlobal::config(), "WM" );
return g.readEntry( "activeForeground", QColor(255,255,255) );
#endif
}
int KGlobalSettings::contrast()
{
KConfigGroup g( KGlobal::config(), "KDE" );
return g.readEntry( "contrast", 5 );
}
qreal KGlobalSettings::contrastF(const KSharedConfigPtr &config)
{
if (config) {
KConfigGroup g( config, "KDE" );
return 0.1 * g.readEntry( "contrast", 7 );
}
return 0.1 * (qreal)contrast();
}
bool KGlobalSettings::shadeSortColumn()
{
KConfigGroup g( KGlobal::config(), "General" );
return g.readEntry( "shadeSortColumn", KDE_DEFAULT_SHADE_SORT_COLUMN );
}
bool KGlobalSettings::allowDefaultBackgroundImages()
{
KConfigGroup g( KGlobal::config(), "General" );
return g.readEntry( "allowDefaultBackgroundImages", KDE_DEFAULT_ALLOW_DEFAULT_BACKGROUND_IMAGES );
}
struct KFontData
{
const char* ConfigGroupKey;
const char* ConfigKey;
const char* FontName;
int Size;
int Weight;
QFont::StyleHint StyleHint;
};
// NOTE: keep in sync with kdebase/workspace/kcontrol/fonts/fonts.cpp
static const char GeneralId[] = "General";
static const char DefaultFont[] = "Sans Serif";
#ifdef Q_WS_MAC
static const char DefaultMacFont[] = "Lucida Grande";
#endif
static const KFontData DefaultFontData[KGlobalSettingsData::FontTypesCount] =
{
#ifdef Q_WS_MAC
{ GeneralId, "font", DefaultMacFont, 13, -1, QFont::SansSerif },
{ GeneralId, "fixed", "Monaco", 10, -1, QFont::TypeWriter },
{ GeneralId, "toolBarFont", DefaultMacFont, 11, -1, QFont::SansSerif },
{ GeneralId, "menuFont", DefaultMacFont, 13, -1, QFont::SansSerif },
#elif defined(Q_WS_MAEMO_5) || defined(MEEGO_EDITION_HARMATTAN)
{ GeneralId, "font", DefaultFont, 16, -1, QFont::SansSerif },
{ GeneralId, "fixed", "Monospace", 16, -1, QFont::TypeWriter },
{ GeneralId, "toolBarFont", DefaultFont, 16, -1, QFont::SansSerif },
{ GeneralId, "menuFont", DefaultFont, 16, -1, QFont::SansSerif },
#else
{ GeneralId, "font", DefaultFont, 9, -1, QFont::SansSerif },
{ GeneralId, "fixed", "Monospace", 9, -1, QFont::TypeWriter },
{ GeneralId, "toolBarFont", DefaultFont, 8, -1, QFont::SansSerif },
{ GeneralId, "menuFont", DefaultFont, 9, -1, QFont::SansSerif },
#endif
{ "WM", "activeFont", DefaultFont, 8, -1, QFont::SansSerif },
{ GeneralId, "taskbarFont", DefaultFont, 9, -1, QFont::SansSerif },
{ GeneralId, "smallestReadableFont", DefaultFont, 8, -1, QFont::SansSerif }
};
QFont KGlobalSettingsData::font( FontTypes fontType )
{
QFont* cachedFont = mFonts[fontType];
if (!cachedFont)
{
const KFontData& fontData = DefaultFontData[fontType];
cachedFont = new QFont( fontData.FontName, fontData.Size, fontData.Weight );
cachedFont->setStyleHint( fontData.StyleHint );
const KConfigGroup configGroup( KGlobal::config(), fontData.ConfigGroupKey );
*cachedFont = configGroup.readEntry( fontData.ConfigKey, *cachedFont );
mFonts[fontType] = cachedFont;
}
return *cachedFont;
}
QFont KGlobalSettings::generalFont()
{
return KGlobalSettingsData::self()->font( KGlobalSettingsData::GeneralFont );
}
QFont KGlobalSettings::fixedFont()
{
return KGlobalSettingsData::self()->font( KGlobalSettingsData::FixedFont );
}
QFont KGlobalSettings::toolBarFont()
{
return KGlobalSettingsData::self()->font( KGlobalSettingsData::ToolbarFont );
}
QFont KGlobalSettings::menuFont()
{
return KGlobalSettingsData::self()->font( KGlobalSettingsData::MenuFont );
}
QFont KGlobalSettings::windowTitleFont()
{
return KGlobalSettingsData::self()->font( KGlobalSettingsData::WindowTitleFont );
}
QFont KGlobalSettings::taskbarFont()
{
return KGlobalSettingsData::self()->font( KGlobalSettingsData::TaskbarFont );
}
QFont KGlobalSettings::smallestReadableFont()
{
return KGlobalSettingsData::self()->font( KGlobalSettingsData::SmallestReadableFont );
}
QFont KGlobalSettingsData::largeFont( const QString& text )
{
QFontDatabase db;
QStringList fam = db.families();
// Move a bunch of preferred fonts to the front.
// most preferred last
static const char* const PreferredFontNames[] =
{
"Arial",
"Sans Serif",
"Verdana",
"Tahoma",
"Lucida Sans",
"Lucidux Sans",
"Nimbus Sans",
"Gothic I"
};
static const unsigned int PreferredFontNamesCount = sizeof(PreferredFontNames)/sizeof(const char*);
for( unsigned int i=0; i<PreferredFontNamesCount; ++i )
{
const QString fontName (PreferredFontNames[i]);
if (fam.removeAll(fontName)>0)
fam.prepend(fontName);
}
if (mLargeFont) {
fam.prepend(mLargeFont->family());
delete mLargeFont;
}
for(QStringList::ConstIterator it = fam.constBegin();
it != fam.constEnd(); ++it)
{
if (db.isSmoothlyScalable(*it) && !db.isFixedPitch(*it))
{
QFont font(*it);
font.setPixelSize(75);
QFontMetrics metrics(font);
int h = metrics.height();
if ((h < 60) || ( h > 90))
continue;
bool ok = true;
for(int i = 0; i < text.length(); i++)
{
if (!metrics.inFont(text[i]))
{
ok = false;
break;
}
}
if (!ok)
continue;
font.setPointSize(48);
mLargeFont = new QFont(font);
return *mLargeFont;
}
}
mLargeFont = new QFont( font(GeneralFont) );
mLargeFont->setPointSize(48);
return *mLargeFont;
}
QFont KGlobalSettings::largeFont( const QString& text )
{
return KGlobalSettingsData::self()->largeFont( text );
}
void KGlobalSettingsData::dropFontSettingsCache()
{
for( int i=0; i<FontTypesCount; ++i )
{
delete mFonts[i];
mFonts[i] = 0;
}
delete mLargeFont;
mLargeFont = 0;
}
KGlobalSettings::KMouseSettings& KGlobalSettingsData::mouseSettings()
{
if (!mMouseSettings)
{
mMouseSettings = new KGlobalSettings::KMouseSettings;
KGlobalSettings::KMouseSettings& s = *mMouseSettings; // for convenience
#ifndef Q_WS_WIN
KConfigGroup g( KGlobal::config(), "Mouse" );
QString setting = g.readEntry("MouseButtonMapping");
if (setting == "RightHanded")
s.handed = KGlobalSettings::KMouseSettings::RightHanded;
else if (setting == "LeftHanded")
s.handed = KGlobalSettings::KMouseSettings::LeftHanded;
else
{
#ifdef Q_WS_X11
// get settings from X server
// This is a simplified version of the code in input/mouse.cpp
// Keep in sync !
s.handed = KGlobalSettings::KMouseSettings::RightHanded;
unsigned char map[20];
int num_buttons = XGetPointerMapping(QX11Info::display(), map, 20);
if( num_buttons == 2 )
{
if ( (int)map[0] == 1 && (int)map[1] == 2 )
s.handed = KGlobalSettings::KMouseSettings::RightHanded;
else if ( (int)map[0] == 2 && (int)map[1] == 1 )
s.handed = KGlobalSettings::KMouseSettings::LeftHanded;
}
else if( num_buttons >= 3 )
{
if ( (int)map[0] == 1 && (int)map[2] == 3 )
s.handed = KGlobalSettings::KMouseSettings::RightHanded;
else if ( (int)map[0] == 3 && (int)map[2] == 1 )
s.handed = KGlobalSettings::KMouseSettings::LeftHanded;
}
#else
// FIXME: Implement on other platforms
#endif
}
#endif //Q_WS_WIN
}
#ifdef Q_WS_WIN
//not cached
#ifndef _WIN32_WCE
mMouseSettings->handed = (GetSystemMetrics(SM_SWAPBUTTON) ?
KGlobalSettings::KMouseSettings::LeftHanded :
KGlobalSettings::KMouseSettings::RightHanded);
#else
// There is no mice under wince
mMouseSettings->handed =KGlobalSettings::KMouseSettings::RightHanded;
#endif
#endif
return *mMouseSettings;
}
// KDE5: make this a const return?
KGlobalSettings::KMouseSettings & KGlobalSettings::mouseSettings()
{
return KGlobalSettingsData::self()->mouseSettings();
}
void KGlobalSettingsData::dropMouseSettingsCache()
{
#ifndef Q_WS_WIN
delete mMouseSettings;
mMouseSettings = 0;
#endif
}
QString KGlobalSettings::desktopPath()
{
QString path = QDesktopServices::storageLocation( QDesktopServices::DesktopLocation );
return path.isEmpty() ? QDir::homePath() : path;
}
// Autostart is not a XDG path, so we have our own code for it.
QString KGlobalSettings::autostartPath()
{
QString s_autostartPath;
KConfigGroup g( KGlobal::config(), "Paths" );
s_autostartPath = KGlobal::dirs()->localkdedir() + "Autostart/";
s_autostartPath = g.readPathEntry( "Autostart" , s_autostartPath );
s_autostartPath = QDir::cleanPath( s_autostartPath );
if ( !s_autostartPath.endsWith( '/' ) ) {
s_autostartPath.append( QLatin1Char( '/' ) );
}
return s_autostartPath;
}
QString KGlobalSettings::documentPath()
{
QString path = QDesktopServices::storageLocation( QDesktopServices::DocumentsLocation );
return path.isEmpty() ? QDir::homePath() : path;
}
QString KGlobalSettings::downloadPath()
{
// Qt 4.4.1 does not have DOWNLOAD, so we based on old code for now
QString downloadPath = QDir::homePath();
#ifndef Q_WS_WIN
const QString xdgUserDirs = KGlobal::dirs()->localxdgconfdir() + QLatin1String( "user-dirs.dirs" );
if( QFile::exists( xdgUserDirs ) ) {
KConfig xdgUserConf( xdgUserDirs, KConfig::SimpleConfig );
KConfigGroup g( &xdgUserConf, "" );
downloadPath = g.readPathEntry( "XDG_DOWNLOAD_DIR", downloadPath ).remove( '"' );
if ( downloadPath.isEmpty() ) {
downloadPath = QDir::homePath();
}
}
#endif
downloadPath = QDir::cleanPath( downloadPath );
if ( !downloadPath.endsWith( '/' ) ) {
downloadPath.append( QLatin1Char( '/' ) );
}
return downloadPath;
}
QString KGlobalSettings::videosPath()
{
QString path = QDesktopServices::storageLocation( QDesktopServices::MoviesLocation );
return path.isEmpty() ? QDir::homePath() : path;
}
QString KGlobalSettings::picturesPath()
{
QString path = QDesktopServices::storageLocation( QDesktopServices::PicturesLocation );
return path.isEmpty() ? QDir::homePath() :path;
}
QString KGlobalSettings::musicPath()
{
QString path = QDesktopServices::storageLocation( QDesktopServices::MusicLocation );
return path.isEmpty() ? QDir::homePath() : path;
}
bool KGlobalSettings::isMultiHead()
{
#ifdef Q_WS_WIN
return GetSystemMetrics(SM_CMONITORS) > 1;
#else
QByteArray multiHead = qgetenv("KDE_MULTIHEAD");
if (!multiHead.isEmpty()) {
return (multiHead.toLower() == "true");
}
return false;
#endif
}
bool KGlobalSettings::wheelMouseZooms()
{
KConfigGroup g( KGlobal::config(), "KDE" );
return g.readEntry( "WheelMouseZooms", KDE_DEFAULT_WHEEL_ZOOM );
}
QRect KGlobalSettings::splashScreenDesktopGeometry()
{
QDesktopWidget *dw = QApplication::desktop();
if (dw->isVirtualDesktop()) {
KConfigGroup group(KGlobal::config(), "Windows");
int scr = group.readEntry("Unmanaged", -3);
if (group.readEntry("XineramaEnabled", true) && scr != -2) {
if (scr == -3)
scr = dw->screenNumber(QCursor::pos());
return dw->screenGeometry(scr);
} else {
return dw->geometry();
}
} else {
return dw->geometry();
}
}
QRect KGlobalSettings::desktopGeometry(const QPoint& point)
{
QDesktopWidget *dw = QApplication::desktop();
if (dw->isVirtualDesktop()) {
KConfigGroup group(KGlobal::config(), "Windows");
if (group.readEntry("XineramaEnabled", true) &&
group.readEntry("XineramaPlacementEnabled", true)) {
return dw->screenGeometry(dw->screenNumber(point));
} else {
return dw->geometry();
}
} else {
return dw->geometry();
}
}
QRect KGlobalSettings::desktopGeometry(const QWidget* w)
{
QDesktopWidget *dw = QApplication::desktop();
if (dw->isVirtualDesktop()) {
KConfigGroup group(KGlobal::config(), "Windows");
if (group.readEntry("XineramaEnabled", true) &&
group.readEntry("XineramaPlacementEnabled", true)) {
if (w)
return dw->screenGeometry(dw->screenNumber(w));
else return dw->screenGeometry(-1);
} else {
return dw->geometry();
}
} else {
return dw->geometry();
}
}
bool KGlobalSettings::showIconsOnPushButtons()
{
KConfigGroup g( KGlobal::config(), "KDE" );
return g.readEntry("ShowIconsOnPushButtons",
KDE_DEFAULT_ICON_ON_PUSHBUTTON);
}
bool KGlobalSettings::naturalSorting()
{
KConfigGroup g( KGlobal::config(), "KDE" );
return g.readEntry("NaturalSorting",
KDE_DEFAULT_NATURAL_SORTING);
}
KGlobalSettings::GraphicEffects KGlobalSettings::graphicEffectsLevel()
{
// This variable stores whether _graphicEffects has the default value because it has not been
// loaded yet, or if it has been loaded from the user settings or defaults and contains a valid
// value.
static bool _graphicEffectsInitialized = false;
if (!_graphicEffectsInitialized) {
_graphicEffectsInitialized = true;
Private::rereadOtherSettings();
}
return _graphicEffects;
}
KGlobalSettings::GraphicEffects KGlobalSettings::graphicEffectsLevelDefault()
{
// For now, let always enable animations by default. The plan is to make
// this code a bit smarter. (ereslibre)
return ComplexAnimationEffects;
}
bool KGlobalSettings::showFilePreview(const KUrl &url)
{
KConfigGroup g(KGlobal::config(), "PreviewSettings");
QString protocol = url.protocol();
bool defaultSetting = KProtocolInfo::showFilePreview( protocol );
return g.readEntry(protocol, defaultSetting );
}
bool KGlobalSettings::opaqueResize()
{
KConfigGroup g( KGlobal::config(), "KDE" );
return g.readEntry("OpaqueResize", KDE_DEFAULT_OPAQUE_RESIZE);
}
int KGlobalSettings::buttonLayout()
{
KConfigGroup g( KGlobal::config(), "KDE" );
return g.readEntry("ButtonLayout", KDE_DEFAULT_BUTTON_LAYOUT);
}
void KGlobalSettings::emitChange(ChangeType changeType, int arg)
{
QDBusMessage message = QDBusMessage::createSignal("/KGlobalSettings", "org.kde.KGlobalSettings", "notifyChange" );
QList<QVariant> args;
args.append(static_cast<int>(changeType));
args.append(arg);
message.setArguments(args);
QDBusConnection::sessionBus().send(message);
#ifdef Q_WS_X11
if (qApp && qApp->type() != QApplication::Tty) {
//notify non-kde qt applications of the change
extern void qt_x11_apply_settings_in_all_apps();
qt_x11_apply_settings_in_all_apps();
}
#endif
}
void KGlobalSettings::Private::_k_slotNotifyChange(int changeType, int arg)
{
switch(changeType) {
case StyleChanged:
if (activated) {
KGlobal::config()->reparseConfiguration();
kdisplaySetStyle();
}
break;
case ToolbarStyleChanged:
KGlobal::config()->reparseConfiguration();
emit q->toolbarAppearanceChanged(arg);
break;
case PaletteChanged:
if (activated) {
KGlobal::config()->reparseConfiguration();
paletteCreated = false;
kdisplaySetPalette();
}
break;
case FontChanged:
KGlobal::config()->reparseConfiguration();
KGlobalSettingsData::self()->dropFontSettingsCache();
if (activated) {
kdisplaySetFont();
}
break;
case SettingsChanged: {
KGlobal::config()->reparseConfiguration();
rereadOtherSettings();
SettingsCategory category = static_cast<SettingsCategory>(arg);
if (category == SETTINGS_MOUSE) {
KGlobalSettingsData::self()->dropMouseSettingsCache();
}
if (category == SETTINGS_QT) {
if (activated) {
propagateQtSettings();
}
} else {
+ if (category == SETTINGS_LOCALE) {
+ KGlobal::locale()->reparseConfiguration();
+ }
emit q->settingsChanged(category);
}
break;
}
case IconChanged:
QPixmapCache::clear();
KGlobal::config()->reparseConfiguration();
emit q->iconChanged(arg);
break;
case CursorChanged:
applyCursorTheme();
break;
case BlockShortcuts:
// FIXME KAccel port
//KGlobalAccel::blockShortcuts(arg);
emit q->blockShortcuts(arg); // see kwin
break;
case NaturalSortingChanged:
emit q->naturalSortingChanged();
break;
default:
kWarning(240) << "Unknown type of change in KGlobalSettings::slotNotifyChange: " << changeType;
}
}
// Set by KApplication
QString kde_overrideStyle;
void KGlobalSettings::Private::applyGUIStyle()
{
//Platform plugin only loaded on X11 systems
#ifdef Q_WS_X11
if (!kde_overrideStyle.isEmpty()) {
const QLatin1String currentStyleName(qApp->style()->metaObject()->className());
if (0 != kde_overrideStyle.compare(currentStyleName, Qt::CaseInsensitive) &&
0 != (QString(kde_overrideStyle + QLatin1String("Style"))).compare(currentStyleName, Qt::CaseInsensitive)) {
qApp->setStyle(kde_overrideStyle);
}
} else {
emit q->kdisplayStyleChanged();
}
#else
const QLatin1String currentStyleName(qApp->style()->metaObject()->className());
if (kde_overrideStyle.isEmpty()) {
const QString &defaultStyle = KStyle::defaultStyle();
const KConfigGroup pConfig(KGlobal::config(), "General");
const QString &styleStr = pConfig.readEntry("widgetStyle", defaultStyle);
if (styleStr.isEmpty() ||
// check whether we already use the correct style to return then
// (workaround for Qt misbehavior to avoid double style initialization)
0 == (QString(styleStr + QLatin1String("Style"))).compare(currentStyleName, Qt::CaseInsensitive) ||
0 == styleStr.compare(currentStyleName, Qt::CaseInsensitive)) {
return;
}
QStyle* sp = QStyleFactory::create( styleStr );
if (sp && currentStyleName == sp->metaObject()->className()) {
delete sp;
return;
}
// If there is no default style available, try falling back any available style
if ( !sp && styleStr != defaultStyle)
sp = QStyleFactory::create( defaultStyle );
if ( !sp )
sp = QStyleFactory::create( QStyleFactory::keys().first() );
qApp->setStyle(sp);
} else if (0 != kde_overrideStyle.compare(currentStyleName, Qt::CaseInsensitive) &&
0 != (QString(kde_overrideStyle + QLatin1String("Style"))).compare(currentStyleName, Qt::CaseInsensitive)) {
qApp->setStyle(kde_overrideStyle);
}
emit q->kdisplayStyleChanged();
#endif //Q_WS_X11
}
QPalette KGlobalSettings::createApplicationPalette(const KSharedConfigPtr &config)
{
return self()->d->createApplicationPalette(config);
}
QPalette KGlobalSettings::createNewApplicationPalette(const KSharedConfigPtr &config)
{
return self()->d->createNewApplicationPalette(config);
}
QPalette KGlobalSettings::Private::createApplicationPalette(const KSharedConfigPtr &config)
{
// This method is typically called once by KQGuiPlatformPlugin::palette and once again
// by kdisplaySetPalette(), so we cache the palette to save time.
if (config == KGlobal::config() && paletteCreated) {
return applicationPalette;
}
return createNewApplicationPalette(config);
}
QPalette KGlobalSettings::Private::createNewApplicationPalette(const KSharedConfigPtr &config)
{
QPalette palette;
QPalette::ColorGroup states[3] = { QPalette::Active, QPalette::Inactive,
QPalette::Disabled };
// TT thinks tooltips shouldn't use active, so we use our active colors for all states
KColorScheme schemeTooltip(QPalette::Active, KColorScheme::Tooltip, config);
for ( int i = 0; i < 3 ; i++ ) {
QPalette::ColorGroup state = states[i];
KColorScheme schemeView(state, KColorScheme::View, config);
KColorScheme schemeWindow(state, KColorScheme::Window, config);
KColorScheme schemeButton(state, KColorScheme::Button, config);
KColorScheme schemeSelection(state, KColorScheme::Selection, config);
palette.setBrush( state, QPalette::WindowText, schemeWindow.foreground() );
palette.setBrush( state, QPalette::Window, schemeWindow.background() );
palette.setBrush( state, QPalette::Base, schemeView.background() );
palette.setBrush( state, QPalette::Text, schemeView.foreground() );
palette.setBrush( state, QPalette::Button, schemeButton.background() );
palette.setBrush( state, QPalette::ButtonText, schemeButton.foreground() );
palette.setBrush( state, QPalette::Highlight, schemeSelection.background() );
palette.setBrush( state, QPalette::HighlightedText, schemeSelection.foreground() );
palette.setBrush( state, QPalette::ToolTipBase, schemeTooltip.background() );
palette.setBrush( state, QPalette::ToolTipText, schemeTooltip.foreground() );
palette.setColor( state, QPalette::Light, schemeWindow.shade( KColorScheme::LightShade ) );
palette.setColor( state, QPalette::Midlight, schemeWindow.shade( KColorScheme::MidlightShade ) );
palette.setColor( state, QPalette::Mid, schemeWindow.shade( KColorScheme::MidShade ) );
palette.setColor( state, QPalette::Dark, schemeWindow.shade( KColorScheme::DarkShade ) );
palette.setColor( state, QPalette::Shadow, schemeWindow.shade( KColorScheme::ShadowShade ) );
palette.setBrush( state, QPalette::AlternateBase, schemeView.background( KColorScheme::AlternateBackground) );
palette.setBrush( state, QPalette::Link, schemeView.foreground( KColorScheme::LinkText ) );
palette.setBrush( state, QPalette::LinkVisited, schemeView.foreground( KColorScheme::VisitedText ) );
}
if (config == KGlobal::config()) {
paletteCreated = true;
applicationPalette = palette;
}
return palette;
}
void KGlobalSettings::Private::kdisplaySetPalette()
{
#if !defined(Q_WS_MAEMO_5) && !defined(Q_OS_WINCE) && !defined(MEEGO_EDITION_HARMATTAN)
if (!kdeFullSession) {
return;
}
if (qApp->type() == QApplication::GuiClient) {
QApplication::setPalette( q->createApplicationPalette() );
}
emit q->kdisplayPaletteChanged();
emit q->appearanceChanged();
#endif
}
void KGlobalSettings::Private::kdisplaySetFont()
{
#if !defined(Q_WS_MAEMO_5) && !defined(Q_OS_WINCE) && !defined(MEEGO_EDITION_HARMATTAN)
if (!kdeFullSession) {
return;
}
if (qApp->type() == QApplication::GuiClient) {
KGlobalSettingsData* data = KGlobalSettingsData::self();
QApplication::setFont( data->font(KGlobalSettingsData::GeneralFont) );
const QFont menuFont = data->font( KGlobalSettingsData::MenuFont );
QApplication::setFont( menuFont, "QMenuBar" );
QApplication::setFont( menuFont, "QMenu" );
QApplication::setFont( menuFont, "KPopupTitle" );
QApplication::setFont( data->font(KGlobalSettingsData::ToolbarFont), "QToolBar" );
}
emit q->kdisplayFontChanged();
emit q->appearanceChanged();
#endif
}
void KGlobalSettings::Private::kdisplaySetStyle()
{
if (qApp->type() == QApplication::GuiClient) {
applyGUIStyle();
// Reread palette from config file.
kdisplaySetPalette();
}
}
void KGlobalSettings::Private::rereadOtherSettings()
{
KConfigGroup g( KGlobal::config(), "KDE-Global GUI Settings" );
// Asking for hasKey we do not ask for graphicEffectsLevelDefault() that can
// contain some very slow code. If we can save that time, do it. (ereslibre)
if (g.hasKey("GraphicEffectsLevel")) {
_graphicEffects = ((GraphicEffects) g.readEntry("GraphicEffectsLevel", QVariant((int) NoEffects)).toInt());
return;
}
_graphicEffects = KGlobalSettings::graphicEffectsLevelDefault();
}
void KGlobalSettings::Private::applyCursorTheme()
{
#if defined(Q_WS_X11) && defined(HAVE_XCURSOR)
KConfig config("kcminputrc");
KConfigGroup g(&config, "Mouse");
QString theme = g.readEntry("cursorTheme", QString());
int size = g.readEntry("cursorSize", -1);
// Default cursor size is 16 points
if (size == -1)
{
QApplication *app = static_cast<QApplication*>(QApplication::instance());
size = app->desktop()->screen(0)->logicalDpiY() * 16 / 72;
}
// Note that in X11R7.1 and earlier, calling XcursorSetTheme()
// with a NULL theme would cause Xcursor to use "default", but
// in 7.2 and later it will cause it to revert to the theme that
// was configured when the application was started.
XcursorSetTheme(QX11Info::display(), theme.isNull() ?
"default" : QFile::encodeName(theme));
XcursorSetDefaultSize(QX11Info::display(), size);
emit q->cursorChanged();
#endif
}
void KGlobalSettings::Private::propagateQtSettings()
{
KConfigGroup cg( KGlobal::config(), "KDE" );
int num = cg.readEntry("CursorBlinkRate", QApplication::cursorFlashTime());
if ((num != 0) && (num < 200))
num = 200;
if (num > 2000)
num = 2000;
QApplication::setCursorFlashTime(num);
num = cg.readEntry("DoubleClickInterval", QApplication::doubleClickInterval());
QApplication::setDoubleClickInterval(num);
num = cg.readEntry("StartDragTime", QApplication::startDragTime());
QApplication::setStartDragTime(num);
num = cg.readEntry("StartDragDist", QApplication::startDragDistance());
QApplication::setStartDragDistance(num);
num = cg.readEntry("WheelScrollLines", QApplication::wheelScrollLines());
QApplication::setWheelScrollLines(num);
bool showIcons = cg.readEntry("ShowIconsInMenuItems", !QApplication::testAttribute(Qt::AA_DontShowIconsInMenus));
QApplication::setAttribute(Qt::AA_DontShowIconsInMenus, !showIcons);
// KDE5: this seems fairly pointless
emit q->settingsChanged(SETTINGS_QT);
}
#include "kglobalsettings.moc"
diff --git a/kdeui/kernel/kglobalsettings.h b/kdeui/kernel/kglobalsettings.h
index cb8f7e2ac0..6b7614640b 100644
--- a/kdeui/kernel/kglobalsettings.h
+++ b/kdeui/kernel/kglobalsettings.h
@@ -1,692 +1,693 @@
/* This file is part of the KDE libraries
Copyright (C) 2000,2006 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _KGLOBALSETTINGS_H
#define _KGLOBALSETTINGS_H
#include <kdeui_export.h>
#include <ksharedconfig.h>
#include <QtCore/QObject>
#include <QtCore/QString>
#include <QtGui/QPalette>
#define KDE_DEFAULT_SINGLECLICK true
#define KDE_DEFAULT_SMOOTHSCROLL true
#define KDE_DEFAULT_INSERTTEAROFFHANDLES 0
#define KDE_DEFAULT_AUTOSELECTDELAY -1
#define KDE_DEFAULT_CHANGECURSOR true
#define KDE_DEFAULT_LARGE_CURSOR false
#define KDE_DEFAULT_WHEEL_ZOOM false
#ifdef Q_WS_MAEMO_5
#define KDE_DEFAULT_ICON_ON_PUSHBUTTON false
#else
#define KDE_DEFAULT_ICON_ON_PUSHBUTTON true
#endif
#define KDE_DEFAULT_OPAQUE_RESIZE true
#define KDE_DEFAULT_BUTTON_LAYOUT 0
#define KDE_DEFAULT_SHADE_SORT_COLUMN true
#define KDE_DEFAULT_ALLOW_DEFAULT_BACKGROUND_IMAGES true
#define KDE_DEFAULT_NATURAL_SORTING true
class KUrl;
class QColor;
class QFont;
class QPoint;
class QRect;
class QWidget;
/**
* Access the KDE global configuration.
*
* @author David Faure \<faure@kde.org\>
*/
class KDEUI_EXPORT KGlobalSettings : public QObject
{
Q_OBJECT
public:
~KGlobalSettings();
/**
* Returns a threshold in pixels for drag & drop operations.
* As long as the mouse movement has not exceeded this number
* of pixels in either X or Y direction no drag operation may
* be started. This prevents spurious drags when the user intended
* to click on something but moved the mouse a bit while doing so.
*
* For this to work you must save the position of the mouse (oldPos)
* in the QWidget::mousePressEvent().
* When the position of the mouse (newPos)
* in a QWidget::mouseMoveEvent() exceeds this threshold
* you may start a drag
* which should originate from oldPos.
*
* Example code:
* \code
* void KColorCells::mousePressEvent( QMouseEvent *e )
* {
* mOldPos = e->pos();
* }
*
* void KColorCells::mouseMoveEvent( QMouseEvent *e )
* {
* if( !(e->state() && LeftButton)) return;
*
* int delay = KGlobalSettings::dndEventDelay();
* QPoint newPos = e->pos();
* if(newPos.x() > mOldPos.x()+delay || newPos.x() < mOldPos.x()-delay ||
* newPos.y() > mOldPos.y()+delay || newPos.y() < mOldPos.y()-delay)
* {
* // Drag color object
* int cell = posToCell(mOldPos); // Find color at mOldPos
* if ((cell != -1) && colors[cell].isValid())
* {
* KColorDrag *d = KColorDrag::makeDrag( colors[cell], this);
* d->dragCopy();
* }
* }
* }
* \endcode
* @return the threshold for drag & drop in pixels
*/
static int dndEventDelay();
/**
* Returns whether KDE runs in single (default) or double click
* mode.
* see http://developer.kde.org/documentation/standards/kde/style/mouse/index.html
* @return true if single click mode, or false if double click mode.
**/
static bool singleClick();
/**
* Returns if item views should force smooth scrolling.
* @return true if smooth scrolling is enabled for item view, false otherwise.
* @since 4.2
*/
static bool smoothScroll();
/**
* This enum describes the return type for insertTearOffHandle() whether to insert
* a handle or not. Applications who independently want to use handles in their popup menus
* should test for Application level before calling the appropriate function in KMenu.
**/
enum TearOffHandle {
Disable = 0, ///< disable tear-off handles
ApplicationLevel, ///< enable on application level
Enable ///< enable tear-off handles
};
/**
* Returns whether tear-off handles are inserted in KMenus.
* @return whether tear-off handles are inserted in KMenus.
**/
static TearOffHandle insertTearOffHandle();
/**
* Checks whether the cursor changes over icons.
* @return the KDE setting for "change cursor over icon"
*/
static bool changeCursorOverIcon();
/**
* Returns the KDE setting for the auto-select option.
*
* @return the auto-select delay or -1 if auto-select is disabled.
*/
static int autoSelectDelay();
/**
* Returns the KDE setting for the shortcut key to open
* context menus.
*
* @return the key that pops up context menus.
* @deprecated Simply reimplement QWidget::contextMenuEvent() instead.
*/
#ifndef KDE_NO_DEPRECATED
static KDE_DEPRECATED int contextMenuKey ();
#endif
/**
* Returns the KDE setting for context menus.
*
* @return whether context menus should be shown on button press
* or button release (click).
*/
static bool showContextMenusOnPress ();
/**
* This enum describes the completion mode used for by the KCompletion class.
* See <a href="http://developer.kde.org/documentation/standards/kde/style/keys/completion.html">
* the styleguide</a>.
**/
enum Completion {
/**
* No completion is used.
*/
CompletionNone=1,
/**
* Text is automatically filled in whenever possible.
*/
CompletionAuto,
/**
* Same as automatic except shortest match is used for completion.
*/
CompletionMan,
/**
* Complete text much in the same way as a typical *nix shell would.
*/
CompletionShell,
/**
* Lists all possible matches in a popup list-box to choose from.
*/
CompletionPopup,
/**
* Lists all possible matches in a popup list-box to choose from, and automatically
* fill the result whenever possible.
*/
CompletionPopupAuto
};
/**
* Returns the preferred completion mode setting.
*
* @return Completion. Default is @p CompletionPopup.
*/
static Completion completionMode();
/**
* Describes the mouse settings.
*/
struct KMouseSettings
{
enum { RightHanded = 0, LeftHanded = 1 };
int handed; // left or right
};
/**
* This returns the current mouse settings.
* On Windows, settings are retrieved from the system.
* @return the current mouse settings
*/
static KMouseSettings & mouseSettings();
/**
* The path to the desktop directory of the current user.
* @return the user's desktop directory
*/
static QString desktopPath();
/**
* The path to the autostart directory of the current user.
* @return the path of the autostart directory
*/
static QString autostartPath();
/**
* The path where documents are stored of the current user.
* @return the path of the document directory
*/
static QString documentPath();
/**
* The path where music are stored of the current user.
* @return the path of the music directory
*/
static QString musicPath();
/**
* The path where videos are stored of the current user.
* @return the path of the video directory
*/
static QString videosPath();
/**
* The path where download are stored of the current user.
* @return the path of the download directory
*/
static QString downloadPath();
/**
* The path where pictures are stored of the current user.
* @return the path of the pictures directory
*/
static QString picturesPath();
/**
* The default color to use for inactive titles.
* @return the inactive title color
*/
static QColor inactiveTitleColor();
/**
* The default color to use for inactive texts.
* @return the inactive text color
*/
static QColor inactiveTextColor();
/**
* The default color to use for active titles.
* @return the active title color
*/
static QColor activeTitleColor();
/**
* The default color to use for active texts.
* @return the active text color
*/
static QColor activeTextColor();
/**
* Returns the contrast for borders.
* @return the contrast (between 0 for minimum and 10 for maximum
* contrast)
*/
static int contrast();
/**
* Returns the contrast for borders as a floating point value.
* @param config pointer to the config from which to read the contrast
* setting (the default is to use KGlobal::config())
* @return the contrast (between 0.0 for minimum and 1.0 for maximum
* contrast)
*/
static qreal contrastF(const KSharedConfigPtr &config = KSharedConfigPtr());
/**
* Returns if the sorted column in a K3ListView shall be drawn with a
* shaded background color.
* @return true if the sorted column shall be shaded
*/
static bool shadeSortColumn();
/**
* Returns if default background images are allowed by the color scheme.
* A "default" background image is just that, i.e. the user has not
* actively selected a background image to use.
* @return true if default background images may be used
*/
static bool allowDefaultBackgroundImages();
/**
* Returns the default general font.
* @return the default general font.
*/
static QFont generalFont();
/**
* Returns the default fixed font.
* @return the default fixed font.
*/
static QFont fixedFont();
/**
* Returns the default toolbar font.
* @return the default toolbar font.
*/
static QFont toolBarFont();
/**
* Returns the default menu font.
* @return the default menu font.
*/
static QFont menuFont();
/**
* Returns the default window title font.
* @return the default window title font.
*/
static QFont windowTitleFont();
/**
* Returns the default taskbar font.
* @return the default taskbar font.
*/
static QFont taskbarFont();
/**
* Returns a font of approx. 48 pt. capable of showing @p text.
* @param text the text to test
* @return the font that is capable to show the text with 48 pt
*/
static QFont largeFont(const QString &text = QString());
/**
* Returns the smallest readable font. This can be used in dockers,
* rulers and other places where space is at a premium.
*/
static QFont smallestReadableFont();
/**
* Returns if the user specified multihead. In case the display
* has multiple screens, the return value of this function specifies
* if the user wants KDE to run on all of them or just on the primary
* On Windows, settings are retrieved from the system.
* @return true if the user chose multi head
*/
static bool isMultiHead();
/**
* Typically, QScrollView derived classes can be scrolled fast by
* holding down the Ctrl-button during wheel-scrolling.
* But QTextEdit and derived classes perform zooming instead of fast
* scrolling.
*
* This value determines whether the user wants to zoom or scroll fast
* with Ctrl-wheelscroll.
* @return true if the user wishes to zoom with the mouse wheel,
* false for scrolling
*/
static bool wheelMouseZooms();
/**
* This function returns the desktop geometry for an application's splash
* screen. It takes into account the user's display settings (number of
* screens, Xinerama, etc), and the user's preferences (if KDE should be
* Xinerama aware).
*
* @return the geometry to use for the desktop. Note that it might not
* start at (0,0).
*/
static QRect splashScreenDesktopGeometry();
/**
* This function returns the desktop geometry for an application that needs
* to set the geometry of a widget on the screen manually. It takes into
* account the user's display settings (number of screens, Xinerama, etc),
* and the user's preferences (if KDE should be Xinerama aware).
*
* Note that this can break in multi-head (not Xinerama) mode because this
* point could be on multiple screens. Use with care.
*
* @param point a reference point for the widget, for instance one that the
* widget should be adjacent or on top of.
*
* @return the geometry to use for the desktop. Note that it might not
* start at (0,0).
*/
static QRect desktopGeometry(const QPoint& point);
/**
* This function returns the desktop geometry for an application that needs
* to set the geometry of a widget on the screen manually. It takes into
* account the user's display settings (number of screens, Xinerama, etc),
* and the user's preferences (if KDE should be Xinerama aware).
*
* @param w the widget in question. This is used to determine which screen
* to use in Xinerama or multi-head mode.
*
* @return the geometry to use for the desktop. Note that it might not
* start at (0,0).
*/
static QRect desktopGeometry(const QWidget* w);
/**
* This function determines if the user wishes to see icons on the
* push buttons.
*
* @return Returns true if user wants to show icons.
*/
static bool showIconsOnPushButtons();
/**
* Returns true, if user visible strings should be sorted in a natural way:
* image 1.jpg
* image 2.jpg
* image 10.jpg
* image 11.jpg
* If false is returned, the strings are sorted by their unicode values:
* image 1.jpg
* image 10.jpg
* image 11.jpg
* image 2.jpg
*
* @since 4.4
*/
static bool naturalSorting();
enum GraphicEffect {
NoEffects = 0x0000, ///< GUI with no effects at all.
GradientEffects = 0x0001, ///< GUI with only gradients enabled.
SimpleAnimationEffects = 0x0002, ///< GUI with simple animations enabled.
ComplexAnimationEffects = 0x0006 ///< GUI with complex animations enabled.
///< Note that ComplexAnimationsEffects implies SimpleAnimationEffects.
};
Q_DECLARE_FLAGS(GraphicEffects, GraphicEffect)
/**
* This function determines the desired level of effects on the GUI.
*
* @since 4.1
*/
static GraphicEffects graphicEffectsLevel();
/**
* This function determines the default level of effects on the GUI
* depending on the system capabilities.
*
* @since 4.1
*/
static GraphicEffects graphicEffectsLevelDefault();
/**
* This function determines if the user wishes to see previews
* for the selected url
*
* @return Returns true if user wants to show previews.
*/
static bool showFilePreview(const KUrl &);
/**
* Whether the user wishes to use opaque resizing. Primarily
* intended for QSplitter::setOpaqueResize()
*
* @return Returns true if user wants to use opaque resizing.
*/
static bool opaqueResize();
/**
* The layout scheme to use for dialog buttons
*
* @return Returns the number of the scheme to use.
*/
static int buttonLayout();
/**
* Used to obtain the QPalette that will be used to set the application palette.
*
* This is only useful for configuration modules such as krdb and should not be
* used in normal circumstances.
* @param config KConfig from which to load the colors (passed as-is to
* ::KColorScheme).
*
* @return the QPalette
*/
static QPalette createApplicationPalette(const KSharedConfigPtr &config = KSharedConfigPtr());
/**
* Used to obtain the QPalette that will be used to set the application palette.
*
* This is only useful for configuration modules such as krdb and should not be
* used in normal circumstances.
* @param config KConfig from which to load the colors (passed as-is to
* ::KColorScheme).
*
* @note The difference between this and the previous is that this never caches.
* @since 4.6.3
*
* @return the QPalette
*/
static QPalette createNewApplicationPalette(const KSharedConfigPtr &config = KSharedConfigPtr());
/**
* An identifier for change signals.
* \see emitChange
*/
enum ChangeType { PaletteChanged = 0, FontChanged, StyleChanged,
SettingsChanged, IconChanged, CursorChanged,
ToolbarStyleChanged, ClipboardConfigChanged,
BlockShortcuts, NaturalSortingChanged };
/**
* Notifies all KDE applications on the current display of a change.
*
* This is typically called by kcontrol modules after changing the corresponding
* config file. Do not call this from a normal KDE application.
*/
static void emitChange(ChangeType changeType, int arg = 0);
/**
* Return the KGlobalSettings singleton.
* This is used to connect to its signals, to be notified of changes.
*/
static KGlobalSettings* self();
/**
* Specifies options passed to activate().
*
* @since 4.6
*/
enum ActivateOption {
ApplySettings = 0x1, ///< Make all globally applicable settings take effect.
ListenForChanges = 0x2 ///< Listen for changes to the settings.
};
Q_DECLARE_FLAGS(ActivateOptions, ActivateOption)
/**
* Makes all globally applicable settings take effect
* and starts listening for changes to these settings.
*
* This is usually called only by the KApplication constructor.
*
* @since 4.3.3
*/
void activate(); //KDE5: Merge with the overloaded method below
/**
* @overload
*
* @since 4.6
*/
void activate(ActivateOptions options);
/**
* Valid values for the settingsChanged signal
*/
enum SettingsCategory { SETTINGS_MOUSE, SETTINGS_COMPLETION, SETTINGS_PATHS,
- SETTINGS_POPUPMENU, SETTINGS_QT, SETTINGS_SHORTCUTS };
+ SETTINGS_POPUPMENU, SETTINGS_QT, SETTINGS_SHORTCUTS,
+ SETTINGS_LOCALE };
Q_SIGNALS:
/**
* Emitted when the application has changed its palette due to a KControl request.
*
* Normally, widgets will update their palette automatically, but you
* should connect to this to program special behavior.
*
* Note: If you derive from a QWidget-based class, a faster method is to
* reimplement QWidget::changeEvent() and catch QEvent::PaletteChange.
* This is the preferred way to get informed about palette updates.
*/
void kdisplayPaletteChanged();
/**
* Emitted when the application has changed its GUI style in response to a KControl request.
*
* Normally, widgets will update their styles automatically (as they would
* respond to an explicit setGUIStyle() call), but you should connect to
* this to program special behavior.
*
* Note: If you derive from a QWidget-based class, a faster method is to
* reimplement QWidget::changeEvent() and catch QEvent::StyleChange.
* This is the preferred way to get informed about style updates.
*/
void kdisplayStyleChanged();
/**
* Emitted when the application has changed its font in response to a KControl request.
*
* Normally widgets will update their fonts automatically, but you should
* connect to this to monitor global font changes, especially if you are
* using explicit fonts.
*
* Note: If you derive from a QWidget-based class, a faster method is to
* reimplement QWidget::changeEvent() and catch QEvent::FontChange.
* This is the preferred way to get informed about font updates.
*/
void kdisplayFontChanged();
/**
* Emitted when the application has changed either its GUI style, its font or its palette
* in response to a kdisplay request. Normally, widgets will update their styles
* automatically, but you should connect to this to program special
* behavior.
*/
void appearanceChanged();
/**
* Emitted when the settings for toolbars have been changed. KToolBar will know what to do.
*/
void toolbarAppearanceChanged(int);
/**
* Emitted when the global settings have been changed.
* KGlobalSettings takes care of calling reparseConfiguration on KGlobal::config()
* so that applications/classes using this only have to re-read the configuration
* @param category the category among the SettingsCategory enum.
*/
void settingsChanged(int category);
/**
* Emitted when the global icon settings have been changed.
* @param group the new group
*/
void iconChanged(int group);
/**
* Emitted when the cursor theme has been changed.
*/
void cursorChanged();
/**
* Emitted by BlockShortcuts
*/
void blockShortcuts(int data);
/**
* Emitted when the natural sorting has been changed.
* @since 4.4
*/
void naturalSortingChanged();
private:
friend class KApplication;
KGlobalSettings();
class Private;
Private* const d;
Q_PRIVATE_SLOT(d, void _k_slotNotifyChange(int, int))
};
Q_DECLARE_OPERATORS_FOR_FLAGS(KGlobalSettings::GraphicEffects)
Q_DECLARE_OPERATORS_FOR_FLAGS(KGlobalSettings::ActivateOptions)
#endif

File Metadata

Mime Type
text/x-diff
Expires
Fri, Nov 1, 8:22 AM (1 d, 7 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
10074954
Default Alt Text
(198 KB)

Event Timeline