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 // Associates a type with Aegisub
void DialogAssociations::AssociateType(wxString type) { void DialogAssociations::AssociateType(wxString type) {
type.Lower(); 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(); if (!key->Exists()) key->Create();
key->SetValue(_T(""),_T("Aegisub")); key->SetValue(_T(""),_T("Aegisub"));
delete key; delete key;
@ -98,7 +98,7 @@ void DialogAssociations::AssociateType(wxString type) {
// Checks if a type is associated with Aegisub // Checks if a type is associated with Aegisub
bool DialogAssociations::CheckAssociation(wxString type) { bool DialogAssociations::CheckAssociation(wxString type) {
type.Lower(); 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()) { if (!key->Exists()) {
delete key; delete key;
return false; return false;

View File

@ -262,26 +262,28 @@ void AegisubApp::RegistryAssociate () {
command << _T("\"") << fullPath << _T("\" \"%1\""); command << _T("\"") << fullPath << _T("\" \"%1\"");
// Main program association // 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(); if (!key->Exists()) key->Create();
key->SetValue(_T(""),_T("Aegisub Subtitle Script")); key->SetValue(_T(""),_T("Aegisub Subtitle Script"));
delete key; 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(); if (!key->Exists()) key->Create();
key->SetValue(_T(""),fullPath); key->SetValue(_T(""),fullPath);
delete key; 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(); if (!key->Exists()) key->Create();
key->SetValue(_T(""),_T("open")); key->SetValue(_T(""),_T("open"));
delete key; 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(); if (!key->Exists()) key->Create();
key->SetValue(_T(""),_T("&Open with Aegisub")); key->SetValue(_T(""),_T("&Open with Aegisub"));
delete key; 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(); if (!key->Exists()) key->Create();
key->SetValue(_T(""),command); key->SetValue(_T(""),command);
delete key; delete key;
#endif
// Check associations // Check associations
if (Options.AsBool(_T("Show associations"))) { if (Options.AsBool(_T("Show associations"))) {