KDevelop API Documentation

editors/qeditor/qeditor_settings.cpp

Go to the documentation of this file.
00001 /* 00002 * Copyright (C) 2003 Roberto Raggi (roberto@kdevelop.org) 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2 of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Library General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; see the file COPYING.LIB. If not, write to 00016 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00017 * Boston, MA 02111-1307, USA. 00018 * 00019 */ 00020 00021 #include "qeditor_settings.h" 00022 #include "qeditor_factory.h" 00023 00024 #include <kinstance.h> 00025 #include <kconfig.h> 00026 00027 QEditorSettings* QEditorSettings::m_self = 0; 00028 00029 QEditorSettings::QEditorSettings( KConfig* config ) 00030 { 00031 m_config = config; 00032 init(); 00033 } 00034 00035 QEditorSettings::~QEditorSettings() 00036 { 00037 } 00038 00039 void QEditorSettings::init() 00040 { 00041 if( !m_config ) 00042 return; 00043 00044 m_config->setGroup(generalGroup()); 00045 m_wordWrap = m_config->readBoolEntry( "WordWrap", true ); 00046 m_tabStop = m_config->readNumEntry( "TabStop", 8 ); 00047 m_completeWordWithSpace = m_config->readBoolEntry( "CompleteWordWithSpace", false ); 00048 m_parenthesesMatching = m_config->readBoolEntry( "ParenthesesMatching", true ); 00049 m_showMarkers = m_config->readBoolEntry( "ShowMarkers", true ); 00050 m_showLineNumber = m_config->readBoolEntry( "ShowLineNumber", false ); 00051 m_showCodeFoldingMarkers = m_config->readBoolEntry( "ShowCodeFoldingMarkers", true ); 00052 } 00053 00054 QEditorSettings* QEditorSettings::self() 00055 { 00056 if( !m_self ) 00057 m_self = new QEditorSettings( QEditorPartFactory::instance()->config() ); 00058 00059 return m_self; 00060 } 00061 00062 void QEditorSettings::setWordWrap( bool enable ) 00063 { 00064 m_wordWrap = enable; 00065 00066 KConfigGroupSaver cgs( m_config, generalGroup() ); 00067 m_config->writeEntry( "WordWrap", m_wordWrap ); 00068 m_config->sync(); 00069 } 00070 00071 void QEditorSettings::setTabStop( int tabStop ) 00072 { 00073 m_tabStop = tabStop; 00074 00075 KConfigGroupSaver cgs( m_config, generalGroup() ); 00076 m_config->writeEntry( "TabStop", m_tabStop ); 00077 m_config->sync(); 00078 } 00079 00080 void QEditorSettings::setCompleteWordWithSpace( bool enable ) 00081 { 00082 m_completeWordWithSpace = enable; 00083 00084 KConfigGroupSaver cgs( m_config, generalGroup() ); 00085 m_config->writeEntry( "CompleteWordWithSpace", m_completeWordWithSpace ); 00086 m_config->sync(); 00087 } 00088 00089 void QEditorSettings::setParenthesesMatching( bool enable ) 00090 { 00091 m_parenthesesMatching = enable; 00092 00093 KConfigGroupSaver cgs( m_config, generalGroup() ); 00094 m_config->writeEntry( "ParenthesesMatching", m_parenthesesMatching ); 00095 m_config->sync(); 00096 } 00097 00098 void QEditorSettings::setShowMarkers( bool enable ) 00099 { 00100 m_showMarkers = enable; 00101 00102 KConfigGroupSaver cgs( m_config, generalGroup() ); 00103 m_config->writeEntry( "ShowMarkers", m_showMarkers ); 00104 m_config->sync(); 00105 } 00106 00107 void QEditorSettings::setShowLineNumber( bool enable ) 00108 { 00109 m_showLineNumber = enable; 00110 00111 KConfigGroupSaver cgs( m_config, generalGroup() ); 00112 m_config->writeEntry( "ShowLineNumber", m_showLineNumber ); 00113 m_config->sync(); 00114 } 00115 00116 void QEditorSettings::setShowCodeFoldingMarkers( bool enable ) 00117 { 00118 m_showCodeFoldingMarkers = enable; 00119 00120 KConfigGroupSaver cgs( m_config, generalGroup() ); 00121 m_config->writeEntry( "ShowCodeFoldingMarkers", m_showCodeFoldingMarkers ); 00122 m_config->sync(); 00123 } 00124
KDE Logo
This file is part of the documentation for KDevelop Version 3.0.4.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Oct 6 17:38:56 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003