1
/***************************************************************************
2
* This file is part of Saaghar, a Persian poetry software *
4
* Copyright (C) 2010-2014 by S. Razi Alavizadeh *
5
* E-Mail: <s.r.alavizadeh@gmail.com>, WWW: <http://pozh.org> *
7
* Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). *
8
* All rights reserved. *
9
* Contact: Nokia Corporation (qt-info@nokia.com) *
11
* This file is part of the examples of the Qt Toolkit. *
13
* $QT_BEGIN_LICENSE:BSD$ *
14
* You may use this file under the terms of the BSD license as follows: *
16
* "Redistribution and use in source and binary forms, with or without *
17
* modification, are permitted provided that the following conditions are *
19
* * Redistributions of source code must retain the above copyright *
20
* notice, this list of conditions and the following disclaimer. *
21
* * Redistributions in binary form must reproduce the above copyright *
22
* notice, this list of conditions and the following disclaimer in *
23
* the documentation and/or other materials provided with the *
25
* * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor *
26
* the names of its contributors may be used to endorse or promote *
27
* products derived from this software without specific prior written *
30
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
31
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
32
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
33
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT *
34
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
35
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
36
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
37
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
38
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
39
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *
40
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." *
43
***************************************************************************/
48
#include <QDomDocument>
51
#include <QTreeWidget>
53
class Bookmarks : public QTreeWidget
58
Bookmarks(QWidget* parent = 0);
60
bool read(QIODevice* device);
61
bool write(QIODevice* device);
62
bool updateBookmarkState(const QString &type, const QVariant &data, bool state);
63
QStringList bookmarkList(const QString &type);
64
void insertBookmarkList(const QVariantList &list);
67
bool unBookmarkItem(QTreeWidgetItem* item = 0);
68
void doubleClicked(QTreeWidgetItem* item, int column);
69
void updateDomElement(QTreeWidgetItem* item, int column);
70
void filterItems(const QString &str);
73
QDomElement findChildNode(const QString &tagName, const QString &type);
74
void parseFolderElement(const QDomElement &element,
75
QTreeWidgetItem* parentItem = 0, const QString &elementID = QString());
76
QTreeWidgetItem* createItem(const QDomElement &element,
77
QTreeWidgetItem* parentItem = 0, const QString &elementID = QString());
79
QDomDocument m_domDocument;
80
QHash<QTreeWidgetItem*, QDomElement> m_domElementForItem;
85
void showBookmarkedItem(const QString &, const QString &, const QString &, bool, bool);