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

knode

  • sources
  • kde-4.12
  • kdepim
  • knode
settings.cpp
Go to the documentation of this file.
1 
2 /*
3  Copyright (c) 2005 by Volker Krause <vkrause@kde.org>
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  You should have received a copy of the GNU General Public License
10  along with this program; if not, write to the Free Software Foundation,
11  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US
12 */
13 
14 #include "settings.h"
15 
16 #include "knconfig.h"
17 #include "knglobals.h"
18 #include "utilities.h"
19 
20 #include <klocale.h>
21 #include <KPIMIdentities/Identity>
22 #include <KPIMIdentities/IdentityManager>
23 #include <kstandarddirs.h>
24 #include <QFile>
25 #include <QTextStream>
26 
27 
28 KNode::Settings::Settings() : SettingsBase()
29 {
30  // KConfigXT doesn't seem to support labels for parameterized fields
31  quoteColorItem( 0 )->setLabel( i18n("Quoted Text - First level") );
32  quoteColorItem( 1 )->setLabel( i18n("Quoted Text - Second level") );
33  quoteColorItem( 2 )->setLabel( i18n("Quoted Text - Third level") );
34 }
35 
36 void KNode::Settings::usrReadConfig( )
37 {
38  // read extra header configuration
39  QString dir = KStandardDirs::locateLocal( "data", "knode/" );
40  if ( !dir.isNull() ) {
41  QFile f( dir + "xheaders" );
42  if ( f.open( QIODevice::ReadOnly ) ) {
43  mXHeaders.clear();
44  QTextStream ts( &f );
45  while ( !ts.atEnd() )
46  mXHeaders.append( XHeader( ts.readLine() ) );
47  f.close();
48  }
49  }
50 }
51 
52 void KNode::Settings::usrWriteConfig( )
53 {
54  // write extra header configuration
55  QString dir = KStandardDirs::locateLocal( "data", "knode/" );
56  if ( dir.isNull() )
57  KNHelper::displayInternalFileError();
58  else {
59  QFile f( dir + "xheaders" );
60  if ( f.open( QIODevice::WriteOnly ) ) {
61  QTextStream ts( &f );
62  for ( XHeader::List::Iterator it = mXHeaders.begin(); it != mXHeaders.end(); ++it )
63  ts << (*it).header() << "\n";
64  ts.flush();
65  f.close();
66  } else
67  KNHelper::displayInternalFileError();
68  }
69 }
70 
71 QColor KNode::Settings::effectiveColor( KConfigSkeleton::ItemColor * item ) const
72 {
73  if ( useCustomColors() )
74  return item->value();
75  item->swapDefault();
76  QColor rv = item->value();
77  item->swapDefault();
78  return rv;
79 }
80 
81 QFont KNode::Settings::effectiveFont( KConfigSkeleton::ItemFont * item ) const
82 {
83  if ( useCustomFonts() )
84  return item->value();
85  item->swapDefault();
86  QFont rv = item->value();
87  item->swapDefault();
88  return rv;
89 }
90 
91 const KPIMIdentities::Identity & KNode::Settings::identity() const
92 {
93  return KNGlobals::self()->identityManager()->identityForUoidOrDefault( SettingsBase::identity() );
94 }
95 
96 void KNode::Settings::setIdentity( const KPIMIdentities::Identity &identity )
97 {
98  SettingsBase::setIdentity( identity.uoid() );
99 }
KNode::Settings::effectiveFont
QFont effectiveFont(KConfigSkeleton::ItemFont *item) const
Returns the effective font value of the given config item.
Definition: settings.cpp:81
utilities.h
KNGlobals::self
static KNGlobals * self()
Return the KNGlobals instance.
Definition: knglobals.cpp:72
KNode::SettingsBase::quoteColorItem
ItemColor * quoteColorItem(int i)
Get Item object corresponding to quoteColor()
Definition: settings_base.h:1470
KNode::Settings::setIdentity
virtual void setIdentity(const KPIMIdentities::Identity &identity)
Sets the global identity.
Definition: settings.cpp:96
KNode::Settings::effectiveColor
QColor effectiveColor(KConfigSkeleton::ItemColor *item) const
Returns the effective color value of the given config item.
Definition: settings.cpp:71
KNode::Settings::usrWriteConfig
virtual void usrWriteConfig()
Reimplemented from KConfigSkeleton.
Definition: settings.cpp:52
KNGlobals::identityManager
KPIMIdentities::IdentityManager * identityManager()
Returns the identity manager.
Definition: knglobals.cpp:167
KNode::SettingsBase
Definition: settings_base.h:18
KNode::Settings::Settings
Settings()
Create a new Settings object.
Definition: settings.cpp:28
KNHelper::displayInternalFileError
static void displayInternalFileError(QWidget *w=0)
use this for all internal files
Definition: utilities.cpp:344
KNode::Settings::identity
virtual const KPIMIdentities::Identity & identity() const
Returns the global identity (or the default one when none is set yet).
Definition: settings.cpp:91
KNode::Settings::usrReadConfig
virtual void usrReadConfig()
Reimplemented from KConfigSkeleton.
Definition: settings.cpp:36
knglobals.h
KNode::SettingsBase::identity
int identity() const
Get identity.
Definition: settings_base.h:37
settings.h
KNode::SettingsBase::setIdentity
void setIdentity(int v)
Set identity.
Definition: settings_base.h:28
knconfig.h
KNode::XHeader
Represents an additional header added by the composer.
Definition: knconfig.h:104
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:58:36 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

knode

Skip menu "knode"
  • Main Page
  • Namespace List
  • 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