equal
deleted
inserted
replaced
177 { |
177 { |
178 return [[qtMenuLoader retain] autorelease]; |
178 return [[qtMenuLoader retain] autorelease]; |
179 } |
179 } |
180 |
180 |
181 // This function will only be called when NSApp is actually running. Before |
181 // This function will only be called when NSApp is actually running. Before |
182 // that, the kAEQuitApplication apple event will be sendt to |
182 // that, the kAEQuitApplication Apple event will be sent to |
183 // QApplicationPrivate::globalAppleEventProcessor in qapplication_mac.mm |
183 // QApplicationPrivate::globalAppleEventProcessor in qapplication_mac.mm |
184 - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender |
184 - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender |
185 { |
185 { |
186 Q_UNUSED(sender); |
186 Q_UNUSED(sender); |
187 // The reflection delegate gets precedence |
187 // The reflection delegate gets precedence |
194 if (!startedQuit) { |
194 if (!startedQuit) { |
195 startedQuit = true; |
195 startedQuit = true; |
196 qAppInstance()->quit(); |
196 qAppInstance()->quit(); |
197 startedQuit = false; |
197 startedQuit = false; |
198 } |
198 } |
|
199 return NSTerminateNow; |
199 } |
200 } |
200 |
201 |
201 if (qtPrivate->threadData->eventLoops.size() == 0) { |
202 if (qtPrivate->threadData->eventLoops.size() == 0) { |
202 // INVARIANT: No event loop is executing. This probably |
203 // INVARIANT: No event loop is executing. This probably |
203 // means that Qt is used as a plugin, or as a part of a native |
204 // means that Qt is used as a plugin, or as a part of a native |
204 // Cocoa application. In any case it should be fine to |
205 // Cocoa application. In any case it should be fine to |
205 // terminate now: |
206 // terminate now: |
206 return NSTerminateNow; |
207 return NSTerminateNow; |
207 } else { |
208 } |
208 // Prevent Cocoa from terminating the application, since this simply |
209 |
209 // exits the program whithout allowing QApplication::exec() to return. |
210 return NSTerminateCancel; |
210 // The call to QApplication::quit() above will instead quit the |
|
211 // application from the Qt side. |
|
212 return NSTerminateCancel; |
|
213 } |
|
214 } |
211 } |
215 |
212 |
216 - (void)applicationDidFinishLaunching:(NSNotification *)aNotification |
213 - (void)applicationDidFinishLaunching:(NSNotification *)aNotification |
217 { |
214 { |
218 Q_UNUSED(aNotification); |
215 Q_UNUSED(aNotification); |
315 QUrl url(qt_mac_NSStringToQString(urlString)); |
312 QUrl url(qt_mac_NSStringToQString(urlString)); |
316 QFileOpenEvent qtEvent(url); |
313 QFileOpenEvent qtEvent(url); |
317 qt_sendSpontaneousEvent(qAppInstance(), &qtEvent); |
314 qt_sendSpontaneousEvent(qAppInstance(), &qtEvent); |
318 } |
315 } |
319 |
316 |
|
317 - (void)appleEventQuit:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent |
|
318 { |
|
319 Q_UNUSED(event); |
|
320 Q_UNUSED(replyEvent); |
|
321 [NSApp terminate:self]; |
|
322 } |
|
323 |
320 @end |
324 @end |
321 #endif |
325 #endif |