by
Changes to 11 files · Browse files at 9d3da274f8a2 Showing diff from parent 2c2a1a633735 4e02beaf36d8 Diff from another changeset...
@@ -17,7 +17,12 @@
class CmdDialog(gtk.Dialog):
def __init__(self, cmdline, progressbar=True, width=520, height=400):
- title = 'hg ' + ' '.join(cmdline[1:])
+ if progressbar:
+ title = 'hg ' + ' '.join(cmdline[1:])
+ else:
+ # use short title if progressbar is not in use. The
+ # calling code may not want to show the complete command
+ title = 'hg ' + ' '.join(cmdline[1:2])
if len(title) > 80:
title = title[:80] + '...'
title = hglib.toutf(title.replace('\n', ' '))
|
@@ -453,7 +453,7 @@ dlg = thgconfig.ConfigDialog(True)
dlg.show_all()
if newpath:
- dlg.new_path(newpath)
+ dlg.new_path(newpath, 'default')
else:
dlg.focus_field('tortoisehg.postpull')
dlg.run()
|
@@ -573,14 +573,15 @@ widgets[w].grab_focus()
return
- def new_path(self, newpath):
+ def new_path(self, newpath, alias='new'):
'''Add a new path to [paths], give default name, focus'''
i = self.pathdata.insert_before(None, None)
safepath = url.hidepassword(newpath)
- alias, num = 'new', 0
- while len([row for row in self.pathdata if row[0] == alias]) > 0:
- num += 1
- alias = 'new_%d' % num
+ if alias in [row[0] for row in self.pathdata]:
+ num = 0
+ while len([row for row in self.pathdata if row[0] == alias]) > 0:
+ num += 1
+ alias = 'new_%d' % num
self.pathdata.set_value(i, 0, alias)
self.pathdata.set_value(i, 1, '%s' % hglib.toutf(safepath))
self.pathdata.set_value(i, 2, '%s' % hglib.toutf(newpath))
@@ -655,7 +656,8 @@ if testpath[0] == '~':
testpath = os.path.expanduser(testpath)
cmdline = ['hg', 'incoming', '--verbose', testpath]
- dlg = hgcmd.CmdDialog(cmdline)
+ # Do not use progressbar, as it may show plaintext passwords
+ dlg = hgcmd.CmdDialog(cmdline, progressbar=False)
dlg.run()
dlg.hide()
|
@@ -44,8 +44,8 @@ lbl = gtk.Label(_('Update to:'))
hbox.pack_start(lbl, False, False, 2)
- # revisions combo box
- combo = gtk.combo_box_new_text()
+ # revisions editable combo box
+ combo = gtk.combo_box_entry_new_text()
hbox.pack_start(combo, True, True, 2)
vbox.pack_start(hbox, False, False, 10)
if rev != None:
|
@@ -46,16 +46,16 @@ if not capt or 'THGDEBUG' in os.environ:
sys.exit(hggtk.hgtk.dispatch(sys.argv[1:]))
else:
- import cStringIO
- sys.stderr = cStringIO.StringIO()
+ mystderr = cStringIO.StringIO()
+ sys.stderr = mystderr
ret = hggtk.hgtk.dispatch(sys.argv[1:])
- sys.stderr.seek(0)
- for l in sys.stderr.readlines():
+ mystderr.seek(0)
+ for l in mystderr.readlines():
if l.startswith('Traceback') or l.startswith('TypeError'):
from hggtk.bugreport import run
from hggtk.hgtk import gtkrun
- sys.stderr.seek(0)
- error = 'Recoverable runtime error (stderr):\n' + sys.stderr.read()
+ mystderr.seek(0)
+ error = 'Recoverable runtime error (stderr):\n' + mystderr.read()
opts = {}
opts['cmd'] = ' '.join(sys.argv[1:])
opts['error'] = error
|
|
|
@@ -18,6 +18,9 @@ UINT idCmd;
};
+// According to http://msdn.microsoft.com/en-us/library/bb776094%28VS.85%29.aspx
+// the help texts for the commands should be reasonably short (under 40 characters)
+
MenuDescription menuDescList[] =
{
{"commit", "Commit...",
@@ -251,7 +254,6 @@ HMENU hMenu, const std::string& name, UINT indexMenu,
UINT idCmd, UINT idCmdFirst, const std::string& prefix)
{
- TDEBUG_TRACE("InsertMenuItemByName: name = " << name);
MenuDescriptionMap::iterator iter = MenuDescMap.find(name);
if (iter == MenuDescMap.end())
{
@@ -451,60 +453,106 @@ UINT_PTR idCmd, UINT uFlags, UINT FAR *reserved,
LPSTR pszName, UINT cchMax)
{
+ // see http://msdn.microsoft.com/en-us/library/bb776094%28VS.85%29.aspx
+
+ HRESULT res = S_FALSE;
+
const char *psz = "";
+ std::string sflags = "?";
+ switch (uFlags)
+ {
+ case GCS_HELPTEXTW:
+ sflags = "GCS_HELPTEXTW"; break;
+ case GCS_HELPTEXTA:
+ sflags = "GCS_HELPTEXTA"; break;
+ case GCS_VALIDATEW:
+ sflags = "GCS_VALIDATEW"; break;
+ case GCS_VALIDATEA:
+ sflags = "GCS_VALIDATEA"; break;
+ case GCS_VERBW:
+ sflags = "GCS_VERBW"; break;
+ case GCS_VERBA:
+ sflags = "GCS_VERBA"; break;
+ }
+
TDEBUG_TRACE(
- "CShellExt::GetCommandString: idCmd = " << idCmd
- << ", uFlags = " << uFlags
- );
+ "CShellExt::GetCommandString: idCmd = " << idCmd
+ << ", uFlags = " << uFlags << " (" << sflags << ")");
MenuIdCmdMap::iterator iter = MenuIdMap.find(static_cast<UINT>(idCmd));
- if (iter != MenuIdMap.end())
+ if (iter == MenuIdMap.end())
{
- TDEBUG_TRACE(
- "CShellExt::GetCommandString: name = " << iter->second.name);
- psz = iter->second.helpText.c_str();
+ TDEBUG_TRACE("CShellExt::GetCommandString: idCmd not found");
}
else
{
TDEBUG_TRACE(
- "CShellExt::GetCommandString: can't find idCmd " << idCmd);
+ "CShellExt::GetCommandString: name = \"" << iter->second.name << "\"");
+
+ if (uFlags == GCS_HELPTEXTW || uFlags == GCS_HELPTEXTA)
+ {
+ psz = iter->second.helpText.c_str();
+ res = S_OK;
+
+ size_t size = iter->second.helpText.size();
+ if (size >= 40)
+ {
+ TDEBUG_TRACE(
+ "CShellExt::GetCommandString: warning:"
+ << " length of help text is " << size
+ << ", which is not reasonably short (<40)");
+ }
+ }
+ else if (uFlags == GCS_VERBW || uFlags == GCS_VERBA)
+ {
+ psz = iter->second.name.c_str();
+ res = S_OK;
+ }
+ else if (uFlags == GCS_VALIDATEW || uFlags == GCS_VALIDATEA)
+ {
+ res = S_OK;
+ }
}
- bool copied = false;
+ if (cchMax < 1)
+ {
+ TDEBUG_TRACE("CShellExt::GetCommandString: cchMax = "
+ << cchMax << " (is <1)");
+ return res;
+ }
+
size_t size = 0;
if (uFlags & GCS_UNICODE)
{
wchar_t* const dest = reinterpret_cast<wchar_t*>(pszName);
- *dest = 0;
const wchar_t* const src = _WCSTR(psz);
+
+ wcsncpy(dest, src, cchMax-1);
+ *(dest + cchMax-1) = 0;
+
size = wcslen(src);
- if (size < cchMax)
- {
- wcscpy(dest, src);
- copied = true;
- }
}
else
{
- *pszName = 0;
+ strncpy(pszName, psz, cchMax-1);
+ *(pszName + cchMax-1) = 0;
+
size = strlen(psz);
- if (size < cchMax)
- {
- strcpy(pszName, psz);
- copied = true;
- }
}
- if (!copied)
+ TDEBUG_TRACE("CShellExt::GetCommandString: res = " << res
+ << ", pszName = \"" << psz << "\"");
+
+ if (size > cchMax-1)
{
TDEBUG_TRACE(
- "CShellExt::GetCommandString: error: source string length ("
- << size << ") exceeds target buffer size (" << cchMax << ")");
+ "CShellExt::GetCommandString: string was truncated: size = "
+ << size << ", cchMax = " << cchMax);
}
- return NOERROR;
+ return res;
}
@@ -520,7 +568,6 @@CShellExt::HandleMenuMsg2(
UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
- TDEBUG_ENTER("CShellExt::HandleMenuMsg2");
// A great tutorial on owner drawn menus in shell extension can be found
// here: http://www.codeproject.com/shell/shellextguide7.asp
|
@@ -115,15 +115,9 @@
if (unset)
{
- TDEBUG_TRACE("Dirstatecache::get: ignored (unset entries)");
- if (!iter->unset)
- {
- Thgstatus::update(cwd);
- iter->unset = true;
- }
- return iter->dstate;
+ TDEBUG_TRACE("Dirstatecache::get: has unset entries");
}
- iter->unset = false;
+ iter->unset = unset;
delete iter->dstate;
iter->dstate = ds.release();
|
@@ -233,37 +233,28 @@
STDMETHODIMP CShellExt::QueryInterface(REFIID riid, LPVOID FAR* ppv)
-{
- std::string clsname = "UNKNOWN CLSID";
-
+{
*ppv = NULL;
if (IsEqualIID(riid, IID_IShellExtInit) || IsEqualIID(riid, IID_IUnknown))
{
- *ppv = (LPSHELLEXTINIT)this;
- clsname = "IID_IShellExtInit";
+ *ppv = (LPSHELLEXTINIT) this;
}
else if (IsEqualIID(riid, IID_IContextMenu))
{
- *ppv = (LPCONTEXTMENU)this;
- clsname = "IID_IContextMenu";
+ *ppv = (LPCONTEXTMENU) this;
}
else if (IsEqualIID(riid, IID_IContextMenu2))
{
- *ppv = (IContextMenu2 *) this;
- clsname = "IID_IContextMenu2";
+ *ppv = (IContextMenu2*) this;
}
else if (IsEqualIID(riid, IID_IContextMenu3))
{
- *ppv = (IContextMenu3 *) this;
- clsname = "IID_IContextMenu3";
+ *ppv = (IContextMenu3*) this;
}
else if (IsEqualIID(riid, IID_IShellIconOverlayIdentifier))
{
- *ppv = (IShellIconOverlayIdentifier *) this;
- clsname = "IID_IShellIconOverlayIdentifier";
+ *ppv = (IShellIconOverlayIdentifier*) this;
}
-
- TDEBUG_TRACE("CShellExt::QueryInterface: " << clsname);
if (*ppv)
{
|
@@ -187,7 +187,6 @@ }
std::string iconpath = thgdir + "\\icons\\" + iconname;
- TDEBUG_TRACE(" GetTortoiseIcon: loading " + iconpath);
HICON h = (HICON) LoadImageA(0, iconpath.c_str(), IMAGE_ICON,
16, 16, LR_LOADFROMFILE);
if (!h)
|
@@ -42,11 +42,7 @@ while (e.read(f, relpath))
{
if (e.unset())
- {
unset = true;
- fclose(f);
- return std::auto_ptr<Dirstate>(0);
- }
if (e.state == 'a')
++pd->num_added_;
|
Loading...