mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -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)
|
bool ReadingListModel::isEditable(const QModelIndex &mi)
|
||||||
{
|
{
|
||||||
|
if(!mi.isValid())
|
||||||
|
return false;
|
||||||
ListItem * item = static_cast<ListItem*>(mi.internalPointer());
|
ListItem * item = static_cast<ListItem*>(mi.internalPointer());
|
||||||
return typeid(*item) != typeid(SpecialListItem);
|
return typeid(*item) != typeid(SpecialListItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ReadingListModel::isReadingList(const QModelIndex &mi)
|
bool ReadingListModel::isReadingList(const QModelIndex &mi)
|
||||||
{
|
{
|
||||||
|
if(!mi.isValid())
|
||||||
|
return false;
|
||||||
ListItem * item = static_cast<ListItem*>(mi.internalPointer());
|
ListItem * item = static_cast<ListItem*>(mi.internalPointer());
|
||||||
return typeid(*item) == typeid(ReadingListItem);
|
return typeid(*item) == typeid(ReadingListItem);
|
||||||
}
|
}
|
||||||
|
@ -1600,7 +1600,9 @@ void LibraryWindow::addNewReadingList()
|
|||||||
|
|
||||||
if (ok) {
|
if (ok) {
|
||||||
QModelIndexList selectedLists = listsView->selectionModel()->selectedIndexes();
|
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))
|
if(selectedLists.isEmpty() || !listsModel->isReadingList(sourceMI))
|
||||||
listsModel->addReadingList(newListName); //top level
|
listsModel->addReadingList(newListName); //top level
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user