mirror of
https://github.com/YACReader/yacreader
synced 2025-07-23 07:24:58 -04:00
new folders are selected automatically after creation
fixed a couple of bugs in TreeModel::addFolderAtParent
This commit is contained in:
@ -622,7 +622,7 @@ void TreeModel::fetchMoreFromDB(const QModelIndex &parent)
|
|||||||
QSqlDatabase::removeDatabase(_databasePath);
|
QSqlDatabase::removeDatabase(_databasePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TreeModel::addFolderAtParent(const QString &folderName, const QModelIndex &parent)
|
QModelIndex TreeModel::addFolderAtParent(const QString &folderName, const QModelIndex &parent)
|
||||||
{
|
{
|
||||||
TreeItem * parentItem;
|
TreeItem * parentItem;
|
||||||
|
|
||||||
@ -645,8 +645,8 @@ void TreeModel::addFolderAtParent(const QString &folderName, const QModelIndex &
|
|||||||
QList<QVariant> data;
|
QList<QVariant> data;
|
||||||
data << newFolder.name;
|
data << newFolder.name;
|
||||||
data << newFolder.path;
|
data << newFolder.path;
|
||||||
data << false;
|
data << false; //finished
|
||||||
data << false;
|
data << true; //completed
|
||||||
|
|
||||||
TreeItem * item = new TreeItem(data);
|
TreeItem * item = new TreeItem(data);
|
||||||
item->id = newFolder.id;
|
item->id = newFolder.id;
|
||||||
@ -656,6 +656,10 @@ void TreeModel::addFolderAtParent(const QString &folderName, const QModelIndex &
|
|||||||
|
|
||||||
beginInsertRows(parent,destRow,destRow);
|
beginInsertRows(parent,destRow,destRow);
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
|
|
||||||
|
items.insert(item->id,item);
|
||||||
|
|
||||||
|
return index(destRow,0,parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TreeModel::deleteFolder(const QModelIndex &mi)
|
void TreeModel::deleteFolder(const QModelIndex &mi)
|
||||||
|
@ -89,7 +89,7 @@ public:
|
|||||||
|
|
||||||
void fetchMoreFromDB(const QModelIndex & parent);
|
void fetchMoreFromDB(const QModelIndex & parent);
|
||||||
|
|
||||||
void addFolderAtParent(const QString & folderName, const QModelIndex & parent);
|
QModelIndex addFolderAtParent(const QString & folderName, const QModelIndex & parent);
|
||||||
|
|
||||||
enum Columns {
|
enum Columns {
|
||||||
Name = 0,
|
Name = 0,
|
||||||
|
@ -1484,7 +1484,10 @@ void LibraryWindow::addFolderToCurrentIndex()
|
|||||||
QDir parentDir(parentPath);
|
QDir parentDir(parentPath);
|
||||||
QDir newFolder(parentPath+"/"+newFolderName);
|
QDir newFolder(parentPath+"/"+newFolderName);
|
||||||
if(parentDir.mkdir(newFolderName) || newFolder.exists())
|
if(parentDir.mkdir(newFolderName) || newFolder.exists())
|
||||||
foldersModel->addFolderAtParent(newFolderName,currentIndex);
|
{
|
||||||
|
foldersView->setCurrentIndex(foldersModel->addFolderAtParent(newFolderName,currentIndex));
|
||||||
|
reloadCovers();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryWindow::deleteSelectedFolder()
|
void LibraryWindow::deleteSelectedFolder()
|
||||||
|
Reference in New Issue
Block a user