Skip to content

Commit

Permalink
[layouts] Fix messagebar link with special characters does not open o…
Browse files Browse the repository at this point in the history
…n win

Fixes #19727
  • Loading branch information
nyalldawson committed Sep 17, 2018
1 parent d37a799 commit a0dceb1
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/native/win/qgswinnative.cpp
Expand Up @@ -68,12 +68,19 @@ void QgsWinNative::cleanup()
void QgsWinNative::openFileExplorerAndSelectFile( const QString &path ) void QgsWinNative::openFileExplorerAndSelectFile( const QString &path )
{ {
const QString nativePath = QDir::toNativeSeparators( path ); const QString nativePath = QDir::toNativeSeparators( path );
ITEMIDLIST *pidl = ILCreateFromPath( nativePath.toUtf8().constData() );
wchar_t *pathArray = new wchar_t[static_cast< uint>( nativePath.length() + 1 )];
nativePath.toWCharArray(pathArray);
pathArray[nativePath.length()] = 0;

ITEMIDLIST *pidl = ILCreateFromPathW( pathArray );
if ( pidl ) if ( pidl )
{ {
SHOpenFolderAndSelectItems( pidl, 0, 0, 0 ); SHOpenFolderAndSelectItems( pidl, 0, nullptr, 0 );
ILFree( pidl ); ILFree( pidl );
} }

delete[] pathArray;
} }


void QgsWinNative::showUndefinedApplicationProgress() void QgsWinNative::showUndefinedApplicationProgress()
Expand Down

0 comments on commit a0dceb1

Please sign in to comment.