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

korganizer

  • sources
  • kde-4.12
  • kdepim
  • korganizer
koprefs.cpp
Go to the documentation of this file.
1 /*
2  This file is part of KOrganizer.
3 
4  Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org>
5  Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
6 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or
10  (at your option) any later version.
11 
12  This program 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
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License along
18  with this program; if not, write to the Free Software Foundation, Inc.,
19  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 
21  As a special exception, permission is given to link this program
22  with any edition of Qt, and distribute the resulting executable,
23  without including the source code for Qt in the source distribution.
24 */
25 
26 #include "koprefs.h"
27 
28 #include <KGlobalSettings>
29 
30 #include <QDir>
31 
32 class KOPrefsPrivate
33 {
34  public:
35  KOPrefsPrivate() : prefs( new KOPrefs ) {}
36  ~KOPrefsPrivate() { delete prefs; }
37  KOPrefs *prefs;
38 };
39 
40 K_GLOBAL_STATIC( KOPrefsPrivate, sInstance )
41 
42 KOPrefs::KOPrefs() : KOPrefsBase()
43 {
44  KGlobal::locale()->insertCatalog( QLatin1String("calendarsupport") );
45 
46  mEventViewsPrefs = EventViews::PrefsPtr( new EventViews::Prefs( this ) );
47 
48  mDefaultMonthViewFont = KGlobalSettings::generalFont();
49  // make it a bit smaller
50  mDefaultMonthViewFont.setPointSize(
51  qMax( mDefaultMonthViewFont.pointSize() - 2, 6 ) );
52 
53  KConfigSkeleton::setCurrentGroup( QLatin1String("General") );
54 
55  // writes into mHtmlExportFile
56  addItemPath( QLatin1String("Html Export File"), mHtmlExportFile,
57  QDir::homePath() + QLatin1Char('/') + i18nc( "Default export file", "calendar.html" ) );
58 
59  monthViewFontItem()->setDefaultValue( mDefaultMonthViewFont );
60 }
61 
62 KOPrefs::~KOPrefs()
63 {
64  kDebug();
65  mEventViewsPrefs->writeConfig();
66 }
67 
68 KOPrefs *KOPrefs::instance()
69 {
70  if ( !sInstance.exists() ) {
71  sInstance->prefs->readConfig();
72  sInstance->prefs->mEventViewsPrefs->readConfig();
73  }
74 
75  return sInstance->prefs;
76 }
77 
78 void KOPrefs::usrSetDefaults()
79 {
80  setMonthViewFont( mDefaultMonthViewFont );
81 
82  KConfigSkeleton::usrSetDefaults();
83 }
84 
85 void KOPrefs::usrReadConfig()
86 {
87  KConfigGroup generalConfig( config(), "General" );
88 
89  KConfigGroup timeScaleConfig( config(), "Timescale" );
90  setTimeScaleTimezones( timeScaleConfig.readEntry( "Timescale Timezones", QStringList() ) );
91 
92  KConfigSkeleton::usrReadConfig();
93 }
94 
95 void KOPrefs::usrWriteConfig()
96 {
97  KConfigGroup generalConfig( config(), "General" );
98 
99  KConfigGroup timeScaleConfig( config(), "Timescale" );
100  timeScaleConfig.writeEntry( "Timescale Timezones", timeScaleTimezones() );
101 
102  KConfigSkeleton::usrWriteConfig();
103 }
104 
105 void KOPrefs::setResourceColor ( const QString &cal, const QColor &color )
106 {
107  return mEventViewsPrefs->setResourceColor( cal, color );
108 }
109 
110 QColor KOPrefs::resourceColor( const QString &cal )
111 {
112  return mEventViewsPrefs->resourceColor( cal );
113 }
114 
115 QStringList KOPrefs::timeScaleTimezones() const
116 {
117  return mTimeScaleTimeZones;
118 }
119 
120 void KOPrefs::setTimeScaleTimezones( const QStringList &list )
121 {
122  mTimeScaleTimeZones = list;
123 }
124 
125 void KOPrefs::setHtmlExportFile( const QString &fileName )
126 {
127  mHtmlExportFile = fileName;
128 }
129 
130 QString KOPrefs::htmlExportFile() const
131 {
132  return mHtmlExportFile;
133 }
134 
135 EventViews::PrefsPtr KOPrefs::eventViewsPreferences() const
136 {
137  return mEventViewsPrefs;
138 }
KOPrefs::setTimeScaleTimezones
void setTimeScaleTimezones(const QStringList &list)
Definition: koprefs.cpp:120
KOPrefs::setResourceColor
void setResourceColor(const QString &, const QColor &)
Definition: koprefs.cpp:105
KOPrefs::eventViewsPreferences
EventViews::PrefsPtr eventViewsPreferences() const
Definition: koprefs.cpp:135
KOPrefs::usrSetDefaults
void usrSetDefaults()
Set preferences to default values.
Definition: koprefs.cpp:78
KOPrefs::htmlExportFile
QString htmlExportFile() const
Definition: koprefs.cpp:130
KOPrefs
Definition: koprefs.h:33
KOPrefs::~KOPrefs
virtual ~KOPrefs()
Definition: koprefs.cpp:62
koprefs.h
KOPrefs::timeScaleTimezones
QStringList timeScaleTimezones() const
Definition: koprefs.cpp:115
KOPrefsBase::setMonthViewFont
void setMonthViewFont(const QFont &v)
Set Month view.
Definition: koprefs_base.h:1218
KOPrefsBase
Definition: koprefs_base.h:11
KOPrefs::instance
static KOPrefs * instance()
Get instance of KOPrefs.
Definition: koprefs.cpp:68
KOPrefs::setHtmlExportFile
void setHtmlExportFile(const QString &fileName)
Definition: koprefs.cpp:125
KOPrefs::usrWriteConfig
void usrWriteConfig()
Write preferences to config file.
Definition: koprefs.cpp:95
KOPrefs::resourceColor
QColor resourceColor(const QString &)
Definition: koprefs.cpp:110
KOPrefs::usrReadConfig
void usrReadConfig()
Read preferences from config file.
Definition: koprefs.cpp:85
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:56:19 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

korganizer

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

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

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