mirror of
https://github.com/YACReader/yacreader
synced 2025-07-18 21:14:33 -04:00
Fix folders type when they are added
This commit is contained in:
@ -1270,12 +1270,14 @@ qulonglong DBHelper::insert(Folder *folder, QSqlDatabase &db)
|
||||
folder->added = added;
|
||||
|
||||
QSqlQuery query(db);
|
||||
query.prepare("INSERT INTO folder (parentId, name, path, added) "
|
||||
"VALUES (:parentId, :name, :path, :added)");
|
||||
query.prepare("INSERT INTO folder (parentId, name, path, added, type) "
|
||||
"VALUES (:parentId, :name, :path, :added, :type)");
|
||||
query.bindValue(":parentId", folder->parentId);
|
||||
query.bindValue(":name", folder->name);
|
||||
query.bindValue(":path", folder->path);
|
||||
query.bindValue(":added", added);
|
||||
auto intType = static_cast<int>(folder->type);
|
||||
query.bindValue(":type", intType);
|
||||
query.exec();
|
||||
|
||||
return query.lastInsertId().toULongLong();
|
||||
|
@ -54,7 +54,7 @@ void LibraryCreator::updateFolder(const QString &source, const QString &target,
|
||||
folderDestinationModelIndex = dest;
|
||||
|
||||
_currentPathFolders.clear();
|
||||
_currentPathFolders.append(Folder(1, 1, "root", "/"));
|
||||
_currentPathFolders.append(Folder::rootFolder());
|
||||
|
||||
QString relativeFolderPath = sourceFolder;
|
||||
relativeFolderPath = relativeFolderPath.remove(QDir::cleanPath(source));
|
||||
@ -139,7 +139,7 @@ void LibraryCreator::run()
|
||||
if (_mode == CREATOR) {
|
||||
QLOG_INFO() << "Starting to create new library ( " << _source << "," << _target << ")";
|
||||
_currentPathFolders.clear();
|
||||
_currentPathFolders.append(Folder(1, 1, "root", "/"));
|
||||
_currentPathFolders.append(Folder::rootFolder());
|
||||
// se crean los directorios .yacreaderlibrary y .yacreaderlibrary/covers
|
||||
QDir dir;
|
||||
dir.mkpath(_target + "/covers");
|
||||
@ -173,7 +173,7 @@ void LibraryCreator::run()
|
||||
QLOG_INFO() << "Starting to update folder" << _sourceFolder << "in library ( " << _source << "," << _target << ")";
|
||||
if (!partialUpdate) {
|
||||
_currentPathFolders.clear();
|
||||
_currentPathFolders.append(Folder(1, 1, "root", "/"));
|
||||
_currentPathFolders.append(Folder::rootFolder());
|
||||
QLOG_DEBUG() << "update whole library";
|
||||
}
|
||||
{
|
||||
|
Reference in New Issue
Block a user