summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2014-07-13 13:43:49 +0200
committerOlivier Goffart <ogoffart@woboq.com>2014-07-13 13:48:19 +0200
commit12a4db710e0e663741e239d76ffe4625e94dace2 (patch)
treea8265beb2afb55be429c2811b1434936548bb459 /src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
parentff7fdf78efb7287af6347c710ac00a0d17d9dfc1 (diff)
Revert "Session management for OS X"
Broke tst_QMenu::statusTip by closing the menu while it should not. (and therefore, a QTimer::singleShot that fires while following test are running is making the test fail) This reverts commit 50c04d631858639c630e85456e7e003a80e33493. Change-Id: Ib4ef8190f945b915fe268745cc64d471994c5e2d Reviewed-by: Richard J. Moore <rich@kde.org>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm')
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm31
1 files changed, 14 insertions, 17 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
index 6c39f1eb5a..efe3269d42 100644
--- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
+++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
@@ -1,6 +1,5 @@
/****************************************************************************
**
-** Copyright (C) 2013 Samuel Gaist <samuel.gaist@edeltech.ch>
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
@@ -79,13 +78,11 @@
#import "qnswindowdelegate.h"
#import "qcocoamenuloader.h"
#include "qcocoaintegration.h"
-#include "qcocoasessionmanager.h"
#include <qevent.h>
#include <qurl.h>
#include <qdebug.h>
#include <qguiapplication.h>
#include <private/qguiapplication_p.h>
-#include <private/qsessionmanager_p.h>
#include "qt_mac_p.h"
#include <qpa/qwindowsysteminterface.h>
@@ -219,17 +216,6 @@ static void cleanupCocoaApplicationDelegate()
return NSTerminateNow;
}
- QGuiApplicationPrivate *qGuiAppPriv = QGuiApplicationPrivate::instance();
-
-#ifndef QT_NO_SESSIONMANAGER
- QSessionManagerPrivate *managerPrivate = static_cast<QSessionManagerPrivate*>(QObjectPrivate::get(qGuiAppPriv->session_manager));
- QCocoaSessionManager *cocoaSessionManager = static_cast<QCocoaSessionManager *>(managerPrivate->platformSessionManager);
- cocoaSessionManager->appCommitData();
-
- if (cocoaSessionManager->wasCanceled())
- return NSTerminateCancel;
-#endif
-
if ([self canQuit]) {
if (!startedQuit) {
startedQuit = true;
@@ -253,7 +239,7 @@ static void cleanupCocoaApplicationDelegate()
}
}
- if (qGuiAppPriv->threadData->eventLoops.isEmpty()) {
+ if (QGuiApplicationPrivate::instance()->threadData->eventLoops.isEmpty()) {
// INVARIANT: No event loop is executing. This probably
// means that Qt is used as a plugin, or as a part of a native
// Cocoa application. In any case it should be fine to
@@ -284,6 +270,10 @@ static void cleanupCocoaApplicationDelegate()
*/
NSAppleEventManager *eventManager = [NSAppleEventManager sharedAppleEventManager];
[eventManager setEventHandler:self
+ andSelector:@selector(appleEventQuit:withReplyEvent:)
+ forEventClass:kCoreEventClass
+ andEventID:kAEQuitApplication];
+ [eventManager setEventHandler:self
andSelector:@selector(getUrl:withReplyEvent:)
forEventClass:kInternetEventClass
andEventID:kAEGetURL];
@@ -293,6 +283,7 @@ static void cleanupCocoaApplicationDelegate()
- (void) removeAppleEventHandlers
{
NSAppleEventManager *eventManager = [NSAppleEventManager sharedAppleEventManager];
+ [eventManager removeEventHandlerForEventClass:kCoreEventClass andEventID:kAEQuitApplication];
[eventManager removeEventHandlerForEventClass:kInternetEventClass andEventID:kAEGetURL];
}
@@ -339,8 +330,7 @@ static void cleanupCocoaApplicationDelegate()
&& [reflectionDelegate respondsToSelector:
@selector(applicationShouldTerminateAfterLastWindowClosed:)])
return [reflectionDelegate applicationShouldTerminateAfterLastWindowClosed:sender];
-
- return qApp->quitOnLastWindowClosed();
+ return NO; // Someday qApp->quitOnLastWindowClosed(); when QApp and NSApp work closer together.
}
@@ -446,6 +436,13 @@ static void cleanupCocoaApplicationDelegate()
QWindowSystemInterface::handleFileOpenEvent(QUrl(QCFString::toQString(urlString)));
}
+- (void)appleEventQuit:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent
+{
+ Q_UNUSED(event);
+ Q_UNUSED(replyEvent);
+ [NSApp terminate:self];
+}
+
- (void)qtDispatcherToQAction:(id)sender
{
Q_UNUSED(sender);