mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
fixed regresion adding lists
This commit is contained in:
parent
e8802c2db1
commit
0c667fd9c4
@ -256,12 +256,16 @@ void ReadingListModel::addReadingListAt(const QString &name, const QModelIndex &
|
||||
|
||||
bool ReadingListModel::isEditable(const QModelIndex &mi)
|
||||
{
|
||||
if(!mi.isValid())
|
||||
return false;
|
||||
ListItem * item = static_cast<ListItem*>(mi.internalPointer());
|
||||
return typeid(*item) != typeid(SpecialListItem);
|
||||
}
|
||||
|
||||
bool ReadingListModel::isReadingList(const QModelIndex &mi)
|
||||
{
|
||||
if(!mi.isValid())
|
||||
return false;
|
||||
ListItem * item = static_cast<ListItem*>(mi.internalPointer());
|
||||
return typeid(*item) == typeid(ReadingListItem);
|
||||
}
|
||||
|
@ -1600,7 +1600,9 @@ void LibraryWindow::addNewReadingList()
|
||||
|
||||
if (ok) {
|
||||
QModelIndexList selectedLists = listsView->selectionModel()->selectedIndexes();
|
||||
QModelIndex sourceMI = listsModelProxy->mapToSource(selectedLists.at(0));
|
||||
QModelIndex sourceMI;
|
||||
if(!selectedLists.isEmpty())
|
||||
sourceMI = listsModelProxy->mapToSource(selectedLists.at(0));
|
||||
if(selectedLists.isEmpty() || !listsModel->isReadingList(sourceMI))
|
||||
listsModel->addReadingList(newListName); //top level
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user