| 400 | } |
| 401 | |
| 402 | void ReadingListModel::addReadingList(const QString &name) |
| 403 | { |
| 404 | QString connectionName = ""; |
| 405 | { |
| 406 | QSqlDatabase db = DataBaseManagement::loadDatabase(_databasePath); |
| 407 | beginInsertRows(QModelIndex(), 0, 0); // TODO calculate the right coordinates before inserting |
| 408 | |
| 409 | qulonglong id = DBHelper::insertReadingList(name, db); |
| 410 | ReadingListItem *newItem; |
| 411 | rootItem->appendChild(newItem = new ReadingListItem(QList<QVariant>() |
| 412 | << name |
| 413 | << id |
| 414 | << false |
| 415 | << true |
| 416 | << 0)); |
| 417 | |
| 418 | items.insert(id, newItem); |
| 419 | |
| 420 | endInsertRows(); |
| 421 | connectionName = db.connectionName(); |
| 422 | } |
| 423 | QSqlDatabase::removeDatabase(connectionName); |
| 424 | } |
| 425 | |
| 426 | void ReadingListModel::addReadingListAt(const QString &name, const QModelIndex &mi) |
| 427 | { |
no test coverage detected