mirror of
https://github.com/fergalmoran/chrometophone.git
synced 2025-12-22 09:41:51 +00:00
FoxToPhone. Compatibility with Seamonkey and folder uploads in Windows. Ready for public test.
This commit is contained in:
@@ -162,7 +162,7 @@ sendtophone.doDrop = function(event)
|
|||||||
for (var i = 0; i < dt.mozItemCount; i++)
|
for (var i = 0; i < dt.mozItemCount; i++)
|
||||||
{
|
{
|
||||||
var file = dt.mozGetDataAt("application/x-moz-file", i);
|
var file = dt.mozGetDataAt("application/x-moz-file", i);
|
||||||
if (file instanceof Ci.nsIFile )
|
if (file instanceof Components.interfaces.nsIFile )
|
||||||
sendtophoneCore.sendFile(file);
|
sendtophoneCore.sendFile(file);
|
||||||
else
|
else
|
||||||
this.alert(this.getString("InvalidFile"));
|
this.alert(this.getString("InvalidFile"));
|
||||||
@@ -173,26 +173,31 @@ sendtophone.doDrop = function(event)
|
|||||||
|
|
||||||
sendtophone.pickFile = function(folder)
|
sendtophone.pickFile = function(folder)
|
||||||
{
|
{
|
||||||
var fp = Cc["@mozilla.org/filepicker;1"]
|
var fp = Components.classes["@mozilla.org/filepicker;1"]
|
||||||
.createInstance(Ci.nsIFilePicker);
|
.createInstance(Components.interfaces.nsIFilePicker);
|
||||||
|
|
||||||
if (folder)
|
if (folder)
|
||||||
fp.init(window, this.getString("SendFolderToPhone"), Ci.nsIFilePicker.modeGetFolder);
|
fp.init(window, this.getString("SendFolderToPhone"), Components.interfaces.nsIFilePicker.modeGetFolder);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fp.init(window, this.getString("SendFileToPhone"), Ci.nsIFilePicker.modeOpenMultiple);
|
fp.init(window, this.getString("SendFileToPhone"), Components.interfaces.nsIFilePicker.modeOpenMultiple);
|
||||||
fp.appendFilters( Ci.nsIFilePicker.filterAll );
|
fp.appendFilters( Components.interfaces.nsIFilePicker.filterAll );
|
||||||
}
|
}
|
||||||
|
|
||||||
var rv = fp.show();
|
var rv = fp.show();
|
||||||
|
|
||||||
if (rv == Ci.nsIFilePicker.returnOK)
|
if (rv == Components.interfaces.nsIFilePicker.returnOK)
|
||||||
{
|
{
|
||||||
var files = fp.files;
|
if (folder)
|
||||||
while (files.hasMoreElements())
|
sendtophoneCore.sendFile( fp.file );
|
||||||
|
else
|
||||||
{
|
{
|
||||||
var file = files.getNext().QueryInterface(Ci.nsILocalFile);
|
var files = fp.files;
|
||||||
sendtophoneCore.sendFile( file );
|
while (files.hasMoreElements())
|
||||||
|
{
|
||||||
|
var file = files.getNext().QueryInterface(Components.interfaces.nsILocalFile);
|
||||||
|
sendtophoneCore.sendFile( file );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,24 +31,22 @@
|
|||||||
</groupbox>
|
</groupbox>
|
||||||
|
|
||||||
<groupbox style="padding:1em; min-height:10em;" label="FileServer">
|
<groupbox style="padding:1em; min-height:10em;" label="FileServer">
|
||||||
<caption label="File transfers" />
|
<caption label="&sendtophoneFileTransfers.label;" />
|
||||||
<hbox align="center">
|
<hbox align="center">
|
||||||
<label value="Server"
|
<label value="&sendtophoneFileServer.label;"
|
||||||
flex="1"
|
flex="1"
|
||||||
control="extensionsSendToPhoneFileServer"/>
|
control="extensionsSendToPhoneFileServer"/>
|
||||||
|
|
||||||
<menulist id="extensionsSendToPhoneFileServer">
|
<menulist id="extensionsSendToPhoneFileServer">
|
||||||
<menupopup>
|
<menupopup>
|
||||||
<menuitem value="" label="None" />
|
<menuitem value="" label="&sendtophoneFileServer.None;" />
|
||||||
<menuitem value="http://min.us" label="Min.us" />
|
<menuitem value="http://min.us" label="Min.us" />
|
||||||
<menuitem value="Custom" label="Custom" />
|
<menuitem value="Custom" label="&sendtophoneFileServer.Custom;" />
|
||||||
</menupopup>
|
</menupopup>
|
||||||
</menulist>
|
</menulist>
|
||||||
|
|
||||||
<description style="width: 300px;height:3em;" id="foxtophoneDisclaimer">
|
<description style="width: 300px;height:3em;" id="foxtophoneDisclaimer">
|
||||||
Disclaimer: We (FoxToPhone developers) are not affiliated
|
&sendtophoneFileServer.Disclaimer;
|
||||||
with any of the third party hosting services listed here.
|
|
||||||
You should read their Terms Of Service before using them.
|
|
||||||
</description>
|
</description>
|
||||||
</hbox>
|
</hbox>
|
||||||
|
|
||||||
|
|||||||
@@ -236,11 +236,9 @@ var sendtophone = {
|
|||||||
initPopup: function()
|
initPopup: function()
|
||||||
{
|
{
|
||||||
var fileServerUrl = this.prefs.getCharPref( "fileServerUrl" );
|
var fileServerUrl = this.prefs.getCharPref( "fileServerUrl" );
|
||||||
if (!fileServerUrl)
|
document.getElementById("sendtophoneContextMenuSendFiles").hidden = !fileServerUrl;
|
||||||
{
|
document.getElementById("sendtophoneContextMenuSendFolder").hidden = !fileServerUrl;
|
||||||
document.getElementById("sendtophoneContextMenuSendFiles").hidden = true;
|
|
||||||
document.getElementById("sendtophoneContextMenuSendFolder").hidden = true;
|
|
||||||
}
|
|
||||||
document.getElementById("sendtophoneContextMenuSendClipboard").disabled = !this.clipboardHasText();
|
document.getElementById("sendtophoneContextMenuSendClipboard").disabled = !this.clipboardHasText();
|
||||||
|
|
||||||
// returning true will make the popup show
|
// returning true will make the popup show
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ let gUploadListener = {
|
|||||||
|
|
||||||
// If no more pending uploads, close the tab.
|
// If no more pending uploads, close the tab.
|
||||||
// Use a 0 ms timeout to avoid flicker while compress -> upload a folder
|
// Use a 0 ms timeout to avoid flicker while compress -> upload a folder
|
||||||
|
// The trick won't work if in order to upload the file itself we have to perform an extra request before
|
||||||
|
// (like creating a gallery in min.us)
|
||||||
let checkTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
let checkTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||||
checkTimer.initWithCallback( this.checkTimerEvent, 0, Ci.nsITimer.TYPE_ONE_SHOT );
|
checkTimer.initWithCallback( this.checkTimerEvent, 0, Ci.nsITimer.TYPE_ONE_SHOT );
|
||||||
},
|
},
|
||||||
@@ -42,7 +44,7 @@ let gUploadListener = {
|
|||||||
{
|
{
|
||||||
notify: function(timer)
|
notify: function(timer)
|
||||||
{
|
{
|
||||||
if (!sendtophoneUploadsManager.isWindowNeeded())
|
if (!sendtophoneUploadsManager.isWindowNeeded(true))
|
||||||
{
|
{
|
||||||
if (gUploadListener.UploadsView.children.length==0)
|
if (gUploadListener.UploadsView.children.length==0)
|
||||||
window.close();
|
window.close();
|
||||||
|
|||||||
@@ -22,3 +22,8 @@
|
|||||||
<!ENTITY sendtophoneContextSendClipboard.accesskey "C">
|
<!ENTITY sendtophoneContextSendClipboard.accesskey "C">
|
||||||
<!ENTITY sendtophoneContextVideo.label "Send Video to Android">
|
<!ENTITY sendtophoneContextVideo.label "Send Video to Android">
|
||||||
<!ENTITY sendtophoneContextVideo.accesskey "V">
|
<!ENTITY sendtophoneContextVideo.accesskey "V">
|
||||||
|
<!ENTITY sendtophoneFileTransfers.label "File transfers">
|
||||||
|
<!ENTITY sendtophoneFileServer.label "Server">
|
||||||
|
<!ENTITY sendtophoneFileServer.None "None">
|
||||||
|
<!ENTITY sendtophoneFileServer.Custom "Custom">
|
||||||
|
<!ENTITY sendtophoneFileServer.Disclaimer "Disclaimer: We (FoxToPhone developers) are not affiliated with any of the third party hosting services listed here. You should read their Terms Of Service before using them.">
|
||||||
|
|||||||
@@ -22,3 +22,8 @@
|
|||||||
<!ENTITY sendtophoneContextSendClipboard.accesskey "C">
|
<!ENTITY sendtophoneContextSendClipboard.accesskey "C">
|
||||||
<!ENTITY sendtophoneContextVideo.label "Enviar video a Android">
|
<!ENTITY sendtophoneContextVideo.label "Enviar video a Android">
|
||||||
<!ENTITY sendtophoneContextVideo.accesskey "V">
|
<!ENTITY sendtophoneContextVideo.accesskey "V">
|
||||||
|
<!ENTITY sendtophoneFileTransfers.label "Envío de ficheros">
|
||||||
|
<!ENTITY sendtophoneFileServer.label "Servidor">
|
||||||
|
<!ENTITY sendtophoneFileServer.None "Ninguno">
|
||||||
|
<!ENTITY sendtophoneFileServer.Custom "Personalizado">
|
||||||
|
<!ENTITY sendtophoneFileServer.Disclaimer "Aviso: Nosotros (los desarrolladores de Fox to Phone) no estamos relacionados con ninguno de los servidores de alojamiento mostrados aquí. Debes leer sus Terminos de Servicio antes de usarlos.">
|
||||||
|
|||||||
@@ -393,7 +393,7 @@ var sendtophoneCore = {
|
|||||||
sendtophoneUploadsManager.finishedUpload( progressId );
|
sendtophoneUploadsManager.finishedUpload( progressId );
|
||||||
|
|
||||||
// Send the zip and delete it afterwards
|
// Send the zip and delete it afterwards
|
||||||
sendtophoneCore.sendFile(nsZip, function() { nsZip.remove(false); });
|
sendtophoneCore.sendFile(nsZip, function() { nsZip.remove(false); if (callback) callback(); } );
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -158,10 +158,14 @@ var sendtophoneUploadsManager = {
|
|||||||
// or there's some file that might take longer than 2 seconds.
|
// or there's some file that might take longer than 2 seconds.
|
||||||
// If there's some file that we still don't know the speed
|
// If there's some file that we still don't know the speed
|
||||||
// then consider it also as needed.
|
// then consider it also as needed.
|
||||||
isWindowNeeded: function()
|
isWindowNeeded: function( alreadyOpen )
|
||||||
{
|
{
|
||||||
for (let id in this.uploads)
|
for (let id in this.uploads)
|
||||||
{
|
{
|
||||||
|
// If the progress window is already open and there's something pending then leave the window open
|
||||||
|
if (alreadyOpen)
|
||||||
|
return true;
|
||||||
|
|
||||||
let upload = this.uploads[id] ;
|
let upload = this.uploads[id] ;
|
||||||
|
|
||||||
// zipping folder: if takes so long to compress it, it will also take some time to upload it
|
// zipping folder: if takes so long to compress it, it will also take some time to upload it
|
||||||
@@ -198,7 +202,7 @@ var showTimerEvent =
|
|||||||
{
|
{
|
||||||
notify: function(timer)
|
notify: function(timer)
|
||||||
{
|
{
|
||||||
if (sendtophoneUploadsManager.isWindowNeeded())
|
if (sendtophoneUploadsManager.isWindowNeeded(false))
|
||||||
{
|
{
|
||||||
cancelShowTimer();
|
cancelShowTimer();
|
||||||
sendtophoneUploadsManager.showWindow();
|
sendtophoneUploadsManager.showWindow();
|
||||||
@@ -260,7 +264,7 @@ function openAndReuseOneTabPerURL(url) {
|
|||||||
var recentWindow = wm.getMostRecentWindow("navigator:browser");
|
var recentWindow = wm.getMostRecentWindow("navigator:browser");
|
||||||
if (recentWindow) {
|
if (recentWindow) {
|
||||||
// Use an existing browser window
|
// Use an existing browser window
|
||||||
recentWindow.delayedOpenTab(url, null, null, null, null);
|
recentWindow.getBrowser().loadOneTab( url, null, null, null, false, null );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// No browser windows are open, so open a new one.
|
// No browser windows are open, so open a new one.
|
||||||
|
|||||||
Reference in New Issue
Block a user