Kate
kateextendedattribute.cpp
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2003, 2004 Anders Lund <anders@alweb.dk> 00003 Copyright (C) 2003, 2005 Hamish Rodda <rodda@kde.org> 00004 Copyright (C) 2001,2002 Joseph Wenninger <jowenn@kde.org> 00005 Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org> 00006 Copyright (C) 1999 Jochen Wilhelmy <digisnap@cs.tu-berlin.de> 00007 00008 This library is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU Library General Public 00010 License version 2 as published by the Free Software Foundation. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Library General Public License for more details. 00016 00017 You should have received a copy of the GNU Library General Public License 00018 along with this library; see the file COPYING.LIB. If not, write to 00019 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00020 Boston, MA 02110-1301, USA. 00021 */ 00022 00023 #include "kateextendedattribute.h" 00024 00025 #include <ktexteditor/highlightinterface.h> 00026 00027 KateExtendedAttribute::KateExtendedAttribute(const QString& name, int defaultStyleIndex) 00028 { 00029 setName(name); 00030 setDefaultStyleIndex(defaultStyleIndex); 00031 setPerformSpellchecking(true); 00032 } 00033 00034 int KateExtendedAttribute::indexForStyleName( const QString & name ) 00035 { 00036 if (name=="dsNormal") return KTextEditor::HighlightInterface::dsNormal; 00037 else if (name=="dsKeyword") return KTextEditor::HighlightInterface::dsKeyword; 00038 else if (name=="dsDataType") return KTextEditor::HighlightInterface::dsDataType; 00039 else if (name=="dsDecVal") return KTextEditor::HighlightInterface::dsDecVal; 00040 else if (name=="dsBaseN") return KTextEditor::HighlightInterface::dsBaseN; 00041 else if (name=="dsFloat") return KTextEditor::HighlightInterface::dsFloat; 00042 else if (name=="dsChar") return KTextEditor::HighlightInterface::dsChar; 00043 else if (name=="dsString") return KTextEditor::HighlightInterface::dsString; 00044 else if (name=="dsComment") return KTextEditor::HighlightInterface::dsComment; 00045 else if (name=="dsOthers") return KTextEditor::HighlightInterface::dsOthers; 00046 else if (name=="dsAlert") return KTextEditor::HighlightInterface::dsAlert; 00047 else if (name=="dsFunction") return KTextEditor::HighlightInterface::dsFunction; 00048 else if (name=="dsRegionMarker") return KTextEditor::HighlightInterface::dsRegionMarker; 00049 else if (name=="dsError") return KTextEditor::HighlightInterface::dsError; 00050 00051 return KTextEditor::HighlightInterface::dsNormal; 00052 } 00053 00054 QString KateExtendedAttribute::name( ) const 00055 { 00056 return stringProperty(AttributeName); 00057 } 00058 00059 void KateExtendedAttribute::setName( const QString & name ) 00060 { 00061 setProperty(AttributeName, name); 00062 } 00063 00064 bool KateExtendedAttribute::isDefaultStyle( ) const 00065 { 00066 return hasProperty(AttributeDefaultStyleIndex); 00067 } 00068 00069 int KateExtendedAttribute::defaultStyleIndex( ) const 00070 { 00071 return intProperty(AttributeDefaultStyleIndex); 00072 } 00073 00074 void KateExtendedAttribute::setDefaultStyleIndex( int index ) 00075 { 00076 setProperty(AttributeDefaultStyleIndex, QVariant(index)); 00077 } 00078 00079 bool KateExtendedAttribute::performSpellchecking( ) const 00080 { 00081 return boolProperty(Spellchecking); 00082 } 00083 00084 void KateExtendedAttribute::setPerformSpellchecking(bool spellchecking) 00085 { 00086 setProperty(Spellchecking, QVariant(spellchecking)); 00087 }
KDE 4.6 API Reference