kio
fileprops.h
Go to the documentation of this file.00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2002 Carsten Pfeiffer <pfeiffer@kde.org> 00003 00004 library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation, version 2. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 */ 00018 00019 #ifndef KFILEPROPS_H 00020 #define KFILEPROPS_H 00021 00022 #include <qstring.h> 00023 00024 #include <kfilemetainfo.h> 00025 00026 class FileProps 00027 { 00028 public: 00029 FileProps( const QString& path, const QStringList& suppliedGroups ); 00030 virtual ~FileProps(); 00031 00032 bool isValid() const; 00033 00034 QString fileName() const { return m_info->path(); } 00035 00036 QStringList supportedGroups() const; 00037 QStringList availableGroups() const; 00038 QStringList translatedGroups(); 00039 00040 const QStringList& groupsToUse() const { return m_groupsToUse; } 00041 bool userSuppliedGroups() const { return m_userSuppliedGroups; } 00042 00043 QStringList supportedKeys( const QString& group ) const; 00044 QStringList availableKeys( const QString& group ) const; 00045 QStringList preferredKeys( const QString& group ) const; 00046 00047 QStringList supportedKeys() const { return m_info->supportedKeys(); } 00048 QStringList preferredKeys() const { return m_info->preferredKeys(); } 00049 00050 QString getValue( const QString& group, const QString& key ) const; 00051 bool setValue( const QString& group, 00052 const QString& key, const QString &value ); 00053 00054 QStringList allValues( const QString& group ) const; 00055 QStringList preferredValues( const QString& group ) const; 00056 00057 bool isReadOnly( const QString& group, const QString& key ); 00058 00059 private: 00060 static QString createKeyValue( const KFileMetaInfoGroup& g, 00061 const QString& key ); 00062 static QStringList createKeyValueList( const KFileMetaInfoGroup&, 00063 const QStringList& ); 00064 bool sync(); 00065 00066 KFileMetaInfo *m_info; 00067 bool m_dirty; 00068 bool m_userSuppliedGroups; 00069 00070 QStringList m_groupsToUse; 00071 00072 }; 00073 00074 #endif // KFILEPROPS_H