QTfrontend/hwform.cpp
changeset 8792 af4ab297b2b7
parent 8765 688062f1db59
parent 8766 ce153d705fff
child 8887 539380a498e4
equal deleted inserted replaced
8768:7450cb9c815b 8792:af4ab297b2b7
  1932     registry_hkcr.setValue("Hedgewars.Save/DefaultIcon/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwsfile.ico\",0");
  1932     registry_hkcr.setValue("Hedgewars.Save/DefaultIcon/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwsfile.ico\",0");
  1933     registry_hkcr.setValue("Hedgewars.Demo/Shell/Open/Command/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwengine.exe\" " + arguments + " %1");
  1933     registry_hkcr.setValue("Hedgewars.Demo/Shell/Open/Command/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwengine.exe\" " + arguments + " %1");
  1934     registry_hkcr.setValue("Hedgewars.Save/Shell/Open/Command/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwengine.exe\" " + arguments + " %1");
  1934     registry_hkcr.setValue("Hedgewars.Save/Shell/Open/Command/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwengine.exe\" " + arguments + " %1");
  1935 
  1935 
  1936     // custom url scheme(s)
  1936     // custom url scheme(s)
  1937     registry_hkcr.setValue("hwplay/Default", "\"URL:Hedgewars ServerAccess Protocol\"");
  1937     registry_hkcr.setValue("hwplay/Default", "\"URL:Hedgewars ServerAccess Scheme\"");
  1938     registry_hkcr.setValue("hwplay/URL Protocol", "");
  1938     registry_hkcr.setValue("hwplay/URL Protocol", "");
  1939     registry_hkcr.setValue("hwplay/DefaultIcon/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hedgewars.exe\",0");
  1939     registry_hkcr.setValue("hwplay/DefaultIcon/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hedgewars.exe\",0");
  1940     registry_hkcr.setValue("hwplay/Shell/Open/Command/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hedgewars.exe\"  %1");
  1940     registry_hkcr.setValue("hwplay/Shell/Open/Command/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hedgewars.exe\"  %1");
  1941 #elif defined __APPLE__
  1941 #elif defined __APPLE__
  1942     // only useful when other apps have taken precedence over our file extensions and you want to reset it
  1942     // only useful when other apps have taken precedence over our file extensions and you want to reset it
  1951     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share/mime/packages");
  1951     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share/mime/packages");
  1952     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local");
  1952     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local");
  1953     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share");
  1953     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share");
  1954     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share/applications");
  1954     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share/applications");
  1955     if (success) success = system(("cp "+datadir->absolutePath()+"/misc/hedgewars-mimeinfo.xml "+QDir::home().absolutePath()+"/.local/share/mime/packages").toLocal8Bit().constData())==0;
  1955     if (success) success = system(("cp "+datadir->absolutePath()+"/misc/hedgewars-mimeinfo.xml "+QDir::home().absolutePath()+"/.local/share/mime/packages").toLocal8Bit().constData())==0;
       
  1956     if (success) success = system(("cp "+datadir->absolutePath()+"/misc/hedgewars.desktop "+QDir::home().absolutePath()+"/.local/share/applications").toLocal8Bit().constData())==0;
  1956     if (success) success = system(("cp "+datadir->absolutePath()+"/misc/hwengine.desktop "+QDir::home().absolutePath()+"/.local/share/applications").toLocal8Bit().constData())==0;
  1957     if (success) success = system(("cp "+datadir->absolutePath()+"/misc/hwengine.desktop "+QDir::home().absolutePath()+"/.local/share/applications").toLocal8Bit().constData())==0;
  1957     if (success) success = system(("update-mime-database "+QDir::home().absolutePath()+"/.local/share/mime").toLocal8Bit().constData())==0;
  1958     if (success) success = system(("update-mime-database "+QDir::home().absolutePath()+"/.local/share/mime").toLocal8Bit().constData())==0;
       
  1959     if (success) success = system("xdg-mime default hedgewars.desktop x-scheme-handler/hwplay")==0;
  1958     if (success) success = system("xdg-mime default hwengine.desktop application/x-hedgewars-demo")==0;
  1960     if (success) success = system("xdg-mime default hwengine.desktop application/x-hedgewars-demo")==0;
  1959     if (success) success = system("xdg-mime default hwengine.desktop application/x-hedgewars-save")==0;
  1961     if (success) success = system("xdg-mime default hwengine.desktop application/x-hedgewars-save")==0;
  1960     // 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
  1962     // 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
  1961     if (success) success = system(("sed -i 's|^\\(Exec=.*\\) \\(%f\\)|\\1 \\2 "+arguments+"|' "+QDir::home().absolutePath()+"/.local/share/applications/hwengine.desktop").toLocal8Bit().constData())==0;
  1963     if (success) success = system(("sed -i 's|^\\(Exec=.*\\) \\(%f\\)|\\1 \\2 "+arguments+"|' "+QDir::home().absolutePath()+"/.local/share/applications/hwengine.desktop").toLocal8Bit().constData())==0;
  1962 #endif
  1964 #endif