]> Some of my projects - localmylist.git/commitdiff
Use the correct id for actions on file location entries.
authorAPTX <marek321@gmail.com>
Mon, 22 Apr 2013 12:45:47 +0000 (14:45 +0200)
committerAPTX <marek321@gmail.com>
Mon, 22 Apr 2013 12:45:47 +0000 (14:45 +0200)
localmylist-management/mylistview.cpp

index 69270e8b6a38973747bef04fce8dab3f868b7c2e..7825862c85bd717407f45e4466e3684431981cf1 100644 (file)
@@ -93,7 +93,9 @@ void MyListView::showCustomContextMenu(const QPoint &pos)
                                        << requestDataAction;
                break;
                case MyListNode::FileLocationNode:
-                       aniDBLinkAction->setText(tr("Open AniDB Page (%1%2)").arg('f').arg(node->id()));
+                       aniDBLinkAction->setText(tr("Open AniDB Page (%1%2) (%3%4)")
+                                                                        .arg('f').arg(node->parent()->id())
+                                                                        .arg("LocationId").arg(node->id()));
                        actions << aniDBLinkAction
                                        << renameTestAction
                                        << renameFilesAction
@@ -182,9 +184,11 @@ void MyListView::openAnidbPage()
                        QDesktopServices::openUrl(QUrl(aniDBUrlBase.arg('e').arg(node->id())));
                break;
                case MyListNode::FileNode:
-               case MyListNode::FileLocationNode:
                        QDesktopServices::openUrl(QUrl(aniDBUrlBase.arg('f').arg(node->id())));
                break;
+               case MyListNode::FileLocationNode:
+                       QDesktopServices::openUrl(QUrl(aniDBUrlBase.arg('f').arg(node->parent()->id())));
+               break;
                default:
                break;
        }
@@ -197,7 +201,14 @@ void MyListView::requestFileRename()
 
 void MyListView::renameTest()
 {
-       int id = myListFilterModel()->node(customContextMenuIndex)->id();
+       using namespace LocalMyList;
+       int id;
+       MyListNode *node = myListFilterModel()->node(customContextMenuIndex);
+       if (node->type() == MyListNode::FileLocationNode)
+               id = node->parent()->id();
+       else
+               id = node->id();
+
        if (id)
                emit renameTest(id);
 }