| 365 | } |
| 366 | |
| 367 | void CFrmBookmark::onDeleteBookmark() |
| 368 | { |
| 369 | QModelIndex index = m_pTreeView->currentIndex(); |
| 370 | if (!index.isValid()) return; |
| 371 | |
| 372 | int type = index.data(Type).toInt(); |
| 373 | QString name = index.data(Qt::DisplayRole).toString(); |
| 374 | int id = index.data(Qt::UserRole).toInt(); |
| 375 | if(1 == id && BookmarkType_Folder == type) { |
| 376 | QMessageBox::warning(this, tr("Warning"), tr("The folder \"%1\" is not delete").arg(name)); |
| 377 | return; |
| 378 | } |
| 379 | |
| 380 | QString message; |
| 381 | if (BookmarkType_Bookmark == type) { |
| 382 | message = tr("Are you sure you want to delete the bookmark \"%1\"?").arg(name); |
| 383 | } else if (BookmarkType_Folder == type) { |
| 384 | message = tr("Are you sure you want to delete the folder \"%1\"?").arg(name); |
| 385 | } else { |
| 386 | return; |
| 387 | } |
| 388 | |
| 389 | QMessageBox::StandardButton reply = QMessageBox::question( |
| 390 | this, tr("Confirm deletion"), message, |
| 391 | QMessageBox::Yes | QMessageBox::No, |
| 392 | QMessageBox::No |
| 393 | ); |
| 394 | |
| 395 | if (reply == QMessageBox::Yes) { |
| 396 | if (BookmarkType_Bookmark == type) { |
| 397 | m_pDatabase->deleteBookmark(id); |
| 398 | } else if (BookmarkType_Folder == type) { |
| 399 | m_pDatabase->deleteFolder(id); |
| 400 | } |
| 401 | refresh(); |
| 402 | } |
| 403 | } |
| 404 | |
| 405 | void CFrmBookmark::onSetFavorite() |
| 406 | { |
nothing calls this directly
no test coverage detected