diff options
author | Lars Knoll <lars.knoll@nokia.com> | 2012-04-16 12:04:34 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@nokia.com> | 2012-04-16 12:04:34 +0200 |
commit | 9bd032355163d92cda5e7e59ecd21214b131f187 (patch) | |
tree | 002fa12558505683143c7eb08949a3d225bf0712 /src/plugins/platforms/cocoa | |
parent | d037d25c3d5236623371cf051aaf6a9e59792ba7 (diff) | |
parent | 41673c45dde2eb95ee21dd918235218399f2be2c (diff) |
Merge remote-tracking branch 'origin/master' into api_changes
Conflicts:
configure
src/corelib/io/qurl.cpp
src/gui/kernel/qwindow.cpp
src/tools/moc/generator.cpp
src/widgets/kernel/qwidget_qpa.cpp
src/widgets/styles/qstyle.h
src/widgets/widgets/qtabbar.cpp
tests/auto/corelib/codecs/utf8/tst_utf8.cpp
Change-Id: Ia457228d6f684ec8184e13e8fcc9d25857b1751e
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r-- | src/plugins/platforms/cocoa/cocoa.pro | 2 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm | 4 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm | 4 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaintegration.h | 4 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaintegration.mm | 9 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoamenuloader.h | 1 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoamenuloader.mm | 12 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaservices.h | 58 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaservices.mm | 69 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qt_menu.nib/keyedobjects.nib | bin | 5560 -> 5560 bytes |
10 files changed, 162 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro index 2ae39dd16c..f149a6775b 100644 --- a/src/plugins/platforms/cocoa/cocoa.pro +++ b/src/plugins/platforms/cocoa/cocoa.pro @@ -36,6 +36,7 @@ OBJECTIVE_SOURCES += main.mm \ qpaintengine_mac.mm \ qprintengine_mac.mm \ qcocoaprintersupport.mm \ + qcocoaservices.mm \ HEADERS += qcocoaintegration.h \ qcocoatheme.h \ @@ -69,6 +70,7 @@ HEADERS += qcocoaintegration.h \ qpaintengine_mac_p.h \ qprintengine_mac_p.h \ qcocoaprintersupport.h \ + qcocoaservices.h \ FORMS += $$PWD/../../../widgets/dialogs/qfiledialog.ui RESOURCES += qcocoaresources.qrc diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm index fd4d6605a9..405cacee01 100644 --- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm @@ -395,6 +395,8 @@ void QCocoaColorDialogHelper::hide_sys() QCocoaColorDialogHelper::DialogCode QCocoaColorDialogHelper::dialogResultCode_sys() { + if (!mDelegate) + return QPlatformDialogHelper::Rejected; QT_MANGLE_NAMESPACE(QNSColorPanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSColorPanelDelegate) *>(mDelegate); return [delegate dialogResultCode]; } @@ -429,6 +431,8 @@ void QCocoaColorDialogHelper::setCurrentColor_sys(const QColor &color) QColor QCocoaColorDialogHelper::currentColor_sys() const { + if (!mDelegate) + return QColor(); return reinterpret_cast<QT_MANGLE_NAMESPACE(QNSColorPanelDelegate) *>(mDelegate)->mQtColor; } diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm index d05a0156b1..1e89270775 100644 --- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm @@ -414,6 +414,8 @@ void QCocoaFontDialogHelper::hide_sys() QCocoaFontDialogHelper::DialogCode QCocoaFontDialogHelper::dialogResultCode_sys() { + if (!mDelegate) + return QPlatformDialogHelper::Rejected; QT_MANGLE_NAMESPACE(QNSFontPanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSFontPanelDelegate) *>(mDelegate); return [delegate dialogResultCode]; } @@ -448,6 +450,8 @@ void QCocoaFontDialogHelper::setCurrentFont_sys(const QFont &font) QFont QCocoaFontDialogHelper::currentFont_sys() const { + if (!mDelegate) + return QFont(); return reinterpret_cast<QT_MANGLE_NAMESPACE(QNSFontPanelDelegate) *>(mDelegate)->mQtFont; } diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.h b/src/plugins/platforms/cocoa/qcocoaintegration.h index fb3ee3290e..a001b6234a 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.h +++ b/src/plugins/platforms/cocoa/qcocoaintegration.h @@ -48,6 +48,7 @@ #include "qcocoacursor.h" #include "qcocoaclipboard.h" #include "qcocoadrag.h" +#include "qcocoaservices.h" #include <QtCore/QScopedPointer> #include <QtGui/QPlatformIntegration> @@ -99,6 +100,7 @@ public: QStringList themeNames() const; QPlatformTheme *createPlatformTheme(const QString &name) const; + QPlatformServices *services() const; private: @@ -111,6 +113,8 @@ private: QList<QCocoaScreen *> mScreens; QCocoaClipboard *mCocoaClipboard; QScopedPointer<QCocoaDrag> mCocoaDrag; + QScopedPointer<QPlatformNativeInterface> mNativeInterface; + QScopedPointer<QCocoaServices> mServices; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index f91351ad46..0b87773dee 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -99,6 +99,8 @@ QCocoaIntegration::QCocoaIntegration() , mAccessibility(new QPlatformAccessibility) , mCocoaClipboard(new QCocoaClipboard) , mCocoaDrag(new QCocoaDrag) + , mNativeInterface(new QCocoaNativeInterface) + , mServices(new QCocoaServices) { QCocoaAutoReleasePool pool; @@ -204,7 +206,7 @@ QPlatformFontDatabase *QCocoaIntegration::fontDatabase() const QPlatformNativeInterface *QCocoaIntegration::nativeInterface() const { - return new QCocoaNativeInterface(); + return mNativeInterface.data(); } QPlatformInputContext *QCocoaIntegration::inputContext() const @@ -239,4 +241,9 @@ QPlatformTheme *QCocoaIntegration::createPlatformTheme(const QString &name) cons return QPlatformIntegration::createPlatformTheme(name); } +QPlatformServices *QCocoaIntegration::services() const +{ + return mServices.data(); +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoamenuloader.h b/src/plugins/platforms/cocoa/qcocoamenuloader.h index 128792410b..b0d61fa541 100644 --- a/src/plugins/platforms/cocoa/qcocoamenuloader.h +++ b/src/plugins/platforms/cocoa/qcocoamenuloader.h @@ -88,6 +88,7 @@ - (IBAction)qtDispatcherToQAction:(id)sender; - (void)qtUpdateMenubar; - (void)orderFrontCharacterPalette:(id)sender; +- (BOOL)validateMenuItem:(NSMenuItem*)menuItem; @end void qt_mac_loadMenuNib(QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *qtMenuLoader); diff --git a/src/plugins/platforms/cocoa/qcocoamenuloader.mm b/src/plugins/platforms/cocoa/qcocoamenuloader.mm index 4993937b91..2fdc28de1e 100644 --- a/src/plugins/platforms/cocoa/qcocoamenuloader.mm +++ b/src/plugins/platforms/cocoa/qcocoamenuloader.mm @@ -310,4 +310,16 @@ void qt_mac_loadMenuNib(QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *qtMenuLoader) { [NSApp orderFrontCharacterPalette:sender]; } + +- (BOOL)validateMenuItem:(NSMenuItem*)menuItem +{ + if ([menuItem action] == @selector(hide:) + || [menuItem action] == @selector(hideOtherApplications:) + || [menuItem action] == @selector(unhideAllApplications:)) { + return [NSApp validateMenuItem:menuItem]; + } else { + return [menuItem isEnabled]; + } +} + @end diff --git a/src/plugins/platforms/cocoa/qcocoaservices.h b/src/plugins/platforms/cocoa/qcocoaservices.h new file mode 100644 index 0000000000..022c39dc57 --- /dev/null +++ b/src/plugins/platforms/cocoa/qcocoaservices.h @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QCOCOADESKTOPSERVICES_H +#define QCOCOADESKTOPSERVICES_H + +#include <QtGui/qplatformservices_qpa.h> + +QT_BEGIN_NAMESPACE + +class QCocoaServices : public QPlatformServices +{ +public: + bool openUrl(const QUrl &url); + bool openDocument(const QUrl &url); +}; + +QT_END_NAMESPACE + +#endif // QCOCOADESKTOPSERVICES_H diff --git a/src/plugins/platforms/cocoa/qcocoaservices.mm b/src/plugins/platforms/cocoa/qcocoaservices.mm new file mode 100644 index 0000000000..60bd62eef8 --- /dev/null +++ b/src/plugins/platforms/cocoa/qcocoaservices.mm @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qcocoaservices.h" + +#include "qt_mac_p.h" + +#include <AppKit/NSWorkspace.h> +#include <Foundation/NSURL.h> + +#include <QtCore/QUrl> + +QT_BEGIN_NAMESPACE + +bool QCocoaServices::openUrl(const QUrl &url) +{ + const QString scheme = url.scheme(); + if (scheme.isEmpty()) + return openDocument(url); + return [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:QT_PREPEND_NAMESPACE(QCFString::toNSString)(url.toString())]]; +} + +bool QCocoaServices::openDocument(const QUrl &url) +{ + if (!url.isValid()) + return false; + + return [[NSWorkspace sharedWorkspace] openFile:QT_PREPEND_NAMESPACE(QCFString::toNSString)(url.toLocalFile())]; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qt_menu.nib/keyedobjects.nib b/src/plugins/platforms/cocoa/qt_menu.nib/keyedobjects.nib Binary files differindex 3edb0ed2eb..67207ca628 100644 --- a/src/plugins/platforms/cocoa/qt_menu.nib/keyedobjects.nib +++ b/src/plugins/platforms/cocoa/qt_menu.nib/keyedobjects.nib |