fix for new qtsingleapplication
authorabs <abs@76c9efe7-43af-4aca-a270-d8da3bf5252a>
Tue, 2 Feb 2010 21:50:26 +0000 (21:50 +0000)
committerabs <abs@76c9efe7-43af-4aca-a270-d8da3bf5252a>
Tue, 2 Feb 2010 21:50:26 +0000 (21:50 +0000)
git-svn-id: svn://oss.syntext.com/oss/serna-free/trunk@270 76c9efe7-43af-4aca-a270-d8da3bf5252a

serna/core/qt/apple_dochandler.i

index 53f5002..7531bfc 100644 (file)
@@ -6,6 +6,7 @@
 #ifdef __APPLE__
 
 #include <Carbon/Carbon.h>
+#include <common/Vector.h>
 
 AEEventHandlerUPP AEHandlerUPP;
 extern QString cfstring2qstring(CFStringRef); //qglobal.cpp
@@ -57,9 +58,14 @@ static pascal OSErr open_doc_event_handler(const AppleEvent* theEvent,
                 cfString = CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle);
                 CFRelease(url);
             }
-            QString file = cfstring2qstring(cfString);
-            if (!file.isEmpty())
+            int cfLen = CFStringGetLength(cfString);
+            if (cfLen > 0) {
+                Common::Vector<UniChar> buf(cfLen);
+                CFStringGetCharacters(cfString, 
+                    CFRangeMake(0, cfLen), buf.begin());
+                QString file((QChar*)buf.begin(), cfLen);
                 static_cast<QtSerna*>(qApp)->handleParams(file);
+            }
         }
     }
     return noErr;