0. install MyPhoneExplorer und Lightning in Thunderbird(xul-ext-lightning)
1. open the MyPhonEexplorer xpi File an copy the mpe.js file (I used xarchiver)
2. open the mpe.js and replace the RegRead and Run function with:
Code: Alles auswählen
function RegRead(subkey,valuename)
{
var out = '';
var os = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime).OS;
if (os=="Linux"||IO.getFile("/usr/bin","wine").exists()){
// um die Konstanten zu genierieren
Components.classes["@mozilla.org/net/osfileconstantsservice;1"].getService(Components.interfaces.nsIOSFileConstantsService).init();
// erzeuge ein tmp file mit dem inhalt #!/bin/bash \n\$1 \> \$2 um die rückgabe der bash in eine Datei zu schreiben
var copyFile = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("TmpD", Components.interfaces.nsIFile);
copyFile.append("copy.sh");
copyFile.createUnique(copyFile.nsIFile.NORMAL_FILE_TYPE, 0o700);
WriteFile(copyFile.path,"#!/bin/bash \n\$1 \> \$2");
var process = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
process.init(copyFile);
var tmpFile = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("TmpD", Components.interfaces.nsIFile);
tmpFile.append("Query.tmp");
tmpFile.createUnique(tmpFile.NORMAL_FILE_TYPE, 0o600);
var args = ["wine reg Query HKCU\\"+subkey +" /v "+valuename, tmpFile.path];
process.run(true, args, args.length);
try {
var out = ReadFile(tmpFile.path);
out=out[2];
out=out.split("REG_SZ ");
out=out[1];
tmpFile.remove(false);
copyFile.remove(false);
//prüft ob es ein Systempfad ist(zweite Stelle ":")
if(out.indexOf(":")==1){
out= 'dosdevices/'+out.substr(0,1).toLowerCase()+out.substr(1,out.length-1);
out = out.split('\\').join('/');//ersetzt alle \\ durch /
out=OS.Constants.Path.homeDir+'/.wine/'+out;
}
}
catch(ex) {
Components.utils.reportError('Error reading HKCU\\' + subkey + ' : ' + valuename + ' : ' + ex);
}
}
else{
try {
var wrk = Components.classes["@mozilla.org/windows-registry-key;1"].createInstance(Components.interfaces.nsIWindowsRegKey);
wrk.open(wrk.ROOT_KEY_CURRENT_USER,subkey,wrk.ACCESS_READ);
out = wrk.readStringValue(valuename);
wrk.close();
}
catch(ex) {
// Components.utils.reportError('Error reading HKCU\\' + subkey + ' : ' + valuename + ' : ' + ex);
}
}
//Components.utils.reportError(out);
return(out);
}
Run: function(args)
{
//var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
var process = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
args=[args];
var os = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime).OS
var path = RegRead("Software\\MyPhoneExplorer", "PathToExe");
if (os=="Linux"||IO.getFile("/usr/bin","wine").exists()){
args=[path,args[0]];
path= "/usr/bin/wine";
}
if (path.length != 0) {
try
{
//file.initWithPath(path);
var file = new FileUtils.File(path);
process.init(file);
process.run(false, args, args.length);
return;
}
catch(ex)
{
Components.utils.reportError('Could not run ' + path);
return;
}
}
Components.utils.reportError("Could not find MyPhoneExplorer.exe");
},
3. put the modified file back into the xpi (also with xarchiver)
4. install the MyPhoneExplorer-Addon in thunderbird
5. make sure all links and regEntrys and Files are in place or run the script(store it as an executable file)
Code: Alles auswählen
#!/bin/bash
#prüfe ob wine installiert
if [ -f /usr/bin/wine ]; then
#erzeuge RegEintrag und bat-Datei für Thunderbird
batfilePath="$HOME/.wine/drive_c/Program Files/Mozilla Thunderbird"
key="HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\thunderbird.exe"
data="C:\\Program Files\\Mozilla Thunderbird\\thunderbird.bat"
wine reg add "$key" /v "" /t REG_SZ /d "$data"
#erzeuge .bat
if [ ! -d "$batfilePath" ]; then
mkdir "$batfilePath"
fi
echo "start /unix /usr/bin/thunderbird %1 %2" > "$batfilePath/thunderbird.bat"
chmod 777 "$batfilePath/thunderbird.bat"
# erzeuge softlink
target="$HOME/.thunderbird"
#aus REG auslesen
key="HKEY_USERS\.Default\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
data="AppData"
position=`wine reg query "$key" /v "$data"`
index=`expr index "$position" ':'`
position="${position:($index-2):(${#position}-$index-1)}"
if [ "$position" != "" ]; then
position="${position,}"
#resetze \ durch /
position="${position//\\/\/}"
position="$HOME/.wine/dosdevices/$position/Thunderbird"
#prüfen ob datei schon existiert
if [ ! -e "$position" ]; then
ln -s "$target" "$position"
fi
fi
unset batfilePath
unset key
unset data
unset target
unset position
unset index
#erzeuge extension.rdf
if [[ $(grep '\[Profile[^0]\]' "$HOME/.thunderbird/profiles.ini") ]]
then echo multi user funktioniert noch nicht, schreibe in thunderbird ordner
else target=$(grep 'Path=' "$HOME/.thunderbird/profiles.ini" | sed 's/^Path=//' | sed 's/\r//' | sed 's/\n//')
fi
target="$HOME/.thunderbird/$target/extensions.rdf"
if [ ! -e "$target" ]; then
echo "<?xml version=\"1.0\"?>" > "$target"
echo "<RDF:RDF xmlns:NS1=\"http://www.mozilla.org/2004/em-rdf#\"" >> "$target"
echo " xmlns:NC=\"http://home.netscape.com/NC-rdf#\"" >> "$target"
echo " xmlns:RDF=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">" >> "$target"
echo " <RDF:Seq RDF:about=\"urn:mozilla:item:root\">" >> "$target"
echo " <RDF:li RDF:resource=\"urn:mozilla:item:{e2fda1a4-762b-4020-b5ad-a41df1933103}\"/>" >> "$target"
echo " <RDF:li RDF:resource=\"urn:mozilla:item:myphoneexplorer@fjsoft.at\"/>" >> "$target"
echo " </RDF:Seq>" >> "$target"
echo " <RDF:Description RDF:about=\"urn:mozilla:item:{e2fda1a4-762b-4020-b5ad-a41df1933103}\"" >> "$target"
echo " NS1:installLocation=\"app-profile\"" >> "$target"
echo " NS1:version=\"6.2.2.1\"" >> "$target"
echo " NS1:optionsURL=\"chrome://messenger/content/preferences/preferences.xul\"" >> "$target"
echo " NS1:iconURL=\"chrome://calendar/skin/cal-icon32.png\"" >> "$target"
echo " NS1:name=\"Lightning\"" >> "$target"
echo " NS1:description=\"An integrated calendar for Thunderbird\"" >> "$target"
echo " NS1:creator=\"Mozilla Calendar Project\"" >> "$target"
echo " NS1:homepageURL=\"http://www.mozilla.org/projects/calendar/\">" >> "$target"
echo " <NS1:type NC:parseType=\"Integer\">2</NS1:type>" >> "$target"
echo " <NS1:targetApplication RDF:resource=\"rdf:#$GqnK52\"/>" >> "$target"
echo " </RDF:Description>" >> "$target"
echo " <RDF:Description RDF:about=\"urn:mozilla:item:myphoneexplorer@fjsoft.at\"" >> "$target"
echo " NS1:installLocation=\"app-profile\"" >> "$target"
echo " NS1:version=\"2.0.23\"" >> "$target"
echo " NS1:name=\"MyPhoneExplorer\"" >> "$target"
echo " NS1:description=\"MyPhoneExplorer Synchronisation\"" >> "$target"
echo " NS1:creator=\"F.J. Wechselberger, N. Pueschel\"" >> "$target"
echo " NS1:homepageURL=\"http://www.fjsoft.at/\">" >> "$target"
echo " <NS1:type NC:parseType=\"Integer\">2</NS1:type>" >> "$target"
echo " <NS1:targetApplication RDF:resource=\"rdf:#$GqnK52\"/>" >> "$target"
echo " </RDF:Description>" >> "$target"
echo "</RDF:RDF>" >> "$target"
else
echo "existiert schon"
fi
unset target
fi
6. ready to use
This time I used the reg function of wine. I think this is more elegant and I added a check for OS so the add-on shut still work an a windows.
@FJ Maybe this changes could find the way in the standard version, to make the wine support easier.