• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDECore

  • sources
  • kde-4.12
  • kdelibs
  • kdecore
  • localization
klocale_mac.cpp
Go to the documentation of this file.
1 /* This file is part of the KDE libraries
2  Copyright (C) 2010 John Layt <john@layt.net>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License as published by the Free Software Foundation; either
7  version 2 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #include "klocale_mac_p.h"
21 #include "kkernel_mac.h"
22 
23 KLocaleMacPrivate::KLocaleMacPrivate(KLocale *q_ptr, const QString &catalog, KSharedConfig::Ptr config)
24  :KLocalePrivate(q_ptr)
25 {
26  // Lock in the current Mac Locale settings
27  m_macLocale = CFLocaleCopyCurrent();
28  init(catalog, QString(), QString(), config, 0);
29 }
30 
31 KLocaleMacPrivate::KLocaleMacPrivate(KLocale *q_ptr, const QString& catalog,
32  const QString &language, const QString &country, KConfig *config)
33  :KLocalePrivate(q_ptr)
34 {
35  // Lock in the current Mac Locale settings
36  m_macLocale = CFLocaleCopyCurrent();
37  init(catalog, language, country, KSharedConfig::Ptr(), config);
38 }
39 
40 KLocaleMacPrivate::KLocaleMacPrivate( const KLocaleMacPrivate &rhs )
41  :KLocalePrivate( rhs )
42 {
43  KLocalePrivate::copy( rhs );
44  m_macLocale = rhs.m_macLocale;
45 }
46 
47 KLocaleMacPrivate &KLocaleMacPrivate::operator=( const KLocaleMacPrivate &rhs )
48 {
49  KLocalePrivate::copy( rhs );
50  m_macLocale = rhs.m_macLocale;
51  return *this;
52 }
53 
54 KLocaleMacPrivate::~KLocaleMacPrivate()
55 {
56 }
57 
58 QString KLocaleMacPrivate::macLocaleValue( CFStringRef key ) const
59 {
60  return convert_CFString_to_QString( CFStringRef( CFLocaleGetValue( m_macLocale, key ) ) );
61 }
62 
63 QString KLocaleMacPrivate::systemCountry() const
64 {
65  return macLocaleValue( kCFLocaleCountryCode );
66 }
67 
68 QByteArray KLocaleMacPrivate::systemCodeset() const
69 {
70  return QByteArray( "UTF-8" );
71 }
72 
73 /*
74 These functions are commented out for now until all required Date/Time functions are implemented
75 to ensure consistent behaviour, i.e. all KDE format or all Mac format, not some invalid mixture
76 
77 QString KLocaleMacPrivate::macDateFormatterValue(CFStringRef key) const
78 {
79  CFDateFormatterRef formatter = CFDateFormatterCreate(kCFAllocatorDefault, m_macLocale, kCFDateFormatterNoStyle, kCFDateFormatterNoStyle);
80  return convert_CFString_to_QString(CFStringRef(CFDateFormatterCopyProperty(formatter, key)));
81 }
82 
83 void KLocaleMacPrivate::initDayPeriods(const KConfigGroup &cg)
84 {
85  QString amText = macDateFormatterValue(kCFDateFormatterAMSymbol);
86  QString pmText = macDateFormatterValue(kCFDateFormatterPMSymbol);
87 
88  m_dayPeriods.clear();
89  m_dayPeriods.append(KDayPeriod("am", amText, amText, amText
90  QTime(0, 0, 0), QTime(11, 59, 59, 999), 0, 12));
91  m_dayPeriods.append(KDayPeriod("pm", pmText, pmText, pmText,
92  QTime(12, 0, 0), QTime(23, 59, 59, 999), 0, 12));
93 }
94 */
KSharedPtr< KSharedConfig >
KLocaleMacPrivate::~KLocaleMacPrivate
virtual ~KLocaleMacPrivate()
Definition: klocale_mac.cpp:54
KLocaleMacPrivate::systemCountry
virtual QString systemCountry() const
Definition: klocale_mac.cpp:63
kkernel_mac.h
KLocalePrivate::init
virtual void init(const QString &catalogName, const QString &language, const QString &country, KSharedConfig::Ptr persistantconfig, KConfig *tempConfig)
Definition: klocale_kde.cpp:229
KLocalePrivate::copy
virtual void copy(const KLocalePrivate &rhs)
Definition: klocale_kde.cpp:139
QString
KGlobal::config
KSharedConfigPtr config()
Returns the general config object.
Definition: kglobal.cpp:138
KLocaleMacPrivate::operator=
KLocaleMacPrivate & operator=(const KLocaleMacPrivate &rhs)
Definition: klocale_mac.cpp:47
klocale_mac_p.h
KLocaleMacPrivate::KLocaleMacPrivate
KLocaleMacPrivate(KLocale *q_ptr, const QString &catalog, KSharedConfig::Ptr config)
Definition: klocale_mac.cpp:23
KLocaleMacPrivate::systemCodeset
virtual QByteArray systemCodeset() const
Definition: klocale_mac.cpp:68
KLocaleMacPrivate
Definition: klocale_mac_p.h:27
KConfig
The central class of the KDE configuration data system.
Definition: kconfig.h:70
KLocale
KLocale provides support for country specific stuff like the national language.
Definition: klocale.h:69
convert_CFString_to_QString
QString convert_CFString_to_QString(CFStringRef str)
qAppFileName() is not public in qt4/mac, so we need to redo it here
Definition: kkernel_mac.cpp:54
KLocalePrivate
Definition: klocale_p.h:34
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:47:08 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDECore

Skip menu "KDECore"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal