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 50c04d6318.
Change-Id: Ib4ef8190f945b915fe268745cc64d471994c5e2d
Reviewed-by: Richard J. Moore <rich@kde.org>
bb10
parent
ff7fdf78ef
commit
12a4db710e
|
|
@ -41,8 +41,7 @@ OBJECTIVE_SOURCES += main.mm \
|
|||
qcocoakeymapper.mm \
|
||||
qcocoamimetypes.mm
|
||||
|
||||
SOURCES += messages.cpp \
|
||||
qcocoasessionmanager.cpp
|
||||
SOURCES += messages.cpp
|
||||
|
||||
HEADERS += qcocoaintegration.h \
|
||||
qcocoatheme.h \
|
||||
|
|
@ -77,8 +76,7 @@ HEADERS += qcocoaintegration.h \
|
|||
qcocoaintrospection.h \
|
||||
qcocoakeymapper.h \
|
||||
messages.h \
|
||||
qcocoamimetypes.h \
|
||||
qcocoasessionmanager.h
|
||||
qcocoamimetypes.h
|
||||
|
||||
contains(QT_CONFIG, opengl.*) {
|
||||
OBJECTIVE_SOURCES += qcocoaglcontext.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
|
||||
|
|
@ -283,6 +269,10 @@ static void cleanupCocoaApplicationDelegate()
|
|||
application depends on.
|
||||
*/
|
||||
NSAppleEventManager *eventManager = [NSAppleEventManager sharedAppleEventManager];
|
||||
[eventManager setEventHandler:self
|
||||
andSelector:@selector(appleEventQuit:withReplyEvent:)
|
||||
forEventClass:kCoreEventClass
|
||||
andEventID:kAEQuitApplication];
|
||||
[eventManager setEventHandler:self
|
||||
andSelector:@selector(getUrl:withReplyEvent:)
|
||||
forEventClass:kInternetEventClass
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -141,14 +141,6 @@ public:
|
|||
void setToolbar(QWindow *window, NSToolbar *toolbar);
|
||||
NSToolbar *toolbar(QWindow *window) const;
|
||||
void clearToolbars();
|
||||
|
||||
void setWindow(NSWindow* nsWindow, QCocoaWindow *window);
|
||||
QCocoaWindow *window(NSWindow *window);
|
||||
|
||||
#ifndef QT_NO_SESSIONMANAGER
|
||||
QPlatformSessionManager *createPlatformSessionManager(const QString &id, const QString &key) const;
|
||||
#endif
|
||||
|
||||
private:
|
||||
static QCocoaIntegration *mInstance;
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@
|
|||
#include "qcocoainputcontext.h"
|
||||
#include "qcocoamimetypes.h"
|
||||
#include "qcocoaaccessibility.h"
|
||||
#include "qcocoasessionmanager.h"
|
||||
|
||||
#include <qpa/qplatformaccessibility.h>
|
||||
#include <QtCore/qcoreapplication.h>
|
||||
|
|
@ -417,13 +416,6 @@ QCocoaScreen *QCocoaIntegration::screenAtIndex(int index)
|
|||
return mScreens.at(index);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_SESSIONMANAGER
|
||||
QPlatformSessionManager *QCocoaIntegration::createPlatformSessionManager(const QString &id, const QString &key) const
|
||||
{
|
||||
return new QCocoaSessionManager(id, key);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool QCocoaIntegration::hasCapability(QPlatformIntegration::Capability cap) const
|
||||
{
|
||||
switch (cap) {
|
||||
|
|
|
|||
|
|
@ -1,70 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Samuel Gaist <samuel.gaist@edeltech.ch>
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QT_NO_SESSIONMANAGER
|
||||
#include <qcocoasessionmanager.h>
|
||||
#include <qstring.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QCocoaSessionManager::QCocoaSessionManager(const QString &id, const QString &key)
|
||||
: QPlatformSessionManager(id, key),
|
||||
m_canceled(false)
|
||||
{
|
||||
}
|
||||
|
||||
QCocoaSessionManager::~QCocoaSessionManager()
|
||||
{
|
||||
}
|
||||
|
||||
void QCocoaSessionManager::cancel()
|
||||
{
|
||||
m_canceled = true;
|
||||
}
|
||||
|
||||
bool QCocoaSessionManager::wasCanceled() const
|
||||
{
|
||||
return m_canceled;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_SESSIONMANAGER
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Samuel Gaist <samuel.gaist@edeltech.ch>
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QCOCOASESSIONMANAGER_H
|
||||
#define QCOCOASESSIONMANAGER_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is part of the QPA API and is not meant to be used
|
||||
// in applications. Usage of this API may make your code
|
||||
// source and binary incompatible with future versions of Qt.
|
||||
//
|
||||
|
||||
#ifndef QT_NO_SESSIONMANAGER
|
||||
|
||||
#include <qpa/qplatformsessionmanager.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class Q_GUI_EXPORT QCocoaSessionManager : public QPlatformSessionManager
|
||||
{
|
||||
public:
|
||||
QCocoaSessionManager(const QString &id, const QString &key);
|
||||
virtual ~QCocoaSessionManager();
|
||||
|
||||
void cancel() Q_DECL_OVERRIDE;
|
||||
bool wasCanceled() const;
|
||||
|
||||
private:
|
||||
bool m_canceled;
|
||||
|
||||
Q_DISABLE_COPY(QCocoaSessionManager)
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_SESSIONMANAGER
|
||||
|
||||
#endif // QCOCOASESSIONMANAGER_H
|
||||
|
|
@ -144,12 +144,7 @@ void tst_QSystemTrayIcon::lastWindowClosed()
|
|||
QTimer::singleShot(2500, &window, SLOT(close()));
|
||||
QTimer::singleShot(20000, qApp, SLOT(quit())); // in case the test fails
|
||||
qApp->exec();
|
||||
|
||||
#ifdef Q_OS_OSX
|
||||
QVERIFY(spy.count() == 2);
|
||||
#else
|
||||
QVERIFY(spy.count() == 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_QSystemTrayIcon)
|
||||
|
|
|
|||
Loading…
Reference in New Issue