Skip to content

Commit

Permalink
Use helper variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Emdek committed Jul 3, 2024
1 parent 7a39ba8 commit dccada6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/core/BookmarksModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,7 @@ void BookmarksModel::writeBookmark(QXmlStreamWriter *writer, Bookmark *bookmark)

const QString elementOwner(QLatin1String("http://otter-browser.org/otter-xbel-bookmark"));
const BookmarkType type(bookmark->getType());
const bool isBookmarks(m_mode == BookmarksMode);

switch (type)
{
Expand Down Expand Up @@ -789,7 +790,7 @@ void BookmarksModel::writeBookmark(QXmlStreamWriter *writer, Bookmark *bookmark)
writer->writeAttribute(QLatin1String("modified"), bookmark->getRawData(TimeModifiedRole).toDateTime().toString(Qt::ISODate));
}

if (m_mode == BookmarksMode)
if (isBookmarks)
{
if (bookmark->getRawData(TimeVisitedRole).toDateTime().isValid())
{
Expand All @@ -804,7 +805,7 @@ void BookmarksModel::writeBookmark(QXmlStreamWriter *writer, Bookmark *bookmark)
writer->writeTextElement(QLatin1String("desc"), bookmark->getRawData(DescriptionRole).toString());
}

if (m_mode == BookmarksMode && (!bookmark->getRawData(KeywordRole).toString().isEmpty() || bookmark->getRawData(VisitsRole).toInt() > 0))
if (isBookmarks && (!bookmark->getRawData(KeywordRole).toString().isEmpty() || bookmark->getRawData(VisitsRole).toInt() > 0))
{
writer->writeStartElement(QLatin1String("info"));
writer->writeStartElement(QLatin1String("metadata"));
Expand Down Expand Up @@ -848,7 +849,7 @@ void BookmarksModel::writeBookmark(QXmlStreamWriter *writer, Bookmark *bookmark)
writer->writeTextElement(QLatin1String("desc"), bookmark->getRawData(DescriptionRole).toString());
}

if (m_mode == BookmarksMode && !bookmark->getRawData(KeywordRole).toString().isEmpty())
if (isBookmarks && !bookmark->getRawData(KeywordRole).toString().isEmpty())
{
writer->writeStartElement(QLatin1String("info"));
writer->writeStartElement(QLatin1String("metadata"));
Expand Down

0 comments on commit dccada6

Please sign in to comment.