2 This file is part of libkdepim.
4 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
5 Copyright (c) 2005 Rafal Rzepecki <divide@users.sourceforge.net>
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA.
23 #include "kpimprefs.h"
29 #include <KStandardDirs>
30 #include <KSystemTimeZone>
41 KPimPrefs::KPimPrefs( const QString
&name
)
42 : KConfigSkeleton( name
)
46 KPimPrefs::KPimPrefs(KPimPrefs
const & other
)
47 : KConfigSkeleton( other
.objectName() )
48 , mCustomCategories( other
.mCustomCategories
)
52 KPimPrefs::~KPimPrefs()
56 void KPimPrefs::usrSetDefaults()
58 setCategoryDefaults();
61 void KPimPrefs::usrReadConfig()
63 KConfigGroup
group( config(), "General" );
64 mCustomCategories
= group
.readEntry( "Custom Categories", QStringList() );
65 if ( mCustomCategories
.isEmpty() ) {
66 setCategoryDefaults();
68 mCustomCategories
.sort();
71 KDateTime::Spec
KPimPrefs::timeSpec()
75 // Read TimeZoneId from korganizerrc.
76 KConfig
korgcfg( KStandardDirs::locate( "config", "korganizerrc" ) );
77 KConfigGroup
group( &korgcfg
, "Time & Date" );
78 QString
tz( group
.readEntry( "TimeZoneId" ) );
79 if ( !tz
.isEmpty() ) {
80 zone
= KSystemTimeZones::zone( tz
);
81 //if ( zone.isValid() ) {
82 // kDebug(5300) << "timezone from korganizerrc is" << tz;
86 // If timezone not found in KOrg, use the system's default timezone.
87 if ( !zone
.isValid() ) {
88 zone
= KSystemTimeZones::local();
89 //if ( zone.isValid() ) {
90 // kDebug(5300) << "system timezone is" << zone.name();
94 return zone
.isValid() ? KDateTime::Spec( zone
) : KDateTime::ClockTime
;
97 void KPimPrefs::usrWriteConfig()
99 KConfigGroup
group( config(), "General" );
100 group
.writeEntry( "Custom Categories", mCustomCategories
);
102 KConfigSkeleton::usrWriteConfig();
105 const QString
KPimPrefs::categorySeparator
= ":";