Changeset 561 for trunk/demos/browser/xbel.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/demos/browser/xbel.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the demonstration applications of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 134 134 BookmarkNode *root = new BookmarkNode(BookmarkNode::Root); 135 135 setDevice(device); 136 while (!atEnd()) { 137 readNext(); 138 if (isStartElement()) { 139 QString version = attributes().value(QLatin1String("version")).toString(); 140 if (name() == QLatin1String("xbel") 141 && (version.isEmpty() || version == QLatin1String("1.0"))) { 142 readXBEL(root); 143 } else { 144 raiseError(QObject::tr("The file is not an XBEL version 1.0 file.")); 145 } 136 if (readNextStartElement()) { 137 QString version = attributes().value(QLatin1String("version")).toString(); 138 if (name() == QLatin1String("xbel") 139 && (version.isEmpty() || version == QLatin1String("1.0"))) { 140 readXBEL(root); 141 } else { 142 raiseError(QObject::tr("The file is not an XBEL version 1.0 file.")); 146 143 } 147 144 } … … 153 150 Q_ASSERT(isStartElement() && name() == QLatin1String("xbel")); 154 151 155 while (!atEnd()) { 156 readNext(); 157 if (isEndElement()) 158 break; 159 160 if (isStartElement()) { 161 if (name() == QLatin1String("folder")) 162 readFolder(parent); 163 else if (name() == QLatin1String("bookmark")) 164 readBookmarkNode(parent); 165 else if (name() == QLatin1String("separator")) 166 readSeparator(parent); 167 else 168 skipUnknownElement(); 169 } 152 while (readNextStartElement()) { 153 if (name() == QLatin1String("folder")) 154 readFolder(parent); 155 else if (name() == QLatin1String("bookmark")) 156 readBookmarkNode(parent); 157 else if (name() == QLatin1String("separator")) 158 readSeparator(parent); 159 else 160 skipCurrentElement(); 170 161 } 171 162 } … … 178 169 folder->expanded = (attributes().value(QLatin1String("folded")) == QLatin1String("no")); 179 170 180 while (!atEnd()) { 181 readNext(); 182 183 if (isEndElement()) 184 break; 185 186 if (isStartElement()) { 187 if (name() == QLatin1String("title")) 188 readTitle(folder); 189 else if (name() == QLatin1String("desc")) 190 readDescription(folder); 191 else if (name() == QLatin1String("folder")) 192 readFolder(folder); 193 else if (name() == QLatin1String("bookmark")) 194 readBookmarkNode(folder); 195 else if (name() == QLatin1String("separator")) 196 readSeparator(folder); 197 else 198 skipUnknownElement(); 199 } 171 while (readNextStartElement()) { 172 if (name() == QLatin1String("title")) 173 readTitle(folder); 174 else if (name() == QLatin1String("desc")) 175 readDescription(folder); 176 else if (name() == QLatin1String("folder")) 177 readFolder(folder); 178 else if (name() == QLatin1String("bookmark")) 179 readBookmarkNode(folder); 180 else if (name() == QLatin1String("separator")) 181 readSeparator(folder); 182 else 183 skipCurrentElement(); 200 184 } 201 185 } … … 225 209 BookmarkNode *bookmark = new BookmarkNode(BookmarkNode::Bookmark, parent); 226 210 bookmark->url = attributes().value(QLatin1String("href")).toString(); 227 while (!atEnd()) { 228 readNext(); 229 if (isEndElement()) 230 break; 231 232 if (isStartElement()) { 233 if (name() == QLatin1String("title")) 234 readTitle(bookmark); 235 else if (name() == QLatin1String("desc")) 236 readDescription(bookmark); 237 else 238 skipUnknownElement(); 239 } 211 while (readNextStartElement()) { 212 if (name() == QLatin1String("title")) 213 readTitle(bookmark); 214 else if (name() == QLatin1String("desc")) 215 readDescription(bookmark); 216 else 217 skipCurrentElement(); 240 218 } 241 219 if (bookmark->title.isEmpty()) 242 220 bookmark->title = QObject::tr("Unknown title"); 243 }244 245 void XbelReader::skipUnknownElement()246 {247 Q_ASSERT(isStartElement());248 249 while (!atEnd()) {250 readNext();251 252 if (isEndElement())253 break;254 255 if (isStartElement())256 skipUnknownElement();257 }258 221 } 259 222
Note:
See TracChangeset
for help on using the changeset viewer.