From 2eca217251bba86e261fb05d403b09137538d934 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Thu, 4 Dec 2014 12:11:47 +0100 Subject: [PATCH] fixed reading lists loading/setup --- YACReaderLibrary/db/reading_list_model.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/YACReaderLibrary/db/reading_list_model.cpp b/YACReaderLibrary/db/reading_list_model.cpp index 02333ec1..76d79acf 100644 --- a/YACReaderLibrary/db/reading_list_model.cpp +++ b/YACReaderLibrary/db/reading_list_model.cpp @@ -393,7 +393,7 @@ void ReadingListModel::setupReadingListsData(QSqlQuery &sqlquery, ReadingListIte else currentParent = items.value(record.value("parentId").toULongLong()); - parent->appendChild(rli); + currentParent->appendChild(rli); items.insert(rli->getId(),rli); } @@ -447,7 +447,7 @@ void ReadingListModel::setupReadingLists(QSqlDatabase & db) //setup root item rootItem = new ReadingListItem(QList() << "ROOT" << 0 << true << false); - QSqlQuery selectQuery("select * from reading_list order by parentId,name",db); + QSqlQuery selectQuery("select * from reading_list order by parentId IS NULL DESC",db); //setup reading lists setupReadingListsData(selectQuery,rootItem);