summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorMilla Pohjanheimo <ext-milla.pohjanheimo@nokia.com>2010-11-19 11:10:57 (GMT)
committerJanne Koskinen <janne.p.koskinen@digia.com>2010-11-23 08:55:55 (GMT)
commita9467c8542ff745471e077ac8be554d3a0087e4a (patch)
treeda764789f3a64ecf4e4b61af4db11d192e1bac99 /src/gui
parent0df002ad600800a6c4ccadb969e1b1de7f8353e7 (diff)
downloadQt-a9467c8542ff745471e077ac8be554d3a0087e4a.zip
Qt-a9467c8542ff745471e077ac8be554d3a0087e4a.tar.gz
Qt-a9467c8542ff745471e077ac8be554d3a0087e4a.tar.bz2
Native color dialog on symbian
Native color dialog implementation for Symbian. During merge extra libraries removed. Task-number: QT-3917 Reviewed-by: Sami Merila Merge-Request: 932 Reviewed-by: Janne Koskinen
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/dialogs/dialogs.pri9
-rw-r--r--src/gui/dialogs/qcolordialog.cpp21
-rw-r--r--src/gui/dialogs/qcolordialog_symbian.cpp107
3 files changed, 131 insertions, 6 deletions
diff --git a/src/gui/dialogs/dialogs.pri b/src/gui/dialogs/dialogs.pri
index 443c5e9..c25b6d5 100644
--- a/src/gui/dialogs/dialogs.pri
+++ b/src/gui/dialogs/dialogs.pri
@@ -109,12 +109,9 @@ SOURCES += \
dialogs/qprintpreviewdialog.cpp
symbian:contains(QT_CONFIG, s60) {
- LIBS += -lcommondialogs \
- -lavkon \
- -lplatformenv \
- -lefsrv \
- -lgdi
- SOURCES += dialogs/qfiledialog_symbian.cpp
+ LIBS += -lcommondialogs
+ SOURCES += dialogs/qfiledialog_symbian.cpp \
+ dialogs/qcolordialog_symbian.cpp
}
FORMS += dialogs/qpagesetupwidget.ui
diff --git a/src/gui/dialogs/qcolordialog.cpp b/src/gui/dialogs/qcolordialog.cpp
index e9b5720..4ef2100 100644
--- a/src/gui/dialogs/qcolordialog.cpp
+++ b/src/gui/dialogs/qcolordialog.cpp
@@ -1952,6 +1952,12 @@ void QColorDialog::open(QObject *receiver, const char *member)
\sa QDialog::open()
*/
+/*
+ For Symbian color dialogs
+*/
+#ifdef Q_WS_S60
+extern QColor qtSymbianGetColor(const QColor &initial);
+#endif
/*!
\since 4.5
@@ -1961,10 +1967,19 @@ void QColorDialog::open(QObject *receiver, const char *member)
QColor::isValid()) color if the user cancels the dialog.
The \a options argument allows you to customize the dialog.
+
+ On Symbian, this static function will use the native color dialog and not a QColorDialog.
+ On Symbian the parameters \a title and \a parent has no relevance and the
+ \a options parameter is only used to define if the native color dialog is
+ used or not.
*/
QColor QColorDialog::getColor(const QColor &initial, QWidget *parent, const QString &title,
ColorDialogOptions options)
{
+#ifdef Q_WS_S60
+ if (!(options & DontUseNativeDialog))
+ return qtSymbianGetColor(initial);
+#endif
QColorDialog dlg(parent);
if (!title.isEmpty())
dlg.setWindowTitle(title);
@@ -1979,10 +1994,16 @@ QColor QColorDialog::getColor(const QColor &initial, QWidget *parent, const QStr
returns that color. The color is initially set to \a initial. The
dialog is a child of \a parent. It returns an invalid (see
QColor::isValid()) color if the user cancels the dialog.
+
+ On Symbian, this static function will use the native
+ color dialog and not a QColorDialog.
*/
QColor QColorDialog::getColor(const QColor &initial, QWidget *parent)
{
+#ifdef Q_WS_S60
+ return qtSymbianGetColor(initial);
+#endif
return getColor(initial, parent, QString(), ColorDialogOptions(0));
}
diff --git a/src/gui/dialogs/qcolordialog_symbian.cpp b/src/gui/dialogs/qcolordialog_symbian.cpp
new file mode 100644
index 0000000..3f8036c
--- /dev/null
+++ b/src/gui/dialogs/qcolordialog_symbian.cpp
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** 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, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qcolordialog_p.h"
+
+#ifndef QT_NO_COLORDIALOG
+
+
+#include "qcolor.h"
+#include "private/qguiplatformplugin_p.h"
+
+#ifdef Q_WS_S60
+#include <AknColourSelectionGrid.h>
+#endif
+
+#include "private/qt_s60_p.h"
+
+QT_BEGIN_NAMESPACE
+
+QColor launchSymbianColorDialog(QColor initial)
+{
+ QColor currentColor = QColor::Invalid;
+#ifdef Q_WS_S60
+ QT_TRAP_THROWING(
+ CArrayFixFlat<TRgb>* array = new( ELeave ) CArrayFixFlat<TRgb>(17);
+ CleanupStack::PushL(array);
+ array->AppendL(KRgbBlack);
+ array->AppendL(KRgbDarkGray);
+ array->AppendL(KRgbDarkRed);
+ array->AppendL(KRgbDarkGreen);
+ array->AppendL(KRgbDarkYellow);
+ array->AppendL(KRgbDarkBlue);
+ array->AppendL(KRgbDarkMagenta);
+ array->AppendL(KRgbDarkCyan);
+ array->AppendL(KRgbRed);
+ array->AppendL(KRgbGreen);
+ array->AppendL(KRgbYellow);
+ array->AppendL(KRgbBlue);
+ array->AppendL(KRgbMagenta);
+ array->AppendL(KRgbCyan);
+ array->AppendL(KRgbGray);
+ array->AppendL(KRgbWhite);
+
+ TRgb initialColour(initial.red(), initial.green(), initial.blue(), initial.alpha());
+
+ TBool noneChosen = EFalse; // If true shows the default colour button
+ CAknColourSelectionGrid* colourSelectionGrid =
+ CAknColourSelectionGrid::NewL(array, EFalse, noneChosen, initialColour);
+ CleanupStack::PushL(colourSelectionGrid);
+
+ if (colourSelectionGrid->ExecuteLD()) {
+ currentColor.setRgb(initialColour.Red(), initialColour.Green(),
+ initialColour.Blue(), initialColour.Alpha());
+ }
+ CleanupStack::Pop(colourSelectionGrid);
+ CleanupStack::PopAndDestroy(array);
+ );
+#endif
+ return currentColor;
+}
+
+QColor qtSymbianGetColor(const QColor &initial)
+{
+ return launchSymbianColorDialog(initial);
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_COLORDIALOG