@@ -1102,6 +1102,51 @@ void QgisApp::dropEvent( QDropEvent *event )
1102
1102
for ( i = urls.begin (); i != urls.end (); ++i )
1103
1103
{
1104
1104
QString fileName = i->toLocalFile ();
1105
+ #ifdef Q_OS_MAC
1106
+ // Mac OS X 10.10, under Qt4.8 ,changes dropped URL format
1107
+ // https://bugreports.qt.io/browse/QTBUG-40449
1108
+ // [pzion 20150805] Work around
1109
+ if ( fileName.startsWith ( " /.file/id=" ) )
1110
+ {
1111
+ QgsDebugMsg ( " Mac dropped URL with /.file/id= (converting)" );
1112
+ CFStringRef relCFStringRef =
1113
+ CFStringCreateWithCString (
1114
+ kCFAllocatorDefault ,
1115
+ fileName.toUtf8 ().constData (),
1116
+ kCFStringEncodingUTF8
1117
+ );
1118
+ CFURLRef relCFURL =
1119
+ CFURLCreateWithFileSystemPath (
1120
+ kCFAllocatorDefault ,
1121
+ relCFStringRef,
1122
+ kCFURLPOSIXPathStyle ,
1123
+ false // isDirectory
1124
+ );
1125
+ CFErrorRef error = 0 ;
1126
+ CFURLRef absCFURL =
1127
+ CFURLCreateFilePathURL (
1128
+ kCFAllocatorDefault ,
1129
+ relCFURL,
1130
+ &error
1131
+ );
1132
+ if ( !error )
1133
+ {
1134
+ static const CFIndex maxAbsPathCStrBufLen = 4096 ;
1135
+ char absPathCStr[maxAbsPathCStrBufLen];
1136
+ if ( CFURLGetFileSystemRepresentation (
1137
+ absCFURL,
1138
+ true , // resolveAgainstBase
1139
+ reinterpret_cast <UInt8 *>( &absPathCStr[0 ] ),
1140
+ maxAbsPathCStrBufLen ) )
1141
+ {
1142
+ fileName = QString ( absPathCStr );
1143
+ }
1144
+ }
1145
+ CFRelease ( absCFURL );
1146
+ CFRelease ( relCFURL );
1147
+ CFRelease ( relCFStringRef );
1148
+ }
1149
+ #endif
1105
1150
// seems that some drag and drop operations include an empty url
1106
1151
// so we test for length to make sure we have something
1107
1152
if ( !fileName.isEmpty () )
0 commit comments