diff options
author | Alessandro Portale <aportale@trolltech.com> | 2009-05-12 17:57:13 (GMT) |
---|---|---|
committer | Alessandro Portale <aportale@trolltech.com> | 2009-05-12 17:57:13 (GMT) |
commit | 10a294b71d0ccaddb48b1396352a744fdd0de6bf (patch) | |
tree | 5aafa2c4585958ba4154f4b458ce8a4d68d6f00b /src/gui/softkeys | |
parent | 282a724b26b734aa4d9406567f5ec4ca96e8c320 (diff) | |
download | Qt-10a294b71d0ccaddb48b1396352a744fdd0de6bf.zip Qt-10a294b71d0ccaddb48b1396352a744fdd0de6bf.tar.gz Qt-10a294b71d0ccaddb48b1396352a744fdd0de6bf.tar.bz2 |
Moved SoftkeyStack files into src/widgets
Corrected PImpl-ing and cleaned up headers
Diffstat (limited to 'src/gui/softkeys')
-rw-r--r-- | src/gui/softkeys/qsoftkeyaction.cpp | 191 | ||||
-rw-r--r-- | src/gui/softkeys/qsoftkeyaction.h | 96 | ||||
-rw-r--r-- | src/gui/softkeys/qsoftkeystack.cpp | 100 | ||||
-rw-r--r-- | src/gui/softkeys/qsoftkeystack.h | 74 | ||||
-rw-r--r-- | src/gui/softkeys/qsoftkeystack_p.h | 86 | ||||
-rw-r--r-- | src/gui/softkeys/qsoftkeystack_s60.cpp | 100 |
6 files changed, 0 insertions, 647 deletions
diff --git a/src/gui/softkeys/qsoftkeyaction.cpp b/src/gui/softkeys/qsoftkeyaction.cpp deleted file mode 100644 index 1d21376..0000000 --- a/src/gui/softkeys/qsoftkeyaction.cpp +++ /dev/null @@ -1,191 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (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 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 "qsoftkeyaction.h" - -/*! - \class QSoftKeyAction - \brief The QSoftKeyAction class defines a special kind of QAction that may also be displayed in a QSoftKeyBar. -*/ - -class QSoftKeyActionPrivate -{ -public: - QSoftKeyActionPrivate(QSoftKeyAction::StandardRole role = QSoftKeyAction::Custom) - { - this->role = role; - } - - QSoftKeyAction::StandardRole role; - QString roleName; - int nativePosition; - int qtContextKey; -}; - -/*! - \enum QSoftKeyAction::StandardRole - This enum defines the standard role for a QSoftKeyAction. - - \value Options - \value Select - \value Back - \value Next - \value Previous - \value Ok - \value Cancel - \value Edit - \value View - \value BackSpace - \value EndEdit - \value RevertEdit - \value Deselect - \value Finish - \value Custom -*/ - -QSoftKeyAction::QSoftKeyAction(QObject *parent) - : QAction(parent) -{ - d = new QSoftKeyActionPrivate(); -} - -QSoftKeyAction::QSoftKeyAction(StandardRole role, QObject *parent) - : QAction(parent) -{ - d = new QSoftKeyActionPrivate(role); -} - -QSoftKeyAction::QSoftKeyAction(const QString &text, QObject* parent) - : QAction(text, parent) -{ - d = new QSoftKeyActionPrivate(); -} - -QSoftKeyAction::QSoftKeyAction(StandardRole role, const QString &text, QObject* parent) - : QAction(text, parent) -{ - d = new QSoftKeyActionPrivate(role); -} - -QSoftKeyAction::QSoftKeyAction(const QIcon &icon, const QString &text, QObject* parent) - : QAction(icon, text, parent) -{ - d = new QSoftKeyActionPrivate(); -} - -QSoftKeyAction::QSoftKeyAction(StandardRole role, const QIcon &icon, const QString &text, QObject* parent) - : QAction(icon, text, parent) -{ - d = new QSoftKeyActionPrivate(role); -} - -QSoftKeyAction::~QSoftKeyAction() -{ - delete d; -} - -/*! - Returns the standard role associated with this action, or Custom - if the role is defined by roleName(). - - \sa setRole(), roleName() -*/ -QSoftKeyAction::StandardRole QSoftKeyAction::role() const -{ - return d->role; -} - -/*! - Returns the custom role name if role() is Custom, or an empty - string otherwise. - - \sa role(), setRole() -*/ -QString QSoftKeyAction::roleName() const -{ - return d->roleName; -} - -/*! - Sets the standard role associated with this action to \a role, - and also sets roleName() to the empty string. - - \sa role(), roleName() -*/ -void QSoftKeyAction::setRole(StandardRole role) -{ - d->role = role; - d->roleName = QString(); - emit changed(); -} - -/*! - Sets the custom roleName() associated with this action to \a role, - and also sets role() to Custom. - - \sa role(), roleName() -*/ -void QSoftKeyAction::setRole(const QString& role) -{ - d->role = QSoftKeyAction::Custom; - d->roleName = role; - emit changed(); -} - -int QSoftKeyAction::nativePosition() const -{ - return d->nativePosition; -} - -void QSoftKeyAction::setNativePosition(int position) -{ - d->nativePosition = position; -} - -int QSoftKeyAction::qtContextKey() const -{ - return d->qtContextKey; -} - -void QSoftKeyAction::setQtContextKey(int key) -{ - d->qtContextKey = key; -} diff --git a/src/gui/softkeys/qsoftkeyaction.h b/src/gui/softkeys/qsoftkeyaction.h deleted file mode 100644 index e735376..0000000 --- a/src/gui/softkeys/qsoftkeyaction.h +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (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 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$ -** -****************************************************************************/ - -#ifndef QSOFTKEYACTION_H -#define QSOFTKEYACTION_H - -#include "QtGui/qaction.h" - -QT_BEGIN_NAMESPACE - -class QSoftKeyActionPrivate; - -class QSoftKeyAction : public QAction -{ -public: - enum StandardRole { - Options, - Select, - Back, - Next, - Previous, - Ok, - Cancel, - Edit, - View, - BackSpace, - EndEdit, - RevertEdit, - Deselect, - Finish, - Menu, - Custom - }; - - QSoftKeyAction(QObject *parent); - QSoftKeyAction(StandardRole role, QObject *parent); - QSoftKeyAction(const QString &text, QObject* parent); - QSoftKeyAction(StandardRole role, const QString &text, QObject* parent); - QSoftKeyAction(const QIcon &icon, const QString &text, QObject* parent); - QSoftKeyAction(StandardRole role, const QIcon &icon, const QString &text, QObject* parent); - ~QSoftKeyAction(); - - StandardRole role() const; - QString roleName() const; - - void setRole(StandardRole role); - void setRole(const QString& role); - int nativePosition() const; - void setNativePosition(int position); - int qtContextKey() const; - void setQtContextKey(int position); - - QSoftKeyActionPrivate *d; -}; - -QT_END_NAMESPACE - -#endif // QSOFTKEYACTION_H diff --git a/src/gui/softkeys/qsoftkeystack.cpp b/src/gui/softkeys/qsoftkeystack.cpp deleted file mode 100644 index a8bd3a9..0000000 --- a/src/gui/softkeys/qsoftkeystack.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (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 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 "qsoftkeystack.h" -#include "qsoftkeystack_p.h" - -QSoftKeyStackPrivate::QSoftKeyStackPrivate() -{ - -} - -QSoftKeyStackPrivate::~QSoftKeyStackPrivate() -{ - -} - -void QSoftKeyStackPrivate::push(QSoftKeyAction *softKey) -{ - QSoftkeySet softKeySet; - softKeySet.append(softKey); - softKeyStack.push(softKeySet); - setNativeSoftKeys(); - -} -void QSoftKeyStackPrivate::push(const QList<QSoftKeyAction*> &softkeys) -{ - QSoftkeySet softKeySet(softkeys); - softKeyStack.push(softKeySet); - setNativeSoftKeys(); -} - -void QSoftKeyStackPrivate::pop() -{ - softKeyStack.pop(); - setNativeSoftKeys(); -} - -QSoftKeyStack::QSoftKeyStack(QWidget *parent) -{ - d = new QSoftKeyStackPrivate(); -} - -QSoftKeyStack::~QSoftKeyStack() -{ - delete d; -} - -void QSoftKeyStack::push(QSoftKeyAction *softKey) -{ - d->push(softKey); -} - -void QSoftKeyStack::push(const QList<QSoftKeyAction*> &softKeys) -{ - d->push(softKeys); -} - -void QSoftKeyStack::pop() -{ - d->pop(); -} - diff --git a/src/gui/softkeys/qsoftkeystack.h b/src/gui/softkeys/qsoftkeystack.h deleted file mode 100644 index 90df43d..0000000 --- a/src/gui/softkeys/qsoftkeystack.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (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 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$ -** -****************************************************************************/ - -#ifndef QSOFTKEYSTACK_H -#define QSOFTKEYSTACK_H - -#include "QtGui/qwidget.h" -#include "QtGui/qaction.h" -#include "qstack.h" - -#include "qsoftkeyaction.h" - -QT_BEGIN_NAMESPACE - -#define QSoftkeySet QList <QSoftKeyAction*> - -class QSoftKeyStackPrivate; - -class QSoftKeyStack : public QObject -{ -public: - QSoftKeyStack(QWidget *parent); - ~QSoftKeyStack(); - -public: - void push(QSoftKeyAction *softKey); - void push(const QList<QSoftKeyAction*> &softkeys); - void pop(); - -private: - QSoftKeyStackPrivate *d; -}; - -QT_END_NAMESPACE - -#endif // QSOFTKEYSTACK_H diff --git a/src/gui/softkeys/qsoftkeystack_p.h b/src/gui/softkeys/qsoftkeystack_p.h deleted file mode 100644 index 8e029af..0000000 --- a/src/gui/softkeys/qsoftkeystack_p.h +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (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 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$ -** -****************************************************************************/ - -#ifndef QSOFTKEYSTACK_P_H -#define QSOFTKEYSTACK_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 "QtGui/qwidget.h" -#include "QtGui/qaction.h" -#include "qstack.h" - -#include "qsoftkeyaction.h" - -QT_BEGIN_NAMESPACE - -#define QSoftkeySet QList <QSoftKeyAction*> - -class QSoftKeyStackPrivate : public QObject -{ -public: - QSoftKeyStackPrivate(); - ~QSoftKeyStackPrivate(); - - void push(QSoftKeyAction *softKey); - void push(const QList<QSoftKeyAction*> &softKeys); - void pop(); - -private: - void mapSoftKeys(const QSoftkeySet &top); - void setNativeSoftKeys(); - -private: - QStack <QSoftkeySet> softKeyStack; -}; - -QT_END_NAMESPACE - -#endif // QSOFTKEYSTACK_P_H diff --git a/src/gui/softkeys/qsoftkeystack_s60.cpp b/src/gui/softkeys/qsoftkeystack_s60.cpp deleted file mode 100644 index ce4f116..0000000 --- a/src/gui/softkeys/qsoftkeystack_s60.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (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 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 <eikenv.h> -#include <eikbtgpc.h> -#include <eikappui.h> -#include <aknappui.h> -#include <avkon.rsg> - -#include "private/qcore_symbian_p.h" - -#include "qsoftkeystack_p.h" - -#define SOFTKEYSTART 5000 -#define SOFTKEYEND (5000 + Qt::Key_Context4) - -void QSoftKeyStackPrivate::mapSoftKeys(const QSoftkeySet &top) -{ - if (top.count() == 1) { - top.at(0)->setNativePosition(2); - top.at(0)->setQtContextKey(Qt::Key_Context2); - } - else { - // FIX THIS - // veryWeirdMagic is needes as s60 5th edition sdk always panics if cba is set with index 1, this hops over it - // This needs further investigation why so that the hack can be removed - int veryWeirdMagic = 0; - for (int index = 0; index < top.count(); index++) { - top.at(index)->setNativePosition(index + veryWeirdMagic); - top.at(index)->setQtContextKey(Qt::Key_Context1 + index); - if (veryWeirdMagic == 0) - veryWeirdMagic = 1; - } - } -} - -void QSoftKeyStackPrivate::setNativeSoftKeys() -{ - CCoeAppUi* appui = CEikonEnv::Static()->AppUi(); - CAknAppUi* aknAppUi = static_cast <CAknAppUi*>(appui); - CEikButtonGroupContainer* nativeContainer = aknAppUi->Cba(); - nativeContainer->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY_WITH_IDS); - if (softKeyStack.isEmpty()) - return; - - const QSoftkeySet top = softKeyStack.top(); - mapSoftKeys(top); - - for (int index = 0; index < top.count(); index++) { - const QSoftKeyAction* softKeyAction = top.at(index); - HBufC* text = qt_QString2HBufCNewL(softKeyAction->text()); - CleanupStack::PushL(text); - if (softKeyAction->role() == QSoftKeyAction::Menu) { - nativeContainer->SetCommandL(softKeyAction->nativePosition(), EAknSoftkeyOptions, *text); - } else { - nativeContainer->SetCommandL(softKeyAction->nativePosition(), SOFTKEYSTART + softKeyAction->qtContextKey(), *text); - } - CleanupStack::PopAndDestroy(); - } -} - - |