FoxToPhone 1.2.3, updated translations, removal of min.us option, internal change on the handling of additional protocols.

This commit is contained in:
amla70
2012-10-21 17:38:35 +00:00
parent 4b66379afc
commit 7321924c04
9 changed files with 142 additions and 101 deletions

View File

@@ -1,5 +1,8 @@
"use strict";
const Cc = Components.classes;
const Ci = Components.interfaces;
let foxToPhonePreferences =
{
load: function()
@@ -14,10 +17,6 @@ let foxToPhonePreferences =
fileserverMenuList.value = fileServerUrl;
break;
case 'http://min.us':
fileserverMenuList.value = fileServerUrl;
break;
default:
fileserverMenuList.value = 'Custom';
break;
@@ -53,8 +52,8 @@ let foxToPhonePreferences =
while (accountsList.getRowCount() >0)
accountsList.removeItemAt(0);
this.prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService)
this.prefs = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefService)
.getBranch("extensions.sendtophone.") ;
var accounts = this.prefs.getCharPref("accounts").split(";");
@@ -73,8 +72,8 @@ let foxToPhonePreferences =
{
if (!this.strings)
{
this.strings = Components.classes["@mozilla.org/intl/stringbundle;1"]
.getService(Components.interfaces.nsIStringBundleService)
this.strings = Cc["@mozilla.org/intl/stringbundle;1"]
.getService(Ci.nsIStringBundleService)
.createBundle("chrome://sendtophone/locale/overlay.properties");
}
@@ -98,8 +97,8 @@ let foxToPhonePreferences =
n++;
var input = {value:"Phone " + n};
if (Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService)
if (Cc["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Ci.nsIPromptService)
.prompt( null, this.getString("SendToPhoneTitle"), this.getString("PhoneAccountPromptAdd"), input, null, {value: false}))
{
@@ -118,8 +117,8 @@ let foxToPhonePreferences =
{
var item = accountsList.selectedItems[i],
input = {value:item.label},
ok = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService)
ok = Cc["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Ci.nsIPromptService)
.prompt( null, this.getString("SendToPhoneTitle"), this.getString("PhoneAccountPromptRename"), input, null, {value: false});
if (!ok)
@@ -140,8 +139,8 @@ let foxToPhonePreferences =
{
var item = accountsList.selectedItems[i],
title = item.label;
if (!Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService)
if (!Cc["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Ci.nsIPromptService)
.confirm( null, this.getString("SendToPhoneTitle"), this.getString("PhoneAccountPromptRemove") + "\r\n" + title))
return;

View File

@@ -71,7 +71,6 @@
<menulist id="extensionsSendToPhoneFileServer">
<menupopup>
<menuitem value="" label="&sendtophoneFileServer.None;" />
<menuitem value="http://min.us" label="Min.us" />
<menuitem value="Custom" label="&sendtophoneFileServer.Custom;" />
</menupopup>
</menulist>

View File

@@ -27,3 +27,8 @@
<!ENTITY sendtophoneFileServer.None "Ниједан">
<!ENTITY sendtophoneFileServer.Custom "Прилагођени">
<!ENTITY sendtophoneFileServer.Disclaimer "Напомена: ми, аутори додатка FoxToPhone, нсимо повезани ни са једним хостингом наведеним овде. Требало би да прочитате њихове услове коришћења пре него што их почнете користити.">
<!ENTITY sendtophonePhoneAccounts.label "Налози у телефону">
<!ENTITY sendtophonePhoneAccounts.description "Ако на својим уређајима користите више налога за Google сервере, можете да се пребацујете између њих, када их једном направите овде.">
<!ENTITY sendtophonePhoneAccounts.add "Додај нови">
<!ENTITY sendtophonePhoneAccounts.rename "Преименуј">
<!ENTITY sendtophonePhoneAccounts.remove "Уклони">

View File

@@ -21,3 +21,6 @@ qrContextMenu=Пошаљи „%s” у Андроид
FileUploadsDisabled=Није могуће слати слике на телефон.
FileTooBig=Датотека је превелика.
videoTitle=Веза до видео снимка
PhoneAccountPromptAdd=Унесите назив новог налога
PhoneAccountPromptRename=Унесите ново име овог налога
PhoneAccountPromptRemove=Желите ли да избришете овај налог?

View File

@@ -12,23 +12,23 @@
<!ENTITY sendtophoneContextLogout.accesskey "L">
<!ENTITY sendtophoneOptions.title "Fox To Phone Seçenekleri">
<!ENTITY sendtophoneProtocols.label "Protokoller">
<!ENTITY sendtophoneContextSendFile.label "Dosya Gönder">
<!ENTITY sendtophoneContextSendFile.label "Dosyaya Gönder">
<!ENTITY sendtophoneContextSendFile.accesskey "S">
<!ENTITY sendtophoneContextSendFolder.label "Klasör Gönder">
<!ENTITY sendtophoneContextSendFolder.label "Klasöre Gönder">
<!ENTITY sendtophoneContextSendFolder.accesskey "F">
<!ENTITY sendtophoneContextQrImage.label "Android için çözümlenmiş QR Link Gönder">
<!ENTITY sendtophoneContextQrImage.label "Çözümlenmiş QR Bağlantısını Android'e Gönder">
<!ENTITY sendtophoneContextQrImage.accesskey "Q">
<!ENTITY sendtophoneContextSendClipboard.label "Panoya Gönder">
<!ENTITY sendtophoneContextSendClipboard.accesskey "C">
<!ENTITY sendtophoneContextVideo.label "Androide video gönder">
<!ENTITY sendtophoneContextVideo.label "Videoyu Andoid'e Gönder">
<!ENTITY sendtophoneContextVideo.accesskey "V">
<!ENTITY sendtophoneFileTransfers.label "Dosya transferleri">
<!ENTITY sendtophoneFileTransfers.label "Dosya aktarımları">
<!ENTITY sendtophoneFileServer.label "Sunucu">
<!ENTITY sendtophoneFileServer.None "Hiç">
<!ENTITY sendtophoneFileServer.Custom "Özel">
<!ENTITY sendtophoneFileServer.Disclaimer "Yasal Uyarı: Biz (FoxToPhone geliştiriciler) burada listelenen üçüncü taraf barındırma hizmetleri ile bağlantılı değildir. Siz bunları kullanmadan önce Hizmet Şartlarını okumalısınız.">
<!ENTITY sendtophoneFileServer.Disclaimer "Yasal Uyarı: Bizim (FoxToPhone geliştiricileri) burada listelenen üçüncü taraf barındırma hizmetleriyle bağlantımız yoktur. Bunları kullanmadan önce servisin kendi koşullarını okumalısınız.">
<!ENTITY sendtophonePhoneAccounts.label "Telefon hesapları">
<!ENTITY sendtophonePhoneAccounts.description "Cihazınızda birden fazla Google hesabı kullanıyorsanız,bu hesapları burada oluşturdktan sonra aralarında geçiş yapabilirsiniz.">
<!ENTITY sendtophonePhoneAccounts.description "Eğer cihazınızda birkaç Google hesabı kullanıyorsanız, burada oluşturduktan sonra bunlar arasında geçiş yapabilirsiniz.">
<!ENTITY sendtophonePhoneAccounts.add "Yeni ekle">
<!ENTITY sendtophonePhoneAccounts.rename "Yeniden adlandır">
<!ENTITY sendtophonePhoneAccounts.remove "Sil">
<!ENTITY sendtophonePhoneAccounts.remove "Kaldır">

View File

@@ -1,26 +1,26 @@
extensions.sendtophone@martinezdelizarrondo.com.description=Var olan sayfayı telefona gönderir
extensions.sendtophone@martinezdelizarrondo.com.description=Geçerli sayfayı Android telefonunuza gönderir
SendToPhoneTitle=Fox To Phone
InvalidScheme=Geçersiz şema, sadece http:// veya https:// bağlantılar gönderebilirsiniz.
InfoSent=Bağlantı telefona gönderildi.
ErrorOnSend=Gönderimde bir hata oluştu:
LoginRequired=Bağlantıyı göndermek için giriş gerekli
InvalidScheme=Geçersiz düzen,lütfen sadece http:// veya https:// bağlantısı gönderin.
InfoSent=Bağlantı telefonunuza gönderildi.
ErrorOnSend=Gönderirken bir hata oluştu:
LoginRequired=Bağlantı göndermek için giriş gerekli.
LoginSuccessful=Giriş yaptınız.
DeviceNotRegistered=Bu GMail hesabına kayıtlı chrometophone.apk dosyasını telefonunuza yüklemeniz gerekiyor.
LogoutSuccessful=Çıkış yaptınız.
DeviceNotRegistered=GMail hesabına kayıtlı telefonunuza chrometophone.apk yüklemeniz gerekir.
LogoutSuccessful=Çıkış yaptınız
marketLink=Market Bağlantısı
smsLink=SMS Numarası
smstoLink=SMS Numarası
telLink=Telefon Numarası
InvalidFile=Geçerli bir dosya değil
SendFileToPhone=Dosyaları telefona gönder
SendFolderToPhone=Klasörleri telefona gönder
InvalidFile=Geçersiz dosya
SendFileToPhone=Telefona dosya gönder.
SendFolderToPhone=Telefona klasör gönder.
qrTitle=QR Görüntü Bağlantısı
ConfirmQR=Bir QR görüntüsü tespit edildin"%s"n Bunu göndermek istiyor musunuz?
RememberMyDecision=Seçimimi hatırla
qrContextMenu="% s" yi Android'e gönder
FileUploadsDisabled=Bu dosyaları telefona yüklemek mümkün değil.
ConfirmQR=Bir QR görüntüsü tespit edildi\n"%s"\nSayfanın yerine bunu göndermek istiyor musunuz?
RememberMyDecision=Seçimlerimi hatırla
qrContextMenu="%s" Android'e gönder
FileUploadsDisabled=Bu telefona dosya yüklemek mümkün değil.
FileTooBig=Dosya çok büyük.
videoTitle=Video Bağlantısı
PhoneAccountPromptAdd=Yeni hesap için lütfen bir isim yazın
PhoneAccountPromptRename=Bu hesap için lütfen bir isim yazın
PhoneAccountPromptAdd=Lütfen, yeni hesabın adını yazın
PhoneAccountPromptRename=Lütfen, bu hesap için yeni bir ad yazın
PhoneAccountPromptRemove=Bu hesabı silmek istediğinizden emin misiniz?

View File

@@ -4,7 +4,7 @@
<em:id>sendtophone@martinezdelizarrondo.com</em:id>
<em:type>2</em:type>
<em:name>Fox To Phone</em:name>
<em:version>1.2.2</em:version>
<em:version>1.2.3</em:version>
<em:creator>Alfonso &amp; Patrick</em:creator>
<em:description>Send links to your Android 2.2 phone using the new C2DM service. Based on the ChromeToPhone extension.</em:description>
@@ -26,12 +26,13 @@
<em:contributor>Michał Jakubowski :: revanmj (Polish)</em:contributor>
<em:contributor>Fırat Avcı, omrakin (Turkish)</em:contributor>
<em:contributor>Jose Sun (Chinese traditional)</em:contributor>
<em:contributor>antonio.cat (Catalan)</em:contributor>
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <!-- Firefox -->
<em:minVersion>3.6</em:minVersion>
<em:maxVersion>9.*</em:maxVersion>
<em:maxVersion>16.*</em:maxVersion>
</Description>
</em:targetApplication>
@@ -40,7 +41,7 @@
<!-- SeaMonkey -->
<em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id>
<em:minVersion>2.1</em:minVersion>
<em:maxVersion>2.3.*</em:maxVersion>
<em:maxVersion>2.6.*</em:maxVersion>
</Description>
</em:targetApplication>

View File

@@ -6,6 +6,13 @@ var EXPORTED_SYMBOLS = [];
const Cc = Components.classes;
const Ci = Components.interfaces;
//XXXgijs: Because necko is annoying and doesn't expose this error flag, we
// define our own constant for it. Throwing something else will show
// ugly errors instead of seeminly doing nothing.
const NS_ERROR_MODULE_NETWORK_BASE = 0x804b0000;
const NS_ERROR_NO_CONTENT = NS_ERROR_MODULE_NETWORK_BASE + 17;
var manager = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
var strings = Cc["@mozilla.org/intl/stringbundle;1"]
.getService(Ci.nsIStringBundleService)
@@ -14,10 +21,10 @@ var strings = Cc["@mozilla.org/intl/stringbundle;1"]
// Utility function to handle the preferences
// https://developer.mozilla.org/en/Code_snippets/Preferences
function PrefListener(branchName, func) {
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
var prefService = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefService);
var branch = prefService.getBranch(branchName);
branch.QueryInterface(Components.interfaces.nsIPrefBranch2);
branch.QueryInterface(Ci.nsIPrefBranch2);
this.register = function() {
branch.addObserver("", this, false);
@@ -60,28 +67,20 @@ function SendToPhone_ProtocolWrapper( properties )
// nsIProtocolHandler implementation:
// default attributes
protocolFlags : Ci.nsIProtocolHandler.URI_LOADABLE_BY_ANYONE,
protocolFlags : Ci.nsIProtocolHandler.URI_LOADABLE_BY_ANYONE | Ci.nsIProtocolHandler.URI_DOES_NOT_RETURN_DATA,
defaultPort : -1,
newURI : function(aSpec, aCharset, aBaseURI)
{
var uri = Components.classes["@mozilla.org/network/simple-uri;1"].createInstance(Ci.nsIURI);
var uri = Cc["@mozilla.org/network/simple-uri;1"].createInstance(Ci.nsIURI);
uri.spec = aSpec;
return uri;
},
newChannel : function(aURI)
{
var myURI = decodeURI(aURI.spec);
// Core functions loaded on demand
if (typeof sendtophoneCore == "undefined")
Components.utils.import("resource://sendtophone/sendtophone.js");
sendtophoneCore.send(this.linkTitle, myURI, "")
// return a fake empty channel so current window doesn't change
return Components.classes[ "@mozilla.org/network/input-stream-channel;1" ].createInstance(Ci.nsIChannel);
// Use our channel implementation
return new BogusChannel(aURI, this.linkTitle);
},
scheme : properties.scheme,
classDescription : "SendToPhone handler for " + properties.scheme,
@@ -93,6 +92,78 @@ function SendToPhone_ProtocolWrapper( properties )
return myHandler;
}
/* bogus nsiChannel copied from Chatzilla */
function BogusChannel(URI, linkTitle)
{
this.URI = URI;
this.linkTitle = linkTitle;
}
BogusChannel.prototype.QueryInterface =
function bc_QueryInterface(iid)
{
if (!iid.equals(Ci.nsIChannel) && !iid.equals(Ci.nsIRequest) &&
!iid.equals(Ci.nsISupports))
throw Components.results.NS_ERROR_NO_INTERFACE;
return this;
}
/* nsIChannel */
BogusChannel.prototype.loadAttributes = null;
BogusChannel.prototype.contentLength = 0;
BogusChannel.prototype.owner = null;
BogusChannel.prototype.loadGroup = null;
BogusChannel.prototype.notificationCallbacks = null;
BogusChannel.prototype.securityInfo = null;
BogusChannel.prototype.open =
BogusChannel.prototype.asyncOpen =
function bc_open(observer, ctxt)
{
// Core functions are loaded on demand
if (typeof sendtophoneCore == "undefined")
Components.utils.import("resource://sendtophone/sendtophone.js");
sendtophoneCore.send(this.linkTitle, decodeURI(this.URI.spec), "")
// We don't throw this (a number, not a real 'resultcode') because it
// upsets xpconnect if we do (error in the js console).
Components.returnCode = NS_ERROR_NO_CONTENT;
}
BogusChannel.prototype.asyncRead =
function bc_asyncRead(listener, ctxt)
{
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIRequest */
BogusChannel.prototype.isPending =
function bc_isPending()
{
return true;
}
BogusChannel.prototype.status = Components.results.NS_OK;
BogusChannel.prototype.cancel =
function bc_cancel(status)
{
this.status = status;
}
BogusChannel.prototype.suspend =
BogusChannel.prototype.resume =
function bc_suspres()
{
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
}
/* /bogus nsiChannel */
// This function takes care of register/unregister the protocol handlers as requested
// It's called when the preferences change.
function toggleProtocolHandler(branch, name)
@@ -137,3 +208,11 @@ var sendToPhoneProtocols = {
// Listen for changes in the preferences and register the protocols as needed.
var preferencesListener = new PrefListener("extensions.sendtophone.protocols.", toggleProtocolHandler);
preferencesListener.register();
// Outputs log message to the console
function log( text )
{
Cc["@mozilla.org/consoleservice;1"]
.getService(Ci.nsIConsoleService)
.logStringMessage( "foxtophone prococolHandler: " + text );
}

View File

@@ -466,12 +466,6 @@ var sendtophoneCore = {
return;
}
if ( uri == "http://min.us" )
{
Minus.SendFile(nsFile, callback);
return;
}
this.sendFileXHR( nsFile, callback, uri, 'upload', function(target, uploadName)
{
var body = target.responseXML,
@@ -614,45 +608,6 @@ var sendtophoneCore = {
}
};
// http://min.us/
var Minus = {
prefix: 'http://min.us/api/',
SendFile : function(nsFile, callback) {
// Create a gallery
sendtophoneCore.processXHR( Minus.prefix + 'CreateGallery', 'GET', null, null, function(req) {
var body = req.responseText;
if (body.substring(0, 1) != '{')
{
sendtophoneCore.alert(sendtophoneCore.getString("ErrorOnSend") + ' (status ' + req.status + ')\r\n' + body);
return;
}
var gallery = JSON.parse( body );
// Send the file
sendtophoneCore.sendFileXHR(nsFile, callback, Minus.prefix +
'UploadItem?editor_id=' + gallery.editor_id + '&key=OK&filename=' + encodeURIComponent(nsFile.leafName), 'file',
function(target, uploadName)
{
var body = target.responseText;
if (body.substring(0, 1) != '{')
{
sendtophoneCore.alert(sendtophoneCore.getString("ErrorOnSend") + ' (status ' + req.status + ')\r\n' + body);
return;
}
var file = JSON.parse( body );
// var url = "http://k.min.us/j" + file.id;
var url = "http://min.us/m" + gallery.reader_id;
sendtophoneCore.send(uploadName, url, "");
});
});
}
};
/* Zipping functions */
const PR_RDONLY = 0x01;
const PR_WRONLY = 0x02;