File-types are now registered in HKCU instead of HKLM, making Vista UAC shut up and associations be user-specific.

Originally committed to SVN as r844.
This commit is contained in:
Niels Martin Hansen 2007-01-19 12:52:02 +00:00
parent 65b110ab98
commit 23ee01ff8f
2 changed files with 13 additions and 11 deletions

View File

@ -87,7 +87,7 @@ DialogAssociations::~DialogAssociations() {
// Associates a type with Aegisub
void DialogAssociations::AssociateType(wxString type) {
type.Lower();
wxRegKey *key = new wxRegKey(_T("HKEY_CLASSES_ROOT\\.") + type);
wxRegKey *key = new wxRegKey(_T("HKEY_CURRENT_USER\\Software\\Classes\\.") + type);
if (!key->Exists()) key->Create();
key->SetValue(_T(""),_T("Aegisub"));
delete key;
@ -98,7 +98,7 @@ void DialogAssociations::AssociateType(wxString type) {
// Checks if a type is associated with Aegisub
bool DialogAssociations::CheckAssociation(wxString type) {
type.Lower();
wxRegKey *key = new wxRegKey(_T("HKEY_CLASSES_ROOT\\.") + type);
wxRegKey *key = new wxRegKey(_T("HKEY_CURRENT_USER\\Software\\Classes\\.") + type);
if (!key->Exists()) {
delete key;
return false;

View File

@ -262,26 +262,28 @@ void AegisubApp::RegistryAssociate () {
command << _T("\"") << fullPath << _T("\" \"%1\"");
// Main program association
wxRegKey *key = new wxRegKey(_T("HKEY_LOCAL_MACHINE\\Software\\Classes\\Aegisub"));
#ifndef DEBUG
wxRegKey *key = new wxRegKey(_T("HKEY_CURRENT_USER\\Software\\Classes\\Aegisub"));
if (!key->Exists()) key->Create();
key->SetValue(_T(""),_T("Aegisub Subtitle Script"));
delete key;
key = new wxRegKey(_T("HKEY_LOCAL_MACHINE\\Software\\Classes\\Aegisub\\DefaultIcon"));
key = new wxRegKey(_T("HKEY_CURRENT_USER\\Software\\Classes\\Aegisub\\DefaultIcon"));
if (!key->Exists()) key->Create();
key->SetValue(_T(""),fullPath);
key->SetValue(_T(""),fullPath);
delete key;
key = new wxRegKey(_T("HKEY_LOCAL_MACHINE\\Software\\Classes\\Aegisub\\Shell"));
key = new wxRegKey(_T("HKEY_CURRENT_USER\\Software\\Classes\\Aegisub\\Shell"));
if (!key->Exists()) key->Create();
key->SetValue(_T(""),_T("open"));
key->SetValue(_T(""),_T("open"));
delete key;
key = new wxRegKey(_T("HKEY_LOCAL_MACHINE\\Software\\Classes\\Aegisub\\Shell\\Open"));
key = new wxRegKey(_T("HKEY_CURRENT_USER\\Software\\Classes\\Aegisub\\Shell\\Open"));
if (!key->Exists()) key->Create();
key->SetValue(_T(""),_T("&Open with Aegisub"));
key->SetValue(_T(""),_T("&Open with Aegisub"));
delete key;
key = new wxRegKey(_T("HKEY_LOCAL_MACHINE\\Software\\Classes\\Aegisub\\Shell\\Open\\Command"));
key = new wxRegKey(_T("HKEY_CURRENT_USER\\Software\\Classes\\Aegisub\\Shell\\Open\\Command"));
if (!key->Exists()) key->Create();
key->SetValue(_T(""),command);
key->SetValue(_T(""),command);
delete key;
#endif
// Check associations
if (Options.AsBool(_T("Show associations"))) {