Repository Browser: Do not show revert, copy path, copy hash menu items if no item...
authorSup Yut Sum <ch3cooli@gmail.com>
Mon, 22 Apr 2013 12:48:24 +0000 (22 20:48 +0800)
committerSup Yut Sum <ch3cooli@gmail.com>
Mon, 22 Apr 2013 12:51:08 +0000 (22 20:51 +0800)
Signed-off-by: Sup Yut Sum <ch3cooli@gmail.com>
src/TortoiseProc/RepositoryBrowser.cpp

index 7bc1a9d..6374775 100644 (file)
@@ -587,7 +587,7 @@ void CRepositoryBrowser::ShowContextMenu(CPoint point, TShadowFilesTreeList &sel
                bAddSeparator = true;\r
        }\r
 \r
-       if (selType == ONLY_FILES && m_bHasWC)\r
+       if (!selectedLeafs.empty() && selType == ONLY_FILES && m_bHasWC)\r
        {\r
                popupMenu.AppendMenuIcon(eCmd_Revert, IDS_LOG_POPUP_REVERTTOREV, IDI_REVERT);\r
                bAddSeparator = true;\r
@@ -597,8 +597,11 @@ void CRepositoryBrowser::ShowContextMenu(CPoint point, TShadowFilesTreeList &sel
                popupMenu.AppendMenu(MF_SEPARATOR);\r
        bAddSeparator = false;\r
 \r
-       popupMenu.AppendMenuIcon(eCmd_CopyPath, IDS_STATUSLIST_CONTEXT_COPY, IDI_COPYCLIP);\r
-       popupMenu.AppendMenuIcon(eCmd_CopyHash, IDS_COPY_COMMIT_HASH, IDI_COPYCLIP);\r
+       if (!selectedLeafs.empty())\r
+       {\r
+               popupMenu.AppendMenuIcon(eCmd_CopyPath, IDS_STATUSLIST_CONTEXT_COPY, IDI_COPYCLIP);\r
+               popupMenu.AppendMenuIcon(eCmd_CopyHash, IDS_COPY_COMMIT_HASH, IDI_COPYCLIP);\r
+       }\r
 \r
        eCmd cmd = (eCmd)popupMenu.TrackPopupMenuEx(TPM_LEFTALIGN|TPM_RETURNCMD, point.x, point.y, this, 0);\r
        switch(cmd)\r