| 265 | } |
| 266 | |
| 267 | void CFrmBookmark::onAddBookmark() |
| 268 | { |
| 269 | bool ok; |
| 270 | QString url = QInputDialog::getText(this, tr("Add bookmark"), |
| 271 | tr("Url:"), QLineEdit::Normal, |
| 272 | "http://", &ok); |
| 273 | if (!ok || url.isEmpty()) return; |
| 274 | |
| 275 | QString title = QInputDialog::getText(this, tr("Add bookmark"), |
| 276 | tr("Title:"), QLineEdit::Normal, |
| 277 | "", &ok); |
| 278 | if (!ok) return; |
| 279 | |
| 280 | BookmarkItem item(BookmarkType_Bookmark); |
| 281 | item.url = url; |
| 282 | item.title = title.isEmpty() ? url : title; |
| 283 | item.createdTime = QDateTime::currentDateTime(); |
| 284 | item.lastVisitTime = item.createdTime; |
| 285 | item.modifiedTime = item.createdTime; |
| 286 | |
| 287 | // 获取选中的文件夹 |
| 288 | QModelIndex currentIndex = m_pTreeView->currentIndex(); |
| 289 | if (currentIndex.isValid()) { |
| 290 | int type = currentIndex.data(Type).toInt(); |
| 291 | if (BookmarkType_Folder == type) { |
| 292 | item.folderId = currentIndex.data(Qt::UserRole).toInt(); |
| 293 | } |
| 294 | } |
| 295 | |
| 296 | if (m_pDatabase->addBookmark(item)) { |
| 297 | refresh(); |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | void CFrmBookmark::onAddFolder() |
| 302 | { |
nothing calls this directly
no test coverage detected