зеркало из https://github.com/mozilla/gecko-dev.git
Bug 99328 can't copy entries in javascript console to X primary selection (copy to clipboard works)
patch by neil@parkwaycc.co.uk r=akkana sr=bz
This commit is contained in:
Родитель
d298dda781
Коммит
d2698e7f7e
|
@ -211,8 +211,15 @@
|
||||||
|
|
||||||
<method name="copySelectedItem">
|
<method name="copySelectedItem">
|
||||||
<body><![CDATA[
|
<body><![CDATA[
|
||||||
if (this.mSelectedItem)
|
if (this.mSelectedItem) try {
|
||||||
this.copyString(this.mSelectedItem.toString());
|
const clipURI = "@mozilla.org/widget/clipboardhelper;1";
|
||||||
|
const clipI = Components.interfaces.nsIClipboardHelper;
|
||||||
|
var clipboard = Components.classes[clipURI].getService(clipI);
|
||||||
|
|
||||||
|
clipboard.copyString(this.mSelectedItem.toString());
|
||||||
|
} catch (ex) {
|
||||||
|
// Unable to copy anything, die quietly
|
||||||
|
}
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
@ -275,31 +282,6 @@
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
<method name="copyString">
|
|
||||||
<parameter name="aString"/>
|
|
||||||
<body><![CDATA[
|
|
||||||
try {
|
|
||||||
const clipURI = "@mozilla.org/widget/clipboard;1";
|
|
||||||
const clipI = Components.interfaces.nsIClipboard;
|
|
||||||
var clipboard = Components.classes[clipURI].getService(clipI);
|
|
||||||
|
|
||||||
const transURI = "@mozilla.org/widget/transferable;1";
|
|
||||||
var transferable = Components.classes[transURI].createInstance(Components.interfaces.nsITransferable);
|
|
||||||
|
|
||||||
transferable.addDataFlavor("text/unicode");
|
|
||||||
|
|
||||||
const strURI = "@mozilla.org/supports-string;1";
|
|
||||||
var wstring = Components.classes[strURI].createInstance(Components.interfaces.nsISupportsString);
|
|
||||||
|
|
||||||
wstring.data = aString;
|
|
||||||
transferable.setTransferData("text/unicode", wstring, aString.length * 2);
|
|
||||||
clipboard.setData(transferable, null, clipI.kGlobalClipboard);
|
|
||||||
} catch (ex) {
|
|
||||||
// Unable to copy anything, die quietly
|
|
||||||
}
|
|
||||||
]]></body>
|
|
||||||
</method>
|
|
||||||
|
|
||||||
<constructor> this.init(); </constructor>
|
<constructor> this.init(); </constructor>
|
||||||
<destructor> this.destroy(); </destructor>
|
<destructor> this.destroy(); </destructor>
|
||||||
</implementation>
|
</implementation>
|
||||||
|
|
Загрузка…
Ссылка в новой задаче