Skip to content
Permalink
Browse files

fix mac build and fix native file selector

  • Loading branch information
3nids committed Aug 3, 2018
1 parent 970fc4f commit a893f52ffcf44579c3e2fd6ab3da1f648536beef
Showing with 10 additions and 7 deletions.
  1. +1 −1 src/native/CMakeLists.txt
  2. +3 −0 src/native/mac/qgsmacnative.h
  3. +6 −6 src/native/mac/qgsmacnative.mm
@@ -116,7 +116,7 @@ ELSE(NOT APPLE)
FRAMEWORK_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}"
MACOSX_FRAMEWORK_INFO_PLIST "${CMAKE_SOURCE_DIR}/mac/framework.info.plist.in"
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${COMPLETE_VERSION}
MACOSX_FRAMEWORK_IDENTIFIER org.qgis.qgis2_native
MACOSX_FRAMEWORK_IDENTIFIER org.qgis.qgis3_native
BUILD_WITH_INSTALL_RPATH TRUE
PUBLIC_HEADER "${QGIS_NATIVE_HDRS}"
LINK_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}"
@@ -20,6 +20,9 @@

#include "qgsnative.h"

class QString;


class NATIVE_EXPORT QgsMacNative : public QgsNative
{
public:
@@ -18,26 +18,26 @@
#include "qgsmacnative.h"

#include <Cocoa/Cocoa.h>
#include <QString>

QgsMacNative::~QgsMacNative()
{
}

const char* QgsMacNative::currentAppLocalizedName()
const char *QgsMacNative::currentAppLocalizedName()
{
return [[[NSRunningApplication currentApplication] localizedName] UTF8String];
}

void QgsMacNative::currentAppActivateIgnoringOtherApps()
{
// valid for Mac OS X >= 10.6
[[NSRunningApplication currentApplication] activateWithOptions:
(NSApplicationActivateAllWindows | NSApplicationActivateIgnoringOtherApps)];
( NSApplicationActivateAllWindows | NSApplicationActivateIgnoringOtherApps )];
}

void openFileExplorerAndSelectFile( const QString &path )
void QgsMacNative::openFileExplorerAndSelectFile( const QString &path )
{
NSString* pathStr = [[NSString alloc] initWithUTF8String:path.toUtf8().data()];
NSArray *fileURLs = [NSArray arrayWithObjects:pathStr, /* ... */ nil];
NSString *pathStr = [[NSString alloc] initWithUTF8String:path.toUtf8().data()];
NSArray *fileURLs = [NSArray arrayWithObjects:[NSURL fileURLWithPath:pathStr], nil];
[[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs:fileURLs];
}

2 comments on commit a893f52

@nyalldawson

This comment has been minimized.

Copy link
Collaborator

@nyalldawson nyalldawson replied Aug 3, 2018

@3nids
Thanks! Who'd have thought coding without testing was a bad idea?

@3nids

This comment has been minimized.

Copy link
Member Author

@3nids 3nids replied Aug 3, 2018

not that bad for a blind test!

Please sign in to comment.
You can’t perform that action at this time.