File indexing completed on 2024-05-12 05:46:31
0001 0002 /* 0003 This file is part of KHelpCenter. 0004 0005 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> 0006 0007 This program is free software; you can redistribute it and/or modify 0008 it under the terms of the GNU General Public License as published by 0009 the Free Software Foundation; either version 2 of the License, or 0010 (at your option) any later version. 0011 0012 This program is distributed in the hope that it will be useful, 0013 but WITHOUT ANY WARRANTY; without even the implied warranty of 0014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0015 GNU General Public License for more details. 0016 0017 You should have received a copy of the GNU General Public License 0018 along with this program; if not, write to the Free Software 0019 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 0020 */ 0021 0022 #ifndef KHC_DOCENTRY_H 0023 #define KHC_DOCENTRY_H 0024 0025 #include <QFileInfo> 0026 #include <QList> 0027 #include <QString> 0028 0029 namespace KHC { 0030 0031 class DocEntry 0032 { 0033 public: 0034 typedef QList<DocEntry *> List; 0035 0036 DocEntry(); 0037 0038 explicit DocEntry( const QString &name, const QString &url = QString(), 0039 const QString &icon = QString() ); 0040 0041 void setName( const QString & ); 0042 QString name() const; 0043 0044 void setSearch( const QString & ); 0045 QString search() const; 0046 0047 void setIcon( const QString & ); 0048 QString icon() const; 0049 0050 void setUrl( const QString & ); 0051 QString url() const; 0052 0053 void setInfo( const QString & ); 0054 QString info() const; 0055 0056 void setLang( const QString & ); 0057 QString lang() const; 0058 0059 void setIdentifier( const QString & ); 0060 QString identifier() const; 0061 0062 void setIndexer( const QString & ); 0063 QString indexer() const; 0064 0065 void setIndexTestFile( const QString & ); 0066 QString indexTestFile() const; 0067 0068 void setWeight( int ); 0069 int weight() const; 0070 0071 void setSearchMethod( const QString & ); 0072 QString searchMethod() const; 0073 0074 void enableSearch( bool enabled ); 0075 bool searchEnabled() const; 0076 0077 void setSearchEnabledDefault( bool enabled ); 0078 bool searchEnabledDefault() const; 0079 0080 void setDocumentType( const QString & ); 0081 QString documentType() const; 0082 0083 void setDirectory( bool ); 0084 bool isDirectory() const; 0085 0086 bool readFromFile( const QFileInfo &fileInfo ); 0087 0088 bool docExists() const; 0089 0090 void addChild( DocEntry * ); 0091 bool hasChildren() const; 0092 DocEntry *firstChild() const; 0093 List children() const; 0094 0095 void setParent( DocEntry * ); 0096 DocEntry *parent() const; 0097 0098 void setNextSibling( DocEntry * ); 0099 DocEntry *nextSibling() const; 0100 0101 QString khelpcenterSpecial() const; 0102 0103 bool isSearchable() const; 0104 0105 void dump() const; 0106 0107 protected: 0108 void init(); 0109 0110 private: 0111 QString mName; 0112 QString mSearch; 0113 QString mIcon; 0114 QString mUrl; 0115 QString mInfo; 0116 QString mLang; 0117 mutable QString mIdentifier; 0118 QString mIndexer; 0119 QString mIndexTestFile; 0120 QString mSearchMethod; 0121 QString mDocumentType; 0122 0123 QString mKhelpcenterSpecial; 0124 0125 List mChildren; 0126 DocEntry *mParent = nullptr; 0127 DocEntry *mNextSibling = nullptr; 0128 0129 int mWeight; 0130 bool mSearchEnabled : 1; 0131 bool mSearchEnabledDefault : 1; 0132 bool mDirectory : 1; 0133 }; 0134 0135 } 0136 0137 #endif //KHC_DOCENTRY_H 0138 // vim:ts=2:sw=2:et