XBEL stream reader: shuffle order of functions
Put readBookmark() first of the constituent parts, as it's the most intelligible (albeit currently undocumented) and gives some clue to the purpose of readTitle(), which is next. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: I91d3d6bf8adc3f3001c90274bb62a9da6bf05362 Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
This commit is contained in:
parent
de9e978532
commit
b610c7aa89
@ -67,6 +67,24 @@ void XbelReader::readXBEL()
|
||||
}
|
||||
//! [3]
|
||||
|
||||
void XbelReader::readBookmark(QTreeWidgetItem *item)
|
||||
{
|
||||
Q_ASSERT(xml.isStartElement() && xml.name() == "bookmark"_L1);
|
||||
|
||||
QTreeWidgetItem *bookmark = createChildItem(item);
|
||||
bookmark->setFlags(bookmark->flags() | Qt::ItemIsEditable);
|
||||
bookmark->setIcon(0, bookmarkIcon);
|
||||
bookmark->setText(0, QObject::tr("Unknown title"));
|
||||
bookmark->setText(1, xml.attributes().value("href"_L1).toString());
|
||||
|
||||
while (xml.readNextStartElement()) {
|
||||
if (xml.name() == "title"_L1)
|
||||
readTitle(bookmark);
|
||||
else
|
||||
xml.skipCurrentElement();
|
||||
}
|
||||
}
|
||||
|
||||
//! [4]
|
||||
void XbelReader::readTitle(QTreeWidgetItem *item)
|
||||
{
|
||||
@ -109,24 +127,6 @@ void XbelReader::readFolder(QTreeWidgetItem *item)
|
||||
}
|
||||
}
|
||||
|
||||
void XbelReader::readBookmark(QTreeWidgetItem *item)
|
||||
{
|
||||
Q_ASSERT(xml.isStartElement() && xml.name() == "bookmark"_L1);
|
||||
|
||||
QTreeWidgetItem *bookmark = createChildItem(item);
|
||||
bookmark->setFlags(bookmark->flags() | Qt::ItemIsEditable);
|
||||
bookmark->setIcon(0, bookmarkIcon);
|
||||
bookmark->setText(0, QObject::tr("Unknown title"));
|
||||
bookmark->setText(1, xml.attributes().value("href"_L1).toString());
|
||||
|
||||
while (xml.readNextStartElement()) {
|
||||
if (xml.name() == "title"_L1)
|
||||
readTitle(bookmark);
|
||||
else
|
||||
xml.skipCurrentElement();
|
||||
}
|
||||
}
|
||||
|
||||
QTreeWidgetItem *XbelReader::createChildItem(QTreeWidgetItem *item)
|
||||
{
|
||||
QTreeWidgetItem *childItem = item ? new QTreeWidgetItem(item) : new QTreeWidgetItem(treeWidget);
|
||||
|
Loading…
Reference in New Issue
Block a user