File indexing completed on 2024-04-21 04:04:44
0001 /* 0002 * privacylist.h 0003 * Copyright (C) 2006 Remko Troncon 0004 * 0005 * This program is free software; you can redistribute it and/or 0006 * modify it under the terms of the GNU General Public License 0007 * as published by the Free Software Foundation; either version 2 0008 * of the License, or (at your option) any later version. 0009 * 0010 * This program is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 * GNU General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU General Public License 0016 * along with this library; if not, write to the Free Software 0017 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 0018 * 02110-1301, USA 0019 * 0020 */ 0021 0022 #ifndef PRIVACYLIST_H 0023 #define PRIVACYLIST_H 0024 0025 #include <QList> 0026 #include <QString> 0027 0028 #include "privacylistitem.h" 0029 0030 class QDomElement; 0031 class QDomDocument; 0032 0033 class PrivacyList 0034 { 0035 public: 0036 PrivacyList(const QString& name, const QList<PrivacyListItem>& items = QList<PrivacyListItem>()); 0037 PrivacyList(const QDomElement&); 0038 0039 const QString& name() const { return name_; } 0040 void setName(const QString& name) { name_ = name; } 0041 bool isEmpty() const { return items_.isEmpty(); } 0042 void clear() { items_.clear(); } 0043 const QList<PrivacyListItem>& items() const { return items_; } 0044 const PrivacyListItem& item(int index) const { return items_.at(index); } 0045 void removeItem(int index) { items_.removeAt(index); } 0046 void insertItem(int index, const PrivacyListItem& item); 0047 bool moveItemUp(int index); 0048 bool moveItemDown(int index); 0049 bool onlyBlockItems() const; 0050 void updateItem(int index, const PrivacyListItem& item); 0051 QDomElement toXml(QDomDocument&) const; 0052 void fromXml(const QDomElement& e); 0053 QString toString() const; 0054 0055 private: 0056 void reNumber(); 0057 QString name_; 0058 QList<PrivacyListItem> items_; 0059 }; 0060 0061 #endif