3 Copyright (c) 2005 by Volker Krause <vkrause@kde.org>
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
17 #include "knglobals.h"
18 #include "utilities.h"
21 #include <KPIMIdentities/Identity>
22 #include <KPIMIdentities/IdentityManager>
23 #include <kstandarddirs.h>
25 #include <QTextStream>
28 KNode::Settings::Settings() : SettingsBase()
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") );
36 void KNode::Settings::usrReadConfig( )
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
) ) {
46 mXHeaders
.append( XHeader( ts
.readLine() ) );
52 void KNode::Settings::usrWriteConfig( )
54 // write extra header configuration
55 QString dir
= KStandardDirs::locateLocal( "data", "knode/" );
57 KNHelper::displayInternalFileError();
59 QFile
f( dir
+ "xheaders" );
60 if ( f
.open( QIODevice::WriteOnly
) ) {
62 for ( XHeader::List::Iterator it
= mXHeaders
.begin(); it
!= mXHeaders
.end(); ++it
)
63 ts
<< (*it
).header() << "\n";
67 KNHelper::displayInternalFileError();
71 QColor
KNode::Settings::effectiveColor( KConfigSkeleton::ItemColor
* item
) const
73 if ( useCustomColors() )
76 QColor rv
= item
->value();
81 QFont
KNode::Settings::effectiveFont( KConfigSkeleton::ItemFont
* item
) const
83 if ( useCustomFonts() )
86 QFont rv
= item
->value();
91 const KPIMIdentities::Identity
& KNode::Settings::identity() const
93 return KNGlobals::self()->identityManager()->identityForUoidOrDefault( SettingsBase::identity() );
96 void KNode::Settings::setIdentity( const KPIMIdentities::Identity
&identity
)
98 SettingsBase::setIdentity( identity
.uoid() );