summaryrefslogtreecommitdiffstats
path: root/seriestreemodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'seriestreemodel.cpp')
-rw-r--r--seriestreemodel.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/seriestreemodel.cpp b/seriestreemodel.cpp
index 748f870..0da1b04 100644
--- a/seriestreemodel.cpp
+++ b/seriestreemodel.cpp
@@ -155,26 +155,26 @@ QModelIndex SeriesTreeModel::findValue(const QVariant &value, const QModelIndex
QFileInfoList SeriesTreeModel::findFiles(const QModelIndex &where) const{
int type = where.data(TypeRole).toInt();
QFileInfoList retval;
+
+ QSqlQuery *query = 0;
if(type == Series){
- mSeriesFilesQuery->bindValue(":id", where.data(SeriesIdRole));
- if(mSeriesFilesQuery->exec()){
- while(mSeriesFilesQuery->next()){
- QString path = Helper::createArchivePath(mSeriesFilesQuery->value(0).toString(), mSeriesFilesQuery->value(1).toString());
- retval << QFileInfo(path);
- }
- return retval;
- }
+ query = mSeriesFilesQuery;
+ query->bindValue(":id", where.data(SeriesIdRole));
}else if(type == Part){
- mSeriesPartFilesQuery->bindValue(":id", where.data(SeriesPartIdRole));
- if(mSeriesPartFilesQuery->exec()){
- while(mSeriesPartFilesQuery->next()){
- QString path = Helper::createArchivePath(mSeriesFilesQuery->value(0).toString(), mSeriesFilesQuery->value(1).toString());
+ query = mSeriesPartFilesQuery;
+ query->bindValue(":id", where.data(SeriesPartIdRole));
+ }
+
+ if(query){
+ if(query->exec()){
+ while(query->next()){
+ QString path = Helper::createArchivePath(query->value(0).toString(), query->value(1).toString());
retval << QFileInfo(path);
}
- return retval;
}
}
- return QFileInfoList();
+
+ return retval;
}
void SeriesTreeModel::populate(){