@@ -103,6 +103,15 @@ HandlerStorage* registerSchemaExecutable(const QDir& storagePath,
103103 return storage;
104104}
105105
106+ QSettings resolveSettings (QDir baseDir)
107+ {
108+ if (!baseDir.exists (" downloadhandler.ini" ) && baseDir.exists (" nxmhandler.ini" )) {
109+ QFile oldSettings (baseDir.absoluteFilePath (" nxmhandler.ini" ));
110+ oldSettings.copy (baseDir.absoluteFilePath (" downloadhandler.ini" ));
111+ }
112+ return QSettings (baseDir.absoluteFilePath (" downloadhandler.ini" ));
113+ }
114+
106115HandlerStorage* registerHandler (HandlerStorage* storage, const QString& schema,
107116 bool forceReg)
108117{
@@ -125,21 +134,21 @@ HandlerStorage* registerHandler(HandlerStorage* storage, const QString& schema,
125134
126135 QDir handlerBaseDir = QFileInfo (handlerPath).absoluteDir ();
127136
128- QSettings settings (baseDir. absoluteFilePath ( " nxmhandler.ini " ), QSettings::IniFormat );
129- bool noRegister = settings.value (" noregister" , false ).toBool ();
130- if (globalStorage.exists (" nxmhandler .ini" ) &&
137+ QSettings settings = resolveSettings (baseDir);
138+ bool noRegister = settings.value (" noregister" , false ).toBool ();
139+ if (globalStorage.exists (" downloadhandler .ini" ) &&
131140 handlerPath.endsWith (" nxmhandler.exe" , Qt::CaseInsensitive) &&
132141 QFile::exists (handlerPath)) {
133- // global configuration avaible - use it
142+ // global configuration available - use it
134143 if (storage == nullptr )
135144 storage = new HandlerStorage (globalStorage.path ());
136- } else if (handlerBaseDir.exists (" nxmhandler .ini" ) &&
145+ } else if (handlerBaseDir.exists (" downloadhandler .ini" ) &&
137146 handlerPath.endsWith (" nxmhandler.exe" , Qt::CaseInsensitive) &&
138147 QFile::exists (handlerPath)) {
139148 // a portable installation is registered to handle links, use its
140149 // configuration
141150 if (storage == nullptr )
142- storage = new HandlerStorage (globalStorage .path ());
151+ storage = new HandlerStorage (handlerBaseDir .path ());
143152 if (forceReg && (QString::compare (QDir::toNativeSeparators (
144153 QCoreApplication::applicationFilePath ()),
145154 handlerPath, Qt::CaseInsensitive))) {
0 commit comments