diff options
author | am <am@f440f766-f032-0410-8965-dc7d17de2ca0> | 2009-07-22 18:44:02 +0000 |
---|---|---|
committer | am <am@f440f766-f032-0410-8965-dc7d17de2ca0> | 2009-07-22 18:44:02 +0000 |
commit | 0e3e202c90e3ccb80310087409936c00189f0cea (patch) | |
tree | a4a38c32e761f024e2dfad6a59097cff15472b9e /listmodel.cpp | |
parent | 84ed109c159dcbd0c9395717d54599e902060b26 (diff) | |
download | SheMov-0e3e202c90e3ccb80310087409936c00189f0cea.tar.gz SheMov-0e3e202c90e3ccb80310087409936c00189f0cea.tar.bz2 SheMov-0e3e202c90e3ccb80310087409936c00189f0cea.zip |
-Finished CoverArchiveEditor (finally, don't like that piece of code, too complicated)
-It's now possible to manually add a movie w/o a file
-Some usability fixes
git-svn-id: file:///var/svn/repos2/shemov/trunk@394 f440f766-f032-0410-8965-dc7d17de2ca0
Diffstat (limited to 'listmodel.cpp')
-rw-r--r-- | listmodel.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/listmodel.cpp b/listmodel.cpp index 437ec3e..71a5040 100644 --- a/listmodel.cpp +++ b/listmodel.cpp @@ -165,10 +165,10 @@ bool ListModel::removeItem(const QVariant &item){ if(rowToDelete == -1){ return false; } - bool success = removeRows(rowToDelete, 1, QModelIndex()); + mDeleteQuery->bindValue(":name", item.toString()); + bool success = mDeleteQuery->exec(); if(success){ - mDeleteQuery->bindValue(":name", item.toString()); - success = mDeleteQuery->exec(); + success = removeRows(rowToDelete, 1, QModelIndex()); } return success; } @@ -185,6 +185,14 @@ bool ListModel::renameItem(const QVariant &oldName, const QVariant &newName){ return success; } +int ListModel::defaultId(){ + if(!mItems.isEmpty()){ + return mItems.at(0)->id(); + } + addItem("(default)"); + return mItems.at(0)->id(); +} + void ListModel::populate(){ QString query = QString("SELECT i%1id, t%1name FROM %1 ORDER BY t%1name").arg(mTable); QSqlQuery q(query); |