@@ -103,6 +103,16 @@ 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+ QSettings::IniFormat);
114+ }
115+
106116HandlerStorage* registerHandler (HandlerStorage* storage, const QString& schema,
107117 bool forceReg)
108118{
@@ -125,21 +135,21 @@ HandlerStorage* registerHandler(HandlerStorage* storage, const QString& schema,
125135
126136 QDir handlerBaseDir = QFileInfo (handlerPath).absoluteDir ();
127137
128- QSettings settings (baseDir. absoluteFilePath ( " nxmhandler.ini " ), QSettings::IniFormat );
129- bool noRegister = settings.value (" noregister" , false ).toBool ();
130- if (globalStorage.exists (" nxmhandler .ini" ) &&
138+ QSettings settings = resolveSettings (baseDir);
139+ bool noRegister = settings.value (" noregister" , false ).toBool ();
140+ if (globalStorage.exists (" downloadhandler .ini" ) &&
131141 handlerPath.endsWith (" nxmhandler.exe" , Qt::CaseInsensitive) &&
132142 QFile::exists (handlerPath)) {
133- // global configuration avaible - use it
143+ // global configuration available - use it
134144 if (storage == nullptr )
135145 storage = new HandlerStorage (globalStorage.path ());
136- } else if (handlerBaseDir.exists (" nxmhandler .ini" ) &&
146+ } else if (handlerBaseDir.exists (" downloadhandler .ini" ) &&
137147 handlerPath.endsWith (" nxmhandler.exe" , Qt::CaseInsensitive) &&
138148 QFile::exists (handlerPath)) {
139149 // a portable installation is registered to handle links, use its
140150 // configuration
141151 if (storage == nullptr )
142- storage = new HandlerStorage (globalStorage .path ());
152+ storage = new HandlerStorage (handlerBaseDir .path ());
143153 if (forceReg && (QString::compare (QDir::toNativeSeparators (
144154 QCoreApplication::applicationFilePath ()),
145155 handlerPath, Qt::CaseInsensitive))) {
0 commit comments