2
* Copyright (C) 2003 Roberto Raggi (roberto@kdevelop.org)
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU 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.
9
* This program 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.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; see the file COPYING.LIB. If not, write to
16
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17
* Boston, MA 02111-1307, USA.
21
#include "qeditor_settings.h"
22
#include "qeditor_factory.h"
24
#include <kinstance.h>
27
QEditorSettings* QEditorSettings::m_self = 0;
29
QEditorSettings::QEditorSettings( KConfig* config )
35
QEditorSettings::~QEditorSettings()
39
void QEditorSettings::init()
44
m_config->setGroup(generalGroup());
45
m_wordWrap = m_config->readBoolEntry( "WordWrap", true );
46
m_tabStop = m_config->readNumEntry( "TabStop", 8 );
47
m_completeWordWithSpace = m_config->readBoolEntry( "CompleteWordWithSpace", false );
48
m_parenthesesMatching = m_config->readBoolEntry( "ParenthesesMatching", true );
49
m_showMarkers = m_config->readBoolEntry( "ShowMarkers", true );
50
m_showLineNumber = m_config->readBoolEntry( "ShowLineNumber", false );
51
m_showCodeFoldingMarkers = m_config->readBoolEntry( "ShowCodeFoldingMarkers", true );
54
QEditorSettings* QEditorSettings::self()
57
m_self = new QEditorSettings( QEditorPartFactory::instance()->config() );
62
void QEditorSettings::setWordWrap( bool enable )
66
KConfigGroupSaver cgs( m_config, generalGroup() );
67
m_config->writeEntry( "WordWrap", m_wordWrap );
71
void QEditorSettings::setTabStop( int tabStop )
75
KConfigGroupSaver cgs( m_config, generalGroup() );
76
m_config->writeEntry( "TabStop", m_tabStop );
80
void QEditorSettings::setCompleteWordWithSpace( bool enable )
82
m_completeWordWithSpace = enable;
84
KConfigGroupSaver cgs( m_config, generalGroup() );
85
m_config->writeEntry( "CompleteWordWithSpace", m_completeWordWithSpace );
89
void QEditorSettings::setParenthesesMatching( bool enable )
91
m_parenthesesMatching = enable;
93
KConfigGroupSaver cgs( m_config, generalGroup() );
94
m_config->writeEntry( "ParenthesesMatching", m_parenthesesMatching );
98
void QEditorSettings::setShowMarkers( bool enable )
100
m_showMarkers = enable;
102
KConfigGroupSaver cgs( m_config, generalGroup() );
103
m_config->writeEntry( "ShowMarkers", m_showMarkers );
107
void QEditorSettings::setShowLineNumber( bool enable )
109
m_showLineNumber = enable;
111
KConfigGroupSaver cgs( m_config, generalGroup() );
112
m_config->writeEntry( "ShowLineNumber", m_showLineNumber );
116
void QEditorSettings::setShowCodeFoldingMarkers( bool enable )
118
m_showCodeFoldingMarkers = enable;
120
KConfigGroupSaver cgs( m_config, generalGroup() );
121
m_config->writeEntry( "ShowCodeFoldingMarkers", m_showCodeFoldingMarkers );