diff options
author | Arno <am@disconnect.de> | 2012-10-27 13:02:16 +0200 |
---|---|---|
committer | Arno <am@disconnect.de> | 2012-10-27 13:02:16 +0200 |
commit | dc7cc269a4fffe43bdac2ae2dc6548fbd1e3bb5e (patch) | |
tree | 30de1f390ad33f067ba1cb9872f994df620fd8c6 /picfilesmodel.cpp | |
parent | a4054f1c7b38e5996081efd7583c06ebf7758e61 (diff) | |
download | SheMov-dc7cc269a4fffe43bdac2ae2dc6548fbd1e3bb5e.tar.gz SheMov-dc7cc269a4fffe43bdac2ae2dc6548fbd1e3bb5e.tar.bz2 SheMov-dc7cc269a4fffe43bdac2ae2dc6548fbd1e3bb5e.zip |
Fix archiving pictures
Well, what can I say. Lost in recursion and parent pointers. This commit
actually boils down to using the proper database tables and inserting
the right values. 'Nuff said...
Diffstat (limited to 'picfilesmodel.cpp')
-rw-r--r-- | picfilesmodel.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/picfilesmodel.cpp b/picfilesmodel.cpp index cab7235..56d9522 100644 --- a/picfilesmodel.cpp +++ b/picfilesmodel.cpp @@ -135,16 +135,16 @@ void PicFilesModel::removeFiles(const QList<QPersistentModelIndex> &files){ } } -bool PicFilesModel::changeMappings(const QList<int> &fileIds, const QList<int> &mappingIds){ +bool PicFilesModel::changeMappings(const QList<int> &fileIds, const QList<QVariant> &parentIds){ mDb.transaction(); foreach(int fid, fileIds){ mDeleteMappingsQ->bindValue(":id", fid); if(!mDeleteMappingsQ->exec()){ goto error; } - foreach(int mid, mappingIds){ + foreach(QVariant pid, parentIds){ mAddMappingsQ->bindValue(":pid", fid); - mAddMappingsQ->bindValue(":id", mid); + mAddMappingsQ->bindValue(":id", pid); if(!mAddMappingsQ->exec()){ goto error; } @@ -172,7 +172,9 @@ QList<MappingData> PicFilesModel::mappingDataFromFiles(const QList<int> fileIds) foreach(int pId, parentIds){ QModelIndex curIdx = mMappingTreeModel->findRecursive(pId, MappingTreeModel::MyId, mMappingTreeModel->rootIndex()); MappingData curData; - curData.id = curIdx.data(MappingTreeModel::MyIdRole).toInt(); + //curData.id = curIdx.data(MappingTreeModel::MyIdRole).toInt(); + curData.mappingId = curIdx.data(MappingTreeModel::MappingIdRole).toInt(); + curData.parentId = curIdx.data(MappingTreeModel::ParentIdRole).toInt(); curData.name = curIdx.data(MappingTreeModel::NameRole).toString(); curData.path << mMappingTreeModel->path(curIdx); //.join("/"); retval << curData; |