scheme association for linux (although it stops during connection)
authorkoda
Fri, 22 Mar 2013 11:08:42 +0100
changeset 8766 ce153d705fff
parent 8763 988901d27abf
child 8769 2bf8919746e7
scheme association for linux (although it stops during connection)
QTfrontend/hwform.cpp
misc/hedgewars.desktop
share/hedgewars/Data/misc/hedgewars-mimeinfo.xml
share/hedgewars/Data/misc/hedgewars.desktop
--- a/QTfrontend/hwform.cpp	Thu Mar 21 15:01:27 2013 +0100
+++ b/QTfrontend/hwform.cpp	Fri Mar 22 11:08:42 2013 +0100
@@ -1928,7 +1928,7 @@
     registry_hkcr.setValue("Hedgewars.Save/Shell/Open/Command/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwengine.exe\" " + arguments + " %1");
 
     // custom url scheme(s)
-    registry_hkcr.setValue("hwplay/Default", "\"URL:Hedgewars ServerAccess Protocol\"");
+    registry_hkcr.setValue("hwplay/Default", "\"URL:Hedgewars ServerAccess Scheme\"");
     registry_hkcr.setValue("hwplay/URL Protocol", "");
     registry_hkcr.setValue("hwplay/DefaultIcon/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hedgewars.exe\",0");
     registry_hkcr.setValue("hwplay/Shell/Open/Command/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hedgewars.exe\"  %1");
@@ -1947,8 +1947,10 @@
     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share");
     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share/applications");
     if (success) success = system(("cp "+datadir->absolutePath()+"/misc/hedgewars-mimeinfo.xml "+QDir::home().absolutePath()+"/.local/share/mime/packages").toLocal8Bit().constData())==0;
+    if (success) success = system(("cp "+datadir->absolutePath()+"/misc/hedgewars.desktop "+QDir::home().absolutePath()+"/.local/share/applications").toLocal8Bit().constData())==0;
     if (success) success = system(("cp "+datadir->absolutePath()+"/misc/hwengine.desktop "+QDir::home().absolutePath()+"/.local/share/applications").toLocal8Bit().constData())==0;
     if (success) success = system(("update-mime-database "+QDir::home().absolutePath()+"/.local/share/mime").toLocal8Bit().constData())==0;
+    if (success) success = system("xdg-mime default hedgewars.desktop x-scheme-handler/hwplay")==0;
     if (success) success = system("xdg-mime default hwengine.desktop application/x-hedgewars-demo")==0;
     if (success) success = system("xdg-mime default hwengine.desktop application/x-hedgewars-save")==0;
     // hack to add user's settings to hwengine. might be better at this point to read in the file, append it, and write it out to its new home.  This assumes no spaces in the data dir path
--- a/misc/hedgewars.desktop	Thu Mar 21 15:01:27 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-[Desktop Entry]
-Type=Application
-Version=1.0
-Encoding=UTF-8
-Name=Hedgewars
-GenericName=Fighting Hedgehogs
-GenericName[de]=Kämpfende Igel
-GenericName[es]=Batallas entre erizos
-GenericName[fr]=Bataille de hérissons
-GenericName[ko]=고슴도치 싸우기
-GenericName[ja]=ファイチングハリネズミ
-GenericName[it]=Ricci combattenti
-GenericName[pl]=Walczące jeże
-GenericName[pt]=Batalhas entre ouriços
-GenericName[ru]=Битвы ежей
-GenericName[sk]=Bojujúci ježkovia
-GenericName[cs]=Bojující ježci
-GenericName[sv]=Stridande igelkottar
-Icon=hedgewars.png
-Exec=hedgewars
-Terminal=false
-StartupNotify=false
-Categories=Application;Game;StrategyGame;
--- a/share/hedgewars/Data/misc/hedgewars-mimeinfo.xml	Thu Mar 21 15:01:27 2013 +0100
+++ b/share/hedgewars/Data/misc/hedgewars-mimeinfo.xml	Fri Mar 22 11:08:42 2013 +0100
@@ -45,4 +45,14 @@
     </magic>
     <glob weight="60" pattern="*.hws"/>
   </mime-type>
+  <mime-type type="x-scheme-handler/hwplay">
+    <icon name="hedgewars" />
+    <!--<generic-icon name="applications-games"/>-->
+    <comment>Hedgewars ServerAccess Scheme</comment>
+    <magic priority="50">
+      <match required="yes" type="byte" offset="0" value="2"/>
+      <match required="yes" type="big16" offset="1" value="21587"/>
+    </magic>
+    <glob weight="60" pattern="hwplay://*"/>
+  </mime-type>
 </mime-info>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/misc/hedgewars.desktop	Fri Mar 22 11:08:42 2013 +0100
@@ -0,0 +1,24 @@
+[Desktop Entry]
+Type=Application
+Version=1.0
+Encoding=UTF-8
+Name=Hedgewars
+GenericName=Fighting Hedgehogs
+GenericName[de]=Kämpfende Igel
+GenericName[es]=Batallas entre erizos
+GenericName[fr]=Bataille de hérissons
+GenericName[ko]=고슴도치 싸우기
+GenericName[ja]=ファイチングハリネズミ
+GenericName[it]=Ricci combattenti
+GenericName[pl]=Walczące jeże
+GenericName[pt]=Batalhas entre ouriços
+GenericName[ru]=Битвы ежей
+GenericName[sk]=Bojujúci ježkovia
+GenericName[cs]=Bojující ježci
+GenericName[sv]=Stridande igelkottar
+Icon=hedgewars.png
+Exec=hedgewars %U
+Terminal=false
+StartupNotify=false
+Categories=Application;Game;StrategyGame;
+MimeType=x-scheme-handler/hwplay