OSDN Git Service

Add workaround show corrent ContextMenu!
authorFrank Li <lznuaa@gmail.com>
Mon, 2 Feb 2009 15:27:20 +0000 (23:27 +0800)
committerFrank Li <lznuaa@gmail.com>
Mon, 2 Feb 2009 15:27:20 +0000 (23:27 +0800)
src/TortoiseShell/ContextMenu.cpp

index c85e65c..cc471cb 100644 (file)
@@ -335,7 +335,8 @@ STDMETHODIMP CShellExt::Initialize(LPCITEMIDLIST pIDFolder,
                                                        {\r
                                                                ATLTRACE2(_T("Exception in GitStatus::GetStatus()\n"));\r
                                                        }\r
                                                        {\r
                                                                ATLTRACE2(_T("Exception in GitStatus::GetStatus()\n"));\r
                                                        }\r
-                                                       if ((status != git_wc_status_unversioned)&&(status != git_wc_status_ignored)&&(status != git_wc_status_none))\r
+                                                       //if ((status != git_wc_status_unversioned)&&(status != git_wc_status_ignored)&&(status != git_wc_status_none))\r
+                                                       if (askedpath.HasAdminDir())\r
                                                                itemStates |= ITEMIS_INSVN;\r
                                                        if (status == git_wc_status_ignored)\r
                                                                itemStates |= ITEMIS_IGNORED;\r
                                                                itemStates |= ITEMIS_INSVN;\r
                                                        if (status == git_wc_status_ignored)\r
                                                                itemStates |= ITEMIS_IGNORED;\r
@@ -435,7 +436,8 @@ STDMETHODIMP CShellExt::Initialize(LPCITEMIDLIST pIDFolder,
                                                                        ATLTRACE2(_T("Exception in GitStatus::GetStatus()\n"));\r
                                                                }\r
                                                        }\r
                                                                        ATLTRACE2(_T("Exception in GitStatus::GetStatus()\n"));\r
                                                                }\r
                                                        }\r
-                                                       if ((status != git_wc_status_unversioned)&&(status != git_wc_status_ignored)&&(status != git_wc_status_none))\r
+                                                       //if ((status != git_wc_status_unversioned)&&(status != git_wc_status_ignored)&&(status != git_wc_status_none))\r
+                                                       if (strpath.HasAdminDir())\r
                                                                itemStates |= ITEMIS_INSVN;\r
                                                        if (status == git_wc_status_ignored)\r
                                                        {\r
                                                                itemStates |= ITEMIS_INSVN;\r
                                                        if (status == git_wc_status_ignored)\r
                                                        {\r
@@ -504,10 +506,13 @@ STDMETHODIMP CShellExt::Initialize(LPCITEMIDLIST pIDFolder,
                git_wc_status_kind status = git_wc_status_none;\r
                if (IsClipboardFormatAvailable(CF_HDROP)) \r
                        itemStatesFolder |= ITEMIS_PATHINCLIPBOARD;\r
                git_wc_status_kind status = git_wc_status_none;\r
                if (IsClipboardFormatAvailable(CF_HDROP)) \r
                        itemStatesFolder |= ITEMIS_PATHINCLIPBOARD;\r
+               \r
+               CTGitPath askedpath;\r
+               askedpath.SetFromWin(folder_.c_str());\r
+\r
                if ((folder_.compare(statuspath)!=0)&&(g_ShellCache.IsContextPathAllowed(folder_.c_str())))\r
                {\r
                if ((folder_.compare(statuspath)!=0)&&(g_ShellCache.IsContextPathAllowed(folder_.c_str())))\r
                {\r
-                       CTGitPath askedpath;\r
-                       askedpath.SetFromWin(folder_.c_str());\r
+                       \r
                        try\r
                        {\r
                                GitStatus stat;\r
                        try\r
                        {\r
                                GitStatus stat;\r
@@ -524,16 +529,7 @@ STDMETHODIMP CShellExt::Initialize(LPCITEMIDLIST pIDFolder,
 //                                     }\r
 //                                     if ((stat.status->entry)&&(stat.status->entry->uuid))\r
 //                                             uuidTarget = CUnicodeUtils::StdGetUnicode(stat.status->entry->uuid);\r
 //                                     }\r
 //                                     if ((stat.status->entry)&&(stat.status->entry->uuid))\r
 //                                             uuidTarget = CUnicodeUtils::StdGetUnicode(stat.status->entry->uuid);\r
-                                       if ((status != git_wc_status_unversioned)&&(status != git_wc_status_ignored)&&(status != git_wc_status_none))\r
-                                               itemStatesFolder |= ITEMIS_INSVN;\r
-                                       if (status == git_wc_status_normal)\r
-                                               itemStatesFolder |= ITEMIS_NORMAL;\r
-                                       if (status == git_wc_status_conflicted)\r
-                                               itemStatesFolder |= ITEMIS_CONFLICTED;\r
-                                       if (status == git_wc_status_added)\r
-                                               itemStatesFolder |= ITEMIS_ADDED;\r
-                                       if (status == git_wc_status_deleted)\r
-                                               itemStatesFolder |= ITEMIS_DELETED;\r
+                               \r
                                }\r
                                else\r
                                {\r
                                }\r
                                else\r
                                {\r
@@ -543,6 +539,19 @@ STDMETHODIMP CShellExt::Initialize(LPCITEMIDLIST pIDFolder,
                                        if (askedpath.HasAdminDir())\r
                                                status = git_wc_status_normal;\r
                                }\r
                                        if (askedpath.HasAdminDir())\r
                                                status = git_wc_status_normal;\r
                                }\r
+                               \r
+                               //if ((status != git_wc_status_unversioned)&&(status != git_wc_status_ignored)&&(status != git_wc_status_none))\r
+                               if (askedpath.HasAdminDir())\r
+                                       itemStatesFolder |= ITEMIS_INSVN;\r
+                               if (status == git_wc_status_normal)\r
+                                       itemStatesFolder |= ITEMIS_NORMAL;\r
+                               if (status == git_wc_status_conflicted)\r
+                                       itemStatesFolder |= ITEMIS_CONFLICTED;\r
+                               if (status == git_wc_status_added)\r
+                                       itemStatesFolder |= ITEMIS_ADDED;\r
+                               if (status == git_wc_status_deleted)\r
+                                       itemStatesFolder |= ITEMIS_DELETED;\r
+\r
                        }\r
                        catch ( ... )\r
                        {\r
                        }\r
                        catch ( ... )\r
                        {\r
@@ -553,7 +562,8 @@ STDMETHODIMP CShellExt::Initialize(LPCITEMIDLIST pIDFolder,
                {\r
                        status = fetchedstatus;\r
                }\r
                {\r
                        status = fetchedstatus;\r
                }\r
-               if ((status != git_wc_status_unversioned)&&(status != git_wc_status_ignored)&&(status != git_wc_status_none))\r
+               //if ((status != git_wc_status_unversioned)&&(status != git_wc_status_ignored)&&(status != git_wc_status_none))\r
+               if (askedpath.HasAdminDir())\r
                {\r
                        itemStatesFolder |= ITEMIS_FOLDERINSVN;\r
                }\r
                {\r
                        itemStatesFolder |= ITEMIS_FOLDERINSVN;\r
                }\r
@@ -578,10 +588,11 @@ STDMETHODIMP CShellExt::Initialize(LPCITEMIDLIST pIDFolder,
                        {\r
                                folder_ = files_.front();\r
                                git_wc_status_kind status = git_wc_status_none;\r
                        {\r
                                folder_ = files_.front();\r
                                git_wc_status_kind status = git_wc_status_none;\r
+                               CTGitPath askedpath;\r
+                               askedpath.SetFromWin(folder_.c_str());\r
+\r
                                if (folder_.compare(statuspath)!=0)\r
                                if (folder_.compare(statuspath)!=0)\r
-                               {\r
-                                       CTGitPath askedpath;\r
-                                       askedpath.SetFromWin(folder_.c_str());\r
+                               {                               \r
                                        try\r
                                        {\r
                                                GitStatus stat;\r
                                        try\r
                                        {\r
                                                GitStatus stat;\r
@@ -609,7 +620,8 @@ STDMETHODIMP CShellExt::Initialize(LPCITEMIDLIST pIDFolder,
                                {\r
                                        status = fetchedstatus;\r
                                }\r
                                {\r
                                        status = fetchedstatus;\r
                                }\r
-                               if ((status != git_wc_status_unversioned)&&(status != git_wc_status_ignored)&&(status != git_wc_status_none))\r
+                               //if ((status != git_wc_status_unversioned)&&(status != git_wc_status_ignored)&&(status != git_wc_status_none))\r
+                               if (askedpath.HasAdminDir())\r
                                        itemStates |= ITEMIS_FOLDERINSVN;\r
                                if (status == git_wc_status_ignored)\r
                                        itemStates |= ITEMIS_IGNORED;\r
                                        itemStates |= ITEMIS_FOLDERINSVN;\r
                                if (status == git_wc_status_ignored)\r
                                        itemStates |= ITEMIS_IGNORED;\r