summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2009-06-12 08:29:29 (GMT)
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2009-06-12 08:29:29 (GMT)
commitaf26ef4356cf2bf8ccbcb391b488ddf301dbb2fe (patch)
tree0656dec3fdf12abbf37a48d65f0adb01d54bbb59
parentbccd5442f24ce18e08ec5a5e78ccc6566f4e0463 (diff)
parent53cfa304345df1cd7b7686a2ebc1acd74a886886 (diff)
downloadQt-af26ef4356cf2bf8ccbcb391b488ddf301dbb2fe.zip
Qt-af26ef4356cf2bf8ccbcb391b488ddf301dbb2fe.tar.gz
Qt-af26ef4356cf2bf8ccbcb391b488ddf301dbb2fe.tar.bz2
Merge branch 'master' of git@scm.dev.troll.no:qt/qt-s60-public
Conflicts: src/network/ssl/ssl.pri
-rw-r--r--dist/changes-4.5.2-tower101
-rw-r--r--doc/src/exceptionsafety.qdoc144
-rw-r--r--doc/src/platform-notes.qdoc13
-rw-r--r--doc/src/symbian-exceptionsafety.qdoc184
-rw-r--r--examples/widgets/softkeys/main.cpp36
-rw-r--r--examples/widgets/softkeys/softkeys.cpp65
-rw-r--r--examples/widgets/softkeys/softkeys.h3
-rw-r--r--qmake/generators/makefile.cpp101
-rw-r--r--qmake/generators/makefile.h3
-rw-r--r--qmake/generators/symbian/symmake_abld.cpp12
-rw-r--r--qmake/generators/symbian/symmake_sbsv2.cpp12
-rw-r--r--src/corelib/global/qglobal.cpp145
-rw-r--r--src/corelib/global/qglobal.h89
-rw-r--r--src/corelib/tools/qlist.h9
-rw-r--r--src/corelib/tools/qscopedpointer.cpp36
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_s60.cpp13
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp2
-rw-r--r--src/gui/kernel/qaction.cpp3
-rw-r--r--src/gui/kernel/qwidget.cpp30
-rw-r--r--src/gui/kernel/qwidget_s60.cpp2
-rw-r--r--src/gui/styles/qs60style.cpp48
-rw-r--r--src/gui/styles/qs60style_simulated.cpp20
-rw-r--r--src/gui/widgets/qactiontokeyeventmapper.cpp2
-rw-r--r--src/gui/widgets/qactiontokeyeventmapper_p.h13
-rw-r--r--src/gui/widgets/qcombobox.cpp2
-rw-r--r--src/gui/widgets/qmenu.cpp2
26 files changed, 939 insertions, 151 deletions
diff --git a/dist/changes-4.5.2-tower b/dist/changes-4.5.2-tower
new file mode 100644
index 0000000..1a039ba
--- /dev/null
+++ b/dist/changes-4.5.2-tower
@@ -0,0 +1,101 @@
+Qt 4.5.2-tower
+---------------
+
+The Qt for S60 "Tower" release is the fifth pre-release from the Qt for
+S60 porting project. "Tower" is based on the Qt 4.5 codebase.
+
+Up to and including SHA: not yet started :D
+
+Lists just S60 fixes, for general 4.5.0 changes go to:
+
+ http://www.qtsoftware.com/developer/changes/changes-4.5.0
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Task Tracker:
+
+ http://qtsoftware.com/developer/task-tracker
+
+Each of these identifiers can be entered in the task tracker to obtain
+more information about a particular change. Sometimes the task is internal
+and cannot be viewed by the public, a lot of them are non-public for Qt for
+S60 at the moment.
+
+****************************************************************************
+* New features *
+****************************************************************************
+
+New modules
+-----------
+
+- QtSql
+ * todo
+- QtWebkit
+ * todo
+- Phonon
+ * todo
+
+
+New classes
+------------
+
+- todo
+ * todo
+
+Ported classes
+--------------
+
+- todo
+ * todo
+
+Features
+--------
+
+- todo
+ * todo
+
+Optimizations
+-------------
+
+- todo
+ * todo
+
+****************************************************************************
+* Build issues *
+****************************************************************************
+
+- todo
+
+****************************************************************************
+* Changes to existing classes *
+****************************************************************************
+
+- todo
+ * todo
+
+****************************************************************************
+* Examples and demos *
+****************************************************************************
+
+- todo
+ * todo
+
+****************************************************************************
+* Tools *
+****************************************************************************
+
+- todo
+ * todo
+
+****************************************************************************
+* Plugins *
+****************************************************************************
+
+- todo
+ * todo
+
+****************************************************************************
+* Important Behavior Changes *
+****************************************************************************
+
+- todo
+ * todo
diff --git a/doc/src/exceptionsafety.qdoc b/doc/src/exceptionsafety.qdoc
new file mode 100644
index 0000000..4e3e89e
--- /dev/null
+++ b/doc/src/exceptionsafety.qdoc
@@ -0,0 +1,144 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the documentation 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page exceptionsafety.html
+ \title Exception Safety
+ \ingroup architecture
+ \brief A guide to exception safety in Qt.
+
+ \bold {Preliminary warning}: Exception safety is not feature complete!
+ Common cases should work, but classes might still leak or even crash.
+
+ Qt itself will not throw exceptions. Instead, error codes are used.
+ In addition, some classes have user visible error messages, for example
+ \l QIODevice::errorString() or \l QSqlQuery::lastError().
+ This has historical and practical reasons - turning on exceptions
+ can increase the library size by over 20%.
+
+ The following sections describe Qt's behavior if exception support is
+ enabled at compile time.
+
+ \tableofcontents
+
+ \section1 Exception safe modules
+
+ \section2 Containers
+
+ Qt's \l{container classes} are generally exception neutral. They pass any
+ exception that happens within their contained type \c T to the user
+ while keeping their internal state valid.
+
+ Example:
+
+ \code
+ QList<QString> list;
+ ...
+ try {
+ list.append("hello");
+ } catch (...) {
+ }
+ // list is safe to use - the exception did not affect it.
+ \endcode
+
+ Exceptions to that rule are containers for types that can throw during assignment
+ or copy constructions. For those types, functions that modify the container as well as
+ returning a value, are unsafe to use:
+
+ \code
+ MyType s = list.takeAt(2);
+ \endcode
+
+ If an exception occurs during the assignment of \c s, the value at index 2 is already
+ removed from the container, but hasn't been assigned to \c s yet. It is lost
+ without chance of recovery.
+
+ The correct way to write it:
+
+ \code
+ MyType s = list.at(2);
+ list.removeAt(2);
+ \endcode
+
+ If the assignment throws, the container still contains the value, no data loss occured.
+
+ Note that implicitly shared Qt classes will not throw in their assignment
+ operators or copy constructors, so the limitation above does not apply.
+
+ \section1 Out of memory handling
+
+ Most desktop operating systems overcommit memory. This means that \c malloc()
+ or \c{operator new} return a valid pointer, even though there is not enough
+ memory available at allocation time. On such systems, no exception of type
+ \c std::bad_alloc is thrown.
+
+ On all other operating systems, Qt will throw an exception of type std::bad_alloc
+ if any allocation fails. Allocations can fail if the system runs out of memory or
+ doesn't have enough continuous memory to allocate the requested size.
+
+ Exceptions to that rule are documented. As an example, \l QImage::create()
+ returns false if not enough memory exists instead of throwing an exception.
+
+ \section1 Recovering from exceptions
+
+ Currently, the only supported use case for recovering from exceptions thrown
+ within Qt (for example due to out of memory) is to exit the event loop and do
+ some cleanup before exiting the application.
+
+ Typical use case:
+
+ \code
+ QApplication app(argc, argv);
+ ...
+ try {
+ app.exec();
+ } catch (const std::bad_alloc &) {
+ // clean up here, e.g. save the session
+ // and close all config files.
+
+ return 0; // exit the application
+ }
+ \endcode
+
+ After an exception is thrown, the connection to the windowing server
+ might already be closed. It is not safe to call a GUI related function
+ after catching an exception.
+*/
diff --git a/doc/src/platform-notes.qdoc b/doc/src/platform-notes.qdoc
index c8046c4..63b721a 100644
--- a/doc/src/platform-notes.qdoc
+++ b/doc/src/platform-notes.qdoc
@@ -512,6 +512,19 @@
*/
/*!
+ \page platform-notes-symbian.html
+ \title Platform Notes - Symbian
+ \contentspage Platform Notes
+
+ This page contains information about the Symbian platforms Qt is currently known
+ to run on. More information about the combinations of platforms and compilers
+ supported by Qt can be found on the \l{Supported Platforms} page.
+
+ For information about mixing exceptions with symbian leaves,
+ see \l QSymbianLeaveException.
+*/
+
+/*!
\page platform-notes-embedded-linux.html
\title Platform Notes - Embedded Linux
\contentspage Platform Notes
diff --git a/doc/src/symbian-exceptionsafety.qdoc b/doc/src/symbian-exceptionsafety.qdoc
new file mode 100644
index 0000000..212f707
--- /dev/null
+++ b/doc/src/symbian-exceptionsafety.qdoc
@@ -0,0 +1,184 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the documentation 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page symbianexceptionsafety.html
+ \title Exception Safety with Symbian
+ \ingroup qts60
+ \brief A guide to integrating exception safety in Qt with Symbian.
+
+ The following sections describe how Qt code can interoperate with Symbian's
+ exception safety system.
+
+ \tableofcontents
+
+ \section1 What the problem is
+
+ Qt and Symbian have different exception systems. Qt works with standard C++
+ exceptions, whereas Symbian has its TRAP/Leave/CleanupStack system. So, what would
+ happen if
+ you mix the two systems? It could go wrong in a number of ways.
+
+ Cleanup ordering would be different between the two. When Symbian code
+ leaves, the cleanup stack is cleaned up before anything else happens. After
+ that, the objects on the call stack would be cleaned up as with a normal
+ exception. So if there are any dependencies between stack based and cleanup stack
+ owned objects, there could be problems due to this ordering.
+
+ Symbian's \c XLeaveException, which is used when Symbian implements leaves as
+ exceptions, is not derived from \c std::exception, so would not be caught in
+ Qt catch statements designed to catch \c std::exception.
+
+ Qt's and standard C++'s \c std::exception derived exceptions result in program
+ termination if they fall back to a Symbian TRAP.
+
+ These problems can be solved with barrier macros and helper functions that
+ will translate between the two exception systems. Use them, in Qt code,
+ whenever calling into or being called from Symbian code.
+
+ \section1 Qt calls to Symbian
+
+ When calling Symbian leaving functions from Qt code, we want to translate
+ Symbian leaves to standard C++ exceptions. The following help is provided:
+
+ \list
+ \o \l qt_translateSymbianErrorToException(int error) takes a Symbian
+ error code and throws an appropriate exception to represent it.
+ This will do nothing if the error code is not in fact an error. The
+ function is equivalent to Symbian's \c User::LeaveIfError.
+ \o \l QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION(f) takes a Symbian leaving
+ code fragment f and runs it under a trap harness converting any resulting
+ error into an exception.
+ \o \c TRAP and \c TRAPD from the Symbian libraries can be used to convert
+ leaves to error codes.
+ \endlist
+
+ \code
+ HBufC* buf=0;
+ // this will throw a std::bad_alloc because we've asked for too much memory
+ QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION(buf = HBufC::NewL(100000000));
+
+ _LIT(KStr,"abc");
+ TInt pos = KStr().Locate('c');
+ // pos is a good value, >= 0, so no exception is thrown
+ qt_translateSymbianErrorToException(pos);
+
+ pos = KStr().Locate('d');
+ // pos == KErrNotFound, so this throws an exception
+ qt_translateSymbianErrorToException(pos);
+ \endcode
+
+ \section1 Qt called from Symbian
+
+ When Qt code is called from Symbian, we want to translate standard C++
+ exceptions to Symbian leaves or error codes. The following help is
+ provided:
+
+ \list
+ \o \l qt_translateExceptionToSymbianError(const std::exception& ex) -
+ this takes a standard exception and gives an appropriate Symbian
+ error code. If no mapping is known for the exception type,
+ \c KErrGeneral is returned.
+ \o \l qt_translateExceptionToSymbianErrorL(const std::exception& ex) -
+ this takes a standard exception and generates an appropriate Symbian
+ leave.
+ \o \l QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_ERROR(err, f) - this macro
+ takes the standard C++ code fragment \c f, catches any std::exceptions
+ thrown from it, and sets err to the corresponding Symbian error code.
+ err is set to \c KErrNone otherwise.
+ \o \l QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_LEAVE(f) - this macro takes the
+ standard C++ code fragment \c f, catches any std::exceptions thrown from
+ it, and throws a corresponding Symbian leave.
+ \endlist
+
+ \code
+ TInt DoTickL() // called from an active object RunL, ie Symbian leaves expected
+ {
+ // without the translation to Symbian Leave, we get a USER:0 panic
+ QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_LEAVE({
+ int* x = new int[100000000]; // compiled as Qt code, will throw std::bad_alloc
+ delete [] x;
+ });
+ return 0;
+ }
+ \endcode
+
+ \section1 Common sense things
+
+ Try to minimise the interleaving of Symbian and Qt code, every switch
+ requires a barrier. Grouping the code styles in different blocks will
+ minimise the problems. For instance, examine the following code.
+
+ \code
+ 1. TRAPD(err, m_playUtility = CMdaAudioPlayerUtility::NewL(*this);
+ 2. QString filepath = QFileInfo( m_sound->fileName() ).absoluteFilePath();
+ 3. filepath = QDir::toNativeSeparators(filepath);
+ 4. m_playUtility->OpenFileL(qt_QString2TPtrC(filepath)));
+ \endcode
+
+ Line 1 starts a Symbian leave handling block, which is good because it
+ also uses a Symbian leave generating function.
+
+ Line 2 creates a \l QString, uses \l QFileInfo and various member functions.
+ These could all throw exceptions, which is not good inside a \c TRAP block.
+
+ Line 3 is unclear as to whether it might throw an exception, but since
+ it's dealing with strings it probably does, again bad.
+
+ Line 4 is tricky, it calls a leaving function which is ok within a \c TRAP,
+ but it also uses \l qt_QString2TPtrC. You might think this is safe, but
+ there is a potential realloc call in there, so this can cause an unwelcome
+ exception.
+
+ We could rewrite this with nested exception translations, but it's much
+ easier to refactor it.
+
+ \code
+ QString filepath = QFileInfo( m_sound->fileName() ).absoluteFilePath();
+ filepath = QDir::toNativeSeparators(filepath);
+ TPtrC filepathPtr(qt_QString2TPtrC(filepath));
+ TRAPD(err, m_playUtility = CMdaAudioPlayerUtility::NewL(*this);
+ m_playUtility->OpenFileL(filepathPtr));
+ \endcode
+
+ Now the exception generating functions are separated from the leaving
+ functions.
+*/
diff --git a/examples/widgets/softkeys/main.cpp b/examples/widgets/softkeys/main.cpp
index a355f93..a544b28 100644
--- a/examples/widgets/softkeys/main.cpp
+++ b/examples/widgets/softkeys/main.cpp
@@ -1,11 +1,41 @@
/****************************************************************************
**
-** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the examples of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/examples/widgets/softkeys/softkeys.cpp b/examples/widgets/softkeys/softkeys.cpp
index edf38b9..87d11c9 100644
--- a/examples/widgets/softkeys/softkeys.cpp
+++ b/examples/widgets/softkeys/softkeys.cpp
@@ -1,8 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
#include "softkeys.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
+ central = new QWidget(this);
+ setCentralWidget(central);
+ infoLabel = new QLabel(tr("Funky stuff in menu!"));
+
+ layout = new QVBoxLayout;
+ layout->addWidget(infoLabel);
+ central->setLayout(layout);
+ central->setFocusPolicy(Qt::TabFocus);
+
fileMenu = menuBar()->addMenu(tr("&File"));
openDialogAct = new QAction(tr("&Open Dialog"), this);
addSoftKeysAct = new QAction(tr("&Add Softkeys"), this);
@@ -13,12 +63,6 @@ MainWindow::MainWindow(QWidget *parent)
connect(openDialogAct, SIGNAL(triggered()), this, SLOT(openDialog()));
connect(addSoftKeysAct, SIGNAL(triggered()), this, SLOT(addSoftKeys()));
connect(clearSoftKeysAct, SIGNAL(triggered()), this, SLOT(clearSoftKeys()));
- QWidget *central = new QWidget(this);
- central->setLayout(new QVBoxLayout);
-// central->setFocus();
- setCentralWidget(central);
- QPushButton button1;
-// QAction* menuAction =
}
MainWindow::~MainWindow()
@@ -43,19 +87,24 @@ void MainWindow::addSoftKeys()
QList<QAction*> softkeys;
softkeys.append(ok);
softkeys.append(cancel);
- setSoftKeys(softkeys);
+ central->setSoftKeys(softkeys);
+ central->setFocus();
}
void MainWindow::clearSoftKeys()
{
- setSoftKey(0);
+ central->setSoftKey(0);
}
void MainWindow::okPressed()
{
+ infoLabel->setText(tr("OK pressed"));
+ central->setSoftKey(0);
}
void MainWindow::cancelPressed()
{
+ infoLabel->setText(tr("Cancel pressed"));
+ central->setSoftKey(0);
}
diff --git a/examples/widgets/softkeys/softkeys.h b/examples/widgets/softkeys/softkeys.h
index 2bc74ba..11db419 100644
--- a/examples/widgets/softkeys/softkeys.h
+++ b/examples/widgets/softkeys/softkeys.h
@@ -59,6 +59,9 @@ public:
MainWindow(QWidget *parent = 0);
~MainWindow();
private:
+ QVBoxLayout *layout;
+ QWidget *central;
+ QLabel *infoLabel;
QMenu* fileMenu;
QAction* openDialogAct;
QAction* addSoftKeysAct;
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index 82703c5..5f38bc7 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -2234,8 +2234,8 @@ MakefileGenerator::writeHeader(QTextStream &t)
t << endl;
}
-void
-MakefileGenerator::writeSubDirs(QTextStream &t)
+QList<MakefileGenerator::SubTarget*>
+MakefileGenerator::findSubDirsSubTargets() const
{
QList<SubTarget*> targets;
{
@@ -2332,6 +2332,13 @@ MakefileGenerator::writeSubDirs(QTextStream &t)
}
}
}
+ return targets;
+}
+
+void
+MakefileGenerator::writeSubDirs(QTextStream &t)
+{
+ QList<SubTarget*> targets = findSubDirsSubTargets();
t << "first: make_default" << endl;
int flags = SubTargetInstalls;
if(project->isActiveConfig("ordered"))
@@ -2348,39 +2355,43 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
for(QStringList::Iterator qeui_it = qeui.begin(); qeui_it != qeui.end(); ++qeui_it)
t << "include " << (*qeui_it) << endl;
- QString ofile = Option::fixPathToTargetOS(Option::output.fileName());
- if(ofile.lastIndexOf(Option::dir_sep) != -1)
- ofile = ofile.right(ofile.length() - ofile.lastIndexOf(Option::dir_sep) -1);
- t << "MAKEFILE = " << ofile << endl;
- /* Calling Option::fixPathToTargetOS() is necessary for MinGW/MSYS, which requires
- * back-slashes to be turned into slashes. */
- t << "QMAKE = " << Option::fixPathToTargetOS(var("QMAKE_QMAKE")) << endl;
- t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl;
- t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl;
- t << "MKDIR = " << var("QMAKE_MKDIR") << endl;
- t << "COPY = " << var("QMAKE_COPY") << endl;
- t << "COPY_FILE = " << var("QMAKE_COPY_FILE") << endl;
- t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << endl;
- t << "INSTALL_FILE = " << var("QMAKE_INSTALL_FILE") << endl;
- t << "INSTALL_PROGRAM = " << var("QMAKE_INSTALL_PROGRAM") << endl;
- t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl;
- t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl;
- t << "SYMLINK = " << var("QMAKE_SYMBOLIC_LINK") << endl;
- t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl;
- t << "MOVE = " << var("QMAKE_MOVE") << endl;
- t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl;
- t << "MKDIR = " << var("QMAKE_MKDIR") << endl;
+ if (!(flags & SubTargetSkipDefaultVariables)) {
+ QString ofile = Option::fixPathToTargetOS(Option::output.fileName());
+ if(ofile.lastIndexOf(Option::dir_sep) != -1)
+ ofile = ofile.right(ofile.length() - ofile.lastIndexOf(Option::dir_sep) -1);
+ t << "MAKEFILE = " << ofile << endl;
+ /* Calling Option::fixPathToTargetOS() is necessary for MinGW/MSYS, which requires
+ * back-slashes to be turned into slashes. */
+ t << "QMAKE = " << Option::fixPathToTargetOS(var("QMAKE_QMAKE")) << endl;
+ t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl;
+ t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl;
+ t << "MKDIR = " << var("QMAKE_MKDIR") << endl;
+ t << "COPY = " << var("QMAKE_COPY") << endl;
+ t << "COPY_FILE = " << var("QMAKE_COPY_FILE") << endl;
+ t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << endl;
+ t << "INSTALL_FILE = " << var("QMAKE_INSTALL_FILE") << endl;
+ t << "INSTALL_PROGRAM = " << var("QMAKE_INSTALL_PROGRAM") << endl;
+ t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl;
+ t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl;
+ t << "SYMLINK = " << var("QMAKE_SYMBOLIC_LINK") << endl;
+ t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl;
+ t << "MOVE = " << var("QMAKE_MOVE") << endl;
+ t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl;
+ t << "MKDIR = " << var("QMAKE_MKDIR") << endl;
+ t << "SUBTARGETS = "; // subtargets are sub-directory
+ for(int target = 0; target < targets.size(); ++target)
+ t << " \\\n\t\t" << targets.at(target)->target;
+ t << endl << endl;
+ }
writeExtraVariables(t);
- t << "SUBTARGETS = "; // subtargets are sub-directory
- for(int target = 0; target < targets.size(); ++target)
- t << " \\\n\t\t" << targets.at(target)->target;
- t << endl << endl;
QStringList targetSuffixes;
const QString abs_source_path = project->first("QMAKE_ABSOLUTE_SOURCE_PATH");
- targetSuffixes << "make_default" << "make_first" << "all" << "clean" << "distclean"
- << QString((flags & SubTargetInstalls) ? "install_subtargets" : "install")
- << QString((flags & SubTargetInstalls) ? "uninstall_subtargets" : "uninstall");
+ if (!(flags & SubTargetSkipDefaultTargets)) {
+ targetSuffixes << "make_default" << "make_first" << "all" << "clean" << "distclean"
+ << QString((flags & SubTargetInstalls) ? "install_subtargets" : "install")
+ << QString((flags & SubTargetInstalls) ? "uninstall_subtargets" : "uninstall");
+ }
// generate target rules
for(int target = 0; target < targets.size(); ++target) {
@@ -2500,23 +2511,25 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
}
t << endl;
- if(project->values("QMAKE_INTERNAL_QMAKE_DEPS").indexOf("qmake_all") == -1)
- project->values("QMAKE_INTERNAL_QMAKE_DEPS").append("qmake_all");
+ if (!(flags & SubTargetSkipDefaultTargets)) {
+ if(project->values("QMAKE_INTERNAL_QMAKE_DEPS").indexOf("qmake_all") == -1)
+ project->values("QMAKE_INTERNAL_QMAKE_DEPS").append("qmake_all");
- writeMakeQmake(t);
+ writeMakeQmake(t);
- t << "qmake_all:";
- if(!targets.isEmpty()) {
- for(QList<SubTarget*>::Iterator it = targets.begin(); it != targets.end(); ++it) {
- if(!(*it)->profile.isEmpty())
- t << " " << (*it)->target << "-" << "qmake_all";
+ t << "qmake_all:";
+ if(!targets.isEmpty()) {
+ for(QList<SubTarget*>::Iterator it = targets.begin(); it != targets.end(); ++it) {
+ if(!(*it)->profile.isEmpty())
+ t << " " << (*it)->target << "-" << "qmake_all";
+ }
}
+ if(project->isEmpty("QMAKE_NOFORCE"))
+ t << " FORCE";
+ if(project->isActiveConfig("no_empty_targets"))
+ t << "\n\t" << "@cd .";
+ t << endl << endl;
}
- if(project->isEmpty("QMAKE_NOFORCE"))
- t << " FORCE";
- if(project->isActiveConfig("no_empty_targets"))
- t << "\n\t" << "@cd .";
- t << endl << endl;
for(int s = 0; s < targetSuffixes.size(); ++s) {
QString suffix = targetSuffixes.at(s);
diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h
index 9896c1d..a6eec52 100644
--- a/qmake/generators/makefile.h
+++ b/qmake/generators/makefile.h
@@ -121,9 +121,12 @@ protected:
enum SubTargetFlags {
SubTargetInstalls=0x01,
SubTargetOrdered=0x02,
+ SubTargetSkipDefaultVariables=0x04,
+ SubTargetSkipDefaultTargets=0x08,
SubTargetsNoFlags=0x00
};
+ QList<MakefileGenerator::SubTarget*> findSubDirsSubTargets() const;
void writeSubTargets(QTextStream &t, QList<SubTarget*> subtargets, int flags);
//extra compiler interface
diff --git a/qmake/generators/symbian/symmake_abld.cpp b/qmake/generators/symbian/symmake_abld.cpp
index 32d08f6..8501224 100644
--- a/qmake/generators/symbian/symmake_abld.cpp
+++ b/qmake/generators/symbian/symmake_abld.cpp
@@ -184,6 +184,10 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool
t << "#" << endl;
t << "# ==============================================================================" << "\n" << endl;
t << endl;
+ QString ofile = Option::fixPathToTargetOS(Option::output.fileName());
+ if(ofile.lastIndexOf(Option::dir_sep) != -1)
+ ofile = ofile.right(ofile.length() - ofile.lastIndexOf(Option::dir_sep) -1);
+ t << "MAKEFILE = " << ofile << endl;
t << "QMAKE = " << Option::fixPathToTargetOS(var("QMAKE_QMAKE")) << endl;
t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl;
t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl;
@@ -273,8 +277,6 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool
}
- writeExtraTargets(t);
-
// pre_targetdeps target depends on:
// - all targets specified in PRE_TARGETDEPS
// - the GENERATED_SOURCES sources (so that they get generated)
@@ -285,6 +287,7 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool
// so supporting generating sources is the best we can do. This is enough for mocs.
if (!isSubdirs) {
+ writeExtraTargets(t);
writeExtraCompilerTargets(t);
t << CREATE_TEMPS_TARGET ":" << endl;
@@ -345,6 +348,11 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool
}
t << endl;
}
+ else {
+ QList<MakefileGenerator::SubTarget*> subtargets = findSubDirsSubTargets();
+ writeSubTargets(t, subtargets, SubTargetSkipDefaultVariables|SubTargetSkipDefaultTargets);
+ qDeleteAll(subtargets);
+ }
writeDeploymentTargets(t);
diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp
index 33431d2..7b739c7 100644
--- a/qmake/generators/symbian/symmake_sbsv2.cpp
+++ b/qmake/generators/symbian/symmake_sbsv2.cpp
@@ -124,6 +124,10 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo
t << "#" << endl;
t << "# ==============================================================================" << "\n" << endl;
t << endl;
+ QString ofile = Option::fixPathToTargetOS(Option::output.fileName());
+ if(ofile.lastIndexOf(Option::dir_sep) != -1)
+ ofile = ofile.right(ofile.length() - ofile.lastIndexOf(Option::dir_sep) -1);
+ t << "MAKEFILE = " << ofile << endl;
t << "QMAKE = " << Option::fixPathToTargetOS(var("QMAKE_QMAKE")) << endl;
t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl;
t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl;
@@ -206,11 +210,15 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo
// Add all extra targets including extra compiler targest also to wrapper makefile,
// even though many of them may have already been added to bld.inf as FLMs.
// This is to enable use of targets like 'mocables', which call targets generated by extra compilers.
- t << extraTargetsCache;
-
if (!isSubdirs) {
+ t << extraTargetsCache;
t << extraCompilersCache;
}
+ else {
+ QList<MakefileGenerator::SubTarget*> subtargets = findSubDirsSubTargets();
+ writeSubTargets(t, subtargets, SubTargetSkipDefaultVariables|SubTargetSkipDefaultTargets);
+ qDeleteAll(subtargets);
+ }
t << "dodistclean:" << endl;
foreach(QString item, project->values("SUBDIRS")) {
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 484c618..6590ea6 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -2207,10 +2207,10 @@ void qt_message_output(QtMsgType msgType, const char *buf)
*/
static void qEmergencyOut(QtMsgType msgType, const char *msg, va_list ap)
{
- char emergency_buf[1024] = { '\0' };
- emergency_buf[1023] = '\0';
+ char emergency_buf[256] = { '\0' };
+ emergency_buf[255] = '\0';
if (msg)
- qvsnprintf(emergency_buf, 1023, msg, ap);
+ qvsnprintf(emergency_buf, 255, msg, ap);
qt_message_output(msgType, emergency_buf);
}
#endif
@@ -3214,14 +3214,127 @@ bool QInternal::callFunction(InternalFunction func, void **args)
#include <typeinfo>
-const char* QSymbianLeaveException::what() const throw()
+/*! \macro QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION(function)
+ \relates QSymbianLeaveException
+
+ TRAP leaves from Symbian \a function and throws an appropriate
+ standard C++ exception instead.
+ This must be used when calling Symbian OS leaving functions
+ from inside Qt or standard C++ code, so that the code can respond
+ correctly to the exception.
+
+ \warning This macro is only available on Symbian.
+
+ Example:
+
+ \code
+ // A Symbian leaving function is being called within a Qt function.
+ // Any leave must be converted to an exception
+ CAknTitlePane* titlePane = S60->titlePane();
+ if (titlePane) {
+ TPtrC captionPtr(qt_QString2TPtrC(caption));
+ QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION(titlePane->SetTextL(captionPtr));
+ }
+ \endcode
+
+ \sa QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_ERROR(), QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_LEAVE()
+*/
+
+/*! \macro QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_ERROR(error, function)
+ \relates QSymbianLeaveException
+ \ingroup qts60
+
+ Catch standard C++ exceptions from a \a function and convert them to a Symbian OS
+ \a error code, or \c KErrNone if there is no exception.
+ This must be used inside Qt or standard C++ code when using exception throwing
+ code (practically anything) and returning an error code to Symbian OS.
+
+ \warning This macro is only available on Symbian.
+
+ Example:
+
+ \code
+ // An exception might be thrown in this Symbian TInt error returning function.
+ // It is caught and translated to an error code
+ TInt QServerApp::Connect(const QString &serverName)
+ {
+ TPtrC name;
+ TInt err;
+ QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_ERROR(err, name.Set(qt_QString2TPtrC(serverName)));
+ if (err != KErrNone)
+ return err;
+ return iServer.Connect(name);
+ }
+ \endcode
+}
+
+ \sa QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_LEAVE(), QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION()
+*/
+
+/*! \macro QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_LEAVE(function)
+ \relates QSymbianLeaveException
+ \ingroup qts60
+
+ Catch standard C++ exceptions from \a function and convert them to Symbian OS
+ leaves. This must be used inside Qt or standard C++ code when using exception
+ throwing code (practically anything) and returning to Symbian OS from a leaving function.
+ For example inside a Symbian active object's \c RunL function implemented with Qt code.
+
+ \warning This macro is only available on Symbian.
+
+ Example:
+
+ \code
+ // This active object signals Qt code
+ // Exceptions from the Qt code must be converted to Symbian OS leaves for the active scheduler
+ void QWakeUpActiveObject::RunL()
+ {
+ iStatus = KRequestPending;
+ SetActive();
+ QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_LEAVE(m_dispatcher->wakeUpWasCalled());
+ }
+ \endcode
+
+ \sa QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION(), QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_ERROR()
+*/
+
+/*! \class QSymbianLeaveException
+ \ingroup qts60
+ \brief The QSymbianLeaveException class represents a block of Symbian leave code.
+
+ \warning This class is only available on Symbian.
+*/
+
+/*! \fn QSymbianLeaveException::QSymbianLeaveException(int error)
+
+ Constructs a QSymbianLeaveException object that stores the given
+ Symbian \a error code.
+*/
+
+/*! \fn const char *QSymbianLeaveException::what() const
+
+ Returns a C-style character string describing the general
+ cause of the current error.
+
+ The string is not localized.
+*/
+const char *QSymbianLeaveException::what() const throw()
{
- static const char str[] = "Symbian leave exception %d";
- static char msg[sizeof(str)+12];
- sprintf(msg, str, error);
+ static char msg[36];
+ snprintf(msg, sizeof(msg), "Symbian leave exception %d", error);
return msg;
}
+/*! \relates QSymbianLeaveException
+ \ingroup qts60
+
+ Throws a QSymbianLeaveException if the \a error parameter is a symbian error code.
+ This is the exception throwing equivalent of Symbian's User::LeaveIfError.
+
+ \warning This function is only available on Symbian.
+
+ \sa qt_translateExceptionToSymbianErrorL(), qt_translateExceptionToSymbianError()
+*/
void qt_translateSymbianErrorToException(int error)
{
if (error >= KErrNone)
@@ -3234,11 +3347,29 @@ void qt_translateSymbianErrorToException(int error)
}
}
+/*! \relates QSymbianLeaveException
+ \ingroup qts60
+
+ Convert a caught standard C++ exception \a aThrow to a Symbian leave
+
+ \warning This function is only available on Symbian.
+
+ \sa qt_translateSymbianErrorToException(), qt_translateExceptionToSymbianError()
+*/
void qt_translateExceptionToSymbianErrorL(const std::exception& aThrow)
{
User::Leave(qt_translateExceptionToSymbianError(aThrow));
}
+/*! \relates QSymbianLeaveException
+ \ingroup qts60
+
+ Convert a caught standard C++ exception \a aThrow to a Symbian error code
+
+ \warning This function is only available on Symbian.
+
+ \sa qt_translateSymbianErrorToException(), qt_translateExceptionToSymbianErrorL()
+*/
int qt_translateExceptionToSymbianError(const std::exception& aThrow)
{
const std::type_info& atype = typeid(aThrow);
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 030840e..450fd86 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -2310,6 +2310,50 @@ QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathTranslations();
QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathSysconf();
#endif
+#if defined(Q_OS_SYMBIAN)
+
+#include <stdexcept>
+
+class QSymbianLeaveException : public std::exception
+{
+public:
+ inline QSymbianLeaveException(int err) : error(err) {}
+ const char* what() const throw();
+public:
+ int error;
+};
+
+Q_CORE_EXPORT void qt_translateSymbianErrorToException(int error);
+Q_CORE_EXPORT void qt_translateExceptionToSymbianErrorL(const std::exception& ex);
+Q_CORE_EXPORT int qt_translateExceptionToSymbianError(const std::exception& ex);
+
+#define QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION(f) \
+ { \
+ TInt error; \
+ TRAP(error, f); \
+ if (error) \
+ qt_translateSymbianErrorToException(error); \
+ }
+
+#define QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_ERROR(err, f) \
+ { \
+ err = KErrNone; \
+ try { \
+ f; \
+ } catch (const std::exception &ex) { \
+ err = qt_translateExceptionToSymbianError(ex); \
+ } \
+ }
+
+#define QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_LEAVE(f) \
+ { \
+ TInt err; \
+ QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_ERROR(err, f) \
+ User::LeaveIfError(err); \
+ }
+#endif
+
+
/*
This gives us the possibility to check which modules the user can
use. These are purely compile time checks and will generate no code.
@@ -2383,6 +2427,9 @@ QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathSysconf();
#define QT_LICENSED_MODULE(x) \
enum QtValidLicenseFor##x##Module { Licensed##x = true };
+/* qdoc is really unhappy with the following block of preprocessor checks,
+ making it difficult to document classes properly after this point. */
+
#if (QT_EDITION & QT_MODULE_CORE)
QT_LICENSED_MODULE(Core)
#endif
@@ -2465,48 +2512,6 @@ QT_LICENSED_MODULE(DBus)
# define QT_NO_CONCURRENT_FILTER
#endif
-#if defined(Q_OS_SYMBIAN)
-
-#include <stdexcept>
-class QSymbianLeaveException : public std::exception
-{
-public:
- QSymbianLeaveException(int err) : error(err){ }
- const char* what() const throw();
-public:
- int error;
-};
-
-Q_CORE_EXPORT void qt_translateSymbianErrorToException(int error);
-Q_CORE_EXPORT void qt_translateExceptionToSymbianErrorL(const std::exception& ex);
-Q_CORE_EXPORT int qt_translateExceptionToSymbianError(const std::exception& ex);
-
-#define QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION(f) \
- { \
- TInt error; \
- TRAP(error, f); \
- if (error) \
- qt_translateSymbianErrorToException(error); \
- }
-
-#define QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_ERROR(err, f) \
- { \
- err = KErrNone; \
- try { \
- f; \
- } catch (const std::exception &ex) { \
- err = qt_translateExceptionToSymbianError(ex); \
- } \
- }
-
-#define QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_LEAVE(f) \
- { \
- TInt err; \
- QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_ERROR(err, f) \
- User::LeaveIfError(err); \
- }
-#endif
-
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index 89e082b..7540035 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -117,7 +117,14 @@ public:
inline int size() const { return p.size(); }
inline void detach() { if (d->ref != 1) detach_helper(); }
- inline void detachShared() { if (d->ref != 1 && d != &QListData::shared_null) detach_helper(); }
+
+ inline void detachShared()
+ {
+ // The "this->" qualification is needed for GCCE.
+ if (d->ref != 1 && this->d != &QListData::shared_null)
+ detach_helper();
+ }
+
inline bool isDetached() const { return d->ref == 1; }
inline void setSharable(bool sharable) { if (!sharable) detach(); d->sharable = sharable; }
diff --git a/src/corelib/tools/qscopedpointer.cpp b/src/corelib/tools/qscopedpointer.cpp
index 8150a18..0239575 100644
--- a/src/corelib/tools/qscopedpointer.cpp
+++ b/src/corelib/tools/qscopedpointer.cpp
@@ -3,9 +3,39 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
-** This file is part of the $MODULE$ of the Qt Toolkit.
+** This file is part of the QtCore module of the Qt Toolkit.
**
-** $TROLLTECH_DUAL_LICENSE$
+** $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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
**
****************************************************************************/
@@ -112,7 +142,7 @@
/*!
\fn void QScopedPointer::reset(T *other = 0)
- Deletes the existing object its pointing to if any, and sets its pointer to
+ Deletes the existing object it is pointing to if any, and sets its pointer to
\a other. QScopedPointer now owns \a other and will delete it in its
destructor.
diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
index 1dfb012..7d79422 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
+++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
@@ -43,7 +43,6 @@
#include "qcoefepinputcontext_p.h"
#include <qapplication.h>
-#include <private/qapplication_p.h>
#include <qtextformat.h>
#include <fepitfr.h>
@@ -89,13 +88,9 @@ QCoeFepInputContext::~QCoeFepInputContext()
// This is to make sure that the FEP manager "forgets" about us,
// otherwise we may get callbacks even after we're destroyed.
- // The call is asynchronous though, so we must spin the event loop
- // to make sure it gets detected. However we will not spin eventloop
- // in case that app is closing, since eventDispatcher is already deleted.
- CCoeEnv::Static()->InputCapabilitiesChanged();
- if(!QApplicationPrivate::is_app_closing) {
- QApplication::processEvents();
- }
+ // The call below is essentially equivalent to InputCapabilitiesChanged(),
+ // but is synchronous, rather than asynchronous.
+ CCoeEnv::Static()->SyncNotifyFocusObserversOfChangeInFocus();
if (m_fepState)
delete m_fepState;
@@ -334,6 +329,8 @@ void QCoeFepInputContext::updateHints()
m_lastImHints = hints;
applyHints(hints);
}
+ } else {
+ CCoeEnv::Static()->InputCapabilitiesChanged();
}
}
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index af84ea6..2576724 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -61,7 +61,7 @@
#ifndef QT_NO_ACCESSIBILITY
#include <qaccessible.h>
#endif
-#include <qactiontokeyeventmapper_p.h>
+#include <private/qactiontokeyeventmapper_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qaction.cpp b/src/gui/kernel/qaction.cpp
index 8263cbc..b1db8d6 100644
--- a/src/gui/kernel/qaction.cpp
+++ b/src/gui/kernel/qaction.cpp
@@ -81,7 +81,8 @@ static QString qt_strippedText(QString s)
QActionPrivate::QActionPrivate() : group(0), enabled(1), forceDisabled(0),
visible(1), forceInvisible(0), checkable(0), checked(0), separator(0), fontSet(false),
- menuRole(QAction::TextHeuristicRole), iconVisibleInMenu(-1)
+ menuRole(QAction::TextHeuristicRole), softKeyRole(QAction::OptionsSoftKey),
+ iconVisibleInMenu(-1)
{
#ifdef QT3_SUPPORT
static int qt_static_action_id = -1;
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 103577e..a83a79f 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -885,6 +885,30 @@ void QWidget::setAutoFillBackground(bool enabled)
\endlist
\sa QEvent, QPainter, QGridLayout, QBoxLayout
+
+ \section1 SoftKeys
+ \since 4.6
+ \preliminary
+
+ Softkeys API is a platform independent way of mapping actions to (hardware)keys
+ and toolbars provided by the underlying platform.
+
+ There are three major use cases supported. First one is a mobile device
+ with keypad navigation and no touch ui. Second use case is a mobile
+ device with touch ui. Third use case is desktop. For now the softkey API is
+ only implemented for Series60.
+
+ QActions are set to widget(s) via softkey API. Actions in focused widget are
+ mapped to native toolbar or hardware keys. Even though the API allows to set
+ any amount of widgets there might be physical restrictions to amount of
+ softkeys that can be used by the device.
+
+ \o Series60: For series60 menu button is automatically mapped to left
+ soft key if there is QMainWindow with QMenuBar in widgets parent hierarchy.
+
+ \sa softKeys()
+ \sa setSoftKey()
+
*/
QWidgetMapper *QWidgetPrivate::mapper = 0; // widget with wid
@@ -11555,6 +11579,9 @@ void QWidget::clearMask()
}
/*!
+ \preliminary
+ \since 4.6
+
Returns the (possibly empty) list of this widget's softkeys.
Returned list cannot be changed. Softkeys should be added
and removed via method called setSoftKeys
@@ -11573,6 +11600,9 @@ const QList<QAction*>& QWidget::softKeys() const
}
/*!
+ \preliminary
+ \since 4.6
+
Sets the softkey \a softkey to this widget's list of softkeys,
Setting 0 as softkey will clear all the existing softkeys set
to the widget
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index eb3180f..bc69d6d 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -95,7 +95,7 @@ void QWidgetPrivate::setSoftKeys_sys(const QList<QAction*> &softkeys)
const QAction* softKeyAction = softkeys.at(index);
if (softKeyAction->softKeyRole() != QAction::ContextMenuSoftKey) {
- HBufC* text = qt_QString2HBufCNewL(softKeyAction->text());
+ HBufC* text = qt_QString2HBufC(softKeyAction->text());
CleanupStack::PushL(text);
if (softKeyAction->softKeyRole() == QAction::MenuSoftKey) {
nativeContainer->SetCommandL(placeInScreen, EAknSoftkeyOptions, *text);
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index 6ee63e6..83f1698 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -44,8 +44,8 @@
#include "qapplication.h"
#include "qpainter.h"
#include "qstyleoption.h"
-#include "qresizeevent"
-#include "qpixmapcache"
+#include "qevent.h"
+#include "qpixmapcache.h"
#include "qcalendarwidget.h"
#include "qdial.h"
@@ -574,7 +574,7 @@ void QS60StylePrivate::drawRow(QS60StyleEnums::SkinParts start,
if (startRect.topRight().y() > endRect.bottomLeft().y()) {
const int overlap = (startRect.topRight().y() - endRect.bottomLeft().y())>>1;
startRect.setHeight(startRect.height()-overlap);
- endRect.adjust(0,overlap,0,0);
+ endRect.adjust(0,overlap,0,0);
}
}
@@ -1129,7 +1129,7 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom
copy.state |= State_Raised;
copy.state &= ~State_Sunken;
}
- pe = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus) ?
+ pe = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus) ?
PE_IndicatorSpinPlus :
PE_IndicatorSpinUp;
@@ -1156,7 +1156,7 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom
copy.state |= State_Raised;
copy.state &= ~State_Sunken;
}
- pe = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus) ?
+ pe = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus) ?
PE_IndicatorSpinMinus :
PE_IndicatorSpinDown;
@@ -1586,12 +1586,12 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
QPixmap tabIcon = optionTab.icon.pixmap(iconSize,
(optionTab.state & State_Enabled) ? QIcon::Normal : QIcon::Disabled);
if (tab->text.isEmpty())
- painter->drawPixmap(tr.center().x() - (tabIcon.height() >>1),
- tr.center().y() - (tabIcon.height() >>1),
+ painter->drawPixmap(tr.center().x() - (tabIcon.height() >>1),
+ tr.center().y() - (tabIcon.height() >>1),
tabIcon);
else
- painter->drawPixmap(tr.left() + tabOverlap,
- tr.center().y() - (tabIcon.height() >>1),
+ painter->drawPixmap(tr.left() + tabOverlap,
+ tr.center().y() - (tabIcon.height() >>1),
tabIcon);
tr.setLeft(tr.left() + iconSize.width() + 4);
}
@@ -1822,7 +1822,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
}
}
QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_TableHeaderItem, painter, mtyRect, adjFlags);
-
+
QRegion clipRegion = painter->clipRegion();
painter->setClipRect(option->rect);
drawControl(CE_HeaderSection, header, painter, widget);
@@ -2038,8 +2038,18 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
#endif //QT_NO_SPINBOX
case PE_FrameFocusRect:
// Calendar widget and combox both do not use styled itemDelegate
- if (!(widget && qobject_cast<const QCalendarWidget *>(widget->parent())) ||
- qobject_cast<const QComboBoxListView *>(widget)) {
+ if ( widget && (
+#ifndef QT_NO_CALENDARWIDGET
+ (qobject_cast<const QCalendarWidget *>(widget->parent()))
+#else
+ false
+#endif //QT_NO_CALENDARWIDGET
+#ifndef QT_NO_COMBOBOX
+ || (qobject_cast<const QComboBoxListView *>(widget))
+#else
+ || false
+#endif //QT_NO_COMBOBOX
+ )) {
// no focus selection for touch
if (option->state & State_HasFocus && !QS60StylePrivate::isTouchSupported()) {
painter->save();
@@ -2292,9 +2302,9 @@ int QS60Style::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
retValue = true;
break;
case SH_ProgressDialog_TextLabelAlignment:
- retValue = (QApplication::layoutDirection() == Qt::LeftToRight) ?
+ retValue = (QApplication::layoutDirection() == Qt::LeftToRight) ?
Qt::AlignLeft :
- Qt::AlignRight;
+ Qt::AlignRight;
break;
case SH_Menu_SubMenuPopupDelay:
retValue = 300;
@@ -2314,6 +2324,8 @@ int QS60Style::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
case SH_BlinkCursorWhenTextSelected:
retValue = true;
break;
+ case SH_UnderlineShortcut:
+ retValue = 0;
default:
break;
}
@@ -2406,7 +2418,7 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple
const int y = frameThickness + spinbox->rect.y();
const int x = spinbox->rect.x() + spinbox->rect.width() - frameThickness - 2*buttonSize.width();
-
+
switch (scontrol) {
case SC_SpinBoxUp:
if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons)
@@ -2641,7 +2653,7 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con
// a) highlight border does not cross the rect
// b) in s60 list checkbox is smaller than normal checkbox
//todo; magic three
- ret.setRect(opt->rect.left()+3, opt->rect.top() + heightOffset,
+ ret.setRect(opt->rect.left()+3, opt->rect.top() + heightOffset,
indicatorWidth-3, indicatorHeight-3);
} else {
ret.setRect(opt->rect.right() - indicatorWidth - spacing, opt->rect.top() + heightOffset,
@@ -2780,8 +2792,8 @@ QIcon QS60Style::standardIconImplementation(StandardPixmap standardIcon,
QS60StyleEnums::SkinParts part;
QS60StylePrivate::SkinElementFlags adjustedFlags;
if (option)
- adjustedFlags = (option->state & State_Enabled) ?
- QS60StylePrivate::SF_StateEnabled :
+ adjustedFlags = (option->state & State_Enabled) ?
+ QS60StylePrivate::SF_StateEnabled :
QS60StylePrivate::SF_StateDisabled;
switch(standardIcon) {
diff --git a/src/gui/styles/qs60style_simulated.cpp b/src/gui/styles/qs60style_simulated.cpp
index 7667f92..684f232 100644
--- a/src/gui/styles/qs60style_simulated.cpp
+++ b/src/gui/styles/qs60style_simulated.cpp
@@ -53,6 +53,7 @@
#include "qmetaobject.h"
#include "qdebug.h"
#include "qbuffer.h"
+#include "qdesktopwidget.h"
#if !defined(QT_NO_STYLE_S60) || defined(QT_PLUGIN)
@@ -61,13 +62,20 @@ QT_BEGIN_NAMESPACE
static const quint32 blobVersion = 1;
static const int pictureSize = 256;
+#if defined(Q_CC_GNU)
+#if __GNUC__ >= 2
+#define __FUNCTION__ __func__
+#endif
+#endif
+
+
bool saveThemeToBlob(const QString &themeBlob,
const QHash<QString, QPicture> &partPictures,
const QHash<QPair<QString, int>, QColor> &colors)
{
QFile blob(themeBlob);
if (!blob.open(QIODevice::WriteOnly)) {
- qWarning() << __FUNCTION__": Could not create blob: " << themeBlob;
+ qWarning() << __FUNCTION__ << ": Could not create blob: " << themeBlob;
return false;
}
@@ -106,7 +114,7 @@ bool loadThemeFromBlob(const QString &themeBlob,
{
QFile blob(themeBlob);
if (!blob.open(QIODevice::ReadOnly)) {
- qWarning() << __FUNCTION__": Could not read blob: " << themeBlob;
+ qWarning() << __FUNCTION__ << ": Could not read blob: " << themeBlob;
return false;
}
QDataStream blobIn(&blob);
@@ -115,7 +123,7 @@ bool loadThemeFromBlob(const QString &themeBlob,
blobIn >> version;
if (version != blobVersion) {
- qWarning() << __FUNCTION__": Invalid blob version: " << version << " ...expected: " << blobVersion;
+ qWarning() << __FUNCTION__ << ": Invalid blob version: " << version << " ...expected: " << blobVersion;
return false;
}
@@ -148,7 +156,7 @@ bool loadThemeFromBlob(const QString &themeBlob,
}
if (dataIn.status() != QDataStream::Ok) {
- qWarning() << __FUNCTION__": Invalid data blob: " << themeBlob;
+ qWarning() << __FUNCTION__ << ": Invalid data blob: " << themeBlob;
return false;
}
return true;
@@ -266,7 +274,7 @@ QPixmap QS60StylePrivate::frame(SkinFrameElements frame, const QSize &size,
const QRect leftRect = rightRect.translated(cornerWidth - rectWidth, 0);
const QRect centerRect = drawOnlyCenter ? rect : rect.adjusted(cornerWidth, cornerWidth, -cornerWidth, -cornerWidth);
- QImage result(size, QImage::Format_ARGB32);
+ QPixmap result(size);
result.fill(Qt::transparent);
QPainter painter(&result);
@@ -295,7 +303,7 @@ QPixmap QS60StylePrivate::frame(SkinFrameElements frame, const QSize &size,
drawPart(center, &painter, centerRect, flags);
#endif
- return QPixmap::fromImage(result);
+ return result;
}
void QS60StylePrivate::setStyleProperty_specific(const char *name, const QVariant &value)
diff --git a/src/gui/widgets/qactiontokeyeventmapper.cpp b/src/gui/widgets/qactiontokeyeventmapper.cpp
index 5cce415..280b1c6 100644
--- a/src/gui/widgets/qactiontokeyeventmapper.cpp
+++ b/src/gui/widgets/qactiontokeyeventmapper.cpp
@@ -41,7 +41,7 @@
#include "qapplication.h"
#include "qevent.h"
-#include "QActionToKeyEventMapper_p.h"
+#include "qactiontokeyeventmapper_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/gui/widgets/qactiontokeyeventmapper_p.h b/src/gui/widgets/qactiontokeyeventmapper_p.h
index da336e8..c54e612 100644
--- a/src/gui/widgets/qactiontokeyeventmapper_p.h
+++ b/src/gui/widgets/qactiontokeyeventmapper_p.h
@@ -42,6 +42,17 @@
#ifndef QACTIONTOKEYEVENTMAPPER_P_H
#define QACTIONTOKEYEVENTMAPPER_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/qobject.h>
#include "QtGui/qaction.h"
QT_BEGIN_HEADER
@@ -67,4 +78,4 @@ QT_END_NAMESPACE
QT_END_HEADER
-#endif //QACTIONTOKEYEVENTMAPPER_H
+#endif //QACTIONTOKEYEVENTMAPPER_P_H
diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp
index 2da5cd0..a6a5e08 100644
--- a/src/gui/widgets/qcombobox.cpp
+++ b/src/gui/widgets/qcombobox.cpp
@@ -63,7 +63,7 @@
#include <private/qabstractitemmodel_p.h>
#include <private/qabstractscrollarea_p.h>
#include <qdebug.h>
-#include <qactiontokeyeventmapper_p.h>
+#include <private/qactiontokeyeventmapper_p.h>
#ifdef Q_WS_X11
#include <private/qt_x11_p.h>
#endif
diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp
index 3486574..6d4dcf2 100644
--- a/src/gui/widgets/qmenu.cpp
+++ b/src/gui/widgets/qmenu.cpp
@@ -60,7 +60,7 @@
#ifndef QT_NO_WHATSTHIS
# include <qwhatsthis.h>
#endif
-#include <qactiontokeyeventmapper_p.h>
+#include <private/qactiontokeyeventmapper_p.h>
#include "qmenu_p.h"
#include "qmenubar_p.h"