aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2018-12-30 12:05:55 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2018-12-30 12:05:55 +0000
commit9909f2d965c98f2fd52d6629e3b1d646f5932786 (patch)
tree9b974754012a4003a5a8729caca1a47917930963
parent4d56c7460d9854b1cedafd201b14b5083f3df87c (diff)
downloadqmmp-9909f2d965c98f2fd52d6629e3b1d646f5932786.tar.gz
qmmp-9909f2d965c98f2fd52d6629e3b1d646f5932786.tar.bz2
qmmp-9909f2d965c98f2fd52d6629e3b1d646f5932786.zip
removed legacy code
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@8540 90c681e8-e032-0410-971d-27865f9a5e38
-rw-r--r--src/qmmpui/winfileassoc.cpp60
-rw-r--r--src/qmmpui/winfileassoc.h7
2 files changed, 3 insertions, 64 deletions
diff --git a/src/qmmpui/winfileassoc.cpp b/src/qmmpui/winfileassoc.cpp
index 983f52f16..a644b2298 100644
--- a/src/qmmpui/winfileassoc.cpp
+++ b/src/qmmpui/winfileassoc.cpp
@@ -54,11 +54,9 @@
#define SHCNE_ASSOCHANGED __MSABI_LONG(0x08000000)
#endif
-WinFileAssoc::WinFileAssoc(const QString ClassId, const QString AppName)
+WinFileAssoc::WinFileAssoc(const QString AppName)
{
- m_ClassId = ClassId;
m_AppName = AppName;
- m_ClassId2 = QFileInfo(QApplication::applicationFilePath()).fileName();
}
// Associates all extensions in the fileExtensions list with current app.
@@ -77,62 +75,6 @@ bool WinFileAssoc::GetRegisteredExtensions(const QStringList &extensionsToCheck,
return VistaGetDefaultApps(extensionsToCheck, registeredExtensions);
}
-// Creates a ClassId for current application.
-// Note: It's better to create the classId from the installation program.
-bool WinFileAssoc::CreateClassId(const QString &executablePath, const QString &friendlyName)
-{
- QString RootKeyName;
- QString classId;
-
- classId = "Software/Classes/" + m_ClassId;
- RootKeyName = "HKEY_CURRENT_USER";
-
- QSettings Reg(RootKeyName, QSettings::NativeFormat);
-
- if (!Reg.isWritable() || Reg.status() != QSettings::NoError)
- return false;
-
- QString appPath = executablePath;
- appPath.replace('/', '\\'); // Explorer gives 'Access Denied' if we write the path with forward slashes to the registry
-
- // Add our ProgId to the HKCR classes
- Reg.setValue(classId + "/shell/open/FriendlyAppName", friendlyName);
- Reg.setValue(classId + "/shell/open/command/.", QString("\"%1\" \"%2\"").arg(appPath, "%1"));
- Reg.setValue(classId + "/DefaultIcon/.", QString("\"%1\",1").arg(appPath));
-
- // Add "Enqueue" command
- Reg.setValue(classId + "/shell/enqueue/.", QObject::tr("Enqueue in Qmmp"));
- Reg.setValue(classId + "/shell/enqueue/command/.", QString("\"%1\" -e \"%2\"").arg(appPath, "%1"));
- return true;
-}
-
-// Remove ClassId from the registry.
-// Called when no associations exist. Note: It's better to do this in the Setup program.
-bool WinFileAssoc::RemoveClassId()
-{
- QString RootKeyName;
- QString classId;
-
- classId = "Software/Classes/" + m_ClassId;
- RootKeyName = "HKEY_CURRENT_USER";
-
- QSettings RegCU(RootKeyName, QSettings::NativeFormat);
-
- if (!RegCU.isWritable() || RegCU.status() != QSettings::NoError)
- return false;
-
- RegCU.remove(classId);
-
- QSettings RegCR("HKEY_CLASSES_ROOT", QSettings::NativeFormat);
-
- if(!RegCR.isWritable() || RegCU.status() != QSettings::NoError)
- return false;
-
- RegCR.remove("Applications/qmmp.exe");
-
- return true;
-}
-
// Windows Vista specific implementation
#if !defined(IApplicationAssociationRegistration)
diff --git a/src/qmmpui/winfileassoc.h b/src/qmmpui/winfileassoc.h
index 5c1a2a126..d087a61e1 100644
--- a/src/qmmpui/winfileassoc.h
+++ b/src/qmmpui/winfileassoc.h
@@ -34,19 +34,16 @@
class QMMPUI_EXPORT WinFileAssoc
{
protected:
- QString m_ClassId; //Application ClassId
- QString m_ClassId2; //The ClassId created by explorer if user selects 'Open With...', usually qmmp.exe
QString m_AppName;
protected:
- bool CreateClassId(const QString& executablePath, const QString& friendlyName);
bool VistaGetDefaultApps(const QStringList &extensions, QStringList& registeredExt);
int VistaSetAppsAsDefault(const QStringList& extensions);
+
public:
- WinFileAssoc(const QString ClassId = "QmmpFileAudio", const QString AppName="Qmmp");
+ WinFileAssoc(const QString AppName="Qmmp");
//Checks the registry to see which extensions are registered with SMPlayer
bool GetRegisteredExtensions(const QStringList& extensionsToCheck, QStringList& registeredExtensions);
- bool RemoveClassId();
int CreateFileAssociations(const QStringList& fileExtensions);
};