bookmarks/xbelreader.h
changeset 9 1d51612454b5
equal deleted inserted replaced
8:6b5f25f057c2 9:1d51612454b5
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 *
       
     5 * This program is free software: you can redistribute it and/or modify
       
     6 * it under the terms of the GNU Lesser General Public License as published by
       
     7 * the Free Software Foundation, version 2.1 of the License.
       
     8 * 
       
     9 * This program is distributed in the hope that it will be useful,
       
    10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12 * GNU Lesser General Public License for more details.
       
    13 *
       
    14 * You should have received a copy of the GNU Lesser General Public License
       
    15 * along with this program.  If not, 
       
    16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
       
    17 *
       
    18 */
       
    19 #ifndef XBELREADER_H
       
    20 #define XBELREADER_H
       
    21 
       
    22 #include <QString>
       
    23 
       
    24 class BookmarksManager;
       
    25 class QXmlStreamReader;
       
    26 class QIODevice;
       
    27 
       
    28 /*
       
    29  * Reads an XBEL file and imports bookmarks
       
    30  * Folders are treated as "tags"
       
    31  * i.e. bookmarks inside folders are imported one at a time and the folder name is added as a tag for that bookmark 
       
    32  */
       
    33 class XbelReader
       
    34 {
       
    35 public: // ctor/dtor
       
    36     XbelReader(BookmarksManager *bmgr);
       
    37     virtual ~XbelReader();
       
    38     
       
    39 public: // members
       
    40     bool read(QIODevice *device);
       
    41     QString errorString() const;
       
    42 
       
    43 private:
       
    44     bool isValidXbel(); 
       
    45     void readXBEL();
       
    46     QString readFolder(QList<QString>& parentFolders);
       
    47     void readBookmark(QList<QString>& parentFolders);
       
    48     void readInfo(QList<QString>& tags);
       
    49     void readMetadata(QList<QString>& tags, QString &owner);
       
    50     void readTags(QList<QString>& tags);
       
    51 
       
    52     BookmarksManager *m_bmgr;
       
    53     QXmlStreamReader *m_xml;
       
    54 };
       
    55 #endif