From 9fa50d504f7fee7db986145e2e42a01242f3e76d Mon Sep 17 00:00:00 2001 From: telwertowski Date: Thu, 21 Aug 2008 07:11:49 +0000 Subject: [PATCH] Restore code to handle Mac double-click at startup which was dropped by r9092. git-svn-id: http://svn.osgeo.org/qgis/trunk@9106 c8812cc2-4d05-0410-92ff-de0c093fc19c --- src/app/main.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/app/main.cpp b/src/app/main.cpp index 86d6d17062b0..119940263308 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -156,18 +156,21 @@ OSErr openDocumentsAEHandler(const AppleEvent *event, AppleEvent *reply, SRefCon } } + // Open files now if application has been fully initialized (has objectName). + // Otherwise (if this routine is called by processEvents inside the QgisApp constructor + // at startup) wait for the command line file loader to notice these files. QgisApp *qgis = QgisApp::instance(); - if(qgis) + if (qgis && qgis->objectName() == "QgisApp") { if (!myProjectFileName.isEmpty()) { - qgis->openProject(myProjectFileName); + qgis->openProject(myProjectFileName); } for (QStringList::Iterator myIterator = myFileList.begin(); myIterator != myFileList.end(); ++myIterator ) { - QString fileName = *myIterator; - qgis->openLayer(fileName); + QString fileName = *myIterator; + qgis->openLayer(fileName); } } }