Bug 669392 - File and Directory paths should be cropped in the middle and not at the beginning of the path; r=Unfocused

This commit is contained in:
Geoff Lankow 2011-08-17 14:03:28 +12:00
parent d3a3a98379
commit 2fed4a06fc
5 changed files with 11 additions and 1 deletions

View File

@ -402,7 +402,7 @@
</xul:vbox> </xul:vbox>
<xul:hbox anonid="input-container" align="center" class="setting-input"> <xul:hbox anonid="input-container" align="center" class="setting-input">
<xul:button type="button" anonid="button" label="&settings.path.button.label;" xbl:inherits="disabled" oncommand="showPicker();" /> <xul:button type="button" anonid="button" label="&settings.path.button.label;" xbl:inherits="disabled" oncommand="showPicker();" />
<xul:label anonid="input" flex="1" crop="start" xbl:inherits="disabled" /> <xul:label anonid="input" flex="1" crop="center" xbl:inherits="disabled" />
</xul:hbox> </xul:hbox>
</content> </content>
@ -466,6 +466,7 @@
label = this.hasAttribute("fullpath") ? file.path : file.leafName; label = this.hasAttribute("fullpath") ? file.path : file.leafName;
} catch (e) {} } catch (e) {}
} }
this.input.tooltipText = val;
return this.input.value = label; return this.input.value = label;
]]> ]]>
</setter> </setter>

View File

@ -242,6 +242,7 @@ add_test(function() {
var button = gManagerWindow.document.getAnonymousElementByAttribute(settings[6], "anonid", "button"); var button = gManagerWindow.document.getAnonymousElementByAttribute(settings[6], "anonid", "button");
input = gManagerWindow.document.getAnonymousElementByAttribute(settings[6], "anonid", "input"); input = gManagerWindow.document.getAnonymousElementByAttribute(settings[6], "anonid", "input");
is(input.value, "", "Label value should be empty"); is(input.value, "", "Label value should be empty");
is(input.tooltipText, "", "Label tooltip should be empty");
var profD = Services.dirsvc.get("ProfD", Ci.nsIFile); var profD = Services.dirsvc.get("ProfD", Ci.nsIFile);
var curProcD = Services.dirsvc.get("CurProcD", Ci.nsIFile); var curProcD = Services.dirsvc.get("CurProcD", Ci.nsIFile);
@ -251,6 +252,7 @@ add_test(function() {
EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow); EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
is(MockFilePicker.mode, Ci.nsIFilePicker.modeOpen, "File picker mode should be open file"); is(MockFilePicker.mode, Ci.nsIFilePicker.modeOpen, "File picker mode should be open file");
is(input.value, profD.path, "Label value should match file chosen"); is(input.value, profD.path, "Label value should match file chosen");
is(input.tooltipText, profD.path, "Label tooltip should match file chosen");
is(Services.prefs.getCharPref("extensions.inlinesettings1.file"), profD.path, "File pref should match file chosen"); is(Services.prefs.getCharPref("extensions.inlinesettings1.file"), profD.path, "File pref should match file chosen");
MockFilePicker.returnFiles = [curProcD]; MockFilePicker.returnFiles = [curProcD];
@ -258,18 +260,21 @@ add_test(function() {
EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow); EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
is(MockFilePicker.mode, Ci.nsIFilePicker.modeOpen, "File picker mode should be open file"); is(MockFilePicker.mode, Ci.nsIFilePicker.modeOpen, "File picker mode should be open file");
is(input.value, profD.path, "Label value should not have changed"); is(input.value, profD.path, "Label value should not have changed");
is(input.tooltipText, profD.path, "Label tooltip should not have changed");
is(Services.prefs.getCharPref("extensions.inlinesettings1.file"), profD.path, "File pref should not have changed"); is(Services.prefs.getCharPref("extensions.inlinesettings1.file"), profD.path, "File pref should not have changed");
ok(!settings[7].hasAttribute("first-row"), "Not the first row"); ok(!settings[7].hasAttribute("first-row"), "Not the first row");
button = gManagerWindow.document.getAnonymousElementByAttribute(settings[7], "anonid", "button"); button = gManagerWindow.document.getAnonymousElementByAttribute(settings[7], "anonid", "button");
input = gManagerWindow.document.getAnonymousElementByAttribute(settings[7], "anonid", "input"); input = gManagerWindow.document.getAnonymousElementByAttribute(settings[7], "anonid", "input");
is(input.value, "", "Label value should be empty"); is(input.value, "", "Label value should be empty");
is(input.tooltipText, "", "Label tooltip should be empty");
MockFilePicker.returnFiles = [profD]; MockFilePicker.returnFiles = [profD];
MockFilePicker.returnValue = Ci.nsIFilePicker.returnOK; MockFilePicker.returnValue = Ci.nsIFilePicker.returnOK;
EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow); EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
is(MockFilePicker.mode, Ci.nsIFilePicker.modeGetFolder, "File picker mode should be directory"); is(MockFilePicker.mode, Ci.nsIFilePicker.modeGetFolder, "File picker mode should be directory");
is(input.value, profD.path, "Label value should match file chosen"); is(input.value, profD.path, "Label value should match file chosen");
is(input.tooltipText, profD.path, "Label tooltip should match file chosen");
is(Services.prefs.getCharPref("extensions.inlinesettings1.directory"), profD.path, "Directory pref should match file chosen"); is(Services.prefs.getCharPref("extensions.inlinesettings1.directory"), profD.path, "Directory pref should match file chosen");
MockFilePicker.returnFiles = [curProcD]; MockFilePicker.returnFiles = [curProcD];
@ -277,6 +282,7 @@ add_test(function() {
EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow); EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
is(MockFilePicker.mode, Ci.nsIFilePicker.modeGetFolder, "File picker mode should be directory"); is(MockFilePicker.mode, Ci.nsIFilePicker.modeGetFolder, "File picker mode should be directory");
is(input.value, profD.path, "Label value should not have changed"); is(input.value, profD.path, "Label value should not have changed");
is(input.tooltipText, profD.path, "Label tooltip should not have changed");
is(Services.prefs.getCharPref("extensions.inlinesettings1.directory"), profD.path, "Directory pref should not have changed"); is(Services.prefs.getCharPref("extensions.inlinesettings1.directory"), profD.path, "Directory pref should not have changed");
} finally { } finally {

View File

@ -724,6 +724,7 @@
} }
#detail-grid > columns > column:first-child { #detail-grid > columns > column:first-child {
min-width: 15em;
max-width: 25em; max-width: 25em;
} }

View File

@ -902,6 +902,7 @@
} }
#detail-grid > columns > column:first-child { #detail-grid > columns > column:first-child {
min-width: 15em;
max-width: 25em; max-width: 25em;
} }

View File

@ -881,6 +881,7 @@
} }
#detail-grid > columns > column:first-child { #detail-grid > columns > column:first-child {
min-width: 15em;
max-width: 25em; max-width: 25em;
} }