diff options
author | Arno <am@disconnect.de> | 2012-10-03 15:11:56 +0200 |
---|---|---|
committer | Arno <am@disconnect.de> | 2012-10-03 15:11:56 +0200 |
commit | deeec5306a37e2280626f3486a07629570aafe92 (patch) | |
tree | 04d8f56c3c6f716c34cdb7d7173263f12149f318 | |
parent | df88caf7df0f3b43c5498c09466a37670b764b9a (diff) | |
download | SheMov-deeec5306a37e2280626f3486a07629570aafe92.tar.gz SheMov-deeec5306a37e2280626f3486a07629570aafe92.tar.bz2 SheMov-deeec5306a37e2280626f3486a07629570aafe92.zip |
Fix MappEditDialg
Convert to new mapping DB layout. Return the parent ID where necessary
instead of the mapping ID.
-rw-r--r-- | mappingtreemodel.cpp | 2 | ||||
-rw-r--r-- | pictureswidget.cpp | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/mappingtreemodel.cpp b/mappingtreemodel.cpp index ff7d7d3..f2af964 100644 --- a/mappingtreemodel.cpp +++ b/mappingtreemodel.cpp @@ -386,7 +386,7 @@ MappingData MappingTreeModel::mappingDataFromIndex(QModelIndex &idx) const{ if(!idx.isValid()){ return retval; } - retval.id = idx.data(MappingTreeModel::IdRole).toInt(); + retval.id = idx.data(MappingTreeModel::MapParentIdRole).toInt(); retval.name = idx.data(MappingTreeModel::NameRole).toString(); retval.path = path(idx); return retval; diff --git a/pictureswidget.cpp b/pictureswidget.cpp index bc4b143..745a133 100644 --- a/pictureswidget.cpp +++ b/pictureswidget.cpp @@ -283,7 +283,7 @@ PicFilesModel::PicFilesModel(const QStringList &headers, QObject *parent) : SmTr mDeleteMappingsQ = new QSqlQuery(mDb); mDeleteMappingsQ->prepare("DELETE FROM pics_mappings2 WHERE ipics_id = :id"); mAddMappingsQ = new QSqlQuery(mDb); - mAddMappingsQ->prepare("INSERT INTO pics_mappings2(ipics_id, imapping_id) VALUES(:pid, :id)"); + mAddMappingsQ->prepare("INSERT INTO pics_mappings2(ipics_id, imappings_parents_id) VALUES(:pid, :id)"); } @@ -415,7 +415,7 @@ QList<MappingData> PicFilesModel::mappingDataFromFiles(const QList<int> fileIds) foreach(int pId, parentIds){ QModelIndex curIdx = mMappingTreeModel->findRecursive(pId, MappingTreeModel::MapParentId, mMappingTreeModel->rootIndex()); MappingData curData; - curData.id = curIdx.data(MappingTreeModel::IdRole).toInt(); + curData.id = curIdx.data(MappingTreeModel::MapParentIdRole).toInt(); curData.name = curIdx.data(MappingTreeModel::NameRole).toString(); curData.path = mMappingTreeModel->path(curIdx); retval << curData; |