@@ -195,7 +195,7 @@ void CFrmBookmark::loadBookmarks()
195195 QStandardItem *pFolderItem = new QStandardItem (folder.getIcon (), folder.title );
196196 if (!pFolderItem) continue ;
197197 pFolderItem->setData (folder.id , ID);
198- pFolderItem->setData (Folder , Type);
198+ pFolderItem->setData (BookmarkType_Folder , Type);
199199 rootItem->appendRow (pFolderItem);
200200 m_folderItems[folder.id ] = pFolderItem;
201201 continue ;
@@ -209,7 +209,7 @@ void CFrmBookmark::loadBookmarks()
209209 QStandardItem *pFolderItem = new QStandardItem (folder.getIcon (), folder.title );
210210 if (!pFolderItem) continue ;
211211 pFolderItem->setData (folder.id , ID);
212- pFolderItem->setData (Folder , Type);
212+ pFolderItem->setData (BookmarkType_Folder , Type);
213213 (*it)->appendRow (pFolderItem);
214214 m_folderItems[folder.id ] = pFolderItem;
215215 }
@@ -227,7 +227,7 @@ void CFrmBookmark::loadBookmarks()
227227
228228 QStandardItem *bookmarkItem = new QStandardItem (bookmark.getIcon (), bookmark.title );
229229 bookmarkItem->setData (bookmark.id , ID);
230- bookmarkItem->setData (Bookmark , Type);
230+ bookmarkItem->setData (BookmarkType_Bookmark , Type);
231231 bookmarkItem->setData (bookmark.url , Url);
232232
233233 if (bookmark.isFavorite ) {
@@ -264,7 +264,7 @@ void CFrmBookmark::onAddBookmark()
264264 QModelIndex currentIndex = m_pTreeView->currentIndex ();
265265 if (currentIndex.isValid ()) {
266266 int type = currentIndex.data (Type).toInt ();
267- if (Folder == type) {
267+ if (BookmarkType_Folder == type) {
268268 item.folderId = currentIndex.data (Qt::UserRole).toInt ();
269269 }
270270 }
@@ -286,7 +286,7 @@ void CFrmBookmark::onAddFolder()
286286 QModelIndex currentIndex = m_pTreeView->currentIndex ();
287287 if (currentIndex.isValid ()) {
288288 int type = currentIndex.data (Type).toInt ();
289- if (Folder == type) {
289+ if (BookmarkType_Folder == type) {
290290 parentId = currentIndex.data (Qt::UserRole).toInt ();
291291 }
292292 }
@@ -304,7 +304,7 @@ void CFrmBookmark::onEditBookmark()
304304 int type = index.data (Type).toInt ();
305305 int id = index.data (Qt::UserRole).toInt ();
306306
307- if (Bookmark == type) {
307+ if (BookmarkType_Bookmark == type) {
308308 BookmarkItem item = m_pDatabase->getBookmark (id);
309309 if (item.id == 0 ) return ;
310310
@@ -325,7 +325,7 @@ void CFrmBookmark::onEditBookmark()
325325 if (m_pDatabase->updateBookmark (item)) {
326326 refresh ();
327327 }
328- } else if (Folder == type) {
328+ } else if (BookmarkType_Folder == type) {
329329 QString oldName = index.data (Qt::DisplayRole).toString ();
330330
331331 bool ok;
@@ -348,15 +348,15 @@ void CFrmBookmark::onDeleteBookmark()
348348 int type = index.data (Type).toInt ();
349349 QString name = index.data (Qt::DisplayRole).toString ();
350350 int id = index.data (Qt::UserRole).toInt ();
351- if (1 == id && Folder == type) {
351+ if (1 == id && BookmarkType_Folder == type) {
352352 QMessageBox::warning (this , tr (" Warning" ), tr (" The folder \" %1\" is not delete" ).arg (name));
353353 return ;
354354 }
355355
356356 QString message;
357- if (Bookmark == type) {
357+ if (BookmarkType_Bookmark == type) {
358358 message = tr (" Are you sure you want to delete the bookmark \" %1\" ?" ).arg (name);
359- } else if (Folder == type) {
359+ } else if (BookmarkType_Folder == type) {
360360 message = tr (" Are you sure you want to delete the folder \" %1\" ?\n "
361361 " The bookmarks inside the folder will be moved to the root directory." ).arg (name);
362362 } else {
@@ -370,9 +370,9 @@ void CFrmBookmark::onDeleteBookmark()
370370 );
371371
372372 if (reply == QMessageBox::Yes) {
373- if (Bookmark == type) {
373+ if (BookmarkType_Bookmark == type) {
374374 m_pDatabase->deleteBookmark (id);
375- } else if (Folder == type) {
375+ } else if (BookmarkType_Folder == type) {
376376 m_pDatabase->deleteFolder (id);
377377 }
378378 refresh ();
@@ -385,7 +385,7 @@ void CFrmBookmark::onSetFavorite()
385385 if (!index.isValid ()) return ;
386386
387387 int type = index.data (Type).toInt ();
388- if (type != Bookmark ) return ;
388+ if (type != BookmarkType_Bookmark ) return ;
389389
390390 int id = index.data (ID).toInt ();
391391 BookmarkItem item = m_pDatabase->getBookmark (id);
@@ -446,7 +446,7 @@ void CFrmBookmark::onSearchTextChanged(const QString &text)
446446 for (const auto &bookmark : bookmarks) {
447447 QStandardItem *item = new QStandardItem (bookmark.getIcon (), bookmark.title );
448448 item->setData (bookmark.id , ID);
449- item->setData (Bookmark , Type);
449+ item->setData (BookmarkType_Bookmark , Type);
450450 item->setData (bookmark.url , Url);
451451
452452 // 显示路径
@@ -467,7 +467,7 @@ void CFrmBookmark::onSearchTextChanged(const QString &text)
467467void CFrmBookmark::onTreeViewDoubleClicked (const QModelIndex &index)
468468{
469469 int type = index.data (Type).toInt ();
470- if (Bookmark == type) {
470+ if (BookmarkType_Bookmark == type) {
471471 QString url = index.data (Url).toString ();
472472 if (!url.isEmpty ()) {
473473 emit openUrlRequested (url);
@@ -487,7 +487,7 @@ void CFrmBookmark::onCustomContextMenu(const QPoint &pos)
487487 int id = index.data (ID).toInt ();
488488 int type = index.data (Type).toInt ();
489489
490- if (Bookmark == type) {
490+ if (BookmarkType_Bookmark == type) {
491491 menu.addAction (QIcon::fromTheme (" document-open" ), tr (" Open" ), this , [this , index]() {
492492 QString url = index.data (Url).toString ();
493493 if (!url.isEmpty ()) {
@@ -502,7 +502,7 @@ void CFrmBookmark::onCustomContextMenu(const QPoint &pos)
502502 connect (favoriteAction, &QAction::triggered, this , &CFrmBookmark::onSetFavorite);
503503
504504 menu.addAction (QIcon::fromTheme (" edit-delete" ), tr (" Delete" ), this , &CFrmBookmark::onDeleteBookmark);
505- } else if (Folder == type) {
505+ } else if (BookmarkType_Folder == type) {
506506 menu.addAction (QIcon::fromTheme (" Add" ), tr (" Add bookmark" ), this , &CFrmBookmark::onAddBookmark);
507507 menu.addAction (QIcon::fromTheme (" folder-new" ), tr (" Add folder" ), this , &CFrmBookmark::onAddFolder);
508508 menu.addSeparator ();
0 commit comments