Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add win32 native implementation, and new openFileExplorerAndSelectFile
method to QgsNative Opens the desktop file explorer at the folder containing path, and (if possible) scrolls to and pre-selects the file at path itself. The default implementation just calls the QDesktopServices method to open the folder, without selecting the specified file. Use this to automatically select the exported layout file when clicking the message bar success message in layouts (on Windows)
- Loading branch information
1 parent
1fea03f
commit 762099b
Showing
10 changed files
with
133 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,31 @@ | |||
/*************************************************************************** | |||
qgswinnative.cpp - abstracted interface to native system calls | |||
------------------- | |||
begin : January 2017 | |||
copyright : (C) 2017 by Matthias Kuhn | |||
email : matthias@opengis.ch | |||
***************************************************************************/ | |||
|
|||
/*************************************************************************** | |||
* * | |||
* This program is free software; you can redistribute it and/or modify * | |||
* it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | |||
* * | |||
***************************************************************************/ | |||
|
|||
#include "qgswinnative.h" | |||
#include <QString> | |||
#include <QDir> | |||
|
|||
void QgsWinNative::openFileExplorerAndSelectFile( const QString &path ) | |||
{ | |||
const QString nativePath = QDir::toNativeSeparators( path ); | |||
ITEMIDLIST *pidl = ILCreateFromPath( nativePath.toUtf8().constData() ); | |||
if ( pidl ) | |||
{ | |||
SHOpenFolderAndSelectItems( pidl, 0, 0, 0 ); | |||
ILFree( pidl ); | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,32 @@ | |||
/*************************************************************************** | |||
qgswinnative.h - abstracted interface to native Mac objective-c | |||
------------------- | |||
begin : January 2014 | |||
copyright : (C) 2014 by Larry Shaffer | |||
email : larrys at dakotacarto dot com | |||
***************************************************************************/ | |||
|
|||
/*************************************************************************** | |||
* * | |||
* This program is free software; you can redistribute it and/or modify * | |||
* it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | |||
* * | |||
***************************************************************************/ | |||
|
|||
#ifndef QGSMACNATIVE_H | |||
#define QGSMACNATIVE_H | |||
|
|||
#include "qgsnative.h" | |||
#include <windows.h> | |||
#include <shlobj.h> | |||
#pragma comment(lib,"Shell32.lib") | |||
|
|||
class NATIVE_EXPORT QgsWinNative : public QgsNative | |||
{ | |||
public: | |||
void openFileExplorerAndSelectFile( const QString &path ) override; | |||
}; | |||
|
|||
#endif // QGSMACNATIVE_H |