| 299 | } |
| 300 | |
| 301 | void CFrmBookmark::onAddFolder() |
| 302 | { |
| 303 | bool ok; |
| 304 | QString name = QInputDialog::getText(this, tr("Add folder"), |
| 305 | tr("Folder name:"), QLineEdit::Normal, |
| 306 | "", &ok); |
| 307 | if (!ok || name.isEmpty()) return; |
| 308 | |
| 309 | int parentId = 0; |
| 310 | QModelIndex currentIndex = m_pTreeView->currentIndex(); |
| 311 | if (currentIndex.isValid()) { |
| 312 | int type = currentIndex.data(Type).toInt(); |
| 313 | if (BookmarkType_Folder == type) { |
| 314 | parentId = currentIndex.data(Qt::UserRole).toInt(); |
| 315 | } |
| 316 | } |
| 317 | |
| 318 | if (m_pDatabase->addFolder(name, parentId)) { |
| 319 | refresh(); |
| 320 | } |
| 321 | } |
| 322 | |
| 323 | void CFrmBookmark::onEditBookmark() |
| 324 | { |