| 321 | } |
| 322 | |
| 323 | void CFrmBookmark::onEditBookmark() |
| 324 | { |
| 325 | QModelIndex index = m_pTreeView->currentIndex(); |
| 326 | if (!index.isValid()) return; |
| 327 | |
| 328 | int type = index.data(Type).toInt(); |
| 329 | int id = index.data(Qt::UserRole).toInt(); |
| 330 | |
| 331 | if (BookmarkType_Bookmark == type) { |
| 332 | BookmarkItem item = m_pDatabase->getBookmark(id); |
| 333 | if (item.id == 0) return; |
| 334 | |
| 335 | bool ok; |
| 336 | QString title = QInputDialog::getText(this, tr("Edit bookmark"), |
| 337 | tr("Title:"), QLineEdit::Normal, |
| 338 | item.title, &ok); |
| 339 | if (!ok) return; |
| 340 | |
| 341 | QString url = QInputDialog::getText(this, tr("Add bookmark"), |
| 342 | tr("Url:"), QLineEdit::Normal, |
| 343 | item.url, &ok); |
| 344 | if (!ok) return; |
| 345 | |
| 346 | item.title = title; |
| 347 | item.url = url; |
| 348 | |
| 349 | if (m_pDatabase->updateBookmark(item)) { |
| 350 | refresh(); |
| 351 | } |
| 352 | } else if (BookmarkType_Folder == type) { |
| 353 | QString oldName = index.data(Qt::DisplayRole).toString(); |
| 354 | |
| 355 | bool ok; |
| 356 | QString newName = QInputDialog::getText(this, tr("Rename folder"), |
| 357 | tr("Folder name:"), QLineEdit::Normal, |
| 358 | oldName, &ok); |
| 359 | if (!ok || newName.isEmpty()) return; |
| 360 | |
| 361 | if (m_pDatabase->renameFolder(id, newName)) { |
| 362 | refresh(); |
| 363 | } |
| 364 | } |
| 365 | } |
| 366 | |
| 367 | void CFrmBookmark::onDeleteBookmark() |
| 368 | { |
nothing calls this directly
no test coverage detected