KDECore
kmimetype_p.h
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries 00002 * Copyright (C) 1999 Waldo Bastian <bastian@kde.org> 00003 * David Faure <faure@kde.org> 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License version 2 as published by the Free Software Foundation; 00008 * 00009 * This library 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 Library General Public License 00015 * along with this library; see the file COPYING.LIB. If not, write to 00016 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 * Boston, MA 02110-1301, USA. 00018 **/ 00019 #ifndef __kmimetype_p_h__ 00020 #define __kmimetype_p_h__ 00021 00022 #include "kservicetype_p.h" 00023 00024 class KMimeTypePrivate: public KServiceTypePrivate 00025 { 00026 public: 00027 K_SYCOCATYPE( KST_KMimeType, KServiceTypePrivate ) 00028 00029 KMimeTypePrivate(const QString &path) : KServiceTypePrivate(path), m_xmlDataLoaded(false) 00030 {} 00031 KMimeTypePrivate(QDataStream &_str, int offset) 00032 : KServiceTypePrivate(_str, offset), m_xmlDataLoaded(false) 00033 { 00034 } 00035 00036 virtual void save(QDataStream &s); 00037 00038 virtual QVariant property(const QString &name ) const; 00039 00040 virtual QStringList propertyNames() const; 00041 00042 virtual QString comment(const KUrl & = KUrl()) const 00043 { 00044 ensureXmlDataLoaded(); 00045 return m_strComment; 00046 } 00047 00048 // virtual because reimplemented in KFolderMimeType 00049 virtual QString iconName(const KUrl &) const 00050 { 00051 ensureXmlDataLoaded(); 00052 if (!m_iconName.isEmpty()) 00053 return m_iconName; 00054 00055 // Make default icon name from the mimetype name 00056 // Don't store this in m_iconName, it would make the filetype editor 00057 // write out icon names in every local mimetype definition file. 00058 QString icon = name(); 00059 const int slashindex = icon.indexOf(QLatin1Char('/')); 00060 if (slashindex != -1) { 00061 icon[slashindex] = QLatin1Char('-'); 00062 } 00063 return icon; 00064 } 00065 00066 bool inherits(const QString& mime) const; 00067 void ensureXmlDataLoaded() const; 00068 virtual int serviceOffersOffset() const; 00069 00070 mutable QStringList m_lstPatterns; 00071 mutable QString m_iconName; // user-specified 00072 mutable bool m_xmlDataLoaded; 00073 }; 00074 00075 #endif // __kmimetype_p_h__
KDE 4.6 API Reference