aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/animation/widget/mwidgetmoveanimation.cpp92
-rw-r--r--src/corelib/animation/widget/mwidgetmoveanimation.h53
-rw-r--r--src/corelib/animation/widget/mwidgetmoveanimation_p.h44
-rw-r--r--src/corelib/animation/widget/widget.pri3
-rw-r--r--src/corelib/core/mapplicationifproxy.cpp16
-rw-r--r--src/corelib/core/mcomponentcache.cpp52
-rw-r--r--src/corelib/core/mcomponentcache.h4
-rw-r--r--src/corelib/core/mcomponentcache_p.h10
-rw-r--r--src/corelib/core/mcomponentdata.cpp3
-rw-r--r--src/corelib/corelib.pro6
-rw-r--r--src/corelib/events/morientationtracker.cpp6
-rw-r--r--src/corelib/events/mpanrecognizer.cpp17
-rw-r--r--src/corelib/i18n/mlocale.cpp679
-rw-r--r--src/corelib/i18n/mlocale.h79
-rw-r--r--src/corelib/i18n/mlocale_p.h11
-rw-r--r--src/corelib/icu-extradata/extradata.pri12
-rw-r--r--src/corelib/icu-extradata/extradata.txt1322
-rw-r--r--src/corelib/icu-extradata/packagelist.txt1
-rw-r--r--src/corelib/scene/mscene.cpp70
-rw-r--r--src/corelib/scene/mscene_p.h1
-rw-r--r--src/corelib/scene/mscenemanager.cpp45
-rw-r--r--src/corelib/style/mwidgetfadeanimationstyle.h2
-rw-r--r--src/corelib/style/mwidgetmoveanimationstyle.h43
-rw-r--r--src/corelib/style/style.pri1
-rw-r--r--src/corelib/widgets/mabstractitemmodel.cpp171
-rw-r--r--src/corelib/widgets/mabstractitemmodel.h141
-rw-r--r--src/corelib/widgets/mabstractitemmodel_p.h56
-rw-r--r--src/corelib/widgets/mapplicationpage.h2
-rw-r--r--src/corelib/widgets/mapplicationwindow.cpp16
-rw-r--r--src/corelib/widgets/mbubbleitem.cpp171
-rw-r--r--src/corelib/widgets/mbubbleitem.h294
-rw-r--r--src/corelib/widgets/mbubbleitem_p.h38
-rw-r--r--src/corelib/widgets/mbubbleitemmodel.cpp20
-rw-r--r--src/corelib/widgets/mbubbleitemmodel.h91
-rw-r--r--src/corelib/widgets/mcontentitem.cpp27
-rw-r--r--src/corelib/widgets/mcontentitem.h34
-rw-r--r--src/corelib/widgets/mcontentitem_p.h1
-rw-r--r--src/corelib/widgets/mcontentitemmodel.h32
-rw-r--r--src/corelib/widgets/mlabel.cpp2
-rw-r--r--src/corelib/widgets/mlist.cpp24
-rw-r--r--src/corelib/widgets/mlist.h11
-rw-r--r--src/corelib/widgets/mlist_p.h2
-rw-r--r--src/corelib/widgets/mlistfilter.cpp167
-rw-r--r--src/corelib/widgets/mlistfilter.h127
-rw-r--r--src/corelib/widgets/mlistfilter_p.h53
-rw-r--r--src/corelib/widgets/mlistitem.cpp51
-rw-r--r--src/corelib/widgets/mlistitem.h72
-rw-r--r--src/corelib/widgets/mlistitem_p.h37
-rw-r--r--src/corelib/widgets/mlistitemmodel.h30
-rw-r--r--src/corelib/widgets/mnavigationbar.h4
-rw-r--r--src/corelib/widgets/mpannableviewport.cpp15
-rw-r--r--src/corelib/widgets/mpannableviewport.h1
-rw-r--r--src/corelib/widgets/mpannableviewportlayout.cpp6
-rw-r--r--src/corelib/widgets/mpannablewidget.cpp23
-rw-r--r--src/corelib/widgets/mphysics2dpanning.cpp139
-rw-r--r--src/corelib/widgets/mphysics2dpanning.h2
-rw-r--r--src/corelib/widgets/mphysics2dpanning_p.h11
-rw-r--r--src/corelib/widgets/mprogressindicator.h2
-rw-r--r--src/corelib/widgets/msortfilterproxymodel.cpp38
-rw-r--r--src/corelib/widgets/msortfilterproxymodel.h53
-rw-r--r--src/corelib/widgets/mtextedit.cpp36
-rw-r--r--src/corelib/widgets/mtextedit.h23
-rw-r--r--src/corelib/widgets/mtoolbar.h14
-rw-r--r--src/corelib/widgets/mwindow.cpp120
-rw-r--r--src/corelib/widgets/mwindow_p.h4
-rw-r--r--src/corelib/widgets/widgets.pri16
-rw-r--r--src/extensions/applicationextension/mapplicationextensionarea.cpp4
-rw-r--r--src/extensions/applicationextension/mapplicationextensionarea.h4
-rw-r--r--src/extensions/applicationextension/mapplicationextensionareaview.cpp5
-rw-r--r--src/extensions/applicationextension/mapplicationextensionmanager.cpp171
-rw-r--r--src/extensions/applicationextension/mapplicationextensionmanager.h76
-rw-r--r--src/extensions/applicationextension/mapplicationextensionmetadata.cpp16
-rw-r--r--src/extensions/applicationextension/mapplicationextensionmetadata.h2
-rw-r--r--src/extensions/applicationextension/mextensionareaview.cpp27
-rw-r--r--src/extensions/applicationextension/mextensionrunner.cpp6
-rw-r--r--src/extensions/extensions.pro5
-rw-r--r--src/extensions/mashup/mashup/mappletinstancemanager.cpp73
-rw-r--r--src/extensions/mashup/mashup/mappletinstancemanager.h13
-rw-r--r--src/extensions/mextensionwatcher.cpp68
-rw-r--r--src/extensions/mextensionwatcher.h98
-rw-r--r--src/icu-extradata/4.4.1/fi.txt21
-rw-r--r--src/icu-extradata/4.4.1/it.txt21
-rw-r--r--src/icu-extradata/4.4.1/lang/de_CH.txt712
-rw-r--r--src/icu-extradata/4.4.1/region/de_CH.txt294
-rw-r--r--src/icu-extradata/icu-extradata.pro85
-rw-r--r--src/include/MAbstractItemModel1
-rw-r--r--src/include/MBubbleItem1
-rw-r--r--src/include/MListFilter2
-rw-r--r--src/include/MListItem1
-rw-r--r--src/include/MSortFilterProxyModel1
-rw-r--r--src/include/mabstractitemmodel.h20
-rw-r--r--src/include/mbubbleitem.h20
-rw-r--r--src/include/mlistfilter.h21
-rw-r--r--src/include/mlistitem.h20
-rw-r--r--src/include/msortfilterproxymodel.h20
-rw-r--r--src/views/animations/mwarpanimation.cpp6
-rw-r--r--src/views/mapplicationmenuview.h10
-rw-r--r--src/views/mbubbleitembackgroundview.cpp0
-rw-r--r--src/views/mbubbleitembackgroundview.h0
-rw-r--r--src/views/mbubbleitemview.cpp299
-rw-r--r--src/views/mbubbleitemview.h74
-rw-r--r--src/views/mbubbleitemview_p.h70
-rw-r--r--src/views/mbuttonview.cpp18
-rw-r--r--src/views/mcontentitemview.cpp21
-rw-r--r--src/views/mcontentitemview_p.h3
-rw-r--r--src/views/mdialogview.cpp4
-rw-r--r--src/views/mescapebuttonpanelview.cpp13
-rw-r--r--src/views/mescapebuttonpanelview_p.h4
-rw-r--r--src/views/mlabelview.cpp15
-rw-r--r--src/views/mlistitemview.cpp129
-rw-r--r--src/views/mlistitemview.h50
-rw-r--r--src/views/mlistitemview_p.h44
-rw-r--r--src/views/mlistview.cpp6
-rw-r--r--src/views/mlistview.h5
-rw-r--r--src/views/mlistview_p.cpp12
-rw-r--r--src/views/mnavigationbarview.cpp2
-rw-r--r--src/views/mscenelayereffectdimview.cpp2
-rw-r--r--src/views/msliderview.cpp158
-rw-r--r--src/views/mstatusbarview.cpp27
-rw-r--r--src/views/mstatusbarview.h9
-rw-r--r--src/views/mtexteditview.cpp44
-rw-r--r--src/views/mtexteditview_p.h1
-rw-r--r--src/views/mtoolbarview.cpp230
-rw-r--r--src/views/mtoolbarview_p.h30
-rw-r--r--src/views/style/mbubbleitembackgroundstyle.h50
-rw-r--r--src/views/style/mlistitemstyle.h36
-rw-r--r--src/views/style/mtexteditstyle.h30
-rw-r--r--src/views/style/style.pri2
-rw-r--r--src/views/views.pri5
-rw-r--r--src/views/widgets/mbubbleitembackground.cpp129
-rw-r--r--src/views/widgets/mbubbleitembackground_p.h94
-rw-r--r--src/views/widgets/widgets.pri2
132 files changed, 6214 insertions, 1977 deletions
diff --git a/src/corelib/animation/widget/mwidgetmoveanimation.cpp b/src/corelib/animation/widget/mwidgetmoveanimation.cpp
new file mode 100644
index 00000000..25a73db4
--- /dev/null
+++ b/src/corelib/animation/widget/mwidgetmoveanimation.cpp
@@ -0,0 +1,92 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#include <QPauseAnimation>
+#include <QPropertyAnimation>
+#include <QSequentialAnimationGroup>
+
+#include "mwidgetmoveanimation.h"
+#include "mwidgetmoveanimation_p.h"
+#include "mwidgetcontroller.h"
+
+void MWidgetMoveAnimationPrivate::init()
+{
+ Q_Q(MWidgetMoveAnimation);
+
+ widget = 0;
+
+ QSequentialAnimationGroup *delayedAnimation = new QSequentialAnimationGroup;
+
+ delay = new QPauseAnimation;
+ delay->setDuration(q->style()->delay());
+ positionAnimation = new QPropertyAnimation;
+ positionAnimation->setPropertyName("pos");
+ positionAnimation->setDuration(q->style()->duration());
+ positionAnimation->setEasingCurve(q->style()->easingCurve());
+
+ delayedAnimation->addAnimation(delay);
+ delayedAnimation->addAnimation(positionAnimation);
+ q->addAnimation(delayedAnimation);
+}
+
+MWidgetMoveAnimation::MWidgetMoveAnimation(QObject *parent) :
+ MParallelAnimationGroup(new MWidgetMoveAnimationPrivate, parent)
+{
+ Q_D(MWidgetMoveAnimation);
+
+ d->init();
+}
+
+MWidgetMoveAnimation::MWidgetMoveAnimation(MWidgetMoveAnimationPrivate *dd, QObject *parent) :
+ MParallelAnimationGroup(dd, parent)
+{
+ Q_D(MWidgetMoveAnimation);
+
+ d->init();
+}
+
+void MWidgetMoveAnimation::setWidget(MWidgetController *widget)
+{
+ Q_D(MWidgetMoveAnimation);
+
+ d->widget = widget;
+}
+
+void MWidgetMoveAnimation::setFinalPos(const QPointF &pos)
+{
+ Q_D(MWidgetMoveAnimation);
+
+ d->finalPos = pos;
+}
+
+void MWidgetMoveAnimation::updateState(QAbstractAnimation::State newState,
+ QAbstractAnimation::State oldState)
+{
+ Q_D(MWidgetMoveAnimation);
+
+ if (oldState == QAbstractAnimation::Stopped &&
+ newState == QAbstractAnimation::Running)
+ {
+ d->positionAnimation->setTargetObject(d->widget);
+ d->positionAnimation->setStartValue(d->widget->pos());
+ d->positionAnimation->setEndValue(d->finalPos);
+ }
+}
+
+#include "moc_mwidgetmoveanimation.cpp"
diff --git a/src/corelib/animation/widget/mwidgetmoveanimation.h b/src/corelib/animation/widget/mwidgetmoveanimation.h
new file mode 100644
index 00000000..7bc51447
--- /dev/null
+++ b/src/corelib/animation/widget/mwidgetmoveanimation.h
@@ -0,0 +1,53 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef MWIDGETMOVEANIMATION_H
+#define MWIDGETMOVEANIMATION_H
+
+#include <QtGlobal>
+
+#include <mparallelanimationgroup.h>
+#include <mwidgetmoveanimationstyle.h>
+
+#include <QPointF>
+
+class MWidgetMoveAnimationPrivate;
+class MWidgetController;
+
+//! \internal
+
+class MWidgetMoveAnimation : public MParallelAnimationGroup
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(MWidgetMoveAnimation)
+ M_ANIMATION_GROUP(MWidgetMoveAnimationStyle)
+
+public:
+ MWidgetMoveAnimation(QObject *parent = NULL);
+ void setWidget(MWidgetController *widget);
+ void setFinalPos(const QPointF &pos);
+
+protected:
+ MWidgetMoveAnimation(MWidgetMoveAnimationPrivate *dd, QObject *parent = NULL);
+ virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
+};
+
+//! \internal_end
+
+#endif
diff --git a/src/corelib/animation/widget/mwidgetmoveanimation_p.h b/src/corelib/animation/widget/mwidgetmoveanimation_p.h
new file mode 100644
index 00000000..f0b86e86
--- /dev/null
+++ b/src/corelib/animation/widget/mwidgetmoveanimation_p.h
@@ -0,0 +1,44 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef MWIDGETMOVEANIMATION_P_H
+#define MWIDGETMOVEANIMATION_P_H
+
+#include "mwidgetmoveanimation.h"
+#include "mparallelanimationgroup_p.h"
+#include <QPointer>
+
+class MWidgetController;
+class QPauseAnimation;
+class QPropertyAnimation;
+
+class MWidgetMoveAnimationPrivate : public MParallelAnimationGroupPrivate
+{
+ Q_DECLARE_PUBLIC(MWidgetMoveAnimation)
+public:
+ virtual void init();
+
+ QPointer<MWidgetController> widget;
+
+ QPointF finalPos;
+ QPauseAnimation *delay;
+ QPropertyAnimation *positionAnimation;
+};
+
+#endif
diff --git a/src/corelib/animation/widget/widget.pri b/src/corelib/animation/widget/widget.pri
index faa98d24..f8ceee0e 100644
--- a/src/corelib/animation/widget/widget.pri
+++ b/src/corelib/animation/widget/widget.pri
@@ -9,16 +9,19 @@ ANIMATIONS_WIDGET_SRC_DIR=./animation/widget
PUBLIC_HEADERS += \
$$ANIMATIONS_WIDGET_SRC_DIR/mwidgetfadeanimation.h \
+ $$ANIMATIONS_WIDGET_SRC_DIR/mwidgetmoveanimation.h \
$$ANIMATIONS_WIDGET_SRC_DIR/mwidgetslideanimation.h \
$$ANIMATIONS_WIDGET_SRC_DIR/mwidgetzoomanimation.h \
PRIVATE_HEADERS += \
$$ANIMATIONS_WIDGET_SRC_DIR/mwidgetfadeanimation_p.h \
+ $$ANIMATIONS_WIDGET_SRC_DIR/mwidgetmoveanimation_p.h \
$$ANIMATIONS_WIDGET_SRC_DIR/mwidgetslideanimation_p.h \
$$ANIMATIONS_WIDGET_SRC_DIR/mwidgetzoomanimation_p.h \
SOURCES += \
$$ANIMATIONS_WIDGET_SRC_DIR/mwidgetfadeanimation.cpp \
+ $$ANIMATIONS_WIDGET_SRC_DIR/mwidgetmoveanimation.cpp \
$$ANIMATIONS_WIDGET_SRC_DIR/mwidgetslideanimation.cpp \
$$ANIMATIONS_WIDGET_SRC_DIR/mwidgetzoomanimation.cpp \
diff --git a/src/corelib/core/mapplicationifproxy.cpp b/src/corelib/core/mapplicationifproxy.cpp
index 0b701cb9..f0852952 100644
--- a/src/corelib/core/mapplicationifproxy.cpp
+++ b/src/corelib/core/mapplicationifproxy.cpp
@@ -37,17 +37,27 @@ QDBusPendingReply<> MApplicationIfProxy::close()
QDBusPendingReply<> MApplicationIfProxy::exit()
{
- return asyncCall(QLatin1String("exit"));
+ // here we only do the dbus call, when the interface is valid,
+ // i.e. there is a program listening "on the other side" of the
+ // dbus connection.
+ if ( isValid() )
+ {
+ return asyncCall(QLatin1String("exit"));
+ }
+ else
+ {
+ return QDBusPendingReply<>();
+ }
}
QDBusPendingReply<> MApplicationIfProxy::launch()
{
- return asyncCallWithArgumentList(QLatin1String("launch"), QList<QVariant>());
+ return callWithArgumentList(QDBus::BlockWithGui, QLatin1String("launch"), QList<QVariant>());
}
QDBusPendingReply<> MApplicationIfProxy::launch(const QStringList &parameters)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(parameters);
- return asyncCallWithArgumentList(QLatin1String("launch"), argumentList);
+ return callWithArgumentList(QDBus::BlockWithGui, QLatin1String("launch"), argumentList);
}
diff --git a/src/corelib/core/mcomponentcache.cpp b/src/corelib/core/mcomponentcache.cpp
index b890ff26..3175ae62 100644
--- a/src/corelib/core/mcomponentcache.cpp
+++ b/src/corelib/core/mcomponentcache.cpp
@@ -52,6 +52,11 @@ MComponentCachePrivate::~MComponentCachePrivate()
delete glWidgetOfOtherWindow;
if (mApplicationWindowInstance != 0)
delete mApplicationWindowInstance;
+
+ while (!shareWidgetsCache.isEmpty()) {
+ FormatWidgetPair pair = shareWidgetsCache.takeFirst();
+ delete pair.second;
+ }
}
bool MComponentCachePrivate::populating()
@@ -81,13 +86,33 @@ void MComponentCachePrivate::populateForMApplication()
cacheBeingPopulated = false;
}
-QGLWidget* MComponentCachePrivate::createNewGlWidget()
+QGLWidget* MComponentCachePrivate::createNewGlWidget(const QGLFormat* format)
{
QGLFormat fmt;
- // disable multisampling, is enabled by default in Qt
- fmt.setSampleBuffers(false);
- fmt.setSamples(0);
- return new QGLWidget(fmt);
+
+ if (!format) {
+ // disable multisampling, is enabled by default in Qt
+ fmt.setSampleBuffers(false);
+ fmt.setSamples(0);
+ }
+ else {
+ fmt = *format;
+ }
+
+ QGLWidget* shareWidget = NULL;
+ foreach(FormatWidgetPair pair, shareWidgetsCache) {
+ if (pair.first == fmt) {
+ shareWidget = pair.second;
+ break;
+ }
+ }
+
+ if (!shareWidget) {
+ shareWidget = new QGLWidget(fmt);
+ shareWidgetsCache.append(qMakePair(fmt, shareWidget));
+ }
+
+ return new QGLWidget(fmt, NULL, shareWidget);
}
MApplication* MComponentCachePrivate::mApplication(int &argc, char **argv, const QString &appIdentifier, MApplicationService *service)
@@ -199,17 +224,21 @@ MApplicationWindow* MComponentCachePrivate::mApplicationWindow()
return returnValue;
}
-QGLWidget* MComponentCachePrivate::glWidget()
+QGLWidget* MComponentCachePrivate::glWidget(const QGLFormat* format)
{
QGLWidget *returnValue;
- if (cacheBeingPopulated && glWidgetOfmApplicationWindowInstance != 0) {
+ if (cacheBeingPopulated && glWidgetOfmApplicationWindowInstance != 0
+ && (!format || glWidgetOfmApplicationWindowInstance->format() == *format))
+ {
returnValue = glWidgetOfmApplicationWindowInstance;
glWidgetOfmApplicationWindowInstance = 0;
- } else if (glWidgetOfOtherWindow != 0) {
+ } else if (glWidgetOfOtherWindow != 0
+ && (!format || glWidgetOfOtherWindow->format() == *format))
+ {
returnValue = glWidgetOfOtherWindow;
glWidgetOfOtherWindow = 0;
} else {
- returnValue = createNewGlWidget();
+ returnValue = createNewGlWidget(format);
}
return returnValue;
}
@@ -242,3 +271,8 @@ QGLWidget* MComponentCache::glWidget()
{
return d_ptr->glWidget();
}
+
+QGLWidget* MComponentCache::glWidget(const QGLFormat& format)
+{
+ return d_ptr->glWidget(&format);
+}
diff --git a/src/corelib/core/mcomponentcache.h b/src/corelib/core/mcomponentcache.h
index cd1251fe..8eb52b79 100644
--- a/src/corelib/core/mcomponentcache.h
+++ b/src/corelib/core/mcomponentcache.h
@@ -28,6 +28,7 @@ class MApplication;
class MApplicationWindow;
class MApplicationService;
class QGLWidget;
+class QGLFormat;
class MComponentCachePrivate;
/*!
@@ -94,8 +95,9 @@ private:
/* QGLWidget object returned by glWidget is owned by the caller */
static QGLWidget* glWidget();
+ static QGLWidget* glWidget(const QGLFormat& format);
friend class MApplicationWindow;
- friend class MWindow;
+ friend class MWindowPrivate;
#ifdef UNIT_TEST
friend class Ut_MComponentCache;
diff --git a/src/corelib/core/mcomponentcache_p.h b/src/corelib/core/mcomponentcache_p.h
index 533a34ce..8143d4ea 100644
--- a/src/corelib/core/mcomponentcache_p.h
+++ b/src/corelib/core/mcomponentcache_p.h
@@ -20,6 +20,9 @@
#ifndef MCOMPONENTCACHE_P_H
#define MCOMPONENTCACHE_P_H
+#include <QList>
+#include <QPair>
+
class MComponentCache;
class MApplication;
class MApplicationWindow;
@@ -34,12 +37,12 @@ public:
bool populating();
MApplication* mApplication(int &argc, char **argv, const QString &appIdentifier, MApplicationService *service);
MApplicationWindow* mApplicationWindow();
- QGLWidget* glWidget();
+ QGLWidget* glWidget(const QGLFormat* format = NULL);
bool canUseCachedApp(int &argc, char **argv, const QString &appIdentifier);
bool hasExtraParams(int &argc, char **argv, const QString &appIdentifier);
- static QGLWidget* createNewGlWidget();
+ QGLWidget* createNewGlWidget(const QGLFormat* format = NULL);
private:
MApplication *mApplicationInstance;
@@ -48,6 +51,9 @@ private:
QGLWidget *glWidgetOfOtherWindow;
bool cacheBeingPopulated;
+ typedef QPair<QGLFormat,QGLWidget*> FormatWidgetPair;
+ QList<FormatWidgetPair> shareWidgetsCache;
+
#ifdef UNIT_TEST
friend class Ut_MComponentCache;
#endif
diff --git a/src/corelib/core/mcomponentdata.cpp b/src/corelib/core/mcomponentdata.cpp
index fc2ff54f..0fedece7 100644
--- a/src/corelib/core/mcomponentdata.cpp
+++ b/src/corelib/core/mcomponentdata.cpp
@@ -504,6 +504,9 @@ void MComponentDataPrivate::init(int &argc, char **argv, const QString &appIdent
if (catalog.isEmpty())
catalog = fileInfo.fileName();
+ // set the path for the icu extra data:
+ MLocale::setDataPath(M_ICUEXTRADATA_DIR);
+
MLocale systemLocale; // gets the current system locale, creating it if necessary.
#ifdef Q_OS_WIN
// walk to translation dir relative to bin dir
diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro
index f73b5f82..bba023d6 100644
--- a/src/corelib/corelib.pro
+++ b/src/corelib/corelib.pro
@@ -23,12 +23,6 @@ contains(DEFINES, HAVE_DBUS) {
include(notification/notification.pri)
}
-contains(DEFINES, HAVE_ICU) {
- include(icu-extradata/extradata.pri)
- EXTRADATA_SOURCE=icu-extradata/extradata.txt
-}
-
-
# install .prf files
system(test -w $$[QT_INSTALL_DATA]) {
install_prf.path = $$[QT_INSTALL_DATA]/mkspecs/features
diff --git a/src/corelib/events/morientationtracker.cpp b/src/corelib/events/morientationtracker.cpp
index ff32f890..d80485ab 100644
--- a/src/corelib/events/morientationtracker.cpp
+++ b/src/corelib/events/morientationtracker.cpp
@@ -77,10 +77,12 @@ void MOrientationTrackerPrivate::topEdgeChanged()
angle = M::Angle270;
orientation = M::Portrait;
} else if (edge == "right") {
- angle = M::Angle90;
+ //angle = M::Angle90; Disabled for now
+ angle = M::Angle270;
orientation = M::Portrait;
} else if (edge == "bottom") {
- angle = M::Angle180;
+ //angle = M::Angle180; Disabled for now
+ angle = M::Angle0;
} else {
angle = M::Angle0;
}
diff --git a/src/corelib/events/mpanrecognizer.cpp b/src/corelib/events/mpanrecognizer.cpp
index 60c3e132..3e711d69 100644
--- a/src/corelib/events/mpanrecognizer.cpp
+++ b/src/corelib/events/mpanrecognizer.cpp
@@ -98,20 +98,9 @@ QGestureRecognizer::Result MPanRecognizer::recognize( QGesture* gesture,
if (panGesture->state() == Qt::NoGesture) {
- if (distX > d->movementThreshold) {
- if (panGesture->panDirection.testFlag(Qt::Vertical)) {
- result = QGestureRecognizer::CancelGesture;
- } else {
- panGesture->panDirection = Qt::Horizontal;
- result = QGestureRecognizer::TriggerGesture;
- }
- } else if (distY > d->movementThreshold) {
- if (panGesture->panDirection.testFlag(Qt::Horizontal)) {
- result = QGestureRecognizer::CancelGesture;
- } else {
- panGesture->panDirection = Qt::Vertical;
- result = QGestureRecognizer::TriggerGesture;
- }
+ if (distX > d->movementThreshold || distY > d->movementThreshold) {
+ panGesture->panDirection = (distX > distY ? Qt::Horizontal : Qt::Vertical);
+ result = QGestureRecognizer::TriggerGesture;
} else {
result = QGestureRecognizer::MayBeGesture;
}
diff --git a/src/corelib/i18n/mlocale.cpp b/src/corelib/i18n/mlocale.cpp
index af8d4afd..570c7fe8 100644
--- a/src/corelib/i18n/mlocale.cpp
+++ b/src/corelib/i18n/mlocale.cpp
@@ -52,7 +52,6 @@
namespace
{
const char *const BackupNameFormatString = "%d%t%g%t%m%t%f";
- const char *const ExtraDataBundleName = "extradata";
const QString RtlLanguages("am:ar:fa:he:ps:ur:");
const char *const Languages = "Languages";
const char *const Countries = "Countries";
@@ -244,7 +243,7 @@ bool MTranslationCatalog::loadWith(MLocale *mlocale, MLocale::Category category)
// Loading the new file into the QTranslator failed.
// Clear any old contents of the QTranslator before returning false.
// This is necessary because the QTranslator may still have old contents.
- // For example, assume that we an Arabic translation "foo_ar.qm" has been loaded
+ // For example, assume that an Arabic translation "foo_ar.qm" has been loaded
// into the translator before and now this loadWith() function tries to
// load "foo_de.qm" because the language has been switched to German
// but "foo_de.qm" does not exist. We do *not* want to keep the previous
@@ -347,6 +346,7 @@ MLocalePrivate::MLocalePrivate()
#endif
, q_ptr(0)
{
+ loadCountryCodes();
}
// copy constructor
@@ -359,6 +359,7 @@ MLocalePrivate::MLocalePrivate(const MLocalePrivate &other)
_calendarLocale(other._calendarLocale),
_monetaryLocale(other._monetaryLocale),
_nameLocale(other._nameLocale),
+ _validCountryCodes( other._validCountryCodes ),
_calendarType(other._calendarType),
_collation(other._collation),
#ifdef HAVE_ICU
@@ -407,6 +408,7 @@ MLocalePrivate &MLocalePrivate::operator=(const MLocalePrivate &other)
_messageTranslations = other._messageTranslations;
_timeTranslations = other._timeTranslations;
_trTranslations = other._trTranslations;
+ _validCountryCodes = other._validCountryCodes;
#ifdef HAVE_ICU
delete _numberFormat;
@@ -422,6 +424,243 @@ MLocalePrivate &MLocalePrivate::operator=(const MLocalePrivate &other)
return *this;
}
+void MLocalePrivate::loadCountryCodes()
+{
+ _validCountryCodes.clear();
+
+
+ _validCountryCodes
+ << "1"
+ << "20"
+ << "212"
+ << "213"
+ << "214"
+ << "215"
+ << "216"
+ << "218"
+ << "219"
+ << "220"
+ << "221"
+ << "222"
+ << "223"
+ << "224"
+ << "225"
+ << "226"
+ << "227"
+ << "228"
+ << "229"
+ << "230"
+ << "231"
+ << "232"
+ << "233"
+ << "234"
+ << "235"
+ << "236"
+ << "237"
+ << "238"
+ << "239"
+ << "240"
+ << "241"
+ << "242"
+ << "243"
+ << "244"
+ << "245"
+ << "246"
+ << "247"
+ << "248"
+ << "249"
+ << "250"
+ << "251"
+ << "252"
+ << "253"
+ << "254"
+ << "255"
+ << "256"
+ << "257"
+ << "258"
+ << "259"
+ << "260"
+ << "261"
+ << "262"
+ << "263"
+ << "264"
+ << "265"
+ << "266"
+ << "267"
+ << "268"
+ << "269"
+ << "27"
+ << "290"
+ << "291"
+ << "297"
+ << "298"
+ << "299"
+ << "30"
+ << "31"
+ << "32"
+ << "33"
+ << "34"
+ << "350"
+ << "351"
+ << "352"
+ << "353"
+ << "354"
+ << "355"
+ << "356"
+ << "357"
+ << "358"
+ << "359"
+ << "36"
+ << "370"
+ << "371"
+ << "372"
+ << "373"
+ << "374"
+ << "375"
+ << "376"
+ << "377"
+ << "378"
+ << "379"
+ << "380"
+ << "381"
+ << "382"
+ << "385"
+ << "386"
+ << "387"
+ << "388"
+ << "389"
+ << "39"
+ << "40"
+ << "41"
+ << "420"
+ << "421"
+ << "423"
+ << "43"
+ << "44"
+ << "45"
+ << "46"
+ << "47"
+ << "48"
+ << "49"
+ << "500"
+ << "501"
+ << "502"
+ << "503"
+ << "504"
+ << "505"
+ << "506"
+ << "507"
+ << "508"
+ << "509"
+ << "51"
+ << "52"
+ << "53"
+ << "54"
+ << "55"
+ << "56"
+ << "57"
+ << "58"
+ << "590"
+ << "591"
+ << "592"
+ << "593"
+ << "594"
+ << "595"
+ << "596"
+ << "597"
+ << "598"
+ << "599"
+ << "60"
+ << "61"
+ << "62"
+ << "63"
+ << "64"
+ << "65"
+ << "66"
+ << "670"
+ << "672"
+ << "673"
+ << "674"
+ << "675"
+ << "676"
+ << "677"
+ << "678"
+ << "679"
+ << "680"
+ << "681"
+ << "682"
+ << "683"
+ << "685"
+ << "686"
+ << "687"
+ << "688"
+ << "689"
+ << "690"
+ << "691"
+ << "692"
+ << "7"
+ << "800"
+ << "808"
+ << "81"
+ << "82"
+ << "84"
+ << "850"
+ << "852"
+ << "853"
+ << "855"
+ << "856"
+ << "86"
+ << "870"
+ << "871"
+ << "872"
+ << "873"
+ << "874"
+ << "878"
+ << "880"
+ << "881"
+ << "882"
+ << "883"
+ << "886"
+ << "888"
+ << "90"
+ << "91"
+ << "92"
+ << "93"
+ << "94"
+ << "95"
+ << "960"
+ << "961"
+ << "962"
+ << "963"
+ << "964"
+ << "965"
+ << "966"
+ << "967"
+ << "968"
+ << "970"
+ << "971"
+ << "972"
+ << "973"
+ << "974"
+ << "975"
+ << "976"
+ << "977"
+ << "979"
+ << "98"
+ << "991"
+ << "992"
+ << "993"
+ << "994"
+ << "995"
+ << "996"
+ << "998";
+}
+
+bool MLocalePrivate::isValidCountryCode( const QString& code ) const
+{
+ return _validCountryCodes.contains( code );
+}
+
#ifdef HAVE_ICU
// creates icu::Locale presenting a category
Locale MLocalePrivate::getCategoryLocale(MLocale::Category category) const
@@ -878,11 +1117,23 @@ void MLocale::setDefault(const MLocale &locale)
// (locale.d_ptr)->currentLanguageItem.set(newLanguage);
//#endif
+ // sends QEvent::LanguageChange to qApp:
+ (s_systemDefault->d_ptr)->insertTrToQCoreApp();
// Setting the default QLocale is needed to get localized number
// support in translations via %Ln, %L1, %L2, ...:
QLocale::setDefault((s_systemDefault->d_ptr)->createQLocale(MLcNumeric));
- // sends QEvent::LanguageChange to qApp:
- (s_systemDefault->d_ptr)->insertTrToQCoreApp();
+ // The event queue needs to be flushed here because
+ // QCoreApplication::removeTranslator() and
+ // QCoreApplication::installTranslator() which are called by
+ // removeTrFromQCoreApp() and insertTrToQCoreApp()
+ // send several QEvent::LanguageChange events which are handled
+ // by the QApplication event handler and may set the
+ // layout direction incorrectly there (see qapplication.cpp in
+ // the Qt source code). We need to make sure these events
+ // are handled *before* we finally set the correct layout direction
+ // below.
+ // (see also bug 169305)
+ QCoreApplication::sendPostedEvents();
// sends QEvent::ApplicationLayoutDirectionChange to qApp:
qApp->setLayoutDirection(s_systemDefault->textDirection());
@@ -1611,34 +1862,15 @@ QString MLocale::icuFormatString( DateType dateType,
TimeType timeType,
CalendarType calendarType) const
{
-
- // Create calLocale which has the time pattern we want to use
- icu::Locale calLocale = MIcuConversions::createLocale(
- categoryName(MLocale::MLcTime),
- calendarType);
-
- icu::DateFormat::EStyle dateStyle = MIcuConversions::toEStyle(dateType);
- icu::DateFormat::EStyle timeStyle = MIcuConversions::toEStyle(timeType);
- icu::DateFormat *df
- = icu::DateFormat::createDateTimeInstance(dateStyle, timeStyle, calLocale);
-
- // Both the locale and the calendarType seem to
- // be ignored here anyway. I.e. the following two statements can be replaced with
- // DateFormatSymbols *dfs = MLocalePrivate::createDateFormatSymbols(icu::Locale(""));
- // without a change in behaviour:
- icu::Locale symbolLocale
- = MIcuConversions::createLocale(categoryName(MLocale::MLcMessages),
- calendarType);
- DateFormatSymbols *dfs = MLocalePrivate::createDateFormatSymbols(symbolLocale);
+ Q_D(const MLocale);
+ MCalendar mcalendar(calendarType);
+ icu::DateFormat *df = d->createDateFormat(dateType, timeType, mcalendar);
QString icuFormatQString;
if (df)
{
icu::UnicodeString icuFormatString;
- // This is not nice but seems to be the only way to set the
- // symbols with the public API
- static_cast<SimpleDateFormat *>(df)->adoptDateFormatSymbols(dfs);
static_cast<SimpleDateFormat *>(df)->toPattern(icuFormatString);
icuFormatQString = MIcuConversions::unicodeStringToQString(icuFormatString);
delete df;
@@ -1683,28 +1915,7 @@ QDateTime MLocale::parseDateTime(const QString &dateTime, CalendarType calendarT
#ifdef HAVE_ICU
QString MLocale::monthName(const MCalendar &mCalendar, int monthNumber) const
{
- Q_D(const MLocale);
- monthNumber--; // months in array starting from index zero
-
- // use message locale as the output language
- icu::Locale symbolLocale
- = MIcuConversions::createLocale(d->categoryName(MLcMessages),
- mCalendar.type());
-
- icu::DateFormatSymbols *dfs = MLocalePrivate::createDateFormatSymbols(symbolLocale);
-
- int len;
- const UnicodeString *months = dfs->getMonths(len);
-
- QString result;
-
- if (monthNumber < len && monthNumber >= 0) {
- result = MIcuConversions::unicodeStringToQString(months[monthNumber]);
- }
-
- delete dfs;
-
- return result;
+ return monthName(mCalendar, monthNumber, MLocale::DateSymbolStandalone, MLocale::DateSymbolWide);
}
#endif
@@ -1731,12 +1942,12 @@ QString MLocale::monthName(const MCalendar &mCalendar, int monthNumber,
icu::DateFormatSymbols::DtWidthType icuWidth =
MIcuConversions::mDateWidthToIcu(symbolLength);
- int len;
+ int len = -1;
const UnicodeString *months = dfs->getMonths(len, icuContext, icuWidth);
QString result;
- if (monthNumber < len && monthNumber >= 0) {
+ if (len > 0 && monthNumber < len && monthNumber >= 0) {
result = MIcuConversions::unicodeStringToQString(months[monthNumber]);
}
@@ -1749,27 +1960,7 @@ QString MLocale::monthName(const MCalendar &mCalendar, int monthNumber,
#ifdef HAVE_ICU
QString MLocale::weekdayName(const MCalendar &mCalendar, int weekday) const
{
- Q_D(const MLocale);
- // use message locale as the output language
- icu::Locale symbolLocale
- = MIcuConversions::createLocale(d->categoryName(MLcMessages),
- mCalendar.type());
-
- icu::DateFormatSymbols *dfs = MLocalePrivate::createDateFormatSymbols(symbolLocale);
-
- int len;
- const UnicodeString *weekdayNames = dfs->getWeekdays(len);
- int weekdayNum = MIcuConversions::icuWeekday(weekday);
-
- QString result;
-
- if (weekdayNum < len && weekdayNum > 0) {
- result = MIcuConversions::unicodeStringToQString(weekdayNames[weekdayNum]);
- }
-
- delete dfs;
-
- return result;
+ return weekdayName(mCalendar, weekday, MLocale::DateSymbolStandalone, MLocale::DateSymbolWide);
}
#endif
@@ -1791,13 +1982,13 @@ QString MLocale::weekdayName(const MCalendar &mCalendar, int weekday,
icu::DateFormatSymbols::DtWidthType icuWidth
= MIcuConversions::mDateWidthToIcu(symbolLength);
- int len;
+ int len = -1;
const UnicodeString *weekdayNames = dfs->getWeekdays(len, icuContext, icuWidth);
int weekdayNum = MIcuConversions::icuWeekday(weekday);
QString result;
- if (weekdayNum < len && weekdayNum > 0) {
+ if (len > 0 && weekdayNum < len && weekdayNum > 0) {
result = MIcuConversions::unicodeStringToQString(weekdayNames[weekdayNum]);
}
@@ -1808,39 +1999,6 @@ QString MLocale::weekdayName(const MCalendar &mCalendar, int weekday,
#endif
#ifdef HAVE_ICU
-namespace
-{
-// fetches a resource bundle for name formats
- UResourceBundle *nameFmtsResourceBundle()
- {
- UErrorCode status = U_ZERO_ERROR;
-
- UResourceBundle *extraData = ures_openDirect(ExtraDataBundleName, "", &status);
-
- if (U_FAILURE(status)) {
- mDebug("mlocale.cpp") << "Error ures_open" << u_errorName(status);
- }
-
- UResourceBundle *posixData = ures_getByKey(extraData, "posixdata", NULL, &status);
-
- if (U_FAILURE(status)) {
- mDebug("mlocale.cpp") << "Error ures_open posixData" << u_errorName(status);
- }
-
- UResourceBundle *nameFmts = ures_getByKey(posixData, "nameFmts", NULL, &status);
- if (U_FAILURE(status)) {
- mDebug("mlocale.cpp") << "Error ures_open nameFmts" << u_errorName(status);
- }
-
- ures_close(extraData);
- ures_close(posixData);
-
- return nameFmts;
- }
-}
-#endif
-
-#ifdef HAVE_ICU
QString MLocale::languageEndonym() const
{
Q_D(const MLocale);
@@ -1849,7 +2007,7 @@ QString MLocale::languageEndonym() const
// TODO: implement a workaround for
// http://site.icu-project.org/design/resbund/issues
#if (U_ICU_VERSION_MAJOR_NUM > 4) || (U_ICU_VERSION_MAJOR_NUM == 4 && U_ICU_VERSION_MINOR_NUM >=4)
- UResourceBundle *res = ures_open("ICUDATA-lang", qPrintable(d->_defaultLocale), &status);
+ UResourceBundle *res = ures_open(U_ICUDATA_NAME "-lang", qPrintable(d->_defaultLocale), &status);
#else
UResourceBundle *res = ures_open(NULL, qPrintable(d->_defaultLocale), &status);
#endif
@@ -1887,7 +2045,7 @@ QString MLocale::countryEndonym() const
// TODO: implement a workaround for
// http://site.icu-project.org/design/resbund/issues
#if (U_ICU_VERSION_MAJOR_NUM > 4) || (U_ICU_VERSION_MAJOR_NUM == 4 && U_ICU_VERSION_MINOR_NUM >=4)
- UResourceBundle *res = ures_open("ICUDATA-region", qPrintable(d->_defaultLocale), &status);
+ UResourceBundle *res = ures_open(U_ICUDATA_NAME "-region", qPrintable(d->_defaultLocale), &status);
#else
UResourceBundle *res = ures_open(NULL, qPrintable(d->_defaultLocale), &status);
#endif
@@ -2117,13 +2275,25 @@ void MLocale::refreshSettings()
if (settingsHaveReallyChanged) {
if (this == s_systemDefault) {
- // Setting the default QLocale is needed to get localized number
- // support in translations via %Ln, %L1, %L2, ...:
- QLocale::setDefault(d->createQLocale(MLcNumeric));
d->removeTrFromQCoreApp();
d->loadTrCatalogs();
// sends QEvent::LanguageChange to qApp:
d->insertTrToQCoreApp();
+ // Setting the default QLocale is needed to get localized number
+ // support in translations via %Ln, %L1, %L2, ...:
+ QLocale::setDefault(d->createQLocale(MLcNumeric));
+ // The event queue needs to be flushed here because
+ // QCoreApplication::removeTranslator() and
+ // QCoreApplication::installTranslator() which are called by
+ // removeTrFromQCoreApp() and insertTrToQCoreApp()
+ // send several QEvent::LanguageChange events which are handled
+ // by the QApplication event handler and may set the
+ // layout direction incorrectly there (see qapplication.cpp in
+ // the Qt source code). We need to make sure these events
+ // are handled *before* we finally set the correct layout direction
+ // below.
+ // (see also bug 169305)
+ QCoreApplication::sendPostedEvents();
// sends QEvent::ApplicationLayoutDirectionChange to qApp:
qApp->setLayoutDirection(this->textDirection());
}
@@ -2135,3 +2305,290 @@ void MLocale::refreshSettings()
#endif
}
+QString MLocale::formatPhoneNumber( const QString& phoneNumber,
+ PhoneNumberGrouping grouping ) const
+{
+ Q_D(const MLocale);
+ return d->formatPhoneNumber( phoneNumber, grouping );
+}
+
+// when string starts with numbers 2 to 9
+QString groupedNormalString( const QString& phoneNumber )
+{
+ QString result;
+ QString remaining( phoneNumber );
+
+ // for remaining number length 1 (also 0) to 3 return number unchanged
+ if ( remaining.length() < 4 )
+ {
+ result.append( remaining );
+ return result;
+ }
+ else if ( remaining.length() < 8 )
+ {
+ result.append( remaining.left( 3 ) );
+ remaining.remove( 0, 3 );
+ result.append( '-' );
+ result.append( remaining );
+ return result;
+ }
+ else if ( remaining.length() < 11 )
+ {
+ result.append( '(' );
+ result.append( remaining.left( 3 ) );
+ remaining.remove( 0, 3 );
+ result.append( ") " );
+ result.append( remaining.left( 3 ) );
+ remaining.remove( 0, 3 );
+ result.append( '-' );
+ result.append( remaining );
+ return result;
+ }
+ else
+ {
+ result.append( remaining );
+ return result;
+ }
+}
+
+// when string starts with number 1
+QString groupedOneString( const QString& phoneNumber )
+{
+ QString result;
+ QString remaining( phoneNumber );
+
+ // for remaining number length 1 (also 0) to 3 return number unchanged
+ if ( remaining.length() < 2 )
+ {
+ result.append( remaining );
+ return result;
+ }
+ else if ( remaining.length() < 3 )
+ {
+ result.append( remaining.left( 1 ) );
+ remaining.remove( 0, 1 );
+ result.append( " (" );
+ result.append( remaining );
+ result.append( " )" );
+ return result;
+ }
+ else if ( remaining.length() < 4 )
+ {
+ result.append( remaining.left( 1 ) );
+ remaining.remove( 0, 1 );
+ result.append( " (" );
+ result.append( remaining );
+ result.append( " )" );
+ return result;
+ }
+ else if ( remaining.length() < 5 )
+ {
+ result.append( remaining.left( 1 ) );
+ remaining.remove( 0, 1 );
+ result.append( " (" );
+ result.append( remaining );
+ result.append( ')' );
+ return result;
+ }
+ else if ( remaining.length() < 8 )
+ {
+ result.append( remaining.left( 1 ) );
+ remaining.remove( 0, 1 );
+ result.append( " (" );
+ result.append( remaining.left( 3 ) );
+ remaining.remove( 0, 3 );
+ result.append( ") " );
+ result.append( remaining );
+ return result;
+ }
+ else if ( remaining.length() < 12 )
+ {
+ result.append( remaining.left( 1 ) );
+ remaining.remove( 0, 1 );
+ result.append( " (" );
+ result.append( remaining.left( 3 ) );
+ remaining.remove( 0, 3 );
+ result.append( ") " );
+ result.append( remaining.left( 3 ) );
+ remaining.remove( 0, 3 );
+ result.append( '-' );
+ result.append( remaining );
+ return result;
+ }
+ else
+ {
+ result.append( remaining );
+ return result;
+ }
+}
+
+// when string starts with numbers 2 to 9
+QString groupedInternationalString( const QString& phoneNumber )
+{
+ QString result;
+ QString remaining( phoneNumber );
+
+ // for remaining number length 1 (also 0) to 3 return number unchanged
+ if ( remaining.length() < 4 )
+ {
+ result.append( '(' );
+ result.append( remaining );
+ result.append( ')' );
+ return result;
+ }
+ else if ( remaining.length() < 7 )
+ {
+ result.append( '(' );
+ result.append( remaining.left( 3 ) );
+ remaining.remove( 0, 3 );
+ result.append( ") " );
+ result.append( remaining );
+ return result;
+ }
+ else if ( remaining.length() < 11 )
+ {
+ result.append( '(' );
+ result.append( remaining.left( 3 ) );
+ remaining.remove( 0, 3 );
+ result.append( ") " );
+ result.append( remaining.left( 3 ) );
+ remaining.remove( 0, 3 );
+ result.append( '-' );
+ result.append( remaining );
+ return result;
+ }
+ else
+ {
+ result.append( remaining );
+ return result;
+ }
+}
+
+QString MLocalePrivate::formatPhoneNumber( const QString& phoneNumber,
+ MLocale::PhoneNumberGrouping grouping ) const
+{
+ // first do sanity check of the input string
+ QRegExp rx( "\\+?\\d*" );
+ if ( ! rx.exactMatch( phoneNumber ) )
+ {
+ qWarning( "MLocale::formatPhoneNumber: cannot understand number: %s",
+ qPrintable( phoneNumber ) );
+ return phoneNumber;
+ }
+
+ // 00 is not a valid country calling code in north america
+ // -> do not do grouping in this case at all
+ if ( ( grouping == MLocale::NorthAmericanGrouping )
+ && phoneNumber.startsWith( "00" ) )
+ {
+ return phoneNumber;
+ }
+
+ QString remaining( phoneNumber );
+ QString result;
+
+ // if we find any error, we will return the string unchanged
+ // bool error = false;
+
+ // first extract the country code
+
+ bool foundCountryCodeIndicator = false;
+
+ // valid beginnings for a country code are "+", "00" or "011"
+ if ( remaining.startsWith( '+' ) )
+ {
+ foundCountryCodeIndicator = true;
+ result.append( '+' );
+ remaining.remove( 0, 1 );
+ }
+ else if ( remaining.startsWith( "00" ) )
+ {
+ foundCountryCodeIndicator = true;
+ result.append( "00 " );
+ remaining.remove( 0, 2 );
+ }
+ else if ( remaining.startsWith( "011" ) )
+ {
+ foundCountryCodeIndicator = true;
+ result.append( "011 " );
+ remaining.remove( 0, 3 );
+ }
+
+
+ // now check for valid country code
+ if ( foundCountryCodeIndicator )
+ {
+ int length = 1;
+ QString code;
+
+ code = remaining.left( length );
+
+ if ( isValidCountryCode( code ) )
+ {
+ result.append( code );
+ result.append( ' ' );
+ remaining.remove( 0, code.length() );
+ }
+ else
+ {
+ length = 2;
+ code = remaining.left( length );
+ if ( isValidCountryCode( code ) )
+ {
+ result.append( code );
+ result.append( ' ' );
+ remaining.remove( 0, code.length() );
+ }
+ else
+ {
+ length = 3;
+ code = remaining.left( length );
+ if ( isValidCountryCode( code ) )
+ {
+ result.append( code );
+ result.append( ' ' );
+ remaining.remove( 0, code.length() );
+ }
+ else
+ {
+ // no valid country code -> error -> return string
+ return phoneNumber;
+ }
+ }
+ }
+ } // found country code indicator
+
+ // if it exists, the country code is split off now
+ if ( grouping != MLocale::NorthAmericanGrouping )
+ {
+ result.append( remaining );
+ return result;
+ }
+ else
+ {
+ // has country code -> do not handle one special.
+ if ( foundCountryCodeIndicator )
+ {
+ result.append( groupedInternationalString( remaining ) );
+ return result;
+ }
+ // 11 is an invalid code, so disable grouping for this case
+ else if ( remaining.startsWith( "11" ) )
+ {
+ result.append( remaining );
+ return result;
+ }
+ else if ( remaining.startsWith( '1' ) )
+ {
+ result.append( groupedOneString( remaining ) );
+ return result;
+ }
+ else
+ {
+ result.append( groupedNormalString( remaining ) );
+ return result;
+ }
+ }
+
+ return phoneNumber;
+}
diff --git a/src/corelib/i18n/mlocale.h b/src/corelib/i18n/mlocale.h
index 2c1dd115..12b7aad8 100644
--- a/src/corelib/i18n/mlocale.h
+++ b/src/corelib/i18n/mlocale.h
@@ -158,6 +158,22 @@ public:
enum DateSymbolLength {DateSymbolAbbreviated, DateSymbolWide, DateSymbolNarrow};
+ /*!
+ * \ brief Grouping formats for phone numbers
+ * The phone number grouping specifies, how phone numbers will
+ * be displayed to the user.
+ * NoGrouping means that the phone numbers are not grouped at all.
+ * NorthAmericanGrouping means that the phone numbers are grouped
+ * according to the "North American Numbering Plan"
+ * DefaultGrouping means that grouping is done according to the
+ * current system settings.
+ */
+ enum PhoneNumberGrouping {
+ DefaultGrouping,
+ NoGrouping,
+ NorthAmericanGrouping
+ };
+
static MLocale *createSystemMLocale();
static MLocale createCLocale();
@@ -622,6 +638,13 @@ public:
const QString &formatString) const;
/*!
+ * \brief Formats a phone number according to the given grouping
+ */
+ QString formatPhoneNumber( const QString& phoneNumber,
+ PhoneNumberGrouping grouping =
+ DefaultGrouping ) const;
+
+ /*!
* \brief returns ICU date and time format string of the current locale
* \param dateType style of date formatting
* \param timeType style of time formatting
@@ -840,15 +863,63 @@ public:
const char *comment = 0, int n = -1);
/*!
- * \brief Sets the DataPaths for locale system to given paths.
- * This should be called at most once before creating any MLocale instances
- * Data itself should be in the ICU specific subdirectory at the given paths, e.g.
- * somePath/icudt42l/
+ * \brief Sets the DataPaths for the (ICU) locale system to the given paths.
+ *
+ * \param dataPaths a list of paths
+ *
+ * This should be called at most once in a process before creating
+ * any MLocale instances. This function is not thread-safe.
+ * Use it before doing anything with MLocale instances from multiple
+ * threads.
+ *
+ * This function calls u_setDataDirectory() in libicu, see also
+ * <a href="http://icu-project.org/apiref/icu4c/putil_8h.html">
+ * http://icu-project.org/apiref/icu4c/putil_8h.html</a>.
+ *
+ * libmeegotouch initialises this data path to the value of the macro
+ *
+ * \code
+ * M_ICUEXTRADATA_DIR
+ * \endcode
+ *
+ * which is normally set to
+ *
+ * \code
+ * /usr/share/meegotouch/icu/
+ * \endcode
+ *
+ * usually one should not change this.
+ *
+ * The user data itself should be in the ICU specific
+ * subdirectories at the given paths, e.g. a user override file
+ * for some of the basic data of the Finnish locale should be
+ * in
+ *
+ * \code
+ * /usr/share/meegotouch/icu/usrdt42l/fi.res
+ * \endcode
+ *
+ * and a user override file for the lang data of the Finnish
+ * locale should be in
+ *
+ * \code
+ * /usr/share/meegotouch/icu/usrdt42l/lang/fi.res
+ * \endcode
+ *
+ * etc.
+ *
+ * \sa void setDataPath(const QString &dataPath)
*/
static void setDataPaths(const QStringList &dataPaths);
/*!
* \brief Sets the DatPaths to given path
+ *
+ * \param dataPath the data path
+ *
+ * convenience function to set the data path to a single directory
+ *
+ * \sa setDataPaths(const QStringList &dataPaths)
*/
static void setDataPath(const QString &dataPath);
diff --git a/src/corelib/i18n/mlocale_p.h b/src/corelib/i18n/mlocale_p.h
index e19249bb..290e5e30 100644
--- a/src/corelib/i18n/mlocale_p.h
+++ b/src/corelib/i18n/mlocale_p.h
@@ -20,6 +20,7 @@
#ifndef MLOCALE_P_H
#define MLOCALE_P_H
+#include <QSet>
#include <QList>
#include <QString>
#include <QStringList>
@@ -106,6 +107,13 @@ public:
static QString parseScript(const QString &localeString);
static QString parseVariant(const QString &localeString);
+ void loadCountryCodes();
+
+ QString formatPhoneNumber( const QString& phoneNumber,
+ MLocale::PhoneNumberGrouping grouping ) const;
+
+ bool isValidCountryCode( const QString& code ) const;
+
bool _valid;
// the default locale is used for messages and other categories if not
@@ -118,6 +126,9 @@ public:
QString _monetaryLocale;
QString _nameLocale;
+ // the list of valid country codes for the formatPhoneNumber function
+ QSet<QString> _validCountryCodes;
+
// the used calendar and collation may be overridden
MLocale::CalendarType _calendarType;
MLocale::Collation _collation;
diff --git a/src/corelib/icu-extradata/extradata.pri b/src/corelib/icu-extradata/extradata.pri
deleted file mode 100644
index 866a9eef..00000000
--- a/src/corelib/icu-extradata/extradata.pri
+++ /dev/null
@@ -1,12 +0,0 @@
-ICUBINDIR = $$system(icu-config --bindir)
-extradata.name = libextradata builder
-extradata.input = EXTRADATA_SOURCE
-extradata.output = $$DESTDIR/lib${QMAKE_FILE_BASE}.a
-extradata.commands += $$ICUBINDIR/genrb -d $$OBJECTS_DIR -s $$IN_PWD -e UTF-8 ${QMAKE_FILE_BASE}.txt;
-extradata.commands += $$ICUBINDIR/pkgdata --name ${QMAKE_FILE_BASE} --mode static -v -d $$DESTDIR -T $$OBJECTS_DIR -s $$OBJECTS_DIR $$IN_PWD/packagelist.txt
-
-
-extradata.clean += $$OBJECTS_DIR/*.mak $$OBJECTS_DIR/*.lst $$OBJECTS_DIR/*.ao $$OBJECTS_DIR/*.o $$OBJECTS_DIR/*.res $$OBJECTS_DIR/*.c $$DESTDIR/lib${QMAKE_FILE_BASE}.a $$DESTDIR/README_${QMAKE_FILE_BASE}.txt
-extradata.CONFIG = target_predeps
-
-QMAKE_EXTRA_COMPILERS += extradata
diff --git a/src/corelib/icu-extradata/extradata.txt b/src/corelib/icu-extradata/extradata.txt
deleted file mode 100644
index a7dad1a4..00000000
--- a/src/corelib/icu-extradata/extradata.txt
+++ /dev/null
@@ -1,1322 +0,0 @@
-root {
-posixdata {
- postalFmts {
- DJ {"%z%c%T%s%b%e%r"}
- ER {"%z%c%T%s%b%e%r"}
- ET {"%z%c%T%s%b%e%r"}
- ZA {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- ES {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- AE {"%z%c%T%s%b%e%r"}
- BH {"%z%c%T%s%b%e%r"}
- DZ {"%z%c%T%s%b%e%r"}
- EG {"%z%c%T%s%b%e%r"}
- IN {"%z%c%T%s%b%e%r"}
- IQ {"%z%c%T%s%b%e%r"}
- JO {"%z%c%T%s%b%e%r"}
- KW {"%z%c%T%s%b%e%r"}
- LB {"%z%c%T%s%b%e%r"}
- LY {"%z%c%T%s%b%e%r"}
- MA {"%z%c%T%s%b%e%r"}
- OM {"%z%c%T%s%b%e%r"}
- QA {"%z%c%T%s%b%e%r"}
- SA {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- SD {"%z%c%T%s%b%e%r"}
- SY {"%z%c%T%s%b%e%r"}
- TN {"%z%c%T%s%b%e%r"}
- YE {"%z%c%T%s%b%e%r"}
- AZ {"???"}
- BY {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- BG {"%f%N%a%N%d%N%b%N%sN%h, %e, %r%N%z %T%N%c%N"}
- BD {"%a%N%f%N%d%N%b%N%h %s %e %r%N%T %z%N%c%N"}
- FR {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- BA {"%a%N%f%N%d%N%b%N%h %s %e %r%N%T %z%N%c%N"}
- AD {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- IT {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- UA {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- CZ {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- PL {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- GB {"%d%N%f%N%d%N%b%N%s %h 5e %r%N%C%z %T%N%c%N"}
- DK {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- AT {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- BE {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- CH {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- DE {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- LI {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- LU {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- BT {"%f%N%a%N%d%N%r%t%e%t%b%N%h%t%s%N%T%N%S%N%z%c%N"}
- CY {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- GR {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- AU {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- BW {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- CA {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- HK {"%z%c%T%s%b%e%r"}
- IE {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- NG {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- NZ {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- PH {"%z%c%T%s%b%e%r"}
- SG {"%z%c%T%s%b%e%r"}
- US {"%a%N%f%N%d%N%b%N%h %s %e %r%N%T, %S %z%N%c%N"}
- ZW {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- AR {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- BO {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- CL {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- CO {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- CR {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- DO {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- EC {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- GT {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- HN {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- MX {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- NI {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- PA {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- PE {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- PR {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- PY {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- SV {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- UY {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- VE {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- EE {"%a%N%f%N%d%N%b%N%s%t%h%t%e%t%r%N%C-%z %T%N%c%N"}
- IR {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- FI {"TISSIS FINLAND %f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- FO {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- NL {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- IL {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- HR {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- HU {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- AM {"%d%N%f%N%d%N%b%N%s %h 5e %r%N%C%z %T%N%c%N"}
- ID {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- IS {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- JP {"%z%c%T%s%b%e%r"}
- GE {"%d%N%f%N%d%N%b%N%s %h 5e %r%N%C%z %T%N%c%N"}
- KZ {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- GL {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- KH {"%f%N%a%N%d%N%r%t%e%t%b%N%h%t%s%N%T%N%S%N%z%c%N"}
- KR {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- TR {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- KG {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- UG {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- LA {"%f%N%a%N%d%N%r%t%e%t%b%N%h%t%s%N%T%N%S%N%z%c%N"}
- LT {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- LV {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- MG {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- MK {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- MN {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- MY {"%z%c%T%s%b%e%r"}
- MT {"%z%c%T%s%b%e%r"}
- NO {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- NP {"%z%c%T%s%b%e%r"}
- KE {"%z%c%T%s%b%e%r"}
- PK {"%a%N%f%N%d%N%b%N%h %s %e %r%N%T %z%N%c%N"}
- AN {"%d%N%f%N%d%N%b%N%s %h 5e %r%N%C%z %T%N%c%N"}
- BR {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- PT {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- RO {"%f%N%a%d%N%s%t%h%N%b%t%e%t%r%N%z%t%T%N%S%t%c%N"}
- RU {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- RW {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- LK {"%z%c%T%s%b%e%r"}
- SK {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- SI {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- SO {"%z%c%T%s%b%e%r"}
- AL {"%z%c%T%s%b%e%r"}
- ME {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- RS {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- SE {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- TJ {"%a%N%f%N%d%N%b%N%h %s %e %r%N%T %z%N%c%N"}
- TH {"%f%N%a%N%d%N%r%t%e%t%b%N%h%t%s%N%T%N%S%N%z%c%N"}
- TM {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- CN {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- UZ {"%C%N%T%N%s %h%N%f%N%b%N%d%N%e %r%N%a%N%z"}
- VN {"%z%c%T%s%b%e%r"}
- SN {"%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"}
- }
-
- nameFmts {
- aa_DJ {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {"Maqanxa"}
- name_mr {"Toobokoyta"}
- name_mrs {"Gisti"}
- name_ms {""}
- }
- aa_ER {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {"Maqanxa"}
- name_mr {"Toobokoyta"}
- name_mrs {"Gisti"}
- name_ms {""}
- }
- aa_ET {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {"Maqanxa"}
- name_mr {"Toobokoyta"}
- name_mrs {"Gisti"}
- name_ms {""}
- }
- af_ZA {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {"mej"}
- name_mr {"mnr"}
- name_mrs {"mev"}
- name_ms {"me"}
- }
- am_ET {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {"ወ/ሪት"}
- name_mr {"አቶ"}
- name_mrs {"ወ/ሮ"}
- name_ms {"ወ/ሪት"}
- }
- an_ES {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- ar_AE {
- name_fmt {"%p%t%f%t%g"}
- name_gen {"-san"}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- ar_BH {
- name_fmt {"%p%t%f%t%g"}
- name_gen {"-san"}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- ar_DZ {
- name_fmt {"%p%t%f%t%g"}
- name_gen {"-san"}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- ar_EG {
- name_fmt {"%p%t%f%t%g"}
- name_gen {"-san"}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- ar_IN {
- name_fmt {"%p%t%f%t%g"}
- name_gen {""}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- ar_IQ {
- name_fmt {"%p%t%f%t%g"}
- name_gen {"-san"}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- ar_JO {
- name_fmt {"%p%t%f%t%g"}
- name_gen {"-san"}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- ar_KW {
- name_fmt {"%p%t%f%t%g"}
- name_gen {"-san"}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- ar_LB {
- name_fmt {"%p%t%f%t%g"}
- name_gen {"-san"}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- ar_LY {
- name_fmt {"%p%t%f%t%g"}
- name_gen {"-san"}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- ar_MA {
- name_fmt {"%p%t%f%t%g"}
- name_gen {"-san"}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- ar_OM {
- name_fmt {"%p%t%f%t%g"}
- name_gen {"-san"}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- ar_QA {
- name_fmt {"%p%t%f%t%g"}
- name_gen {"-san"}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- ar_SA {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- ar_SD {
- name_fmt {"%p%t%f%t%g"}
- name_gen {"-san"}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- ar_SY {
- name_fmt {"%p%t%f%t%g"}
- name_gen {"-san"}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- ar_TN {
- name_fmt {"%p%t%f%t%g"}
- name_gen {"-san"}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- ar_YE {
- name_fmt {"%p%t%f%t%g"}
- name_gen {"-san"}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- as_IN {
- name_fmt {"%p%t%f%t%g"}
- name_gen {""}
- name_miss {"কুমাৰী"}
- name_mr {"শ্ৰী"}
- name_mrs {"শ্ৰীমতী"}
- name_ms {"কুমাৰী"}
- }
- ast_ES {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- az_AZ {
- name_fmt {"???"}
- }
- be_BY {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- ber_DZ {
- name_fmt {"%p%t%f%t%g"}
- name_gen {"-san"}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- ber_MA {
- name_fmt {"%p%t%f%t%g"}
- name_gen {"-san"}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- bg_BG {
- name_fmt {"%s%t%g%t%m%t%f"}
- name_miss {"г-жица"}
- name_mr {"г-дин"}
- name_mrs {"г-жа"}
- name_ms {"г-жа"}
- }
- bn_BD {
- name_fmt {"%p%t%f%t%m%t%g"}
- name_gen {""}
- name_miss {"বেগম"}
- name_mr {"জনাব"}
- name_mrs {"বেগম"}
- name_ms {"বেগম"}
- }
- bn_IN {
- name_fmt {"%p%t%f%t%g"}
- name_gen {""}
- name_miss {"কুমারী"}
- name_mr {"শ্রী"}
- name_mrs {"শ্রীমতী"}
- name_ms {"শ্রীমতী"}
- }
- br_FR {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {"Mlle"}
- name_mr {"M."}
- name_mrs {"Mme"}
- name_ms {""}
- }
- bs_BA {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- byn_ER {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {"ወ/ሪት"}
- name_mr {"ኣቶ"}
- name_mrs {"ወ/ሮ"}
- name_ms {"ወ/ሪት"}
- }
- ca_AD {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- ca_ES {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- ca_FR {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- ca_IT {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- crh_UA {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- cs_CZ {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_miss {"Slečna"}
- name_mr {"Pan"}
- name_mrs {"Paní"}
- name_ms {"Paní"}
- }
- csb_PL {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- cy_GB {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- da_DK {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- de_AT {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- de_BE {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- de_CH {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- de_DE {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_miss {"Fräulein"}
- name_mr {"Herr"}
- name_mrs {"Frau"}
- name_ms {"Frau"}
- }
- de_LI {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- de_LU {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- dz_BT {
- name_fmt {"%p%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {"མོ"}
- name_mr {"ཕོ"}
- name_mrs {"ཨམ"}
- }
- el_CY {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- el_GR {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- en_AU {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- en_BW {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- en_CA {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- en_DK {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- en_GB {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- en_HK {
- name_fmt {"%p%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {"Ms."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {""}
- }
- en_IE {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- en_IN {
- name_fmt {"%p%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {"Ms."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {""}
- }
- en_NG {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- en_NZ {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- en_PH {
- name_fmt {"%p%t%f%t%g"}
- name_gen {""}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- en_SG {
- name_fmt {"%p%t%f%t%g"}
- name_gen {""}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- en_US {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- en_ZA {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {"Miss"}
- name_mr {"Mr"}
- name_mrs {"Mrs"}
- name_ms {"Ms"}
- }
- en_ZW {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- eo_US {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_mr {"s-ro"}
- name_mrs {"s-ino"}
- name_ms {"s-ino"}
- }
- es_AR {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- es_BO {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- es_CL {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- es_CO {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- es_CR {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- es_DO {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- es_EC {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- es_ES {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- es_GT {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- es_HN {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- es_MX {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- es_NI {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- es_PA {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- es_PE {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- es_PR {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- es_PY {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- es_SV {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- es_US {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- es_UY {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- es_VE {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- et_EE {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- eu_ES {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- eu_FR {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- fa_IR {
- name_fmt {"%d%t%s%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {"خانم"}
- name_mr {"آقای"}
- name_mrs {"خانم"}
- name_ms {"خانم"}
- }
- fi_FI {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- fil_PH {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {"Bb."}
- name_mr {"G."}
- name_mrs {"Gng."}
- name_ms {"Bb."}
- }
- fo_FO {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- fr_BE {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {"Mlle"}
- name_mr {"M."}
- name_mrs {"Mme"}
- name_ms {""}
- }
- fr_CA {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {"Mlle"}
- name_mr {"M."}
- name_mrs {"Mme"}
- name_ms {""}
- }
- fr_CH {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {"Mlle"}
- name_mr {"M."}
- name_mrs {"Mme"}
- name_ms {""}
- }
- fr_FR {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {"Mlle"}
- name_mr {"M."}
- name_mrs {"Mme"}
- name_ms {""}
- }
- fr_LU {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {"Mlle"}
- name_mr {"M."}
- name_mrs {"Mme"}
- name_ms {""}
- }
- fur_IT {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- fy_DE {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_miss {"Fräulein"}
- name_mr {"Herr"}
- name_mrs {"Frau"}
- name_ms {"Frau"}
- }
- fy_NL {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- ga_IE {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- gd_GB {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- gez_ER {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {"ወ/ሪት"}
- name_mr {"ኣቶ"}
- name_mrs {"ወ/ሮ"}
- name_ms {"ወ/ሪት"}
- }
- gez_ET {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {"ወ/ሪት"}
- name_mr {"አቶ"}
- name_mrs {"ወ/ሮ"}
- name_ms {"ወ/ሪት"}
- }
- gl_ES {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- gu_IN {
- name_fmt {"%p%t%f%t%g"}
- name_gen {"જાતિ"}
- name_miss {"કુમારી"}
- name_mr {"શ્રીમાન"}
- name_mrs {"શ્રીમતિ"}
- name_ms {"સશ્રી"}
- }
- gv_GB {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- ha_NG {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- he_IL {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- hi_IN {
- name_fmt {"%p%t%f%t%g"}
- name_gen {""}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- hr_HR {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- hsb_DE {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_miss {"knježna"}
- name_mr {"knjez"}
- name_mrs {"knjeni"}
- }
- hu_HU {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- hy_AM {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_miss {"օրիորդ"}
- name_mr {"պրն"}
- name_mrs {"տկն"}
- }
- id_ID {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- ig_NG {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- ik_CA {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- is_IS {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- it_CH {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- it_IT {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- iu_CA {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- iw_IL {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- ja_JP {
- name_fmt {"%p%t%f%t%g"}
- name_gen {"様"}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- ka_GE {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- kk_KZ {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- kl_GL {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- km_KH {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_mr {"ທ"}
- name_mrs {"ນ"}
- }
- kn_IN {
- name_fmt {"%p%t%f%t%g"}
- name_gen {""}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- ko_KR {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- ks_IN {
- name_fmt {"%p%t%f%t%g"}
- name_gen {""}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- ku_TR {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {"Barêz"}
- name_miss {"Barêz"}
- name_mr {"Barêz"}
- name_mrs {"Barêz"}
- name_ms {"Barêz"}
- }
- kw_GB {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- ky_KG {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- lg_UG {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_miss {"Mla"}
- name_mr {"Mw"}
- name_mrs {"Mla"}
- name_ms {"Mla"}
- }
- li_BE {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- li_NL {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- lo_LA {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_mr {"ທ"}
- name_mrs {"ນ"}
- }
- lt_LT {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- lv_LV {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- mai_IN {
- name_fmt {"%p%t%f%t%g"}
- name_gen {""}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- mg_MG {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- mi_NZ {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- mk_MK {
- name_fmt {"%g%t%f"}
- name_gen {"почитуван"}
- name_miss {"г-ѓица"}
- name_mr {"г-дин"}
- name_mrs {"г-ѓа"}
- name_ms {"г-ѓа"}
- }
- ml_IN {
- name_fmt {"%p%t%f%t%g"}
- name_gen {"ശ്രീ"}
- name_miss {"കുമാരി"}
- name_mr {"ശ്രീമാനു്"}
- name_mrs {"ശ്രീമതി"}
- name_ms {"ശ്രീമതി"}
- }
- mn_MN {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_miss {"Хатагтай"}
- name_mr {"Ноён"}
- name_mrs {"Хатагтай"}
- name_ms {"Хатагтай"}
- }
- mr_IN {
- name_fmt {"%p%t%f%t%g"}
- name_gen {""}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- ms_MY {
- name_fmt {"%p%t%f%t%g"}
- name_gen {""}
- name_miss {"cik"}
- name_mr {"Eecik"}
- name_mrs {"Puan"}
- name_ms {"cik/Puan"}
- }
- mt_MT {
- name_fmt {"%p%t%f%t%g"}
- name_gen {""}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- nb_NO {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- nds_DE {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_miss {"Fräulein"}
- name_mr {"Herr"}
- name_mrs {"Frau"}
- name_ms {"Frau"}
- }
- nds_NL {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- ne_NP {
- name_fmt {"%p%t%f%t%g"}
- name_gen {""}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- nl_BE {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- nl_NL {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- nn_NO {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- nr_ZA {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- nso_ZA {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- oc_FR {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {"Mlle"}
- name_mr {"M."}
- name_mrs {"Mme"}
- name_ms {""}
- }
- om_ET {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {"Du"}
- name_mr {"Ob"}
- name_mrs {"Ad"}
- name_ms {""}
- }
- om_KE {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {"Du"}
- name_mr {"Ob"}
- name_mrs {"Ad"}
- name_ms {""}
- }
- or_IN {
- name_fmt {"%p%t%f%t%g"}
- name_gen {""}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- pa_IN {
- name_fmt {"%p%t%f%t%g"}
- name_gen {""}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- pa_PK {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- pap_AN {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- pl_PL {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- pt_BR {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- pt_PT {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- ro_RO {
- name_fmt {"%d%t%s%t%f%t%g%t%m"}
- name_miss {"D-ra."}
- name_mr {"Dl."}
- name_mrs {"D-na."}
- }
- ru_RU {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- ru_UA {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- rw_RW {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- sa_IN {
- name_fmt {"%p%t%f%t%g"}
- name_gen {""}
- name_miss {"कुमारी"}
- name_mr {"श्री"}
- name_mrs {"श्रीमती"}
- name_ms {"श्रीमती"}
- }
- sc_IT {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- se_NO {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- shs_CA {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- si_LK {
- name_fmt {"%g%t%m%t%f%t%s"}
- name_gen {""}
- name_miss {"මිය"}
- name_mr {"මයා"}
- name_mrs {"මිය"}
- name_ms {"මිය"}
- }
- sid_ET {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {"Beeto"}
- name_mr {"Kalaa"}
- name_mrs {"Dukko"}
- name_ms {""}
- }
- sk_SK {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- sl_SI {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- so_DJ {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {""}
- name_mr {"Md"}
- name_mrs {"Mw"}
- name_ms {"Mw"}
- }
- so_ET {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {""}
- name_mr {"Md"}
- name_mrs {"Mw"}
- name_ms {"Mw"}
- }
- so_KE {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {""}
- name_mr {"Md"}
- name_mrs {"Mw"}
- name_ms {"Mw"}
- }
- so_SO {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {""}
- name_mr {"Md"}
- name_mrs {"Mw"}
- name_ms {"Mw"}
- }
- sq_AL {
- name_fmt {"%p%t%f%t%g"}
- name_gen {""}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- sr_ME {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {"г-ђица"}
- name_mr {"г-дин"}
- name_mrs {"г-ђа"}
- name_ms {"г-ђа"}
- }
- sr_RS {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {"г-ђица"}
- name_mr {"г-дин"}
- name_mrs {"г-ђа"}
- name_ms {"г-ђа"}
- }
- ss_ZA {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- st_ZA {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- sv_FI {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- sv_SE {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- ta_IN {
- name_fmt {"%p%t%f%t%g"}
- name_gen {""}
- name_miss {"செல்வி "}
- name_mr {"திரு "}
- name_mrs {"திருமதி "}
- name_ms {"Ms."}
- }
- te_IN {
- name_fmt {"%p%t%f%t%g%t%m"}
- name_gen {""}
- name_miss {"కుమారి "}
- name_mr {"శ్రీ "}
- name_mrs {"శ్రీమతి "}
- name_ms {""}
- }
- tg_TJ {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- th_TH {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {"คุณ"}
- name_miss {"นางสาว"}
- name_mr {"นาย"}
- name_mrs {"นาง"}
- }
- ti_ER {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {"ወ/ሪት"}
- name_mr {"ኣቶ"}
- name_mrs {"ወ/ሮ"}
- name_ms {"ወ/ሪት"}
- }
- ti_ET {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {"ወ/ሪት"}
- name_mr {"አቶ"}
- name_mrs {"ወ/ሮ"}
- name_ms {"ወ/ሪት"}
- }
- tig_ER {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {"ወ/ሪት"}
- name_mr {"ኣቶ"}
- name_mrs {"ወ/ሮ"}
- name_ms {"ወ/ሪት"}
- }
- tk_TM {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {""}
- name_mr {""}
- name_mrs {""}
- name_ms {""}
- }
- tl_PH {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- tn_ZA {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- tr_CY {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {"Sayın"}
- name_miss {"Bayan"}
- name_mr {"Bay"}
- name_mrs {"Bayan"}
- name_ms {"Bayan"}
- }
- tr_TR {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {"Sayın"}
- name_miss {"Bayan"}
- name_mr {"Bay"}
- name_mrs {"Bayan"}
- name_ms {"Bayan"}
- }
- ts_ZA {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- tt_RU {
- name_fmt {"???"}
- }
- ug_CN {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- uk_UA {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {"шановний(-на)"}
- name_miss {"панна"}
- name_mr {"пан"}
- name_mrs {"пані"}
- name_ms {"пані"}
- }
- ur_PK {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- uz_UZ {
- name_fmt {"%d%t%f%t%g%t%m"}
- name_gen {"Hurmatli"}
- name_miss {""}
- name_mr {"Janob"}
- name_mrs {"Xonim"}
- name_ms {""}
- }
- ve_ZA {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- vi_VN {
- name_fmt {"%p%t%f%t%m%t%g"}
- name_gen {""}
- name_miss {"C."}
- name_mr {"Ô."}
- name_mrs {"B."}
- name_ms {""}
- }
- wa_BE {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {"Mle"}
- name_mr {"M."}
- name_mrs {"Mme"}
- name_ms {"Mme"}
- }
- wal_ET {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_gen {""}
- name_miss {"ኬታዩ"}
- name_mr {"ሚሲያ"}
- name_mrs {"ኬታዋ"}
- name_ms {"ኬታዩ"}
- }
- wo_SN {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- xh_ZA {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_miss {"Nkosazana"}
- name_mr {"Mnumzana"}
- name_mrs {"Nkosikazi"}
- name_ms {""}
- }
- yi_US {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- yo_NG {
- name_fmt {"%d%t%g%t%m%t%f"}
- }
- zh_HK {
- name_fmt {"%f%t%d1"}
- name_gen {"君"}
- name_miss {"小姐"}
- name_mr {"先生"}
- name_mrs {"夫人."}
- name_ms {"女士"}
- }
- zh_SG {
- name_fmt {"%p%t%f%t%g"}
- name_gen {""}
- name_miss {"Miss."}
- name_mr {"Mr."}
- name_mrs {"Mrs."}
- name_ms {"Ms."}
- }
- zu_ZA {
- name_fmt {"%d%t%g%t%m%t%f"}
- name_miss {"Nkosazane"}
- name_mr {"Mnumzane"}
- name_mrs {"Nkosikazi"}
- name_ms {""}
- }
- }
-}
-}
diff --git a/src/corelib/icu-extradata/packagelist.txt b/src/corelib/icu-extradata/packagelist.txt
deleted file mode 100644
index 41992931..00000000
--- a/src/corelib/icu-extradata/packagelist.txt
+++ /dev/null
@@ -1 +0,0 @@
-root.res
diff --git a/src/corelib/scene/mscene.cpp b/src/corelib/scene/mscene.cpp
index dc9e1f9d..91f9f0ef 100644
--- a/src/corelib/scene/mscene.cpp
+++ b/src/corelib/scene/mscene.cpp
@@ -387,6 +387,46 @@ void MScenePrivate::logFpsCounter(const QTime *timeStamp, float fps)
fpsLog.stream << " " << QString("%1").arg(fps, 0, 'f', 1) << endl;
}
+void MScenePrivate::fillMarginRectWithPattern(QPainter * painter, const QRectF& rect, int thickness)
+{
+ if(thickness == 0)
+ return;
+
+ QColor fillColor;
+
+ switch(thickness)
+ {
+ case 24:
+ fillColor = QColor(122, 24, 127);
+ break;
+ case 16:
+ fillColor = QColor(250, 25, 0);
+ break;
+ case 12:
+ fillColor = QColor(100, 190, 69);
+ break;
+ case 8:
+ fillColor = QColor(0, 51, 250);
+ break;
+ case 6:
+ fillColor = QColor(138, 93, 59);
+ break;
+ case 4:
+ fillColor = QColor(255, 171, 0);
+ break;
+ case 2:
+ fillColor = QColor(250, 250, 2);
+ break;
+
+ default:
+ fillColor = QColor(2, 254, 255);
+ }
+
+ painter->fillRect(rect, QBrush(fillColor));
+ painter->setOpacity(0.6);
+ painter->fillRect(rect, QBrush(Qt::black, Qt::BDiagPattern));
+}
+
MScene::MScene(QObject *parent)
: QGraphicsScene(parent),
d_ptr(new MScenePrivate)
@@ -468,20 +508,22 @@ void MScene::drawForeground(QPainter *painter, const QRectF &rect)
if (layoutItem) {
qreal left, top, right, bottom;
layoutItem->getContentsMargins(&left, &top, &right, &bottom);
- if (left != 0 || top != 0 || right != 0 || bottom != 0) {
- QPainterPath path;
- path.addPolygon(bp);
- path.addPolygon((*item)->mapToScene(br.adjusted(left, top, -right, -bottom)));
-
- painter->setOpacity(MarginBackgroundOpacity);
- painter->fillPath(path, QBrush(MarginColor));
- painter->setOpacity(1.0);
- painter->fillPath(path, QBrush(MarginColor, Qt::BDiagPattern));
- QPen pen(Qt::DashLine);
- pen.setWidth(MarginBorderWidth);
- pen.setColor(MarginColor);
- painter->strokePath(path, pen);
- }
+
+ QRectF outerRect = (*item)->mapRectToScene(br.x(),br.y(), br.width(), br.height());
+ QRectF innerRect = outerRect.adjusted(left, top, -right, -bottom);
+
+ QRectF leftRect(outerRect.x(), outerRect.y(), innerRect.x() - outerRect.x(), outerRect.height());
+ QRectF topRect(innerRect.x(), outerRect.y(), innerRect.width(), innerRect.y() - outerRect.y());
+ QRectF rightRect(innerRect.bottomRight().x(), outerRect.y(), outerRect.bottomRight().x() - innerRect.bottomRight().x(), outerRect.height());
+ QRectF bottomRect(innerRect.x(), innerRect.bottomRight().y(), innerRect.width(), outerRect.bottomRight().y() - innerRect.bottomRight().y());
+
+ painter->setOpacity(0.5);
+
+ d->fillMarginRectWithPattern(painter, leftRect, leftRect.width());
+ d->fillMarginRectWithPattern(painter, topRect, topRect.height());
+ d->fillMarginRectWithPattern(painter, rightRect, rightRect.width());
+ d->fillMarginRectWithPattern(painter, bottomRect, bottomRect.height());
+
}
painter->setOpacity(1.0);
diff --git a/src/corelib/scene/mscene_p.h b/src/corelib/scene/mscene_p.h
index b7a66034..1e2ad8bc 100644
--- a/src/corelib/scene/mscene_p.h
+++ b/src/corelib/scene/mscene_p.h
@@ -65,6 +65,7 @@ public:
void touchPointCopyMousePosToPointStartPos(QTouchEvent::TouchPoint &point, const QGraphicsSceneMouseEvent *event);
bool eventEmulatePinch(QEvent* event);
bool eventEmulatePan(QEvent* event);
+ void fillMarginRectWithPattern(QPainter * painter, const QRectF& rect, int thickness);
protected:
MScene *q_ptr;
diff --git a/src/corelib/scene/mscenemanager.cpp b/src/corelib/scene/mscenemanager.cpp
index ab574658..7527dd02 100644
--- a/src/corelib/scene/mscenemanager.cpp
+++ b/src/corelib/scene/mscenemanager.cpp
@@ -63,6 +63,7 @@
#include <mwidgetslideanimation.h>
#include <mwidgetfadeanimation.h>
#include <mwidgetzoomanimation.h>
+#include <mwidgetmoveanimation.h>
namespace
{
@@ -358,10 +359,6 @@ void MSceneManagerPrivate::_q_onSceneWindowDisappeared()
if (window->windowType() == MSceneWindow::StatusBar) {
statusBar = 0;
-
- // All other scene windows have to be repositioned since now there's more
- // space available in the scene.
- setSceneWindowGeometries();
}
if (isOnDisplay()) {
@@ -907,10 +904,6 @@ void MSceneManagerPrivate::prepareWindowShow(MSceneWindow *window)
Q_ASSERT(statusBar == 0);
statusBar = window;
-
- // All other scene windows have to be repositioned since now there's less
- // space available in the scene for them.
- setSceneWindowGeometries();
}
window->show();
@@ -1191,6 +1184,24 @@ void MSceneManagerPrivate::createAppearanceAnimationForSceneWindow(MSceneWindow
animation = objectMenuAnimation;
break;
}
+ case MSceneWindow::StatusBar: {
+ MWidgetSlideAnimation *slideInAnimation = new MWidgetSlideAnimation(sceneWindow);
+ slideInAnimation->setTransitionDirection(MWidgetSlideAnimation::In);
+ animation = slideInAnimation;
+
+ QList<MSceneWindow*> sceneWindows = *windows;
+ sceneWindows.removeAll(sceneWindow);
+ foreach (MSceneWindow *window, sceneWindows) {
+ if (window->windowType() != MSceneWindow::ApplicationPage &&
+ window->windowType() != MSceneWindow::DockWidget) {
+ MWidgetMoveAnimation *moveAnimation = new MWidgetMoveAnimation;
+ moveAnimation->setWidget(window);
+ moveAnimation->setFinalPos(QPointF(window->x(), window->y() + sceneWindow->effectiveSizeHint(Qt::PreferredSize).height()));
+ animation->addAnimation(moveAnimation);
+ }
+ }
+ break;
+ }
case MSceneWindow::ObjectMenu: {
MWidgetZoomAnimation *objectMenuAnimation =
new MWidgetZoomAnimation(sceneWindow);
@@ -1247,6 +1258,24 @@ void MSceneManagerPrivate::createDisappearanceAnimationForSceneWindow(MSceneWind
animation = zoomAnimation;
break;
}
+ case MSceneWindow::StatusBar: {
+ MWidgetSlideAnimation *slideOutAnimation = new MWidgetSlideAnimation(sceneWindow);
+ slideOutAnimation->setTransitionDirection(MWidgetSlideAnimation::Out);
+ animation = slideOutAnimation;
+
+ QList<MSceneWindow*> sceneWindows = *windows;
+ sceneWindows.removeAll(sceneWindow);
+ foreach (MSceneWindow *window, sceneWindows) {
+ if (window->windowType() != MSceneWindow::ApplicationPage &&
+ window->windowType() != MSceneWindow::DockWidget) {
+ MWidgetMoveAnimation *moveAnimation = new MWidgetMoveAnimation;
+ moveAnimation->setWidget(window);
+ moveAnimation->setFinalPos(QPointF(window->x(), window->y() - sceneWindow->effectiveSizeHint(Qt::PreferredSize).height()));
+ animation->addAnimation(moveAnimation);
+ }
+ }
+ break;
+ }
case MSceneWindow::ObjectMenu: {
MWidgetZoomAnimation *zoomAnimation =
new MWidgetZoomAnimation(sceneWindow);
diff --git a/src/corelib/style/mwidgetfadeanimationstyle.h b/src/corelib/style/mwidgetfadeanimationstyle.h
index 27fac88c..205a364a 100644
--- a/src/corelib/style/mwidgetfadeanimationstyle.h
+++ b/src/corelib/style/mwidgetfadeanimationstyle.h
@@ -24,7 +24,7 @@
#include <QEasingCurve>
//! \internal
-class MWidgetFadeAnimationStyle : public MAbstractWidgetAnimationStyle
+class M_EXPORT MWidgetFadeAnimationStyle : public MAbstractWidgetAnimationStyle
{
Q_OBJECT
M_STYLE_INTERNAL(MWidgetFadeAnimationStyle)
diff --git a/src/corelib/style/mwidgetmoveanimationstyle.h b/src/corelib/style/mwidgetmoveanimationstyle.h
new file mode 100644
index 00000000..148ce6ee
--- /dev/null
+++ b/src/corelib/style/mwidgetmoveanimationstyle.h
@@ -0,0 +1,43 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef MWIDGETMOVEANIMATIONSTYLE_H
+#define MWIDGETMOVEANIMATIONSTYLE_H
+
+#include <manimationstyle.h>
+#include <QEasingCurve>
+
+//! \internal
+class MWidgetMoveAnimationStyle : public MAnimationStyle
+{
+ Q_OBJECT
+ M_STYLE_INTERNAL(MWidgetMoveAnimationStyle)
+
+ M_STYLE_ATTRIBUTE(int, delay, Delay)
+ M_STYLE_ATTRIBUTE(int, duration, Duration)
+ M_STYLE_ATTRIBUTE(QEasingCurve, easingCurve, EasingCurve)
+};
+
+class MWidgetMoveAnimationStyleContainer : public MAnimationStyleContainer
+{
+ M_STYLE_CONTAINER_INTERNAL(MWidgetMoveAnimationStyle)
+};
+//! \internal_end
+
+#endif
diff --git a/src/corelib/style/style.pri b/src/corelib/style/style.pri
index 1ec272cd..8a56e509 100644
--- a/src/corelib/style/style.pri
+++ b/src/corelib/style/style.pri
@@ -29,6 +29,7 @@ MGEN_STYLE_HEADERS += \
$$STYLE_SRC_DIR/mgroupanimationstyle.h \
$$STYLE_SRC_DIR/mlayoutanimationstyle.h \
$$STYLE_SRC_DIR/mwidgetfadeanimationstyle.h \
+ $$STYLE_SRC_DIR/mwidgetmoveanimationstyle.h \
$$STYLE_SRC_DIR/mwidgetslideanimationstyle.h \
$$STYLE_SRC_DIR/mwidgetzoomanimationstyle.h \
$$STYLE_SRC_DIR/mpageswitchanimationstyle.h \
diff --git a/src/corelib/widgets/mabstractitemmodel.cpp b/src/corelib/widgets/mabstractitemmodel.cpp
new file mode 100644
index 00000000..bfbee6f6
--- /dev/null
+++ b/src/corelib/widgets/mabstractitemmodel.cpp
@@ -0,0 +1,171 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#include "mabstractitemmodel.h"
+#include "mabstractitemmodel_p.h"
+
+MAbstractItemModelPrivate::MAbstractItemModelPrivate()
+ : groupMode(false)
+{
+}
+
+MAbstractItemModelPrivate::~MAbstractItemModelPrivate()
+{
+}
+
+void MAbstractItemModelPrivate::connectModel()
+{
+ Q_Q(MAbstractItemModel);
+
+ connect(q, SIGNAL(rowsInserted(QModelIndex,int,int)), SLOT(_q_rowsInsertAnimated(QModelIndex,int,int)));
+ connect(q, SIGNAL(rowsRemoved(QModelIndex,int,int)), SLOT(_q_rowsRemoveAnimated(QModelIndex,int,int)));
+}
+
+void MAbstractItemModelPrivate::setGrouped(bool mode)
+{
+ groupMode = mode;
+}
+
+bool MAbstractItemModelPrivate::isGrouped() const
+{
+ return groupMode;
+}
+
+void MAbstractItemModelPrivate::setChangeAnimated(bool animated)
+{
+ animatedChange.push(animated);
+}
+
+bool MAbstractItemModelPrivate::changeAnimated()
+{
+ return animatedChange.pop();
+}
+
+void MAbstractItemModelPrivate::_q_rowsInsertAnimated(const QModelIndex &parent, int first, int last)
+{
+ Q_Q(MAbstractItemModel);
+
+ emit q->rowsInserted(parent, first, last, changeAnimated());
+}
+
+void MAbstractItemModelPrivate::_q_rowsRemoveAnimated(const QModelIndex &parent, int first, int last)
+{
+ Q_Q(MAbstractItemModel);
+
+ emit q->rowsRemoved(parent, first, last, changeAnimated());
+}
+
+MAbstractItemModel::MAbstractItemModel(QObject *parent)
+ : QAbstractItemModel(parent),
+ d_ptr(new MAbstractItemModelPrivate)
+{
+ Q_D(MAbstractItemModel);
+
+ d->q_ptr = this;
+ d->connectModel();
+}
+
+MAbstractItemModel::~MAbstractItemModel()
+{
+}
+
+void MAbstractItemModel::setGrouped(bool mode)
+{
+ Q_D(MAbstractItemModel);
+
+ if (d->isGrouped() == mode)
+ return;
+
+ d->setGrouped(mode);
+ emit layoutChanged();
+}
+
+bool MAbstractItemModel::isGrouped() const
+{
+ Q_D(const MAbstractItemModel);
+
+ return d->isGrouped();
+}
+
+int MAbstractItemModel::rowCount(const QModelIndex &parent) const
+{
+ if (isGrouped()) {
+ if (parent.isValid())
+ return rowCountInGroup(parent.row());
+ else
+ return groupCount();
+ } else {
+ if (parent.isValid())
+ return 0;
+ else
+ return rowCountInGroup(-1);
+ }
+}
+
+QModelIndex MAbstractItemModel::index(int row, int column, const QModelIndex &parent) const
+{
+ return row < rowCountInGroup(parent.row()) ? createIndex(row, column, parent.row()) : QModelIndex();
+}
+
+QModelIndex MAbstractItemModel::parent(const QModelIndex &child) const
+{
+ if (isGrouped()) {
+ return index(child.internalId(), 0);
+ }
+
+ return QModelIndex();
+}
+
+int MAbstractItemModel::columnCount(const QModelIndex &parent) const
+{
+ Q_UNUSED(parent);
+
+ return 1;
+}
+
+QVariant MAbstractItemModel::data(const QModelIndex &index, int role) const
+{
+ if (isGrouped()) {
+ if (!index.parent().isValid())
+ return groupTitle(index.row());
+ else
+ return itemData(index.row(), index.parent().row(), role);
+ } else {
+ if (index.isValid())
+ return itemData(index.row(), -1, role);
+ }
+
+ return QVariant();
+}
+
+void MAbstractItemModel::beginInsertRows(const QModelIndex &parent, int first, int last, bool animated)
+{
+ Q_D(MAbstractItemModel);
+
+ QAbstractItemModel::beginInsertRows(parent, first, last);
+ d->setChangeAnimated(animated);
+}
+
+void MAbstractItemModel::beginRemoveRows(const QModelIndex &parent, int first, int last, bool animated)
+{
+ Q_D(MAbstractItemModel);
+
+ QAbstractItemModel::beginRemoveRows(parent, first, last);
+ d->setChangeAnimated(animated);
+}
diff --git a/src/corelib/widgets/mabstractitemmodel.h b/src/corelib/widgets/mabstractitemmodel.h
new file mode 100644
index 00000000..c2f117c4
--- /dev/null
+++ b/src/corelib/widgets/mabstractitemmodel.h
@@ -0,0 +1,141 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef MABSTRACTITEMMODEL_H
+#define MABSTRACTITEMMODEL_H
+
+#include <MExport>
+#include <QAbstractItemModel>
+
+class MAbstractItemModelPrivate;
+
+/*!
+ \class MAbstractItemModel
+ \brief MAbstractItemModel implementation of a simple list data model.
+*/
+class M_EXPORT MAbstractItemModel : public QAbstractItemModel
+{
+ Q_OBJECT
+ /*!
+ \property MAbstractItemModel::grouped
+ \brief True if the model is a grouped (tree) model, false if the model is
+ a plain list model.
+ */
+ Q_PROPERTY(bool grouped READ isGrouped WRITE setGrouped)
+
+public:
+ /*!
+ \brief Constructor.
+ \param parent Item model owner.
+ */
+ MAbstractItemModel(QObject *parent = NULL);
+ /*!
+ \brief Destructor.
+ */
+ virtual ~MAbstractItemModel();
+
+ /*!
+ \return Number of groups in the model. (O - for the plain list model).
+ */
+ virtual int groupCount() const = 0;
+
+ /*!
+ \return Number of rows in the group.
+ */
+ virtual int rowCountInGroup(int group) const = 0;
+
+ /*!
+ \param group The group index.
+ \return Title of the group.
+ */
+ virtual QString groupTitle(int group) const = 0;
+
+ /*!
+ \param row The row index in the group.
+ \param group The group index in the model, (-1 - for the plain list model).
+ \param role The item data role request.
+ \return The item data for the specified role.
+ */
+ virtual QVariant itemData(int row, int group, int role = Qt::DisplayRole) const = 0;
+
+ /*!
+ \brief Set's the grouping mode for the data model.
+ \param mode The grouping mode of the model to set.
+ */
+ void setGrouped(bool mode);
+
+ /*!
+ \return The model grouping mode.
+ */
+ bool isGrouped() const;
+
+ //! \reimp
+ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ //! \reimp_end
+
+protected:
+ //! \reimp
+ int columnCount(const QModelIndex &parent) const;
+ QModelIndex parent(const QModelIndex &child) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ //! \reimp_end
+
+ /*!
+ \param parent The parent index where the row insertion begins.
+ \param first The first row index.
+ \param last The last row index.
+ \param animated Flag to insert rows with or without animations.
+ */
+ void beginInsertRows(const QModelIndex &parent, int first, int last, bool animated);
+
+ /*!
+ \param parent The parent index from which the rows are going to be removed.
+ \param first The first row index.
+ \param last The last row index.
+ \param animated Flag to remove rows with or without animations.
+ */
+ void beginRemoveRows(const QModelIndex &parent, int first, int last, bool animated);
+
+Q_SIGNALS:
+ /*!
+ \param parent Parent index in which the rows were inserted.
+ \param first First inserted row index.
+ \param last Last inserted row index.
+ \param animated Flag that shows if the insert operation was with animations or not.
+ */
+ void rowsInserted(const QModelIndex &parent, int first, int last, bool animated);
+
+ /*!
+ \param parent Parent index in which the rows were removed.
+ \param first First removed row index.
+ \param last Last removed row index.
+ \param animated Flag that shows if the remove operation was with animations or not.
+ */
+ void rowsRemoved(const QModelIndex &parent, int first, int last, bool animated);
+
+private:
+ Q_DISABLE_COPY(MAbstractItemModel)
+ Q_DECLARE_PRIVATE(MAbstractItemModel)
+ //! \internal
+ MAbstractItemModelPrivate *const d_ptr;
+ //! \internal_end
+};
+
+#endif // MABSTRACTITEMMODEL_H
diff --git a/src/corelib/widgets/mabstractitemmodel_p.h b/src/corelib/widgets/mabstractitemmodel_p.h
new file mode 100644
index 00000000..f7a5d784
--- /dev/null
+++ b/src/corelib/widgets/mabstractitemmodel_p.h
@@ -0,0 +1,56 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef MABSTRACTITEMMODEL_P_H
+#define MABSTRACTITEMMODEL_P_H
+
+#include <QObject>
+#include <QModelIndex>
+#include <QStack>
+
+class MAbstractItemModel;
+
+class MAbstractItemModelPrivate : public QObject
+{
+ Q_OBJECT
+ Q_DECLARE_PUBLIC(MAbstractItemModel)
+
+public:
+ MAbstractItemModelPrivate();
+ virtual ~MAbstractItemModelPrivate();
+
+ void connectModel();
+
+ void setGrouped(bool mode);
+ bool isGrouped() const;
+
+ void setChangeAnimated(bool animated);
+ bool changeAnimated();
+
+private Q_SLOTS:
+ void _q_rowsInsertAnimated(const QModelIndex &parent, int first, int last);
+ void _q_rowsRemoveAnimated(const QModelIndex &parent, int first, int last);
+
+private:
+ MAbstractItemModel *q_ptr;
+ QStack<bool> animatedChange;
+ bool groupMode;
+};
+
+#endif // MABSTRACTITEMMODEL_P_H
diff --git a/src/corelib/widgets/mapplicationpage.h b/src/corelib/widgets/mapplicationpage.h
index 5d8de699..27fdd372 100644
--- a/src/corelib/widgets/mapplicationpage.h
+++ b/src/corelib/widgets/mapplicationpage.h
@@ -42,7 +42,7 @@ class MPannableViewport;
the assiciated show animation for the page. If you want to show a page instantly, refer to
MSceneManager API.
- A page can contain actions, which will be shown in the navigation bar or on a view menu.
+ A page can contain actions, which will be shown in the navigation bar in the application menu.
\li addAction()
\li actions()
diff --git a/src/corelib/widgets/mapplicationwindow.cpp b/src/corelib/widgets/mapplicationwindow.cpp
index 0d58e98c..9e5a5a96 100644
--- a/src/corelib/widgets/mapplicationwindow.cpp
+++ b/src/corelib/widgets/mapplicationwindow.cpp
@@ -225,9 +225,9 @@ void MApplicationWindowPrivate::windowStateChangeEvent(QWindowStateChangeEvent *
#endif
if (q->isFullScreen() && !event->oldState().testFlag(Qt::WindowFullScreen)) {
- q->sceneManager()->disappearSceneWindowNow(statusBar);
+ q->sceneManager()->disappearSceneWindow(statusBar);
} else if (!q->isFullScreen() && event->oldState().testFlag(Qt::WindowFullScreen)) {
- q->sceneManager()->appearSceneWindowNow(statusBar);
+ q->sceneManager()->appearSceneWindow(statusBar);
}
}
@@ -241,9 +241,9 @@ void MApplicationWindowPrivate::_q_updateStatusBarVisibility()
if (q->isFullScreen()) {
if (callStatusProperty.value().toString() == "active") {
- q->sceneManager()->appearSceneWindowNow(statusBar);
+ q->sceneManager()->appearSceneWindow(statusBar);
} else {
- q->sceneManager()->disappearSceneWindowNow(statusBar);
+ q->sceneManager()->disappearSceneWindow(statusBar);
}
}
}
@@ -381,7 +381,6 @@ void MApplicationWindowPrivate::openMenu()
if (menu->actions().count() > 0) {
menu->appear(q);
escapeButtonPanel->setEnabled(false);
- toolBar->setEnabled(false);
}
}
@@ -569,8 +568,11 @@ void MApplicationWindowPrivate::updateDockWidgetVisibility()
bool toolbarHasVisibleActions = false;
for (int i = 0; i < count; ++i) {
if (actions[i]->isVisible()) {
- toolbarHasVisibleActions = true;
- break;
+ MAction *action = qobject_cast<MAction*>(actions[i]);
+ if(!action || action->location().testFlag(MAction::ToolBarPortraitLocation)) {
+ toolbarHasVisibleActions = true;
+ break;
+ }
}
}
diff --git a/src/corelib/widgets/mbubbleitem.cpp b/src/corelib/widgets/mbubbleitem.cpp
new file mode 100644
index 00000000..d8bbf0e6
--- /dev/null
+++ b/src/corelib/widgets/mbubbleitem.cpp
@@ -0,0 +1,171 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+
+#include "mbubbleitem.h"
+#include "mbubbleitem_p.h"
+#include "mbubbleitemmodel.h"
+
+#include "mimagewidget.h"
+#include "mwidgetcreator.h"
+
+M_REGISTER_WIDGET(MBubbleItem)
+
+MBubbleItemPrivate::MBubbleItemPrivate()
+ : MWidgetControllerPrivate()
+{
+}
+
+MBubbleItemPrivate::~MBubbleItemPrivate()
+{
+}
+
+void MBubbleItemPrivate::init()
+{
+}
+
+MBubbleItem::MBubbleItem(QGraphicsItem *parent)
+ : MWidgetController(new MBubbleItemPrivate, new MBubbleItemModel, parent)
+{
+ Q_D(MBubbleItem);
+
+ d->init();
+}
+
+MBubbleItem::MBubbleItem(MBubbleItemPrivate *dd, MBubbleItemModel *model, QGraphicsItem *parent)
+ : MWidgetController(dd, model, parent)
+{
+ Q_D(MBubbleItem);
+
+ d->init();
+}
+
+MBubbleItem::~MBubbleItem()
+{
+}
+
+MImageWidget* MBubbleItem::avatar() const
+{
+ return model()->avatar();
+}
+
+void MBubbleItem::setAvatar(MImageWidget* avatar)
+{
+ model()->setAvatar(avatar);
+}
+
+void MBubbleItem::setAvatar(const QPixmap &avatar)
+{
+ model()->beginTransaction();
+
+ if (!model()->avatar())
+ model()->setAvatar(new MImageWidget);
+
+ model()->avatar()->setPixmap(avatar);
+ model()->commitTransaction();
+}
+
+QString MBubbleItem::senderName()
+{
+ return model()->senderName();
+}
+
+void MBubbleItem::setSenderName(const QString &senderName)
+{
+ model()->setSenderName(senderName);
+}
+
+QString MBubbleItem::timeStamp()
+{
+ return model()->timeStamp();
+}
+
+void MBubbleItem::setTimeStamp(const QString &timeStamp)
+{
+ model()->setTimeStamp(timeStamp);
+}
+
+QString MBubbleItem::message()
+{
+ return model()->message();
+}
+
+void MBubbleItem::setMessage(const QString &message)
+{
+ model()->setMessage(message);
+}
+
+MBubbleItem::MessageType MBubbleItem::messageType() const
+{
+ return static_cast<MBubbleItem::MessageType>(model()->messageType());
+}
+
+void MBubbleItem::setMessageType(MessageType messageType)
+{
+ model()->beginTransaction();
+
+ if (messageType == MBubbleItem::Outgoing)
+ model()->setAvatar(NULL);
+
+ model()->setMessageType(messageType);
+ model()->commitTransaction();
+}
+
+void MBubbleItem::setCentralWidget(QGraphicsWidget* centralWidget)
+{
+ model()->setCentralWidget( centralWidget );
+}
+
+QGraphicsWidget* MBubbleItem::centralWidget()
+{
+ return model()->centralWidget();
+}
+
+QStack<QGraphicsWidget*> MBubbleItem::informationWidgets()
+{
+ return model()->informationWidgets();
+}
+
+void MBubbleItem::addInformationWidget(QGraphicsWidget* item)
+{
+ QStack<QGraphicsWidget*> stack = model()->informationWidgets();
+ stack.push(item);
+ model()->setInformationWidgets( stack );
+}
+
+QString MBubbleItem::commentsString()
+{
+ return model()->commentsString();
+}
+
+void MBubbleItem::setCommentsString(const QString &comments)
+{
+ model()->setCommentsString(comments);
+}
+
+QString MBubbleItem::thumbsUpString()
+{
+ return model()->thumbsUpString();
+}
+
+void MBubbleItem::setThumbsUpString(const QString &thumbsUp)
+{
+ model()->setThumbsUpString(thumbsUp);
+}
+
diff --git a/src/corelib/widgets/mbubbleitem.h b/src/corelib/widgets/mbubbleitem.h
new file mode 100644
index 00000000..939dd3eb
--- /dev/null
+++ b/src/corelib/widgets/mbubbleitem.h
@@ -0,0 +1,294 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef MBUBBLEITEM_H
+#define MBUBBLEITEM_H
+
+#include <MWidgetController>
+#include "mbubbleitemmodel.h"
+
+class MBubbleItemPrivate;
+class MImageWidget;
+
+/*!
+ \class MBubbleItem
+ \brief MBubbleItem is a speech bubble like widget for conversation views.
+
+ MBubbleItem, MListItem and MContentItem can usually be used for the same
+ type of purposes, however the MBubbleItem API is message-centric and therefore
+ better suited for messaging applications. When several bubble items are put into
+ a layout the visual impression is that of a back and forth conversation.
+
+ The speech bubble supports avatar images, separate styling for incoming and
+ outgoing messages, as well as an area for application specific widgets.
+*/
+class M_EXPORT MBubbleItem : public MWidgetController
+{
+ Q_OBJECT
+ M_CONTROLLER(MBubbleItem)
+
+public:
+
+ /*!
+ \property MBubbleItem::senderName
+ Name of the message sender.
+ */
+ Q_PROPERTY(QString senderName READ senderName WRITE setSenderName)
+
+ /*!
+ \property MBubbleItem::timeStamp
+ Time the message was sent, displayed as part of the bubble.
+ */
+ Q_PROPERTY(QString timeStamp READ timeStamp WRITE setTimeStamp)
+
+ /*!
+ \property MBubbleItem::message
+ The main body of the message.
+ */
+ Q_PROPERTY(QString message READ message WRITE setMessage)
+
+ /*!
+ \property MBubbleItem::commentsString
+ The number of comments received, displayed as part of the bubble.
+ */
+ Q_PROPERTY(QString commentsString READ commentsString WRITE setCommentsString)
+
+ /*!
+ \property MBubbleItem::thumbsUpString
+ The number of thumbs up received, displayed as part of the bubble.
+ */
+ Q_PROPERTY(QString thumbsUpString READ thumbsUpString WRITE setThumbsUpString)
+
+ /*!
+ The type determines if the message is incoming or outgoing, and the widget
+ may be styled differently based on this.
+ */
+ enum MessageType {
+ Incoming,
+ Outgoing
+ };
+
+public:
+
+ /*!
+ Constructs a MBubbleItem instance. The optional \a parent argument is passed to MWidgetController's constructor.
+ */
+ explicit MBubbleItem(QGraphicsItem *parent = 0);
+
+ /*!
+ Destroys the item.
+ */
+ virtual ~MBubbleItem();
+
+ /*!
+ Returns the image widget used for the avatar.
+
+ \sa setAvatar()
+ */
+ MImageWidget* avatar() const;
+
+ /*!
+ Returns the name of the message sender.
+
+ \sa setSenderName()
+ */
+ QString senderName();
+
+ /*!
+ Returns the time stamp string displayed as part of the bubble.
+
+ \sa setSenderName()
+ */
+ QString timeStamp();
+
+ /*!
+ Returns the body of the message.
+
+ \sa setMessage()
+ */
+ QString message();
+
+ /*!
+ Returns the type of the message.
+
+ \sa setMessageType()
+ */
+ MessageType messageType() const;
+
+ /*!
+ Returns the central widget.
+
+ For performance reasons, the central widget is not created by default.
+ If the central widget has not been previously set the function returns 0.
+
+ \sa setCentralWidget()
+ */
+ QGraphicsWidget* centralWidget();
+
+ /*!
+ Returns the stack of informational widgets attached to the bubble.
+
+ \sa addInformationWidget()
+ \sa setCommentsString()
+ \sa setThumbsUpString()
+ */
+ QStack<QGraphicsWidget*> informationWidgets();
+
+ /*!
+ Returns the string for the number of comments received for the bubble.
+
+ \sa setCommentsString();
+ */
+ QString commentsString();
+
+ /*!
+ Returns the string for the number of thumbs-up received for the bubble.
+
+ \sa setThumbsUpString()
+ */
+ QString thumbsUpString();
+
+Q_SIGNALS:
+ /*!
+ This signal is emitted if a link pointing to \a url in the message is clicked.
+
+ Links can be created using HTML notation, see the MLabel documentation for
+ further information.
+ */
+ void linkActivated(const QString &url);
+
+ /*!
+ This signal is emitted if the bubble that contains the message is clicked.
+ */
+ void bubbleClicked();
+
+public Q_SLOTS:
+
+ /**
+ Replaces the current avatar image widget attached to the bubble with \a avatar
+
+ \sa avatar()
+ */
+ void setAvatar(MImageWidget* avatar);
+
+ /*!
+ Sets the avatar image to display the \a pixmap
+
+ \sa avatar()
+ */
+ void setAvatar(const QPixmap &pixmap);
+
+ /**
+ Sets the name of the message sender to \a name
+
+ \sa senderName()
+ */
+ void setSenderName(const QString &name);
+
+ /**
+ Sets the time stamp string of the message to \a timeStamp
+
+ \sa timeStamp()
+ */
+ void setTimeStamp(const QString &timeStamp);
+
+ /**
+ Sets the body of the message to \a message
+
+ \sa message()
+ */
+ void setMessage(const QString &message);
+
+ /**
+ Sets type of the message (incoming or outgoing) to \a messageType.
+
+ \sa messageType()
+ */
+
+ void setMessageType(MessageType messageType);
+
+ /**
+ Sets the \a centralWidget
+
+ The central widget is the attachment point for application specific content
+ inside the bubble item.
+
+ Example:
+ \code
+ MBubbleItem *bubble = new MBubbleItem();
+ MWidget *container = new MWidget();
+ MImageWidget *image1 = new MImageWidget("foo");
+ MImageWidget *image2 = new MImageWidget("bar");
+ QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical, container);
+ layout->addItem(image1);
+ layout->addItem(image2);
+
+ bubble->setCentralWidget(container);
+ \endcode
+
+ \sa centralWidget()
+ */
+ void setCentralWidget(QGraphicsWidget* centralWidget);
+
+ /**
+ Adds the \a widget to the informational widgets stack.
+
+ Informational widgets are displayed as part of the message bubble main body.
+ There are two pre-defined information widgets for the bubble: number of comments and thumbs up received.
+
+ \sa informationWidgets()
+ \sa setCommentsString();
+ \sa setThumbsUpString();
+ */
+ void addInformationWidget(QGraphicsWidget* widget);
+
+ /**
+ Sets the string for number of comments received for the bubble item to \a comments.
+
+ This is a convenience method that creates widgets on the informationWidgets() stack
+ for showing the number of comments attached to the bubble item. An example of
+ a string could "+3", but it is up to the application to determine how the string
+ is formatted.
+
+ \sa commentsString()
+ */
+ void setCommentsString(const QString &comments);
+
+ /**
+ Sets the string for number of thumbs up received for the bubble item to \a thumbsUp
+
+ This is a convenience method that creates widgets on the informationWidgets() stack
+ for showing the number of "thumbs up" attached to the bubble item. An example of
+ a string could "+3", but it is up to the application to determine how the string
+ is formatted.
+
+ \sa thumbsUpString()
+ */
+ void setThumbsUpString(const QString &thumbsUp);
+
+private:
+ //! \internal
+ MBubbleItem(MBubbleItemPrivate *dd, MBubbleItemModel *model, QGraphicsItem *parent);
+ //! \internal_end
+
+ Q_DISABLE_COPY(MBubbleItem)
+ Q_DECLARE_PRIVATE(MBubbleItem)
+};
+
+#endif
diff --git a/src/corelib/widgets/mbubbleitem_p.h b/src/corelib/widgets/mbubbleitem_p.h
new file mode 100644
index 00000000..d7c3a772
--- /dev/null
+++ b/src/corelib/widgets/mbubbleitem_p.h
@@ -0,0 +1,38 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef MBUBBLEITEM_P_H__
+#define MBUBBLEITEM_P_H__
+
+#include "private/mwidgetcontroller_p.h"
+
+class MBubbleItem;
+
+class MBubbleItemPrivate : public MWidgetControllerPrivate
+{
+ Q_DECLARE_PUBLIC(MBubbleItem)
+
+public:
+ MBubbleItemPrivate();
+ virtual ~MBubbleItemPrivate();
+
+ void init();
+};
+
+#endif
diff --git a/src/corelib/widgets/mbubbleitemmodel.cpp b/src/corelib/widgets/mbubbleitemmodel.cpp
new file mode 100644
index 00000000..ab3c88b3
--- /dev/null
+++ b/src/corelib/widgets/mbubbleitemmodel.cpp
@@ -0,0 +1,20 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#include "mbubbleitemmodel.h"
diff --git a/src/corelib/widgets/mbubbleitemmodel.h b/src/corelib/widgets/mbubbleitemmodel.h
new file mode 100644
index 00000000..7b6d52ee
--- /dev/null
+++ b/src/corelib/widgets/mbubbleitemmodel.h
@@ -0,0 +1,91 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef MBUBBLEITEMMODEL_H__
+#define MBUBBLEITEMMODEL_H__
+
+#include <mwidgetmodel.h>
+#include <QStack>
+
+class QPixmap;
+class QGraphicsWidget;
+class MImageWidget;
+
+class M_EXPORT MBubbleItemModel : public MWidgetModel
+{
+ Q_OBJECT
+ M_MODEL_INTERNAL(MBubbleItemModel)
+
+public:
+ /*!
+ \property MBubbleItemModel::avatar
+ \brief Avatar.
+ */
+ M_MODEL_PTR_PROPERTY(MImageWidget *, avatar, Avatar, true, 0)
+
+ /*!
+ \property MBubbleItemModel::senderName
+ \brief Sender name.
+ */
+ M_MODEL_PROPERTY(QString, senderName, SenderName, true, QString())
+
+ /*!
+ \property MBubbleItemModel::timeStamp
+ \brief Timestamp.
+ */
+ M_MODEL_PROPERTY(QString, timeStamp, TimeStamp, true, QString())
+
+ /*!
+ \property MBubbleItemModel::message
+ \brief Message.
+ */
+ M_MODEL_PROPERTY(QString, message, Message, true, QString())
+
+ /*!
+ \property MBubbleItemModel::centralWidget
+ \brief CentralWidget.
+ */
+ M_MODEL_PTR_PROPERTY(QGraphicsWidget *, centralWidget, CentralWidget, true, NULL)
+
+ /*!
+ \property MBubbleItemModel::items
+ \brief Stack of items shown in the header, for example icons
+ */
+ M_MODEL_PROPERTY(QStack<QGraphicsWidget*>, informationWidgets, InformationWidgets, true, QStack<QGraphicsWidget*>())
+
+ /*!
+ \property MBubbleItemModel::type
+ \brief centralWidget.
+ */
+ M_MODEL_PTR_PROPERTY(int, messageType, MessageType, true, NULL)
+
+ /*!
+ \property MBubbleItemModel::commentsString
+ \brief Comment string.
+ */
+ M_MODEL_PROPERTY(QString, commentsString, CommentsString, true, QString())
+
+ /*!
+ \property MBubbleItemModel::thumbsUpString
+ \brief Thumbs up string.
+ */
+ M_MODEL_PROPERTY(QString, thumbsUpString, ThumbsUpString, true, QString())
+};
+
+#endif
diff --git a/src/corelib/widgets/mcontentitem.cpp b/src/corelib/widgets/mcontentitem.cpp
index c06b4e6e..ecc33971 100644
--- a/src/corelib/widgets/mcontentitem.cpp
+++ b/src/corelib/widgets/mcontentitem.cpp
@@ -69,6 +69,11 @@ QImage MContentItem::image() const
return d->image;
}
+QString MContentItem::imageID() const
+{
+ return model()->itemImageID();
+}
+
QString MContentItem::title() const
{
return model()->title();
@@ -103,11 +108,12 @@ void MContentItem::setImage(const QImage &image)
model()->setItemImage(d->image);
}
-void MContentItem::setImage(const QString &id)
+void MContentItem::setImageID(const QString &id, const QSize &size)
{
- Q_D(MContentItem);
- d->imageID = id;
- model()->setItemImageID(d->imageID);
+ model()->beginTransaction();
+ model()->setItemImageID(id);
+ model()->setItemImageSize(size);
+ model()->commitTransaction();
}
void MContentItem::setTitle(const QString &text)
@@ -153,6 +159,14 @@ void MContentItem::setOptionalImage(const QImage &image)
model()->setOptionalImage(d->optionalImage);
}
+void MContentItem::setOptionalImageID(const QString &id, const QSize &size)
+{
+ model()->beginTransaction();
+ model()->setOptionalImageID(id);
+ model()->setOptionalImageSize(size);
+ model()->commitTransaction();
+}
+
QPixmap MContentItem::optionalPixmap() const
{
Q_D(const MContentItem);
@@ -165,6 +179,11 @@ QImage MContentItem::optionalImage() const
return d->optionalImage;
}
+QString MContentItem::optionalImageID() const
+{
+ return model()->optionalImageID();
+}
+
void MContentItem::setAdditionalItem(MWidget* widget)
{
model()->setAdditionalItem(widget);
diff --git a/src/corelib/widgets/mcontentitem.h b/src/corelib/widgets/mcontentitem.h
index 7734375a..83b3dd8a 100644
--- a/src/corelib/widgets/mcontentitem.h
+++ b/src/corelib/widgets/mcontentitem.h
@@ -126,6 +126,12 @@ public:
Q_PROPERTY(QImage image READ image WRITE setImage)
/*!
+ \property MContentItem::imageID
+ \brief image from theme which will be displayed
+ */
+ Q_PROPERTY(QString imageID READ imageID WRITE setImageID)
+
+ /*!
\property MContentItem::title
\brief See MContentItemModel::title
*/
@@ -145,6 +151,12 @@ public:
Q_PROPERTY(QImage optionalImage READ optionalImage WRITE setOptionalImage)
+ /*!
+ \property MContentItem::optionalImage
+ \brief image from theme which will be displayed as "optional image"
+ */
+ Q_PROPERTY(QString optionalImageID READ optionalImageID WRITE setOptionalImageID)
+
public:
/*!
@@ -172,6 +184,12 @@ public:
QImage image() const;
/*!
+ \brief Get the thumbnail image theme-id
+ \return id
+ */
+ QString imageID() const;
+
+ /*!
\brief Get the title.
\return title text string.
*/
@@ -213,6 +231,12 @@ public:
*/
QImage optionalImage() const;
+ /*!
+ \brief Get the optional image theme-id
+ \return id
+ */
+ QString optionalImageID() const;
+
public Q_SLOTS:
/**
\brief Sets thumbnail pixmap.
@@ -229,8 +253,9 @@ public Q_SLOTS:
/**
\brief Sets thumbnail image.
\param id, image id in theme system.
+ \param size, requested size of the icon
*/
- void setImage(const QString &id);
+ void setImageID(const QString &id, const QSize &size = QSize());
/**
\brief Set title text. This is first line.
@@ -284,6 +309,13 @@ public Q_SLOTS:
*/
void setOptionalImage(const QImage& image);
+ /**
+ \brief Sets optional image (Icon).
+ \param id, image id in theme system.
+ \param s, requested size of the icon
+ */
+ void setOptionalImageID(const QString &id, const QSize &s = QSize());
+
/*!
\brief Makes content item to send clicked() signal.
*/
diff --git a/src/corelib/widgets/mcontentitem_p.h b/src/corelib/widgets/mcontentitem_p.h
index 0f9c4be4..65f81a74 100644
--- a/src/corelib/widgets/mcontentitem_p.h
+++ b/src/corelib/widgets/mcontentitem_p.h
@@ -33,7 +33,6 @@ public:
QPixmap pixmap;
QImage image;
- QString imageID;
QPixmap optionalPixmap;
QImage optionalImage;
MLabel* smallText;
diff --git a/src/corelib/widgets/mcontentitemmodel.h b/src/corelib/widgets/mcontentitemmodel.h
index 6a182ac5..4e852bd6 100644
--- a/src/corelib/widgets/mcontentitemmodel.h
+++ b/src/corelib/widgets/mcontentitemmodel.h
@@ -75,11 +75,25 @@ public:
*/
M_MODEL_PROPERTY(QImage, itemImage, ItemImage, false, QImage())
- M_MODEL_PROPERTY(QImage, itemQImage, ItemQImage, false, QImage())
+ /*!
+ \property MContentItemModel::itemImageID
+ \brief Item thumbnail theme ID.
+ \sa MContentItemView
+ */
M_MODEL_PROPERTY(QString, itemImageID, ItemImageID, true, QString())
/*!
+ \property MContentItemModel::itemImageSize
+ \brief Contains size of the thumbnail (set thumbnail from theme using itemImageID).
+
+ \sa MContentItemView
+ */
+ M_MODEL_PROPERTY(QSize, itemImageSize, ItemImageSize, true, QSize())
+
+ M_MODEL_PROPERTY(QImage, itemQImage, ItemQImage, false, QImage())
+
+ /*!
\property MContentItemModel::selected
\brief Contains selection status of item.
*/
@@ -98,6 +112,22 @@ public:
M_MODEL_PROPERTY(QImage, optionalImage, OptionalImage, false, QImage())
/*!
+ \property MContentItemModel::optionalImageID
+ \brief Contains theme ID of optional icon on the right-hand side.
+
+ \sa MContentItemView
+ */
+ M_MODEL_PROPERTY(QString, optionalImageID, OptionalImageID, true, QString())
+
+ /*!
+ \property MContentItemModel::optionalImageSize
+ \brief Contains size of the optional icon (set optional icon from theme with optionalImageID).
+
+ \sa MContentItemView
+ */
+ M_MODEL_PROPERTY(QSize, optionalImageSize, OptionalImageSize, true, QSize())
+
+ /*!
\property MContentItemModel::additionalItem
\brief MWidget as e.g. progress bar, visible below the title.
In case there is already a subtitle it will be replaced.
diff --git a/src/corelib/widgets/mlabel.cpp b/src/corelib/widgets/mlabel.cpp
index 8e7d04e1..e4c3dfdc 100644
--- a/src/corelib/widgets/mlabel.cpp
+++ b/src/corelib/widgets/mlabel.cpp
@@ -32,13 +32,11 @@ M_REGISTER_WIDGET(MLabel)
MLabel::MLabel(QGraphicsItem *parent, MLabelModel *model) :
MWidgetController(new MLabelPrivate, model == NULL ? new MLabelModel : model, parent)
{
- grabGesture(Qt::TapAndHoldGesture);
}
MLabel::MLabel(QString const &text, QGraphicsItem *parent) :
MWidgetController(new MLabelPrivate, new MLabelModel, parent)
{
- grabGesture(Qt::TapAndHoldGesture);
setText(text);
}
diff --git a/src/corelib/widgets/mlist.cpp b/src/corelib/widgets/mlist.cpp
index decec0f3..fea4b469 100644
--- a/src/corelib/widgets/mlist.cpp
+++ b/src/corelib/widgets/mlist.cpp
@@ -29,16 +29,18 @@
#include "mlist_p.h"
#include "mlabel.h"
#include "mpannableviewport.h"
+#include "mlistfilter.h"
#include "mwidgetcreator.h"
M_REGISTER_WIDGET(MList)
- MListPrivate::MListPrivate() : selectionMode(MList::NoSelection)
+MListPrivate::MListPrivate() : selectionMode(MList::NoSelection)
{
}
MListPrivate::~MListPrivate()
{
+ delete listFilter;
}
void MListPrivate::init()
@@ -47,6 +49,8 @@ void MListPrivate::init()
q->setSelectionMode(MList::NoSelection);
q->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); //grow to available space in both directions
+ listFilter = new MListFilter(q);
+ listFilter->setEnabled(false);
}
MList::MList(MListPrivate *dd, MListModel *model, QGraphicsItem *parent)
@@ -88,6 +92,10 @@ void MList::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
void MList::setItemModel(QAbstractItemModel *itemModel)
{
+ Q_D(MList);
+ if(d->listFilter->enabled())
+ itemModel = d->listFilter->updateItemModel(itemModel);
+
setSelectionModel(NULL);
if (itemModel)
@@ -229,3 +237,17 @@ MList::SelectionMode MList::selectionMode() const
Q_D(const MList);
return d->selectionMode;
}
+
+MListFilter *MList::filtering() const
+{
+ Q_D(const MList);
+ return d->listFilter;
+}
+
+void MList::keyPressEvent(QKeyEvent *event)
+{
+ Q_D(MList);
+
+ if(d->listFilter->enabled())
+ d->listFilter->keyPressEvent(event);
+}
diff --git a/src/corelib/widgets/mlist.h b/src/corelib/widgets/mlist.h
index f525db0a..91a8cd77 100644
--- a/src/corelib/widgets/mlist.h
+++ b/src/corelib/widgets/mlist.h
@@ -31,6 +31,7 @@ class QItemSelectionModel;
class QAbstractItemModel;
class QModelIndex;
class MCellCreator;
+class MListFilter;
/*!
\class MList
@@ -319,6 +320,11 @@ public:
*/
bool indexVisible();
+ /*!
+ \return filter which implements live filtering of list contents.
+ */
+ MListFilter *filtering() const;
+
public Q_SLOTS:
/*!
\brief Convenience function - Select the given item.
@@ -392,6 +398,11 @@ protected:
*/
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
+ /*!
+ Handling of key events
+ */
+ virtual void keyPressEvent(QKeyEvent *event);
+
private:
Q_DECLARE_PRIVATE(MList)
Q_DISABLE_COPY(MList)
diff --git a/src/corelib/widgets/mlist_p.h b/src/corelib/widgets/mlist_p.h
index fcd917dc..829e556e 100644
--- a/src/corelib/widgets/mlist_p.h
+++ b/src/corelib/widgets/mlist_p.h
@@ -32,6 +32,7 @@
class MPannableViewport;
class MWidget;
+class MListFilter;
#include "mlist.h"
@@ -48,6 +49,7 @@ public:
MList::SelectionMode selectionMode;
+ MListFilter* listFilter;
public slots:
/*!
* \brief This slot is called when items are changed in the model. The changed items are those
diff --git a/src/corelib/widgets/mlistfilter.cpp b/src/corelib/widgets/mlistfilter.cpp
new file mode 100644
index 00000000..828d8ba0
--- /dev/null
+++ b/src/corelib/widgets/mlistfilter.cpp
@@ -0,0 +1,167 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#include "mlistfilter.h"
+#include "mlistfilter_p.h"
+
+#include <MList>
+#include <MTextEdit>
+#include <MPannableViewport>
+
+#include <QKeyEvent>
+#include <QPointF>
+#include <MSortFilterProxyModel>
+
+MListFilterPrivate::MListFilterPrivate()
+: cachedPannableViewport(NULL), q_ptr(NULL)
+{
+}
+
+MListFilterPrivate::~MListFilterPrivate()
+{
+}
+
+void MListFilterPrivate::init()
+{
+ Q_Q(MListFilter);
+ connect(q->list, SIGNAL(panningStarted()), this, SLOT(panningStarted()));
+}
+
+void MListFilterPrivate::panningStarted()
+{
+ // When list's pannable viewport can be resolved for the first time,
+ // connect a signal to get viewport position changes
+ if(!cachedPannableViewport && pannableViewport()) {
+ MPannableViewport* viewport = pannableViewport();
+ connect(viewport, SIGNAL(positionChanged(QPointF)), this, SLOT(viewportPositionChanged(QPointF)));
+ }
+ panningStartPos = viewportPos;
+}
+
+void MListFilterPrivate::viewportPositionChanged(const QPointF& pos)
+{
+ Q_Q(MListFilter);
+
+ viewportPos = pos;
+ if(q->filteringEnabled && viewportPos.y() < 0 && panningStartPos.y() == 0) {
+ emit q->listPannedUpFromTop();
+ }
+}
+
+MPannableViewport* MListFilterPrivate::pannableViewport()
+{
+ Q_Q(MListFilter);
+
+ if(!cachedPannableViewport) {
+ QGraphicsWidget* parentWidget = q->list->parentWidget();
+ while(parentWidget && !cachedPannableViewport) {
+ cachedPannableViewport = qobject_cast<MPannableViewport*>(parentWidget);
+ parentWidget = parentWidget->parentWidget();
+ }
+ }
+ return cachedPannableViewport;
+}
+
+MListFilter::MListFilter(MList *parent)
+: list(parent), filterEditor(NULL), filterProxy(NULL), filteringEnabled(false), d_ptr(new MListFilterPrivate)
+{
+ Q_D(MListFilter);
+
+ d->q_ptr = this;
+ d->init();
+
+ filterProxy = new MSortFilterProxyModel(parent);
+ filterEditor = new MTextEdit(MTextEditModel::SingleLine, "", parent);
+ filterEditor->setVisible(false);
+
+ connect(filterEditor, SIGNAL(textChanged()), this, SLOT(editorTextChanged()));
+}
+
+MListFilter::~MListFilter()
+{
+}
+
+void MListFilter::setEnabled(bool enabled)
+{
+ filteringEnabled = enabled;
+
+ if(enabled) {
+ filterProxy->setSourceModel(list->itemModel());
+ list->setItemModel(filterProxy);
+ list->setFlag(QGraphicsItem::ItemIsFocusable, true);
+ list->setFocusPolicy(Qt::StrongFocus);
+ list->setFocus();
+ } else {
+ list->setFlag(QGraphicsItem::ItemIsFocusable, false);
+ if(filterProxy->sourceModel())
+ list->setItemModel(filterProxy->sourceModel());
+ filterProxy->setSourceModel(NULL);
+ }
+}
+
+QAbstractItemModel* MListFilter::updateItemModel(QAbstractItemModel *itemModel)
+{
+ QAbstractItemModel* proxyModel = itemModel;
+ if(filteringEnabled && itemModel != filterProxy) {
+ filterProxy->setSourceModel(itemModel);
+ proxyModel = filterProxy;
+ }
+ return proxyModel;
+}
+
+bool MListFilter::enabled()
+{
+ return filteringEnabled;
+}
+
+MTextEdit *MListFilter::editor() const
+{
+ return filterEditor;
+}
+
+MSortFilterProxyModel *MListFilter::proxy() const
+{
+ return filterProxy;
+}
+
+void MListFilter::setFilterRole(int role)
+{
+ filterProxy->setFilterRole(role);
+}
+
+int MListFilter::filterRole() const
+{
+ return filterProxy->filterRole();
+}
+
+void MListFilter::keyPressEvent(QKeyEvent *event)
+{
+ if(filteringEnabled && event->text()[0].isPrint()) {
+ filterEditor->insert(event->text());
+ filterEditor->setFocus();
+ }
+}
+
+void MListFilter::editorTextChanged()
+{
+ QRegExp::PatternSyntax syntax = QRegExp::RegExp;
+ Qt::CaseSensitivity caseSensitivity = Qt::CaseSensitive;
+ QRegExp regExp(filterEditor->text(), caseSensitivity, syntax);
+ filterProxy->setFilterRegExp(regExp);
+}
diff --git a/src/corelib/widgets/mlistfilter.h b/src/corelib/widgets/mlistfilter.h
new file mode 100644
index 00000000..a6ab86f2
--- /dev/null
+++ b/src/corelib/widgets/mlistfilter.h
@@ -0,0 +1,127 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef MLISTFILTER_H
+#define MLISTFILTER_H
+
+#include <QObject>
+#include "mexport.h"
+
+class MListFilterPrivate;
+class MList;
+class MTextEdit;
+class MSortFilterProxyModel;
+class QAbstractItemModel;
+class QKeyEvent;
+
+/*!
+ * \class MListFilter
+ * \brief MListFilter implements live filtering, for searching through the list content.
+ *
+ * MListFilter creates a text editor and an item proxy model to be used to filter MList items.
+ * Application is responsible of putting the text editor into layout.
+ *
+ */
+class M_EXPORT MListFilter : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ /*!
+ * \brief Default constructor. Constructs the list filter.
+ * \param parent The list controller of the list filter content.
+ */
+ MListFilter(MList *parent = NULL);
+
+ /*!
+ * \brief Default destructor. Cleanups and destroys the list filter.
+ */
+ virtual ~MListFilter();
+
+ /*!
+ * \brief Sets live filtering to enabled or disabled. When
+ * live filtering is enabled list uses QSortFilterProxyModel
+ * as item model. By default live filtering is disabled.
+ */
+ void setEnabled(bool enabled);
+
+ /*!
+ * \return <code>true</code> if live filtering is enabled, otherwise false
+ */
+ bool enabled();
+
+ /*!
+ * \return text editor used in live filtering
+ */
+ MTextEdit *editor() const;
+
+ /*!
+ * \return proxy model used in live filtering
+ */
+ MSortFilterProxyModel *proxy() const;
+
+ /*!
+ * \brief Sets filter role to be used in live filtering proxy. Default is Qt::DisplayRole
+ */
+ void setFilterRole(int role);
+
+ /*!
+ * \return filter role used in live filtering proxy. Default is Qt::DisplayRole
+ */
+ int filterRole() const;
+
+ /*!
+ * \brief Handling of key events - used to pass key presses to text editor when
+ * live filtering is enabled
+ */
+ void keyPressEvent(QKeyEvent *event);
+
+public Q_SLOTS:
+
+ /*!
+ * \brief Handles text changes in live filtering text editor. Updates live filtering
+ * model regular expression.
+ */
+ void editorTextChanged();
+
+Q_SIGNALS:
+
+ /*!
+ * \brief Emitted when list is panned up starting from top position. This signal can
+ * be used in applications as a starter for list filtering with virtual keyboard.
+ */
+ void listPannedUpFromTop();
+
+protected:
+ QAbstractItemModel *updateItemModel(QAbstractItemModel* itemModel);
+
+private:
+ Q_DISABLE_COPY(MListFilter)
+ Q_DECLARE_PRIVATE(MListFilter)
+ friend class MList;
+
+ MList *list;
+ MTextEdit *filterEditor;
+ MSortFilterProxyModel *filterProxy;
+ bool filteringEnabled;
+ MListFilterPrivate *d_ptr;
+};
+
+#endif
diff --git a/src/corelib/widgets/mlistfilter_p.h b/src/corelib/widgets/mlistfilter_p.h
new file mode 100644
index 00000000..05078ed4
--- /dev/null
+++ b/src/corelib/widgets/mlistfilter_p.h
@@ -0,0 +1,53 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef MLISTFILTER_P_H
+#define MLISTFILTER_P_H
+
+#include <QObject>
+#include <QPointF>
+#include "mlistfilter.h"
+
+class MPannableViewport;
+
+class MListFilterPrivate : public QObject
+{
+ Q_OBJECT
+ Q_DECLARE_PUBLIC(MListFilter)
+
+public:
+ MListFilterPrivate();
+ virtual ~MListFilterPrivate();
+ void init();
+
+public Q_SLOTS:
+ void panningStarted();
+ void viewportPositionChanged(const QPointF& pos);
+
+private:
+ MPannableViewport* pannableViewport();
+
+private:
+ QPointF viewportPos;
+ QPointF panningStartPos;
+ MPannableViewport *cachedPannableViewport;
+ MListFilter *q_ptr;
+};
+
+#endif
diff --git a/src/corelib/widgets/mlistitem.cpp b/src/corelib/widgets/mlistitem.cpp
new file mode 100644
index 00000000..1c58f913
--- /dev/null
+++ b/src/corelib/widgets/mlistitem.cpp
@@ -0,0 +1,51 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#include "mlistitem.h"
+#include "mlistitem_p.h"
+
+#include "mwidgetcreator.h"
+
+M_REGISTER_WIDGET(MListItem)
+
+MListItemPrivate::MListItemPrivate()
+ : MWidgetControllerPrivate()
+{
+}
+
+MListItemPrivate::~MListItemPrivate()
+{
+}
+
+MListItem::MListItem(QGraphicsItem *parent)
+ : MWidgetController(new MListItemPrivate, new MListItemModel, parent)
+{
+}
+
+MListItem::~MListItem()
+{
+}
+
+void MListItem::click()
+{
+ emit clicked();
+}
+
+
+
diff --git a/src/corelib/widgets/mlistitem.h b/src/corelib/widgets/mlistitem.h
new file mode 100644
index 00000000..61d28c35
--- /dev/null
+++ b/src/corelib/widgets/mlistitem.h
@@ -0,0 +1,72 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef MLISTITEM_H
+#define MLISTITEM_H
+
+#include <MWidgetController>
+
+#include "mlistitemmodel.h"
+
+class MLayout;
+class MListItemPrivate;
+
+/*!
+ \class MListItem
+ \brief MListItem is a simple widget for displaying content with basic functionality
+ like background rendering with differend object modes.
+
+ \ingroup widgets
+
+ \sa MListItemView
+*/
+class M_EXPORT MListItem : public MWidgetController
+{
+ Q_OBJECT
+ M_CONTROLLER(MListItem)
+
+public:
+ /*!
+ \brief Constructs a MListItem with a \a parent.
+ \param parent Parent object.
+ */
+ MListItem(QGraphicsItem *parent = 0);
+ /*!
+ \brief Destructor.
+ */
+ virtual ~MListItem();
+
+public Q_SLOTS:
+ /*!
+ \brief Makes the list cell to send clicked() signal.
+ */
+ void click();
+
+Q_SIGNALS:
+ /*!
+ \brief The signal is emitted when the list cell is clicked.
+ */
+ void clicked();
+
+private:
+ Q_DECLARE_PRIVATE(MListItem)
+ Q_DISABLE_COPY(MListItem)
+};
+
+#endif // MLISTITEM_H
diff --git a/src/corelib/widgets/mlistitem_p.h b/src/corelib/widgets/mlistitem_p.h
new file mode 100644
index 00000000..5f71dbc9
--- /dev/null
+++ b/src/corelib/widgets/mlistitem_p.h
@@ -0,0 +1,37 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef MLISTITEM_P_H
+#define MLISTITEM_P_H
+
+#include <mwidgetcontroller_p.h>
+
+#include "mlistitem.h"
+
+class MListItemPrivate : MWidgetControllerPrivate
+{
+public:
+ MListItemPrivate();
+ virtual ~MListItemPrivate();
+
+private:
+ Q_DECLARE_PUBLIC(MListItem)
+};
+
+#endif // MLISTITEM_P_H
diff --git a/src/corelib/widgets/mlistitemmodel.h b/src/corelib/widgets/mlistitemmodel.h
new file mode 100644
index 00000000..22bc3237
--- /dev/null
+++ b/src/corelib/widgets/mlistitemmodel.h
@@ -0,0 +1,30 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef MLISTITEMMODEL_H
+#define MLISTITEMMODEL_H
+
+#include <MWidgetModel>
+
+class M_EXPORT MListItemModel : public MWidgetModel
+{
+ M_MODEL(MListItemModel)
+};
+
+#endif // MLISTITEMMODEL_H
diff --git a/src/corelib/widgets/mnavigationbar.h b/src/corelib/widgets/mnavigationbar.h
index f77dc922..df53674d 100644
--- a/src/corelib/widgets/mnavigationbar.h
+++ b/src/corelib/widgets/mnavigationbar.h
@@ -56,7 +56,7 @@ public:
virtual ~MNavigationBar();
/**
- * Returns the iconID of the icon of the view menu button.
+ * Returns the iconID of the icon of the application menu button.
*/
QString viewMenuIconID() const;
@@ -90,7 +90,7 @@ public Q_SLOTS:
void setViewMenuDescription(const QString &text);
/**
- * Sets the new icon of the view menu button.
+ * Sets the new icon of the application menu button.
* \param the id of the icon that should be shown.
*/
void setViewMenuIconID(const QString &id);
diff --git a/src/corelib/widgets/mpannableviewport.cpp b/src/corelib/widgets/mpannableviewport.cpp
index ac15bcb6..fc789a9a 100644
--- a/src/corelib/widgets/mpannableviewport.cpp
+++ b/src/corelib/widgets/mpannableviewport.cpp
@@ -361,6 +361,21 @@ void MPannableViewport::updateGeometry()
MPannableWidget::updateGeometry();
}
+void MPannableViewport::updateData(const QList<const char *> &modifications)
+{
+ Q_D(MPannableViewport);
+ const char *member;
+
+ foreach(member, modifications) {
+ if (member == MPannableWidgetModel::Enabled) {
+ if (isEnabled())
+ d->viewportLayout->setPanningDirections(panDirection());
+ else
+ d->viewportLayout->setPanningDirections(0);
+ }
+ }
+}
+
void MPannableViewport::setPositionIndicator(MPositionIndicator *positionIndicator)
{
Q_D(MPannableViewport);
diff --git a/src/corelib/widgets/mpannableviewport.h b/src/corelib/widgets/mpannableviewport.h
index dfcaf680..d345e7f3 100644
--- a/src/corelib/widgets/mpannableviewport.h
+++ b/src/corelib/widgets/mpannableviewport.h
@@ -168,6 +168,7 @@ public:
void setPanDirection(const Qt::Orientations &panDirection);
void resizeEvent(QGraphicsSceneResizeEvent *event);
void updateGeometry();
+ void updateData(const QList<const char *> &modifications);
//! \reimp_end
Q_SIGNALS:
diff --git a/src/corelib/widgets/mpannableviewportlayout.cpp b/src/corelib/widgets/mpannableviewportlayout.cpp
index c56b5a82..f3e54bff 100644
--- a/src/corelib/widgets/mpannableviewportlayout.cpp
+++ b/src/corelib/widgets/mpannableviewportlayout.cpp
@@ -53,11 +53,13 @@ void MPannableViewportLayout::setGeometry(const QRectF &rect)
if (pannedWidget) {
if (panningDirections.testFlag(Qt::Horizontal)) {
- unboundedRect.setWidth(pannedWidget->effectiveSizeHint(Qt::PreferredSize).width());
+ qreal width = qMax(rect.width(), pannedWidget->effectiveSizeHint(Qt::PreferredSize).width());
+ unboundedRect.setWidth(width);
}
if (panningDirections.testFlag(Qt::Vertical)) {
- unboundedRect.setHeight(pannedWidget->effectiveSizeHint(Qt::PreferredSize).height());
+ qreal height = qMax(rect.height(), pannedWidget->effectiveSizeHint(Qt::PreferredSize).height());
+ unboundedRect.setHeight(height);
}
}
diff --git a/src/corelib/widgets/mpannablewidget.cpp b/src/corelib/widgets/mpannablewidget.cpp
index 441bb13d..8f273630 100644
--- a/src/corelib/widgets/mpannablewidget.cpp
+++ b/src/corelib/widgets/mpannablewidget.cpp
@@ -180,8 +180,6 @@ MPannableWidgetPrivate::~MPannableWidgetPrivate()
void MPannableWidgetPrivate::translateEventToItemCoordinates(const QGraphicsItem *srcItem, const QGraphicsItem *destItem, QGraphicsSceneMouseEvent *event)
{
- //we only handle left button here. Every other buttons are filtered out in the glassMousePressEvents();
- event->setButtonDownPos(Qt::LeftButton, destItem->mapFromItem(srcItem, event->buttonDownPos(Qt::LeftButton)));
event->setLastPos(destItem->mapFromItem(srcItem, event->lastPos()));
event->setPos(destItem->mapFromItem(srcItem, event->pos()));
}
@@ -189,6 +187,13 @@ void MPannableWidgetPrivate::translateEventToItemCoordinates(const QGraphicsItem
void MPannableWidgetPrivate::deliverPressEvent()
{
Q_Q(MPannableWidget);
+
+ if (physics->inMotion())
+ {
+ physics->stop();
+ return;
+ }
+
glass->ungrabMouse();
q->resendEvent(&pressEvent);
mouseGrabber = q->scene()->mouseGrabberItem();
@@ -405,14 +410,7 @@ void MPannableWidget::glassMousePressEvent(QGraphicsSceneMouseEvent *event)
}
copyGraphicsSceneMouseEvent(d->pressEvent, *event);
- if (!d->physics->inMotion()) {
- // sending it now, we will send "cancel" if it will be needed.
- copyGraphicsSceneMouseEvent(d->pressEvent, *event);
- d->initialPressStartTimer();
-
- } else {
- d->physics->stop();
- }
+ d->initialPressStartTimer();
}
void MPannableWidget::glassMouseReleaseEvent(QGraphicsSceneMouseEvent *event)
@@ -467,8 +465,9 @@ void MPannableWidget::glassPanEvent(QGestureEvent *event, QPanGesture* panGestur
d->mouseGrabber = 0;
}
- d->physics->pointerPress(d->pressEvent.pos() + panGesture->offset());
- break;
+ d->physics->pointerPress(d->pressEvent.pos());
+ //Fallthough is intentionary, we need to handle the movement that
+ //is delivered with a started gesture.
case Qt::GestureUpdated:
d->physics->pointerMove(d->pressEvent.pos() + panGesture->offset());
break;
diff --git a/src/corelib/widgets/mphysics2dpanning.cpp b/src/corelib/widgets/mphysics2dpanning.cpp
index d3d3bfc8..77b3cfd2 100644
--- a/src/corelib/widgets/mphysics2dpanning.cpp
+++ b/src/corelib/widgets/mphysics2dpanning.cpp
@@ -23,9 +23,7 @@
#include "mphysics2dpanning.h"
#include "mphysics2dpanning_p.h"
-static const int PanningTimelineDuration = 1000000; /* in ms */
-static const int PanningTimelineInterval = 20; /* in ms */
-static const int PositionNoiseDampingDelta = 2; /* in px */
+static const int PositionNoiseDampingDelta = 2; /* in px */
MPhysics2DPanningPrivate::MPhysics2DPanningPrivate(MPhysics2DPanning *publicObject) :
enabled(true),
@@ -37,8 +35,7 @@ MPhysics2DPanningPrivate::MPhysics2DPanningPrivate(MPhysics2DPanning *publicObje
pointerSpringX(0.0),
pointerSpringY(0.0),
sceneLastPos(QPointF()),
- timeLine(new QTimeLine()),
- currFrame(0),
+ panningAnimation(new PanningAnimation),
pointerPressed(false),
pointerSpringK(0.0),
frictionC(0.0),
@@ -53,75 +50,68 @@ MPhysics2DPanningPrivate::MPhysics2DPanningPrivate(MPhysics2DPanning *publicObje
MPhysics2DPanningPrivate::~MPhysics2DPanningPrivate()
{
- delete timeLine;
+ delete panningAnimation;
}
-void MPhysics2DPanningPrivate::_q_integrator(int frame)
+void MPhysics2DPanningPrivate::_q_integrator(const QVariant &value)
{
Q_Q(MPhysics2DPanning);
+ Q_UNUSED(value);
qreal accX, accY;
qreal tempPosX;
qreal tempPosY;
- int i = 0;
tempPosX = posX;
tempPosY = posY;
- while (frame > currFrame) {
- if (panDirection.testFlag(Qt::Horizontal)) {
- q->integrateAxis(Qt::Horizontal,
- posX,
- velX,
- accX,
- pointerSpringX,
- pointerPressed
- );
- } else {
- posX = 0.0;
- velX = 0.0;
- accX = 0.0;
- }
+ if (panDirection.testFlag(Qt::Horizontal)) {
+ q->integrateAxis(Qt::Horizontal,
+ posX,
+ velX,
+ accX,
+ pointerSpringX,
+ pointerPressed
+ );
+ } else {
+ posX = 0.0f;
+ velX = 0.0f;
+ accX = 0.0f;
+ }
- if (panDirection.testFlag(Qt::Vertical)) {
- q->integrateAxis(Qt::Vertical,
- posY,
- velY,
- accY,
- pointerSpringY,
- pointerPressed
- );
+ if (panDirection.testFlag(Qt::Vertical)) {
+ q->integrateAxis(Qt::Vertical,
+ posY,
+ velY,
+ accY,
+ pointerSpringY,
+ pointerPressed
+ );
- } else {
- posY = 0.0;
- velY = 0.0;
- accY = 0.0;
- }
+ } else {
+ posY = 0.0f;
+ velY = 0.0f;
+ accY = 0.0f;
+ }
- // Checking if the viewport is currently dragged beyond it's borders and the integration should
- // continue even though the speed is low.
- bool inRangeX = (panDirection.testFlag(Qt::Horizontal) == false) ||
- (posX >= range.left() && posX <= range.right());
+ // Checking if the viewport is currently dragged beyond it's borders and the integration should
+ // continue even though the speed is low.
+ bool inRangeX = (panDirection.testFlag(Qt::Horizontal) == false) ||
+ (posX >= range.left() && posX <= range.right());
- bool inRangeY = (panDirection.testFlag(Qt::Vertical) == false) ||
- (posY >= range.top() && posY <= range.bottom());
+ bool inRangeY = (panDirection.testFlag(Qt::Vertical) == false) ||
+ (posY >= range.top() && posY <= range.bottom());
// Integration stop condition.
- if (inRangeX && inRangeY &&
- qAbs(accX) < 1 &&
- qAbs(accY) < 1 &&
- qAbs(velX) < 1 &&
- qAbs(velY) < 1 &&
- !pointerPressed) {
- timeLine->stop();
-
- emit q->panningStopped();
-
- break;
- }
-
- currFrame++;
- i++;
+ if (inRangeX && inRangeY &&
+ qAbs(accX) < 1 &&
+ qAbs(accY) < 1 &&
+ qAbs(velX) < 1 &&
+ qAbs(velY) < 1 &&
+ !pointerPressed) {
+ panningAnimation->stop();
+
+ emit q->panningStopped();
}
if (tempPosX != posX || tempPosY != posY) {
@@ -134,8 +124,7 @@ MPhysics2DPanning::MPhysics2DPanning(QObject *parent)
d_ptr(new MPhysics2DPanningPrivate(this))
{
Q_D(MPhysics2DPanning);
- connect(d->timeLine, SIGNAL(frameChanged(int)),
- this, SLOT(_q_integrator(int)));
+ connect(d->panningAnimation, SIGNAL(valueChanged(QVariant)), SLOT(_q_integrator(QVariant)));
}
@@ -221,20 +210,20 @@ void MPhysics2DPanning::start()
{
Q_D(MPhysics2DPanning);
if (!inMotion()) {
- d->velX = 0.0;
- d->velY = 0.0;
-
- d->timeLine->setDuration(PanningTimelineDuration);
- d->timeLine->setUpdateInterval(PanningTimelineInterval);
- d->timeLine->setFrameRange(0, 29999);
- d->timeLine->setCurrentTime(0);
- d->timeLine->setCurveShape(QTimeLine::LinearCurve);
- d->currFrame = 0;
- d->timeLine->start();
+ d->velX = 0.0f;
+ d->velY = 0.0f;
+
+ // Duration does not matter as we loop until the physics termination condition is hit
+ d->panningAnimation->setDuration(1000000);
+ d->panningAnimation->setLoopCount(-1);
+
+ d->panningAnimation->setStartValue(0.0f);
+ d->panningAnimation->setEndValue(1.0f);
+
+ d->panningAnimation->start();
}
}
-
void MPhysics2DPanning::stop()
{
Q_D(MPhysics2DPanning);
@@ -248,7 +237,7 @@ void MPhysics2DPanning::stop()
(d->posY >= d->range.top() && d->posY <= d->range.bottom());
if (inRangeX && inRangeY) {
- d->timeLine->stop();
+ d->panningAnimation->stop();
emit panningStopped();
}
}
@@ -320,7 +309,7 @@ bool MPhysics2DPanning::inMotion() const
{
Q_D(const MPhysics2DPanning);
- return (d->timeLine->state() == QTimeLine::Running);
+ return (d->panningAnimation->state() == QAbstractAnimation::Running);
}
@@ -334,8 +323,8 @@ void MPhysics2DPanning::pointerPress(const QPointF &pos)
d->pointerPressed = true;
d->sceneLastPos = pos;
- d->pointerSpringX = 0.0;
- d->pointerSpringY = 0.0;
+ d->pointerSpringX = 0.0f;
+ d->pointerSpringY = 0.0f;
}
@@ -466,11 +455,11 @@ void MPhysics2DPanning::integrateAxis(Qt::Orientation orientation,
} else {
- acceleration = force;
+ acceleration = force - pointerDifference;
velocity += acceleration;
position += velocity;
- pointerDifference += velocity;
+ pointerDifference = 0;
}
}
diff --git a/src/corelib/widgets/mphysics2dpanning.h b/src/corelib/widgets/mphysics2dpanning.h
index a4955c15..0ae9d4b5 100644
--- a/src/corelib/widgets/mphysics2dpanning.h
+++ b/src/corelib/widgets/mphysics2dpanning.h
@@ -277,7 +277,7 @@ private:
Q_DISABLE_COPY(MPhysics2DPanning)
Q_DECLARE_PRIVATE(MPhysics2DPanning)
- Q_PRIVATE_SLOT(d_func(),void _q_integrator(int))
+ Q_PRIVATE_SLOT(d_func(),void _q_integrator(QVariant))
#ifdef UNIT_TEST
//! Test unit is defined as a friend of production code to access private members
diff --git a/src/corelib/widgets/mphysics2dpanning_p.h b/src/corelib/widgets/mphysics2dpanning_p.h
index 0c328eab..318c8c44 100644
--- a/src/corelib/widgets/mphysics2dpanning_p.h
+++ b/src/corelib/widgets/mphysics2dpanning_p.h
@@ -22,10 +22,16 @@
#include <QRectF>
#include <QPointF>
+#include <QVariantAnimation>
#include "mphysics2dpanning.h"
class QTimeLine;
+class PanningAnimation : public QVariantAnimation
+{
+ virtual void updateCurrentValue(const QVariant&) {}
+};
+
class MPhysics2DPanningPrivate
{
Q_DECLARE_PUBLIC(MPhysics2DPanning)
@@ -45,8 +51,7 @@ public:
qreal pointerSpringY;
QPointF sceneLastPos;
- QTimeLine *timeLine;
- int currFrame;
+ PanningAnimation *panningAnimation;
// Integration algorithm constants
bool pointerPressed;
@@ -57,7 +62,7 @@ public:
qreal borderFrictionC;
Qt::Orientations panDirection;
- void _q_integrator(int frame);
+ void _q_integrator(const QVariant &value);
protected:
MPhysics2DPanning *q_ptr;
diff --git a/src/corelib/widgets/mprogressindicator.h b/src/corelib/widgets/mprogressindicator.h
index c07589d2..6c0d3bd2 100644
--- a/src/corelib/widgets/mprogressindicator.h
+++ b/src/corelib/widgets/mprogressindicator.h
@@ -44,7 +44,7 @@ class MProgressIndicatorPrivate;
\li Application can decide to display label indicating the state of the operation next to indicator such as
"124 / 345 kt received." or "75%".
\li If the wait operation applies to the whole view, a spinner should be used to temporarily replace the view's
- view menu icon.
+ application menu icon.
\section ProgressIndicatorVariants Variants
\li \link MProgressIndicatorBarView Progress bar \endlink
diff --git a/src/corelib/widgets/msortfilterproxymodel.cpp b/src/corelib/widgets/msortfilterproxymodel.cpp
new file mode 100644
index 00000000..15f77e6d
--- /dev/null
+++ b/src/corelib/widgets/msortfilterproxymodel.cpp
@@ -0,0 +1,38 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#include "msortfilterproxymodel.h"
+
+MSortFilterProxyModel::MSortFilterProxyModel(QObject *parent)
+ : QSortFilterProxyModel(parent)
+{
+}
+
+MSortFilterProxyModel::~MSortFilterProxyModel()
+{
+}
+
+bool MSortFilterProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
+{
+ if (!source_parent.isValid() &&
+ sourceModel()->rowCount(sourceModel()->index(source_row, 0, source_parent)) > 0)
+ return true;
+
+ return QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent);
+}
diff --git a/src/corelib/widgets/msortfilterproxymodel.h b/src/corelib/widgets/msortfilterproxymodel.h
new file mode 100644
index 00000000..ebddcaa1
--- /dev/null
+++ b/src/corelib/widgets/msortfilterproxymodel.h
@@ -0,0 +1,53 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef MSORTFILTERPROXYMODEL_H
+#define MSORTFILTERPROXYMODEL_H
+
+#include <MExport>
+#include <QSortFilterProxyModel>
+
+/*!
+ \class MSortFilterProxyModel
+ \brief MSortFilterProxyModel reimplementation of a custom sort/filter proxy data model.
+ In case of filtering does not filter out the group headers (oposite to default
+ QSortFilterProxyModel behavior).
+*/
+class M_EXPORT MSortFilterProxyModel : public QSortFilterProxyModel
+{
+ Q_OBJECT
+
+public:
+ /*!
+ \brief Constructor.
+ \param parent Model owner.
+ */
+ MSortFilterProxyModel(QObject *parent = NULL);
+
+ /*!
+ \brief Destructor.
+ */
+ virtual ~MSortFilterProxyModel();
+
+ //! \reimp
+ virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
+ //! \reimp_end
+};
+
+#endif // MSORTFILTERPROXYMODEL_H
diff --git a/src/corelib/widgets/mtextedit.cpp b/src/corelib/widgets/mtextedit.cpp
index f95eaf96..64a8d99e 100644
--- a/src/corelib/widgets/mtextedit.cpp
+++ b/src/corelib/widgets/mtextedit.cpp
@@ -1500,16 +1500,40 @@ bool MTextEdit::setCursorPosition(int index)
void MTextEdit::handleMousePress(int cursorPosition, QGraphicsSceneMouseEvent *event)
{
+ handleMousePress(cursorPosition, event, NULL);
+}
+
+
+void MTextEdit::handleMousePress(int cursorPosition, QGraphicsSceneMouseEvent *event,
+ TextFieldLocationType *location)
+{
Q_D(MTextEdit);
+ if (textInteractionFlags() != Qt::NoTextInteraction && location) {
+ QString text = document()->toPlainText();
+ MBreakIterator breakIterator(text);
+
+ if (breakIterator.isBoundary(cursorPosition) == true) {
+ *location = MTextEdit::WordBoundary;
+ } else {
+ *location = MTextEdit::Word;
+ }
+ }
+
d->notifyInputContextMouseHandler(cursorPosition, event);
}
void MTextEdit::handleMouseRelease(int eventCursorPosition, QGraphicsSceneMouseEvent *event)
{
- Q_D(MTextEdit);
+ handleMouseRelease(eventCursorPosition, event, NULL);
+}
+
+void MTextEdit::handleMouseRelease(int eventCursorPosition, QGraphicsSceneMouseEvent *event,
+ TextFieldLocationType *location)
+{
+ Q_D(MTextEdit);
if (textInteractionFlags() == Qt::NoTextInteraction)
return;
@@ -1528,9 +1552,15 @@ void MTextEdit::handleMouseRelease(int eventCursorPosition, QGraphicsSceneMouseE
// clicks on word boundaries move the cursor
if (breakIterator.isBoundary(eventCursorPosition) == true) {
+ if (location) {
+ *location = MTextEdit::WordBoundary;
+ }
d->setCursorPosition(eventCursorPosition);
} else {
+ if (location) {
+ *location = MTextEdit::Word;
+ }
if (inputMethodCorrectionEnabled()) {
// clicks on words remove them from the normal contents and makes them preedit.
int start = breakIterator.previousInclusive(eventCursorPosition);
@@ -1568,6 +1598,9 @@ void MTextEdit::handleMouseRelease(int eventCursorPosition, QGraphicsSceneMouseE
}
} else {
+ if (location) {
+ *location = MTextEdit::Word;
+ }
d->notifyInputContextMouseHandler(eventCursorPosition, event);
}
@@ -1576,7 +1609,6 @@ void MTextEdit::handleMouseRelease(int eventCursorPosition, QGraphicsSceneMouseE
}
}
-
void MTextEdit::handleMouseMove(int cursorPosition, QGraphicsSceneMouseEvent *event)
{
Q_D(MTextEdit);
diff --git a/src/corelib/widgets/mtextedit.h b/src/corelib/widgets/mtextedit.h
index 0c18d7f5..203c8901 100644
--- a/src/corelib/widgets/mtextedit.h
+++ b/src/corelib/widgets/mtextedit.h
@@ -80,6 +80,15 @@ class M_EXPORT MTextEdit : public MWidgetController
public:
typedef M::TextContentType TextContentType; // workaround for moc bug
+ //! What is under the press or release location
+ enum TextFieldLocationType {
+ //! Pressed on top of a word
+ Word,
+
+ //! Pressed between words or empty space
+ WordBoundary
+ };
+
/*!
* \brief Default constructor. Creates a textedit field with a specified text and line mode.
* \param type widget type (single line or multiline).
@@ -188,6 +197,13 @@ public:
* The implementation will notify possible input context.
* \param cursorPosition position of the click within characters
* \param event event the view received
+ * \param location assigned by the method either as Word or as WordBoundary depending on where in text mouse is pressed
+ * \note Location parameter is assigned by the method only if Qt::TextInteractionFlags is something other than Qt::NoTextInteraction
+ */
+ void handleMousePress(int cursorPosition, QGraphicsSceneMouseEvent *event, TextFieldLocationType *location);
+
+ /*!
+ * \overload handleMousePress()
*/
void handleMousePress(int cursorPosition, QGraphicsSceneMouseEvent *event);
@@ -199,6 +215,13 @@ public:
* clicked word as preedit if possible.
* \param cursorPosition position of the click within characters
* \param event event the view received
+ * \param location assigned by the method either as Word or as WordBoundary depending on where in text mouse is released
+ * \note Location parameter is assigned by the method only if Qt::TextInteractionFlags is something other than Qt::NoTextInteraction
+ */
+ void handleMouseRelease(int cursorPosition, QGraphicsSceneMouseEvent *event, TextFieldLocationType *location);
+
+ /*!
+ * \overload handleMouseRelease()
*/
void handleMouseRelease(int cursorPosition, QGraphicsSceneMouseEvent *event);
diff --git a/src/corelib/widgets/mtoolbar.h b/src/corelib/widgets/mtoolbar.h
index 64e392e4..1342df2c 100644
--- a/src/corelib/widgets/mtoolbar.h
+++ b/src/corelib/widgets/mtoolbar.h
@@ -74,18 +74,18 @@ class MToolBarPrivate;
\endcode
\section MToolBarUseGuidelines Usage guidelines
- - The toolbar is functionally in the same role as in the view menu: it has commands that
+ - The toolbar is functionally in the same role as in the application menu: it has commands that
are not related specifically to any content item or button displayed within the contents
of the view.
- The toolbar should be utilized only if the commands are expected to be used often. The
toolbar takes away space from the content area. If the commands are not important to the
view and the main use cases, it is recommendable to not have a toolbar at all, and place
- the commands in the view menu. Similarly, reconsider your design if you would have only
- one or two buttons to the toolbar; commands can be placed to the view menu, or embedded
- to the view.
+ the commands in the application menu. Similarly, reconsider your design if you would have only
+ one or two buttons to the toolbar; commands can be placed to the application menu, or embedded
+ to the page.
- Note that the toolbar is not scalable: do not place commands in the toolbar if the view is
expected to grow with more functionalities in the future.
- - The commands in the toolbar and in the view menu are not to be duplicated.
+ - The commands in the toolbar and in the application menu are not to be duplicated.
- Since the Direct UI style has no focus for the items in the content view, it is not
possible to create toolbars that have actions that affect on a single item on screen. For
instance you shouldn't design a toolbar with "Reply", "Delete", "Move" etc. commands, if
@@ -94,10 +94,10 @@ class MToolBarPrivate;
The scrollable area ends on top of the toolbar (so that the latest in the list should not
end up being stuck behind the toolbar)
- The user is not able to personalize the contents of the toolbar. The application designer
- decides what is shown in toolbar and what in view menu.
+ decides what is shown in the toolbar and what in the application menu.
- Application design can also decide whether toolbar is used in both landscape and portrait
modes. For example, a toolbar can be shown only in landscape mode, and then in portrait
- mode the functionalities are provided somewhere else (for instance in the view menu).
+ mode the functionalities are provided somewhere else (for instance in the application menu).
- The toolbar can be hidden if application designer decides so, for example when using
full-screen media, virtual keyboard or web browser. Toolbar is hidden and shown together
with command area.
diff --git a/src/corelib/widgets/mwindow.cpp b/src/corelib/widgets/mwindow.cpp
index 27d5856d..d9fac5bc 100644
--- a/src/corelib/widgets/mwindow.cpp
+++ b/src/corelib/widgets/mwindow.cpp
@@ -132,6 +132,74 @@ void MWindowPrivate::init()
if (MApplication::fullScreen())
q->showFullScreen();
+}
+
+void MWindowPrivate::initSoftwareViewport()
+{
+ Q_Q(MWindow);
+
+ mWarning("MWindow") << "Switching to software rendering";
+
+#ifdef M_USE_OPENGL
+ MGLES2Renderer::activate(NULL);
+ MGLES2Renderer::destroy(glWidget);
+ glWidget = NULL;
+#endif
+
+ q->setViewport(new QWidget());
+ q->setViewportUpdateMode(MWindow::MinimalViewportUpdate);
+
+ configureViewport();
+}
+
+void MWindowPrivate::initGLViewport()
+{
+#ifdef QT_OPENGL_LIB
+ Q_Q(MWindow);
+
+ mWarning("MWindow") << "Window restored, switching to GL rendering";
+
+ bool translucent = q->testAttribute(Qt::WA_TranslucentBackground);
+
+ // The sequence of calls here is important. When translucency is not
+ // enabled, ensure setViewport() is called before DuiGLES2Renderer
+ // initializes its vertices, otherwise call setViewport() after
+ // DuiGLES2Renderer initializes itself. Failure to do this will cause
+ // a crash.
+ // This QGLWidget is owned by the viewport so previous one
+ // actually gets deleted if we overwrite it with a new one
+ if (translucent) {
+ QGLFormat fmt;
+ // disable multisampling, is enabled by default in Qt
+ fmt.setSampleBuffers(false);
+ fmt.setSamples(0);
+ fmt.setAlpha(true); // Workaround for NB#153625
+
+ glWidget = MComponentCache::glWidget(fmt);
+ QPalette palette;
+ palette.setColor(QPalette::Base, Qt::transparent);
+ glWidget->setAutoFillBackground(true);
+ glWidget->setPalette(palette);
+ } else {
+ glWidget = MComponentCache::glWidget();
+ q->setViewport(glWidget);
+ }
+#ifdef M_USE_OPENGL
+ MGLES2Renderer::instance(glWidget);
+ MGLES2Renderer::activate(glWidget);
+#endif
+ if (translucent)
+ q->setViewport(glWidget);
+#endif
+
+ q->setViewportUpdateMode(MWindow::FullViewportUpdate);
+
+ configureViewport();
+}
+
+void MWindowPrivate::configureViewport()
+{
+ Q_Q(MWindow);
q->viewport()->grabGesture(Qt::TapAndHoldGesture);
q->viewport()->grabGesture(Qt::PinchGesture);
@@ -142,6 +210,7 @@ void MWindowPrivate::init()
q->setAttribute(Qt::WA_AcceptTouchEvents);
}
+
#ifdef Q_WS_X11
void MWindowPrivate::appendVisibilityChangeMask()
{
@@ -341,51 +410,13 @@ void MWindow::setTranslucentBackground(bool enable)
{
Q_D(MWindow);
- if (!MApplication::softwareRendering()) {
-#ifdef QT_OPENGL_LIB
- setViewportUpdateMode(MWindow::FullViewportUpdate);
-
- // The sequence of calls here is important. When translucency is not
- // enabled, ensure setViewport() is called before MGLES2Renderer
- // initializes its vertices, otherwise call setViewport() after
- // MGLES2Renderer initializes itself. Failure to do this will cause
- // a crash.
- if (enable) {
- QGLFormat fmt;
- // disable multisampling, is enabled by default in Qt
- fmt.setSampleBuffers(false);
- fmt.setSamples(0);
-
- //d->glWidget->setAttribute(Qt::WA_TranslucentBackground);
-
- fmt.setAlpha(true); // Workaround for NB#153625
- d->glWidget = new QGLWidget(fmt);
- QPalette palette;
- palette.setColor(QPalette::Base, Qt::transparent);
- d->glWidget->setAutoFillBackground(true);
- d->glWidget->setPalette(palette);
- } else {
- d->glWidget = MComponentCache::glWidget();
-
- if (d->glWidget->isValid() == false) {
- qCritical("Could not create a valid QGLWidget, quitting.");
- exit(EXIT_FAILURE);
- }
-
- setViewport(d->glWidget);
- }
-#ifdef M_USE_OPENGL
- MGLES2Renderer::instance(d->glWidget);
- MGLES2Renderer::activate(d->glWidget);
-#endif
- if (enable)
- setViewport(d->glWidget);
-#endif
- } else {
- viewport()->setAutoFillBackground(!enable);
- }
if (enable)
setAttribute(Qt::WA_TranslucentBackground);
+
+ if (MApplication::softwareRendering() || MApplication::isPrestarted())
+ d->initSoftwareViewport();
+ else
+ d->initGLViewport();
}
void MWindow::setGlobalAlpha(qreal level)
@@ -870,6 +901,9 @@ void MWindow::setVisible(bool visible)
if (MApplication::isPrestarted()) {
return;
} else {
+ if (!MApplication::softwareRendering() && d->glWidget == 0) {
+ d->initGLViewport();
+ }
d->isLogicallyClosed = false;
}
diff --git a/src/corelib/widgets/mwindow_p.h b/src/corelib/widgets/mwindow_p.h
index faf70762..30a1ad17 100644
--- a/src/corelib/widgets/mwindow_p.h
+++ b/src/corelib/widgets/mwindow_p.h
@@ -66,6 +66,10 @@ public:
void propagateMOnDisplayChangeEventToScene(MOnDisplayChangeEvent *event);
+ void initGLViewport();
+ void initSoftwareViewport();
+ void configureViewport();
+
bool onDisplay;
bool onDisplaySet;
diff --git a/src/corelib/widgets/widgets.pri b/src/corelib/widgets/widgets.pri
index ca45964c..f2731321 100644
--- a/src/corelib/widgets/widgets.pri
+++ b/src/corelib/widgets/widgets.pri
@@ -26,6 +26,7 @@ PUBLIC_HEADERS += \
$$WIDGETS_SRC_DIR/mlabel.h \
$$WIDGETS_SRC_DIR/mlabelhighlighter.h \
$$WIDGETS_SRC_DIR/mlist.h \
+ $$WIDGETS_SRC_DIR/mlistfilter.h \
$$WIDGETS_SRC_DIR/mgriditem.h \
$$WIDGETS_SRC_DIR/mmessagebox.h \
$$WIDGETS_SRC_DIR/mnavigationbar.h \
@@ -54,6 +55,10 @@ PUBLIC_HEADERS += \
$$WIDGETS_SRC_DIR/mwidgetrecycler.h \
$$WIDGETS_SRC_DIR/mabstractcellcreator.h \
$$WIDGETS_SRC_DIR/mcontentitem.h \
+ $$WIDGETS_SRC_DIR/mlistitem.h \
+ $$WIDGETS_SRC_DIR/mabstractitemmodel.h \
+ $$WIDGETS_SRC_DIR/msortfilterproxymodel.h \
+ $$WIDGETS_SRC_DIR/mbubbleitem.h \
MGEN_MODEL_HEADERS += \
$$WIDGETS_SRC_DIR/mwidgetmodel.h \
@@ -87,6 +92,8 @@ MGEN_MODEL_HEADERS += \
$$WIDGETS_SRC_DIR/mcontainermodel.h \
$$WIDGETS_SRC_DIR/mcompletermodel.h \
$$WIDGETS_SRC_DIR/mcontentitemmodel.h \
+ $$WIDGETS_SRC_DIR/mlistitemmodel.h \
+ $$WIDGETS_SRC_DIR/mbubbleitemmodel.h \
PUBLIC_HEADERS += \
$$MGEN_MODEL_HEADERS \
@@ -96,6 +103,9 @@ PRIVATE_HEADERS += \
$$WIDGETS_SRC_DIR/mpannableviewportlayout.h \
$$WIDGETS_SRC_DIR/mcontentitem_p.h \
$$WIDGETS_SRC_DIR/mbuttongroup_p.h \
+ $$WIDGETS_SRC_DIR/mlistitem_p.h \
+ $$WIDGETS_SRC_DIR/mabstractitemmodel_p.h \
+ $$WIDGETS_SRC_DIR/mlistfilter_p.h \
SOURCES += \
$$WIDGETS_SRC_DIR/mwidgetmodel.cpp \
@@ -118,6 +128,7 @@ SOURCES += \
$$WIDGETS_SRC_DIR/mlabelmodel.cpp \
$$WIDGETS_SRC_DIR/mlabelhighlighter.cpp \
$$WIDGETS_SRC_DIR/mlist.cpp \
+ $$WIDGETS_SRC_DIR/mlistfilter.cpp \
$$WIDGETS_SRC_DIR/mgriditem.cpp \
$$WIDGETS_SRC_DIR/minfobannermodel.cpp \
$$WIDGETS_SRC_DIR/mapplicationmenu.cpp \
@@ -152,3 +163,8 @@ SOURCES += \
$$WIDGETS_SRC_DIR/mcontentitemmodel.cpp \
$$WIDGETS_SRC_DIR/mlistmodel.cpp \
$$WIDGETS_SRC_DIR/mpopuplistmodel.cpp \
+ $$WIDGETS_SRC_DIR/mlistitem.cpp \
+ $$WIDGETS_SRC_DIR/mabstractitemmodel.cpp \
+ $$WIDGETS_SRC_DIR/msortfilterproxymodel.cpp \
+ $$WIDGETS_SRC_DIR/mbubbleitem.cpp \
+ $$WIDGETS_SRC_DIR/mbubbleitemmodel.cpp \
diff --git a/src/extensions/applicationextension/mapplicationextensionarea.cpp b/src/extensions/applicationextension/mapplicationextensionarea.cpp
index f06a9545..63215ea9 100644
--- a/src/extensions/applicationextension/mapplicationextensionarea.cpp
+++ b/src/extensions/applicationextension/mapplicationextensionarea.cpp
@@ -42,8 +42,8 @@ void MApplicationExtensionAreaPrivate::init(const QString &interface)
{
Q_Q(MApplicationExtensionArea);
extensionManager = QSharedPointer<MApplicationExtensionManager>(new MApplicationExtensionManager(interface));
- QObject::connect(extensionManager.data(), SIGNAL(extensionInstantiated(MApplicationExtensionInterface *)), q, SIGNAL(extensionInstantiated(MApplicationExtensionInterface *)), Qt::QueuedConnection);
- QObject::connect(extensionManager.data(), SIGNAL(extensionRemoved(MApplicationExtensionInterface*)), q, SIGNAL(extensionRemoved(MApplicationExtensionInterface*)), Qt::QueuedConnection);
+ QObject::connect(extensionManager.data(), SIGNAL(extensionInstantiated(MApplicationExtensionInterface *)), q, SIGNAL(extensionInstantiated(MApplicationExtensionInterface *)));
+ QObject::connect(extensionManager.data(), SIGNAL(extensionRemoved(MApplicationExtensionInterface*)), q, SIGNAL(extensionRemoved(MApplicationExtensionInterface*)));
QObject::connect(extensionManager.data(), SIGNAL(widgetCreated(QGraphicsWidget*, MDataStore&)), q, SLOT(addWidget(QGraphicsWidget*, MDataStore&)));
QObject::connect(extensionManager.data(), SIGNAL(widgetRemoved(QGraphicsWidget*)), q, SLOT(removeWidget(QGraphicsWidget*)));
}
diff --git a/src/extensions/applicationextension/mapplicationextensionarea.h b/src/extensions/applicationextension/mapplicationextensionarea.h
index a443a3ff..d068cee9 100644
--- a/src/extensions/applicationextension/mapplicationextensionarea.h
+++ b/src/extensions/applicationextension/mapplicationextensionarea.h
@@ -94,7 +94,9 @@ public:
/*!
* Initializes the application extension area. All setters introduced by
- * this class must be called before the area is initialized. Initialization
+ * this class must be called before the area is initialized, and the
+ * signals must be connected, because calling init() will result in
+ * the extensions being created. Initialization
* will fail if no interface name has been provided or if the area has
* already been initialized.
*
diff --git a/src/extensions/applicationextension/mapplicationextensionareaview.cpp b/src/extensions/applicationextension/mapplicationextensionareaview.cpp
index 5253a28a..c27ccdbf 100644
--- a/src/extensions/applicationextension/mapplicationextensionareaview.cpp
+++ b/src/extensions/applicationextension/mapplicationextensionareaview.cpp
@@ -38,8 +38,11 @@ void MApplicationExtensionAreaViewPrivate::init(MApplicationExtensionArea *contr
{
this->controller = controller;
- layout = new QGraphicsLinearLayout(Qt::Vertical);
+ QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical);
+ layout->setContentsMargins(0, 0, 0, 0);
+ layout->setSpacing(0);
controller->setLayout(layout);
+ this->layout = layout;
}
void MApplicationExtensionAreaViewPrivate::addToLayout(QGraphicsWidget *widget, int index)
diff --git a/src/extensions/applicationextension/mapplicationextensionmanager.cpp b/src/extensions/applicationextension/mapplicationextensionmanager.cpp
index 9da4d619..637e493a 100644
--- a/src/extensions/applicationextension/mapplicationextensionmanager.cpp
+++ b/src/extensions/applicationextension/mapplicationextensionmanager.cpp
@@ -28,6 +28,7 @@
#include "mdesktopentry.h"
#include "mextensionhandle.h"
#include "mfiledatastore.h"
+#include "msubdatastore.h"
#include "mdebug.h"
MApplicationExtensionManager::MApplicationExtensionManager(const QString &interface) :
@@ -76,15 +77,34 @@ bool MApplicationExtensionManager::init()
updateAvailableExtensions(APPLICATION_EXTENSION_DATA_DIR);
// Start watching the application extensions directory for changes
- connect(&watcher, SIGNAL(directoryChanged(const QString)), this, SLOT(updateAvailableExtensions(QString)));
- watcher.addPath(APPLICATION_EXTENSION_DATA_DIR);
-
+ connectSignals();
+ desktopDirectoryWatcher.addPath(APPLICATION_EXTENSION_DATA_DIR);
return true;
}
+void MApplicationExtensionManager::parseAndInstantiateExtension(
+ const QString& desktopFile,
+ QSet<QString>* currentExtensionsList)
+{
+ QSharedPointer<const MApplicationExtensionMetaData>
+ metadata(new MApplicationExtensionMetaData(desktopFile));
+ if (metadata->isValid() && metadata->type() == "X-MeeGoApplicationExtension" && metadata->interface() == interface) {
+ if (currentExtensionsList != NULL) {
+ currentExtensionsList->insert(desktopFile);
+ }
+ if (!extensionMetaDatas.contains(desktopFile)) {
+ // This extension is a new one. Instantiate it
+ if (instantiateExtension(metadata)) {
+ extensionMetaDatas[desktopFile] = metadata;
+ }
+ }
+ }
+}
+
void MApplicationExtensionManager::updateAvailableExtensions(const QString &path)
{
- QList<QString> currentExtensionsList;
+ disconnectSignals();
+ QSet<QString> currentExtensionsList;
QDir applicationExtensionsDir(path);
if (applicationExtensionsDir.exists()) {
@@ -92,33 +112,38 @@ void MApplicationExtensionManager::updateAvailableExtensions(const QString &path
filter << "*.desktop";
foreach(const QString &fileName, applicationExtensionsDir.entryList(filter, QDir::Files)) {
const QString desktopFile = QFileInfo(applicationExtensionsDir, fileName).absoluteFilePath();
- QSharedPointer<MApplicationExtensionMetaData> metadata(new MApplicationExtensionMetaData(desktopFile));
- if (metadata->isValid() && metadata->type() == "X-MeeGoApplicationExtension" && metadata->interface() == interface) {
- currentExtensionsList.append(fileName);
-
- if (!extensionMetaDatas.contains(fileName)) {
- // This extension is a new one. Instantiate it
- if (instantiateExtension(*metadata.data())) {
- extensionMetaDatas[fileName] = metadata;
- }
- }
- }
+ parseAndInstantiateExtension(desktopFile,
+ &currentExtensionsList);
}
-
// Find what extensions got removed
- QList<QString> toBeRemovedExtensions;
+ QSet<QString> toBeRemovedExtensions;
MetaDataEntryHash::const_iterator itEnd = extensionMetaDatas.constEnd();
for (MetaDataEntryHash::const_iterator it = extensionMetaDatas.constBegin(); it != itEnd; ++it) {
if (!currentExtensionsList.contains(it.key())) {
- toBeRemovedExtensions.append(it.key());
+ toBeRemovedExtensions.insert(it.key());
}
}
// Remove extensions that no longer exist
foreach (const QString &fileName, toBeRemovedExtensions) {
- removeExtension(*extensionMetaDatas[fileName].data());
- extensionMetaDatas.remove(fileName);
+ removeExtension(*extensionMetaDatas[fileName]);
}
}
+ connectSignals();
+}
+
+void MApplicationExtensionManager::updateExtension(
+ const MDesktopEntry &extensionData)
+{
+ const MApplicationExtensionMetaData* metadata =
+ dynamic_cast<const MApplicationExtensionMetaData*>(&extensionData);
+ if (!metadata) {
+ return;
+ }
+ disconnectSignals();
+ QString fileName = metadata->fileName();
+ removeExtension(*metadata);
+ parseAndInstantiateExtension(fileName, NULL);
+ connectSignals();
}
bool MApplicationExtensionManager::isInProcess(const MApplicationExtensionMetaData &metaData)
@@ -126,25 +151,28 @@ bool MApplicationExtensionManager::isInProcess(const MApplicationExtensionMetaDa
return metaData.runnerBinary().isEmpty();
}
-bool MApplicationExtensionManager::instantiateExtension(const MApplicationExtensionMetaData &metadata)
+bool MApplicationExtensionManager::instantiateExtension(QSharedPointer<const MApplicationExtensionMetaData> &metadata)
{
bool success = false;
- if (isInProcess(metadata)) {
- if (metadata.fileName().indexOf(inProcessFilter) >= 0) {
- success = instantiateInProcessExtension(metadata.extensionBinary());
+ if (isInProcess(*metadata)) {
+ if (metadata->fileName().indexOf(inProcessFilter) >= 0) {
+ success = instantiateInProcessExtension(metadata);
}
} else {
- if (metadata.fileName().indexOf(outOfProcessFilter) >= 0) {
+ if (metadata->fileName().indexOf(outOfProcessFilter) >= 0) {
success = instantiateOutOfProcessExtension(metadata);
}
}
-
+ if (success) {
+ extensionWatcher.addExtension(metadata);
+ }
return success;
}
-bool MApplicationExtensionManager::instantiateInProcessExtension(const QString &binary)
+bool MApplicationExtensionManager::instantiateInProcessExtension(QSharedPointer<const MApplicationExtensionMetaData> &metadata)
{
+ QString binary = metadata->extensionBinary();
QPluginLoader loader(binary);
QObject *object = loader.instance();
@@ -157,14 +185,16 @@ bool MApplicationExtensionManager::instantiateInProcessExtension(const QString &
if (success) {
QGraphicsWidget *widget = extension->widget();
if (widget) {
- // Inform about the added extension widget
- emit widgetCreated(widget, *extensionDataStore.data());
+ QString tmp = metadata->fileName();
+ QSharedPointer<MDataStore> dataStore =
+ createSubDataStore(*metadata);
+ inProcessDataStores[metadata.data()] = dataStore;
+ emit widgetCreated(widget, *dataStore);
}
+ // Store the instantiated extension
+ inProcessExtensions[metadata.data()] = qMakePair(extension, widget);
// Inform interested parties about the new extension
emit extensionInstantiated(extension);
-
- // Store the instantiated extension
- inProcessExtensions[binary] = qMakePair(extension, widget);
}
}
}
@@ -176,12 +206,15 @@ bool MApplicationExtensionManager::instantiateInProcessExtension(const QString &
return success;
}
-bool MApplicationExtensionManager::instantiateOutOfProcessExtension(const MApplicationExtensionMetaData &metadata)
+bool MApplicationExtensionManager::instantiateOutOfProcessExtension(
+ QSharedPointer<const MApplicationExtensionMetaData> &metadata)
{
MExtensionHandle *handle = new MExtensionHandle;
- handle->init(metadata.runnerBinary(), metadata.fileName());
- outOfProcessHandles.insert(metadata.fileName(), handle);
- emit widgetCreated(handle, *extensionDataStore.data());
+ handle->init(metadata->runnerBinary(), metadata->fileName());
+ outOfProcessHandles.insert(metadata.data(), handle);
+ QSharedPointer<MDataStore> dataStore = createSubDataStore(*metadata);
+ outOfProcessDataStores[metadata.data()] = dataStore;
+ emit widgetCreated(handle, *dataStore);
return true;
}
@@ -194,35 +227,41 @@ QString MApplicationExtensionManager::dataPath() const
void MApplicationExtensionManager::removeExtension(const MApplicationExtensionMetaData &metadata)
{
+ QString fileName = metadata.fileName();
if (isInProcess(metadata)) {
- removeInProcessExtension(metadata.extensionBinary());
+ removeInProcessExtension(metadata);
} else {
removeOutOfProcessExtension(metadata);
}
+ extensionMetaDatas.remove(fileName);
+ extensionWatcher.removeExtension(metadata.fileName());
}
-void MApplicationExtensionManager::removeInProcessExtension(const QString &binary)
+void MApplicationExtensionManager::removeInProcessExtension(
+ const MApplicationExtensionMetaData &metadata)
{
- if (inProcessExtensions.contains(binary)) {
- InProcessExtensionData extension = inProcessExtensions.take(binary);
+ if (inProcessExtensions.contains(&metadata)) {
+ InProcessExtensionData extension = inProcessExtensions.take(&metadata);
emit extensionRemoved(extension.first);
if (extension.second) {
emit widgetRemoved(extension.second);
}
+ inProcessDataStores.remove(&metadata);
delete extension.first;
+ QPluginLoader loader(metadata.extensionBinary());
+ loader.unload();
}
}
void MApplicationExtensionManager::removeOutOfProcessExtension(const MApplicationExtensionMetaData &metadata)
{
QString desktopFileName = metadata.fileName();
- if (outOfProcessHandles.contains(desktopFileName)) {
- MExtensionHandle *handle = outOfProcessHandles.take(desktopFileName);
- if (handle) {
- emit widgetRemoved(handle);
- handle->kill();
- delete handle;
- }
+ MExtensionHandle *handle = outOfProcessHandles.take(&metadata);
+ if (handle) {
+ emit widgetRemoved(handle);
+ handle->kill();
+ outOfProcessDataStores.remove(&metadata);
+ delete handle;
}
}
@@ -259,3 +298,41 @@ bool MApplicationExtensionManager::createDataStore()
return false;
}
}
+
+QSharedPointer<MDataStore> MApplicationExtensionManager::createSubDataStore(
+ const MApplicationExtensionMetaData &metadata)
+{
+ return QSharedPointer<MDataStore>(
+ new MSubDataStore(
+ metadata.fileName().replace('/', '\\')
+ + QString("/"), *extensionDataStore));
+}
+
+void MApplicationExtensionManager::connectSignals()
+{
+ connect(&extensionWatcher,
+ SIGNAL(extensionChanged(
+ const MDesktopEntry &)),
+ this,
+ SLOT(updateExtension(
+ const MDesktopEntry &)));
+ connect(&desktopDirectoryWatcher,
+ SIGNAL(directoryChanged(const QString)),
+ this,
+ SLOT(updateAvailableExtensions(QString)));
+}
+
+void MApplicationExtensionManager::disconnectSignals()
+{
+ disconnect(&extensionWatcher,
+ SIGNAL(extensionChanged(
+ const MDesktopEntry &)),
+ this,
+ SLOT(updateExtension(
+ const MDesktopEntry &)));
+ disconnect(&desktopDirectoryWatcher,
+ SIGNAL(directoryChanged(const QString)),
+ this,
+ SLOT(updateAvailableExtensions(QString)));
+}
+
diff --git a/src/extensions/applicationextension/mapplicationextensionmanager.h b/src/extensions/applicationextension/mapplicationextensionmanager.h
index 5eb80e1e..99acbe0b 100644
--- a/src/extensions/applicationextension/mapplicationextensionmanager.h
+++ b/src/extensions/applicationextension/mapplicationextensionmanager.h
@@ -24,8 +24,8 @@
#include <QFileSystemWatcher>
#include <QHash>
#include <QSharedPointer>
-#include <QHash>
#include <QRegExp>
+#include "mextensionwatcher.h"
class MApplicationExtensionMetaData;
class MDataStore;
@@ -124,13 +124,22 @@ private slots:
*/
void updateAvailableExtensions(const QString &path);
+ /*!
+ * \brief Slot for updating an extension when the files for the extension
+ * have been updated.
+ * \param extensionData the extension to update
+ */
+ void updateExtension(const MDesktopEntry &extensionData);
+
private:
//! Whether the manager has been initialized or not
bool initialized;
//! A file system watcher for the desktop entry file directory
- QFileSystemWatcher watcher;
+ QFileSystemWatcher desktopDirectoryWatcher;
+ //! An extension watcher for observing modifications to the extensions
+ MExtensionWatcher extensionWatcher;
//! The name of the interface extensions to be instantiated should implement
QString interface;
@@ -145,13 +154,19 @@ private:
typedef QPair<MApplicationExtensionInterface*, QGraphicsWidget*> InProcessExtensionData;
- //! Instantiated in-process extensions. A map from the shared library name to the extension instance.
- QHash<QString, InProcessExtensionData> inProcessExtensions;
+ //! In-process extensions and datastores
+ QHash<const MApplicationExtensionMetaData*, InProcessExtensionData> inProcessExtensions;
+
+ QHash<const MApplicationExtensionMetaData*,
+ QSharedPointer<MDataStore> > inProcessDataStores;
- //! Hash of desktop file name versus the widget (handle) created
- QHash<QString, MExtensionHandle*> outOfProcessHandles;
+ //! Ouf-of-process extensions and datastores
+ QHash<const MApplicationExtensionMetaData*, MExtensionHandle*> outOfProcessHandles;
- typedef QHash<QString, QSharedPointer<MApplicationExtensionMetaData> > MetaDataEntryHash;
+ QHash<const MApplicationExtensionMetaData*, QSharedPointer<MDataStore> >
+ outOfProcessDataStores;
+
+ typedef QHash<QString, QSharedPointer<const MApplicationExtensionMetaData> > MetaDataEntryHash;
/*!
* A container for application extension desktop entries with the correct application extension interface defined.
* This container also only contains the entries that succeeded to instantiate.
@@ -179,38 +194,67 @@ private:
bool createDataStore();
/*!
+ * Creates a subdatastore for an extension
+ * \param metaData Metadata for the extension
+ */
+ QSharedPointer<MDataStore> createSubDataStore(
+ const MApplicationExtensionMetaData &metaData);
+ /*!
+ * Connects the signals for the directory watcher and the extension
+ * watcher.
+ */
+ void connectSignals();
+ /*!
+ * Disconnects the signals for the directory watcher and the extension
+ * watcher.
+ */
+ void disconnectSignals();
+
+ /*!
+ * Creates extension metadata and instantiates an extension
+ * if it isn't already instantiated.
+ * \param desktopFile Full path of the desktop file to parse.
+ * \param currentExtensionsList List of current extensions.
+ * Used by updateAvailableExtensions to keep track of which
+ * extensions exist and which need to be removed.
+ */
+ void parseAndInstantiateExtension(const QString& desktopFile,
+ QSet<QString>* currentExtensionsList);
+ /*!
* Instantiate an extension for an application extension metadata
* \param metadata the metadata object of the extension
* \return \c true if extension instantiated succesfully, \c false otherwise
*/
- bool instantiateExtension(const MApplicationExtensionMetaData &metadata);
+ bool instantiateExtension(
+ QSharedPointer<const MApplicationExtensionMetaData> &metadata);
/*!
* Instantiates an in process extension.
- *
- * \param binary the name of the in process extension binary
+ * \param metadata metadata for the extension
* \return \c true if the instantiation succeeds, \c false otherwise
*/
- bool instantiateInProcessExtension(const QString &binary);
+ bool instantiateInProcessExtension(
+ QSharedPointer<const MApplicationExtensionMetaData> &metadata);
/*!
* Instantiate out of process extensions
- * \param metadata for the extension
+ * \param metadata metadata for the extension
* \return bool True if extension instantiated, else return false
*/
- bool instantiateOutOfProcessExtension(const MApplicationExtensionMetaData &metadata);
+ bool instantiateOutOfProcessExtension(
+ QSharedPointer<const MApplicationExtensionMetaData> &metadata);
/*!
* Removes an extension that was defined in the desktop entry given as a parameter.
- * \param metadata the relevant metadata.
+ * \param metadata metadata for the extension
*/
void removeExtension(const MApplicationExtensionMetaData &metadata);
/*!
* Removes an in process extension that was loaded from the specified library.
- * \param library the path name to the library
+ * \param metadata metadata for the extension
*/
- void removeInProcessExtension(const QString &library);
+ void removeInProcessExtension(const MApplicationExtensionMetaData &metadata);
/*!
* Removes an out of process extension that was loaded from the specified metadata
diff --git a/src/extensions/applicationextension/mapplicationextensionmetadata.cpp b/src/extensions/applicationextension/mapplicationextensionmetadata.cpp
index cd73f112..81d11d91 100644
--- a/src/extensions/applicationextension/mapplicationextensionmetadata.cpp
+++ b/src/extensions/applicationextension/mapplicationextensionmetadata.cpp
@@ -21,9 +21,9 @@
#include <QDir>
#include <MDebug>
-const QString ExtensionBinaryKey("X-MeeGoApplicationExtension/Extension");
-const QString IdentifierKey("X-MeeGoApplicationExtension/Identifier");
-const QString InterfaceKey("X-MeeGoApplicationExtension/Interface");
+const QString EXTENSION_BINARY_KEY("X-MeeGoApplicationExtension/Extension");
+const QString IDENTIFIER_KEY("X-MeeGoApplicationExtension/Identifier");
+const QString INTERFACE_KEY("X-MeeGoApplicationExtension/Interface");
MApplicationExtensionMetaData::MApplicationExtensionMetaData(const QString &fileName) : MDesktopEntry(fileName)
{
@@ -42,7 +42,7 @@ bool MApplicationExtensionMetaData::isValid() const
// Loop through keys and check that all are found
QStringList requiredKeys;
- requiredKeys << ExtensionBinaryKey << InterfaceKey;
+ requiredKeys << EXTENSION_BINARY_KEY << INTERFACE_KEY;
foreach(const QString &key, requiredKeys) {
if (!contains(key)) {
return false;
@@ -80,7 +80,7 @@ QString MApplicationExtensionMetaData::runnerBinary() const
QString MApplicationExtensionMetaData::extensionBinary() const
{
// Fetch the absolute file path and return it.
- QFileInfo extension(QString(APPLICATION_EXTENSION_LIBS), value(ExtensionBinaryKey));
+ QFileInfo extension(QString(APPLICATION_EXTENSION_LIBS), value(EXTENSION_BINARY_KEY));
if (extension.exists() && extension.isFile()) {
return extension.absoluteFilePath();
} else {
@@ -91,7 +91,7 @@ QString MApplicationExtensionMetaData::extensionBinary() const
QString MApplicationExtensionMetaData::interface() const
{
- return value(InterfaceKey);
+ return value(INTERFACE_KEY);
}
QString MApplicationExtensionMetaData::extractLibraryName(const QString &libFileName)
@@ -114,8 +114,8 @@ QString MApplicationExtensionMetaData::resourceIdentifier() const
QString resourceId;
QString binary = extensionBinary();
- if (contains(IdentifierKey)) {
- resourceId = value(IdentifierKey);
+ if (contains(IDENTIFIER_KEY)) {
+ resourceId = value(IDENTIFIER_KEY);
} else if (!binary.isNull()) {
resourceId = extractLibraryName(binary);
} else {
diff --git a/src/extensions/applicationextension/mapplicationextensionmetadata.h b/src/extensions/applicationextension/mapplicationextensionmetadata.h
index 6ee05884..f3651182 100644
--- a/src/extensions/applicationextension/mapplicationextensionmetadata.h
+++ b/src/extensions/applicationextension/mapplicationextensionmetadata.h
@@ -55,7 +55,7 @@ public:
* file in that is given as a construction parameter.
* \param filename Location of .desktop file to be read by constructed MApplicationExtensionMetaData instance.
*/
- MApplicationExtensionMetaData(const QString &filename);
+ explicit MApplicationExtensionMetaData(const QString &filename);
/*!
* Destructor
diff --git a/src/extensions/applicationextension/mextensionareaview.cpp b/src/extensions/applicationextension/mextensionareaview.cpp
index ad89c7c2..a1aadefb 100644
--- a/src/extensions/applicationextension/mextensionareaview.cpp
+++ b/src/extensions/applicationextension/mextensionareaview.cpp
@@ -24,6 +24,8 @@
#include "mdatastore.h"
#include "mcontainer.h"
+static const QString LAYOUT_INDEX = "layoutIndex";
+
MExtensionAreaViewPrivate::MExtensionAreaViewPrivate()
: controller(0),
layout(0),
@@ -80,8 +82,8 @@ void MExtensionAreaViewPrivate::updateData()
// Change the data in the store if item is still valid and geometry has changed.
if (centralWidget != NULL && dsMap->contains(centralWidget) &&
- (*dsMap)[centralWidget]->value("layoutIndex") != i) {
- (*dsMap)[centralWidget]->createValue("layoutIndex", i);
+ (*dsMap)[centralWidget]->value(LAYOUT_INDEX) != i) {
+ (*dsMap)[centralWidget]->createValue(LAYOUT_INDEX, i);
}
}
}
@@ -114,7 +116,8 @@ void MExtensionAreaViewPrivate::updateLayout()
bool alreadyInLayout = false;
const int count = layout->count();
for (int i = 0; i < count; ++i) {
- MContainer *theContainer = dynamic_cast<MContainer *>(layout->itemAt(i));
+ MContainer *theContainer =
+ dynamic_cast<MContainer *>(layout->itemAt(i));
if (widget == theContainer->centralWidget()) {
// Widget found from the layout, don't add again
alreadyInLayout = true;
@@ -131,21 +134,19 @@ void MExtensionAreaViewPrivate::updateLayout()
if (container) {
setContainerEnabled(*container, q->style()->containerMode());
}
-
- int layoutIndex = 0;
-
// Add widget to the layout policy
- if (store->allKeys().contains("layoutIndex") &&
- store->value("layoutIndex").type() == QVariant::Int) {
- layoutIndex = store->value("layoutIndex").toInt();
- addToLayout(container, layoutIndex);
+ int layoutIndex = 0;
+ bool layoutIndexFound = false;
+ int tmpIndex =
+ store->value(LAYOUT_INDEX).toInt(&layoutIndexFound);
+ if (layoutIndexFound) {
+ layoutIndex = tmpIndex;
} else {
layoutIndex = layout->count();
- addToLayout(container);
}
-
+ addToLayout(container, layoutIndex);
// Write the layout data to the permanent store
- store->createValue("layoutIndex", layoutIndex);
+ store->createValue(LAYOUT_INDEX, layoutIndex);
}
}
}
diff --git a/src/extensions/applicationextension/mextensionrunner.cpp b/src/extensions/applicationextension/mextensionrunner.cpp
index 4cbebff0..805874df 100644
--- a/src/extensions/applicationextension/mextensionrunner.cpp
+++ b/src/extensions/applicationextension/mextensionrunner.cpp
@@ -167,7 +167,6 @@ bool MExtensionRunner::init(const QString &serverName)
teardown();
return false;
}
-
return true;
}
@@ -383,10 +382,7 @@ void MExtensionRunner::createAppletPixmap(Qt::HANDLE handle)
pixmap = QPixmap::fromX11Pixmap(handle, QPixmap::ExplicitlyShared);
#ifdef QT_OPENGL_LIB
- // Try to use opengl to render directly to the pixmap
- if (context != NULL)
- delete context;
-
+ // The QGLWidget takes the ownership of the context
context = new QGLContext(QGLFormat::defaultFormat(), &pixmap);
context->create();
if (context->isValid()) {
diff --git a/src/extensions/extensions.pro b/src/extensions/extensions.pro
index 3c5a58ce..4798d970 100644
--- a/src/extensions/extensions.pro
+++ b/src/extensions/extensions.pro
@@ -22,6 +22,9 @@ contains(DEFINES, HAVE_DBUS) {
LIBS += -lmeegotouchviews -lmeegotouchsettings -lmeegotouchcore
-SOURCES += mextensionslibrary.cpp
+SOURCES += mextensionwatcher.cpp \
+ mextensionslibrary.cpp
+
+HEADERS += mextensionwatcher.h
include(../common_bot.pri)
diff --git a/src/extensions/mashup/mashup/mappletinstancemanager.cpp b/src/extensions/mashup/mashup/mappletinstancemanager.cpp
index 99f2f11f..2a9ec44d 100644
--- a/src/extensions/mashup/mashup/mappletinstancemanager.cpp
+++ b/src/extensions/mashup/mashup/mappletinstancemanager.cpp
@@ -33,6 +33,8 @@
#include "mscenemanager.h"
#include "morientationtracker.h"
#include "maction.h"
+#include "mextensionwatcher.h"
+#include <algorithm>
const QString MAppletInstanceManager::PACKAGE_MANAGER_DBUS_SERVICE = "com.nokia.package_manager";
const QString MAppletInstanceManager::PACKAGE_MANAGER_DBUS_PATH = "/com/nokia/package_manager";
@@ -50,6 +52,7 @@ MAppletInstanceManager::~MAppletInstanceManager()
{
qDeleteAll(applets.values());
delete fileDataStore;
+ delete watcher;
}
void MAppletInstanceManager::init(const QString &mashupCanvasName, MDataStore *dataStore)
@@ -57,6 +60,7 @@ void MAppletInstanceManager::init(const QString &mashupCanvasName, MDataStore *d
this->applicationName = QFileInfo(QCoreApplication::applicationFilePath()).fileName();
this->mashupCanvasName = mashupCanvasName;
this->dataStore = dataStore;
+ this->watcher = new MExtensionWatcher;
if (dataStore == NULL) {
// Create a file datastore if a data store was not provided
@@ -75,6 +79,8 @@ void MAppletInstanceManager::init(const QString &mashupCanvasName, MDataStore *d
// Connect to the system bus to receive the Package Manager signals
QDBusConnection::systemBus().connect(QString(), PACKAGE_MANAGER_DBUS_PATH, PACKAGE_MANAGER_DBUS_INTERFACE, "OperationComplete", this, SLOT(operationComplete(QString, QString, QString)));
+ connect(watcher, SIGNAL(extensionChanged(const MDesktopEntry &)),
+ this, SLOT(updateApplet(const MDesktopEntry &)));
}
bool MAppletInstanceManager::restoreApplets()
@@ -114,6 +120,29 @@ void MAppletInstanceManager::instantiateAppletFromPackage(const QString &package
instantiateApplet(appletId);
}
+/*!
+ * A helper functor class for finding remaining applet instances
+ * after removing one instance
+ */
+struct FindAppletByFileName
+{
+ QString fileName_;
+ /**
+ * Constructs the functor
+ * \param fileName File name to compare against
+ */
+ explicit FindAppletByFileName(const QString& fileName)
+ : fileName_(fileName){
+ }
+ /**
+ * Compares an applet instance against the wanted file name
+ * \param data Instance to compare
+ */
+ bool operator()(const MAppletInstanceData* data) {
+ return data->desktopFile == fileName_;
+ }
+};
+
bool MAppletInstanceManager::removeApplet(MAppletId appletId)
{
// Make sure the applet instance exists in this particular applet instance manager
@@ -121,12 +150,20 @@ bool MAppletInstanceManager::removeApplet(MAppletId appletId)
appletId.mashupCanvasName() == mashupCanvasName && applets.contains(appletId.instanceId())) {
// Get the data for the applet
MAppletInstanceData *data = applets.value(appletId.instanceId());
-
+ QString fileName = data->desktopFile;
// Let interested parties know that the applet's widget should be removed
emit appletRemoved(data->widget);
// Remove the applet instance data
removeAppletInstanceData(appletId);
+
+ if (std::find_if(applets.constBegin(), applets.constEnd(),
+ FindAppletByFileName(fileName))
+ == applets.constEnd()) {
+ // this was the last instance, remove from watcher
+ watcher->removeExtension(data->desktopFile);
+ }
+
return true;
}
@@ -169,21 +206,24 @@ bool MAppletInstanceManager::instantiateApplet(MAppletId appletId)
QFile desktopFile(data->desktopFile);
if ((!data->desktopFile.isEmpty() && desktopFile.exists()) || data->installationStatus == MAppletInstanceData::Installing) {
// The desktop file exists, so the applet is installed or the applet was being installed: instantiate the applet
- MAppletMetaData metadata(data->desktopFile);
- if (metadata.isValid()) {
+ QSharedPointer<const MAppletMetaData>
+ metadata(new MAppletMetaData(data->desktopFile));
+ if (metadata->isValid()) {
// Check whether a runner is defined
bool success;
- if (metadata.runnerBinary().isEmpty()) {
+ if (metadata->runnerBinary().isEmpty()) {
// Runner not defined: create an in-process applet
- success = instantiateInProcessApplet(data, metadata);
+ // IN PROCESS APPLETS ARE NOT FULLY SUPPORTED AT THE MOMENT
+ success = instantiateInProcessApplet(data, *metadata);
} else {
// Runner is defined: create an out-of-process applet
- success = instantiateOutOfProcessApplet(data, metadata);
+ success = instantiateOutOfProcessApplet(data, *metadata);
}
if (success) {
// Notify that the applet placeholder instantiation is done
emit appletInstantiated(data->widget, *data->mashupCanvasDataStore);
+ watcher->addExtension(metadata);
return true;
}
}
@@ -208,6 +248,26 @@ bool MAppletInstanceManager::instantiateApplet(MAppletId appletId)
return false;
}
+void MAppletInstanceManager::updateApplet(const MDesktopEntry &updatedExtension)
+{
+ const MAppletMetaData* metadata =
+ dynamic_cast<const MAppletMetaData*>(&updatedExtension);
+ if (metadata->runnerBinary().isEmpty()) {
+ // Runner not defined: create an in-process applet
+ // IN PROCESS APPLETS ARE NOT FULLY SUPPORTED AT THE MOMENT
+ qWarning() << "In-process applet updates are not supported at the moment";
+ } else {
+ AppletContainerIterator appletIterator(applets);
+ while (appletIterator.hasNext()) {
+ appletIterator.next();
+ if (appletIterator.value()->desktopFile == metadata->fileName()) {
+ MAppletHandle *handle = dynamic_cast<MAppletHandle *>(appletIterator.value()->widget);
+ handle->reinit();
+ }
+ }
+ }
+}
+
bool MAppletInstanceManager::instantiateOutOfProcessApplet(MAppletInstanceData *data, const MAppletMetaData &metadata)
{
// Create an applet handle if one doesn't exist already
@@ -245,6 +305,7 @@ bool MAppletInstanceManager::instantiateOutOfProcessApplet(MAppletInstanceData *
return true;
}
+// IN PROCESS APPLETS ARE NOT FULLY SUPPORTED AT THE MOMENT
bool MAppletInstanceManager::instantiateInProcessApplet(MAppletInstanceData *data, const MAppletMetaData &metadata)
{
MFileDataStore *instanceDataStore = new MFileDataStore(data->instanceDataFilePath);
diff --git a/src/extensions/mashup/mashup/mappletinstancemanager.h b/src/extensions/mashup/mashup/mappletinstancemanager.h
index 52e1067b..b00fc81b 100644
--- a/src/extensions/mashup/mashup/mappletinstancemanager.h
+++ b/src/extensions/mashup/mashup/mappletinstancemanager.h
@@ -32,6 +32,8 @@ class MAppletMetaData;
class MAppletHandle;
class MFileDataStore;
class QDBusPendingCallWatcher;
+class MExtensionWatcher;
+class MDesktopEntry;
//! \internal
@@ -160,6 +162,14 @@ private slots:
*/
void receiveOperation(QDBusPendingCallWatcher *watcher);
+ /*!
+ * Tells us that we need to update the applet. Currently the \c watcher informs the manager
+ * that the update desktop file has changed
+ *
+ * \param appletData The applet that has changed.
+ */
+ void updateApplet(const MDesktopEntry &appletData);
+
private:
/*!
* Initializes the instance manager.
@@ -380,6 +390,9 @@ private:
//! A map for keeping track of running applets
AppletContainer applets;
+ //! The watcher used to monitor changes in the applets
+ MExtensionWatcher *watcher;
+
//! The last applet ID that used to be free
MAppletId::AppletInstanceID lastAppletInstanceID;
diff --git a/src/extensions/mextensionwatcher.cpp b/src/extensions/mextensionwatcher.cpp
new file mode 100644
index 00000000..44464d84
--- /dev/null
+++ b/src/extensions/mextensionwatcher.cpp
@@ -0,0 +1,68 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#include "mextensionwatcher.h"
+#include "mdesktopentry.h"
+#include "mapplicationextensionmetadata.h"
+#include <QFile>
+#include <QStringList>
+
+
+MExtensionWatcher::MExtensionWatcher()
+{
+ connect(&watcher, SIGNAL(fileChanged(const QString &)), this, SLOT(notifyDataChanged(const QString &)));
+}
+
+MExtensionWatcher::~MExtensionWatcher()
+{
+}
+
+void MExtensionWatcher::addExtension(
+ QSharedPointer<const MDesktopEntry> extension)
+{
+ QString fileName = extension->fileName();
+ if (!extensionsToWatch.contains(fileName)) {
+ extensionsToWatch.insert(fileName, extension);
+ watcher.addPath(fileName);
+ }
+}
+
+void MExtensionWatcher::removeExtension(const QString &fileName)
+{
+ extensionsToWatch.remove(fileName);
+}
+
+void MExtensionWatcher::notifyDataChanged(const QString &path) const
+{
+ // If the file does not exist anymore no need to signal an update for it
+ // observation of the file removal is handled by the instance managers
+ if (!QFile::exists(path)) {
+ return;
+ }
+ QHash<QString, QSharedPointer<const MDesktopEntry> >::const_iterator
+ extension = extensionsToWatch.find(path);
+ if (extension != extensionsToWatch.constEnd()) {
+ emit extensionChanged(*extension.value());
+ }
+ if (!watcher.files().contains(path)) {
+ // if the file is removed and recreated, we need to re-add
+ // the path to the watcher
+ watcher.addPath(path);
+ }
+}
diff --git a/src/extensions/mextensionwatcher.h b/src/extensions/mextensionwatcher.h
new file mode 100644
index 00000000..bc0a227e
--- /dev/null
+++ b/src/extensions/mextensionwatcher.h
@@ -0,0 +1,98 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef MEXTENSIONWATCHER_H
+#define MEXTENSIONWATCHER_H
+
+#include <QFileSystemWatcher>
+#include <QHash>
+#include <QSharedPointer>
+
+class MDesktopEntry;
+
+/*!
+ * \brief \c MExtensionWatcher provides means to watch if either a given
+ * applet or a application extension has been updated by the package manager.
+ * If the change happens a corresponding signal will be emitted.
+ *
+ * The user of this class is responsible for the lifecycle management of the
+ * watched entries. This class does not assume ownership of the items nor can
+ * it detect if they are deleted. The user must remove the item from this
+ * watcher before deleting the item. Otherwise desktop file modification
+ * notification leads to undefined behaviour, because the target item of the
+ * notification will not exist.
+ */
+class MExtensionWatcher : public QObject
+{
+ Q_OBJECT
+
+public:
+ /*!
+ * Constructs the watcher instance
+ */
+ MExtensionWatcher();
+
+
+ /*!
+ * Destroys the wathcer instance
+ */
+ virtual ~MExtensionWatcher();
+
+ /*!
+ * Add an extension to the list of watched extensions.
+ * If the extension (its desktop entry) changes,
+ * a signal \see extensionChanged will be emitted.
+ *
+ * \param extension The extension to watch.
+ */
+ void addExtension(QSharedPointer<const MDesktopEntry> extension);
+
+ /*!
+ * Removes an extension from the list of watched extension
+ *
+ * \param fileName Name of the desktop file of the extension to
+ * remove
+ */
+ void removeExtension(const QString &fileName);
+
+Q_SIGNALS:
+
+ /*!
+ * Informs that an extension (its desktop file) has changed.
+ *
+ * \param extension The extension that has changed
+ */
+ void extensionChanged(const MDesktopEntry &extension) const;
+
+private slots:
+ //! Listens in on the actual changes
+ void notifyDataChanged(const QString &path) const;
+
+private:
+ //! The watcher instance for observing changes to desktop files
+ mutable QFileSystemWatcher watcher;
+ //! The list of applets to watch
+ QHash<QString, QSharedPointer<const MDesktopEntry> > extensionsToWatch;
+
+#ifdef UNIT_TEST
+ friend class Ut_MExtensionWatcher;
+#endif
+};
+
+#endif //MEXTENSIONWATCHER_H
diff --git a/src/icu-extradata/4.4.1/fi.txt b/src/icu-extradata/4.4.1/fi.txt
new file mode 100644
index 00000000..15b942ce
--- /dev/null
+++ b/src/icu-extradata/4.4.1/fi.txt
@@ -0,0 +1,21 @@
+fi{
+ calendar{
+ gregorian{
+ DateTimePatterns{
+ "H.mm.ss zzzz",
+ "H.mm.ss z",
+ "H.mm.ss",
+ "H.mm",
+ "cccc d. MMMM y",
+ "d. MMMM y",
+ "d.M.yyyy",
+ "d.M.yyyy",
+ "{1} {0}",
+ "{1} {0}",
+ "{1} {0}",
+ "{1} {0}",
+ "{1} {0}",
+ }
+ }
+ }
+}
diff --git a/src/icu-extradata/4.4.1/it.txt b/src/icu-extradata/4.4.1/it.txt
new file mode 100644
index 00000000..1c7b07aa
--- /dev/null
+++ b/src/icu-extradata/4.4.1/it.txt
@@ -0,0 +1,21 @@
+it{
+ calendar{
+ gregorian{
+ DateTimePatterns{
+ "HH:mm:ss zzzz",
+ "HH:mm:ss z",
+ "HH:mm:ss",
+ "HH:mm",
+ "cccc d LLLL y",
+ "dd MMMM y",
+ "dd/MMM/y",
+ "dd/MM/yy",
+ "{1} {0}",
+ "{1} {0}",
+ "{1} {0}",
+ "{1} {0}",
+ "{1} {0}",
+ }
+ }
+ }
+}
diff --git a/src/icu-extradata/4.4.1/lang/de_CH.txt b/src/icu-extradata/4.4.1/lang/de_CH.txt
new file mode 100644
index 00000000..22c5cea4
--- /dev/null
+++ b/src/icu-extradata/4.4.1/lang/de_CH.txt
@@ -0,0 +1,712 @@
+de_CH{
+ Keys{
+ calendar{"Kalender"}
+ collation{"Sortierung"}
+ currency{"Währung"}
+ }
+ Languages{
+ aa{"Afar"}
+ ab{"Abchasisch"}
+ ace{"Aceh-Sprache"}
+ ach{"Acholi-Sprache"}
+ ada{"Adangme"}
+ ady{"Adygeisch"}
+ ae{"Avestisch"}
+ af{"Afrikaans"}
+ afa{"Afroasiatisch"}
+ afh{"Afrihili"}
+ ain{"Ainu-Sprache"}
+ ak{"Akan"}
+ akk{"Akkadisch"}
+ ale{"Aleutisch"}
+ alg{"Algonkin-Sprache"}
+ alt{"Süd-Altaisch"}
+ am{"Amharisch"}
+ an{"Aragonesisch"}
+ ang{"Altenglisch"}
+ anp{"Angika"}
+ apa{"Apache-Sprache"}
+ ar{"Arabisch"}
+ arc{"Aramäisch"}
+ arn{"Araukanisch"}
+ arp{"Arapaho-Sprache"}
+ art{"Kunstsprache"}
+ arw{"Arawak-Sprache"}
+ as{"Assamesisch"}
+ ast{"Asturianisch"}
+ ath{"Athapaskisch"}
+ aus{"Australisch"}
+ av{"Awarisch"}
+ awa{"Awadhi"}
+ ay{"Aymara"}
+ az{"Aserbaidschanisch"}
+ ba{"Baschkirisch"}
+ bad{"Banda-Sprache"}
+ bai{"Bamileke-Sprache"}
+ bal{"Belutschisch"}
+ ban{"Balinesisch"}
+ bas{"Basaa-Sprache"}
+ bat{"Baltisch"}
+ be{"Weissrussisch"}
+ bej{"Bedauye"}
+ bem{"Bemba-Sprache"}
+ ber{"Berbersprache"}
+ bg{"Bulgarisch"}
+ bh{"Biharisch"}
+ bho{"Bhodschpuri"}
+ bi{"Bislama"}
+ bik{"Bikol-Sprache"}
+ bin{"Bini-Sprache"}
+ bla{"Blackfoot-Sprache"}
+ bm{"Bambara-Sprache"}
+ bn{"Bengalisch"}
+ bnt{"Bantusprache"}
+ bo{"Tibetisch"}
+ br{"Bretonisch"}
+ bra{"Braj-Bhakha"}
+ bs{"Bosnisch"}
+ btk{"Batak"}
+ bua{"Burjatisch"}
+ bug{"Buginesisch"}
+ byn{"Blin"}
+ ca{"Katalanisch"}
+ cad{"Caddo"}
+ cai{"Zentralamerikanische Indianersprache"}
+ car{"Karibisch"}
+ cau{"Kaukasisch"}
+ cch{"Atsam"}
+ ce{"Tschetschenisch"}
+ ceb{"Cebuano"}
+ cel{"Keltisch"}
+ ch{"Chamorro-Sprache"}
+ chb{"Chibcha-Sprache"}
+ chg{"Tschagataisch"}
+ chk{"Trukesisch"}
+ chm{"Tscheremissisch"}
+ chn{"Chinook"}
+ cho{"Choctaw"}
+ chp{"Chipewyan"}
+ chr{"Cherokee"}
+ chy{"Cheyenne"}
+ cmc{"Cham-Sprache"}
+ co{"Korsisch"}
+ cop{"Koptisch"}
+ cpe{"Kreolisch-Englische Sprache"}
+ cpf{"Kreolisch-Französische Sprache"}
+ cpp{"Kreolisch-Portugiesische Sprache"}
+ cr{"Cree"}
+ crh{"Krimtatarisch"}
+ crp{"Kreolische Sprache"}
+ cs{"Tschechisch"}
+ csb{"Kaschubisch"}
+ cu{"Kirchenslawisch"}
+ cus{"Kuschitisch"}
+ cv{"Tschuwaschisch"}
+ cy{"Walisisch"}
+ da{"Dänisch"}
+ dak{"Dakota-Sprache"}
+ dar{"Darginisch"}
+ day{"Dajak"}
+ de{"Deutsch"}
+ de_AT{"Österreichisches Deutsch"}
+ de_CH{"Schweizer Hochdeutsch"}
+ del{"Delaware-Sprache"}
+ den{"Slave"}
+ dgr{"Dogrib"}
+ din{"Dinka-Sprache"}
+ doi{"Dogri"}
+ dra{"Drawidisch"}
+ dsb{"Niedersorbisch"}
+ dua{"Duala"}
+ dum{"Mittelniederländisch"}
+ dv{"Maledivisch"}
+ dyu{"Dyula-Sprache"}
+ dz{"Bhutanisch"}
+ ee{"Ewe-Sprache"}
+ efi{"Efik"}
+ egy{"Ägyptisch"}
+ eka{"Ekajuk"}
+ el{"Griechisch"}
+ elx{"Elamisch"}
+ en{"Englisch"}
+ en_AU{"Australisches Englisch"}
+ en_CA{"Kanadisches Englisch"}
+ en_GB{"Britisches Englisch"}
+ en_US{"Amerikanisches Englisch"}
+ enm{"Mittelenglisch"}
+ eo{"Esperanto"}
+ es{"Spanisch"}
+ es_419{"Lateinamerikanisches Spanisch"}
+ es_ES{"Iberisches Spanisch"}
+ et{"Estnisch"}
+ eu{"Baskisch"}
+ ewo{"Ewondo"}
+ fa{"Persisch"}
+ fan{"Pangwe-Sprache"}
+ fat{"Fanti-Sprache"}
+ ff{"Ful"}
+ fi{"Finnisch"}
+ fil{"Filipino"}
+ fiu{"Finnougrisch"}
+ fj{"Fidschianisch"}
+ fo{"Färöisch"}
+ fon{"Fon-Sprache"}
+ fr{"Französisch"}
+ fr_CA{"Kanadisches Französisch"}
+ fr_CH{"Schweizer Französisch"}
+ frm{"Mittelfranzösisch"}
+ fro{"Altfranzösisch"}
+ frr{"Nordfriesisch"}
+ frs{"Ostfriesisch"}
+ fur{"Friulisch"}
+ fy{"Friesisch"}
+ ga{"Irisch"}
+ gaa{"Ga-Sprache"}
+ gay{"Gayo"}
+ gba{"Gbaya-Sprache"}
+ gd{"Schottisches Gälisch"}
+ gem{"Germanisch"}
+ gez{"Geez"}
+ gil{"Gilbertesisch"}
+ gl{"Galizisch"}
+ gmh{"Mittelhochdeutsch"}
+ gn{"Guarani"}
+ goh{"Althochdeutsch"}
+ gon{"Gondi-Sprache"}
+ gor{"Mongondou"}
+ got{"Gotisch"}
+ grb{"Grebo-Sprache"}
+ grc{"Altgriechisch"}
+ gsw{"Schweizerdeutsch"}
+ gu{"Gujarati"}
+ gv{"Manx"}
+ gwi{"Kutchin-Sprache"}
+ ha{"Hausa"}
+ hai{"Haida-Sprache"}
+ haw{"Hawaiisch"}
+ he{"Hebräisch"}
+ hi{"Hindi"}
+ hil{"Hiligaynon-Sprache"}
+ him{"Himachali"}
+ hit{"Hethitisch"}
+ hmn{"Miao-Sprache"}
+ ho{"Hiri-Motu"}
+ hr{"Kroatisch"}
+ hsb{"Obersorbisch"}
+ ht{"Haitianisch"}
+ hu{"Ungarisch"}
+ hup{"Hupa"}
+ hy{"Armenisch"}
+ hz{"Herero-Sprache"}
+ ia{"Interlingua"}
+ iba{"Iban"}
+ id{"Indonesisch"}
+ ie{"Interlingue"}
+ ig{"Igbo-Sprache"}
+ ii{"Sichuan Yi"}
+ ijo{"Ijo-Sprache"}
+ ik{"Inupiak"}
+ ilo{"Ilokano-Sprache"}
+ inc{"Indoarisch"}
+ ine{"Indogermanisch"}
+ inh{"Inguschisch"}
+ io{"Ido-Sprache"}
+ ira{"Iranische Sprache"}
+ iro{"Irokesische Sprache"}
+ is{"Isländisch"}
+ it{"Italienisch"}
+ iu{"Inukitut"}
+ ja{"Japanisch"}
+ jbo{"Lojban"}
+ jpr{"Jüdisch-Persisch"}
+ jrb{"Jüdisch-Arabisch"}
+ jv{"Javanisch"}
+ ka{"Georgisch"}
+ kaa{"Karakalpakisch"}
+ kab{"Kabylisch"}
+ kac{"Kachin-Sprache"}
+ kaj{"Jju"}
+ kam{"Kamba"}
+ kar{"Karenisch"}
+ kaw{"Kawi"}
+ kbd{"Kabardinisch"}
+ kcg{"Tyap"}
+ kfo{"Koro"}
+ kg{"Kongo"}
+ kha{"Khasi-Sprache"}
+ khi{"Khoisan-Sprache"}
+ kho{"Sakisch"}
+ ki{"Kikuyu-Sprache"}
+ kj{"Kwanyama"}
+ kk{"Kasachisch"}
+ kl{"Grönländisch"}
+ km{"Kambodschanisch"}
+ kmb{"Kimbundu-Sprache"}
+ kn{"Kannada"}
+ ko{"Koreanisch"}
+ kok{"Konkani"}
+ kos{"Kosraeanisch"}
+ kpe{"Kpelle-Sprache"}
+ kr{"Kanuri-Sprache"}
+ krc{"Karatschaiisch-Balkarisch"}
+ krl{"Karelisch"}
+ kro{"Kru-Sprache"}
+ kru{"Oraon-Sprache"}
+ ks{"Kaschmirisch"}
+ ku{"Kurdisch"}
+ kum{"Kumükisch"}
+ kut{"Kutenai-Sprache"}
+ kv{"Komi-Sprache"}
+ kw{"Kornisch"}
+ ky{"Kirgisisch"}
+ la{"Latein"}
+ lad{"Ladino"}
+ lah{"Lahnda"}
+ lam{"Lamba-Sprache"}
+ lb{"Luxemburgisch"}
+ lez{"Lesgisch"}
+ lg{"Ganda-Sprache"}
+ li{"Limburgisch"}
+ ln{"Lingala"}
+ lo{"Laotisch"}
+ lol{"Mongo"}
+ loz{"Rotse-Sprache"}
+ lt{"Litauisch"}
+ lu{"Luba-Katanga"}
+ lua{"Luba-Lulua"}
+ lui{"Luiseno-Sprache"}
+ lun{"Lunda-Sprache"}
+ luo{"Luo-Sprache"}
+ lus{"Lushai-Sprache"}
+ lv{"Lettisch"}
+ mad{"Maduresisch"}
+ mag{"Khotta"}
+ mai{"Maithili"}
+ mak{"Makassarisch"}
+ man{"Manding-Sprache"}
+ map{"Austronesisch"}
+ mas{"Massai-Sprache"}
+ mdf{"Moksha"}
+ mdr{"Mandaresisch"}
+ men{"Mende-Sprache"}
+ mg{"Malagassi-Sprache"}
+ mga{"Mittelirisch"}
+ mh{"Marschallesisch"}
+ mi{"Maori"}
+ mic{"Micmac-Sprache"}
+ min{"Minangkabau-Sprache"}
+ mis{"(andere Sprache)"}
+ mk{"Mazedonisch"}
+ mkh{"Mon-Khmer-Sprache"}
+ ml{"Malayalam"}
+ mn{"Mongolisch"}
+ mnc{"Mandschurisch"}
+ mni{"Meithei-Sprache"}
+ mno{"Manobo-Sprache"}
+ mo{"Moldauisch"}
+ moh{"Mohawk-Sprache"}
+ mos{"Mossi-Sprache"}
+ mr{"Marathi"}
+ ms{"Malaiisch"}
+ mt{"Maltesisch"}
+ mul{"Mehrsprachig"}
+ mun{"Munda-Sprache"}
+ mus{"Muskogee-Sprache"}
+ mwl{"Mirandesisch"}
+ mwr{"Marwari"}
+ my{"Birmanisch"}
+ myn{"Maya-Sprache"}
+ myv{"Ersja-Mordwinisch"}
+ na{"Nauruisch"}
+ nah{"Nahuatl"}
+ nai{"Nordamerikanische Indianersprache"}
+ nap{"Neapolitanisch"}
+ nb{"Norwegisch Bokmål"}
+ nd{"Nord-Ndebele-Sprache"}
+ nds{"Niederdeutsch"}
+ ne{"Nepalesisch"}
+ new{"Newari"}
+ ng{"Ndonga"}
+ nia{"Nias-Sprache"}
+ nic{"Nigerkordofanisch"}
+ niu{"Niue-Sprache"}
+ nl{"Niederländisch"}
+ nl_BE{"Flämisch"}
+ nn{"Norwegisch Nynorsk"}
+ no{"Norwegisch"}
+ nog{"Nogai"}
+ non{"Altnordisch"}
+ nqo{"N’Ko"}
+ nr{"Süd-Ndebele-Sprache"}
+ nso{"Nord-Sotho-Sprache"}
+ nub{"Nubisch"}
+ nv{"Navajo"}
+ nwc{"Alt-Newari"}
+ ny{"Nyanja-Sprache"}
+ nym{"Nyamwezi-Sprache"}
+ nyn{"Nyankole"}
+ nyo{"Nyoro"}
+ nzi{"Nzima"}
+ oc{"Okzitanisch"}
+ oj{"Ojibwa-Sprache"}
+ om{"Oromo"}
+ or{"Orija"}
+ os{"Ossetisch"}
+ osa{"Osage-Sprache"}
+ ota{"Osmanisch"}
+ oto{"Otomangue-Sprache"}
+ pa{"Pandschabisch"}
+ paa{"Papuasprache"}
+ pag{"Pangasinan-Sprache"}
+ pal{"Mittelpersisch"}
+ pam{"Pampanggan-Sprache"}
+ pap{"Papiamento"}
+ pau{"Palau"}
+ peo{"Altpersisch"}
+ phi{"Philippinen-Austronesisch"}
+ phn{"Phönikisch"}
+ pi{"Pali"}
+ pl{"Polnisch"}
+ pon{"Ponapeanisch"}
+ pra{"Prakrit"}
+ pro{"Altprovenzalisch"}
+ ps{"Paschtu"}
+ pt{"Portugiesisch"}
+ pt_BR{"Brasilianisches Portugiesisch"}
+ pt_PT{"Iberisches Portugiesisch"}
+ qu{"Quechua"}
+ raj{"Rajasthani"}
+ rap{"Osterinsel-Sprache"}
+ rar{"Rarotonganisch"}
+ rm{"Rätoromanisch"}
+ rn{"Rundi-Sprache"}
+ ro{"Rumänisch"}
+ roa{"Romanische Sprache"}
+ rom{"Romani"}
+ root{"Root"}
+ ru{"Russisch"}
+ rup{"Aromunisch"}
+ rw{"Ruandisch"}
+ sa{"Sanskrit"}
+ sad{"Sandawe-Sprache"}
+ sah{"Jakutisch"}
+ sai{"Südamerikanische Indianersprache"}
+ sal{"Salish-Sprache"}
+ sam{"Samaritanisch"}
+ sas{"Sasak"}
+ sat{"Santali"}
+ sc{"Sardisch"}
+ scn{"Sizilianisch"}
+ sco{"Schottisch"}
+ sd{"Sindhi"}
+ se{"Nord-Samisch"}
+ sel{"Selkupisch"}
+ sem{"Semitisch"}
+ sg{"Sango"}
+ sga{"Altirisch"}
+ sgn{"Gebärdensprache"}
+ sh{"Serbo-Kroatisch"}
+ shn{"Schan-Sprache"}
+ si{"Singhalesisch"}
+ sid{"Sidamo"}
+ sio{"Sioux-Sprache"}
+ sit{"Sinotibetisch"}
+ sk{"Slowakisch"}
+ sl{"Slowenisch"}
+ sla{"Slawisch"}
+ sm{"Samoanisch"}
+ sma{"Süd-Samisch"}
+ smi{"Lappisch"}
+ smj{"Lule-Lappisch"}
+ smn{"Inari-Lappisch"}
+ sms{"Skolt-Lappisch"}
+ sn{"Shona"}
+ snk{"Soninke-Sprache"}
+ so{"Somali"}
+ sog{"Sogdisch"}
+ son{"Songhai-Sprache"}
+ sq{"Albanisch"}
+ sr{"Serbisch"}
+ srn{"Srananisch"}
+ srr{"Serer-Sprache"}
+ ss{"Swazi"}
+ ssa{"Nilosaharanisch"}
+ st{"Süd-Sotho-Sprache"}
+ su{"Sundanesisch"}
+ suk{"Sukuma-Sprache"}
+ sus{"Susu"}
+ sux{"Sumerisch"}
+ sv{"Schwedisch"}
+ sw{"Suaheli"}
+ swb{"Komorisch"}
+ syc{"Altsyrisch"}
+ syr{"Syrisch"}
+ ta{"Tamilisch"}
+ tai{"Tai-Sprache"}
+ te{"Telugu"}
+ tem{"Temne"}
+ ter{"Tereno-Sprache"}
+ tet{"Tetum-Sprache"}
+ tg{"Tadschikisch"}
+ th{"Thailändisch"}
+ ti{"Tigrinja"}
+ tig{"Tigre"}
+ tiv{"Tiv-Sprache"}
+ tk{"Turkmenisch"}
+ tkl{"Tokelauanisch"}
+ tl{"Tagalog"}
+ tlh{"Klingonisch"}
+ tli{"Tlingit-Sprache"}
+ tmh{"Tamaseq"}
+ tn{"Tswana-Sprache"}
+ to{"Tongaisch"}
+ tog{"Tsonga-Sprache"}
+ tpi{"Neumelanesisch"}
+ tr{"Türkisch"}
+ ts{"Tsonga"}
+ tsi{"Tsimshian-Sprache"}
+ tt{"Tatarisch"}
+ tum{"Tumbuka-Sprache"}
+ tup{"Tupi-Sprache"}
+ tut{"Altaisch"}
+ tvl{"Elliceanisch"}
+ tw{"Twi"}
+ ty{"Tahitisch"}
+ tyv{"Tuwinisch"}
+ udm{"Udmurtisch"}
+ ug{"Uigurisch"}
+ uga{"Ugaritisch"}
+ uk{"Ukrainisch"}
+ umb{"Mbundu-Sprache"}
+ und{"Unbestimmte Sprache"}
+ ur{"Urdu"}
+ uz{"Usbekisch"}
+ vai{"Vai-Sprache"}
+ ve{"Venda-Sprache"}
+ vi{"Vietnamesisch"}
+ vo{"Volapük"}
+ vot{"Wotisch"}
+ wa{"Wallonisch"}
+ wak{"Wakashanisch"}
+ wal{"Walamo-Sprache"}
+ war{"Waray"}
+ was{"Washo-Sprache"}
+ wen{"Sorbisch"}
+ wo{"Wolof"}
+ xal{"Kalmückisch"}
+ xh{"Xhosa"}
+ yao{"Yao-Sprache"}
+ yap{"Yapesisch"}
+ yi{"Jiddisch"}
+ yo{"Yoruba"}
+ ypk{"Yupik-Sprache"}
+ yue{"Kantonesisch"}
+ za{"Zhuang"}
+ zap{"Zapotekisch"}
+ zbl{"Bliss-Symbole"}
+ zen{"Zenaga"}
+ zh{"Chinesisch"}
+ zh_Hans{"Chinesisch (vereinfacht)"}
+ zh_Hant{"Chinesisch (traditionell)"}
+ znd{"Zande-Sprache"}
+ zu{"Zulu"}
+ zun{"Zuni-Sprache"}
+ zxx{"Keine Sprachinhalte"}
+ zza{"Zaza"}
+ }
+ Scripts{
+ Arab{"Arabisch"}
+ Armi{"Armi"}
+ Armn{"Armenisch"}
+ Avst{"Avestisch"}
+ Bali{"Balinesisch"}
+ Batk{"Battakisch"}
+ Beng{"Bengalisch"}
+ Blis{"Bliss-Symbole"}
+ Bopo{"Bopomofo"}
+ Brah{"Brahmi"}
+ Brai{"Blindenschrift"}
+ Bugi{"Buginesisch"}
+ Buhd{"Buhid"}
+ Cakm{"Cakm"}
+ Cans{"UCAS"}
+ Cari{"Karisch"}
+ Cham{"Cham"}
+ Cher{"Cherokee"}
+ Cirt{"Cirth"}
+ Copt{"Koptisch"}
+ Cprt{"Zypriotisch"}
+ Cyrl{"Kyrillisch"}
+ Cyrs{"Altkirchenslawisch"}
+ Deva{"Devanagari"}
+ Dsrt{"Deseret"}
+ Egyd{"Ägyptisch - Demotisch"}
+ Egyh{"Ägyptisch - Hieratisch"}
+ Egyp{"Ägyptische Hieroglyphen"}
+ Ethi{"Äthiopisch"}
+ Geok{"Khutsuri"}
+ Geor{"Georgisch"}
+ Glag{"Glagolitisch"}
+ Goth{"Gotisch"}
+ Grek{"Griechisch"}
+ Gujr{"Gujarati"}
+ Guru{"Gurmukhi"}
+ Hang{"Hangul"}
+ Hani{"Chinesisch"}
+ Hano{"Hanunoo"}
+ Hans{"Vereinfachte Chinesische Schrift"}
+ Hant{"Traditionelle Chinesische Schrift"}
+ Hebr{"Hebräisch"}
+ Hira{"Hiragana"}
+ Hmng{"Pahawh Hmong"}
+ Hrkt{"Katakana oder Hiragana"}
+ Hung{"Altungarisch"}
+ Inds{"Indus-Schrift"}
+ Ital{"Altitalisch"}
+ Java{"Javanesisch"}
+ Jpan{"Japanisch"}
+ Kali{"Kayah Li"}
+ Kana{"Katakana"}
+ Khar{"Kharoshthi"}
+ Khmr{"Khmer"}
+ Knda{"Kannada"}
+ Kore{"Koreanisch"}
+ Kthi{"Kthi"}
+ Lana{"Lanna"}
+ Laoo{"Laotisch"}
+ Latf{"Lateinisch - Fraktur-Variante"}
+ Latg{"Lateinisch - Gälische Variante"}
+ Latn{"Lateinisch"}
+ Lepc{"Lepcha"}
+ Limb{"Limbu"}
+ Lina{"Linear A"}
+ Linb{"Linear B"}
+ Lyci{"Lykisch"}
+ Lydi{"Lydisch"}
+ Mand{"Mandäisch"}
+ Mani{"Manichäisch"}
+ Maya{"Maya-Hieroglyphen"}
+ Mero{"Meroitisch"}
+ Mlym{"Malaysisch"}
+ Mong{"Mongolisch"}
+ Moon{"Moon"}
+ Mtei{"Meitei Mayek"}
+ Mymr{"Birmanisch"}
+ Nkoo{"N’Ko"}
+ Ogam{"Ogham"}
+ Olck{"Ol Chiki"}
+ Orkh{"Orchon-Runen"}
+ Orya{"Oriya"}
+ Osma{"Osmanisch"}
+ Perm{"Altpermisch"}
+ Phag{"Phags-pa"}
+ Phli{"Phli"}
+ Phlp{"Phlp"}
+ Phlv{"Pahlavi"}
+ Phnx{"Phönizisch"}
+ Plrd{"Pollard Phonetisch"}
+ Prti{"Prti"}
+ Qaai{"Geerbter Schriftwert"}
+ Rjng{"Rejang"}
+ Roro{"Rongorongo"}
+ Runr{"Runenschrift"}
+ Samr{"Samaritanisch"}
+ Sara{"Sarati"}
+ Saur{"Saurashtra"}
+ Sgnw{"Gebärdensprache"}
+ Shaw{"Shaw-Alphabet"}
+ Sinh{"Singhalesisch"}
+ Sund{"Sundanesisch"}
+ Sylo{"Syloti Nagri"}
+ Syrc{"Syrisch"}
+ Syre{"Syrisch - Estrangelo-Variante"}
+ Syrj{"Westsyrisch"}
+ Syrn{"Ostsyrisch"}
+ Tagb{"Tagbanwa"}
+ Tale{"Tai Le"}
+ Talu{"Tai Lue"}
+ Taml{"Tamilisch"}
+ Tavt{"Tavt"}
+ Telu{"Telugu"}
+ Teng{"Tengwar"}
+ Tfng{"Tifinagh"}
+ Tglg{"Tagalog"}
+ Thaa{"Thaana"}
+ Thai{"Thai"}
+ Tibt{"Tibetisch"}
+ Ugar{"Ugaritisch"}
+ Vaii{"Vai"}
+ Visp{"Sichtbare Sprache"}
+ Xpeo{"Altpersisch"}
+ Xsux{"Sumerisch-akkadische Keilschrift"}
+ Yiii{"Yi"}
+ Zmth{"Zmth"}
+ Zsym{"Zsym"}
+ Zxxx{"Schriftlos"}
+ Zyyy{"Unbestimmt"}
+ Zzzz{"Uncodierte Schrift"}
+ }
+ Types{
+ calendar{
+ buddhist{"Buddhistischer Kalender"}
+ chinese{"Chinesischer Kalender"}
+ gregorian{"Gregorianischer Kalender"}
+ hebrew{"Hebräischer Kalender"}
+ indian{"Indischer Nationalkalender"}
+ islamic{"Islamischer Kalender"}
+ islamic-civil{"Bürgerlicher islamischer Kalender"}
+ japanese{"Japanischer Kalender"}
+ roc{"Kalender der Republik China"}
+ }
+ collation{
+ big5han{"Traditionelles Chinesisch - Big5"}
+ direct{"Direkte Sortierregeln"}
+ gb2312han{"Vereinfachtes Chinesisch - GB2312"}
+ phonebook{"Telefonbuch-Sortierregeln"}
+ pinyin{"Pinyin-Sortierregeln"}
+ stroke{"Strichfolge"}
+ traditional{"Traditionelle Sortierregeln"}
+ }
+ }
+ Variants{
+ 1606NICT{"Spätes Mittelfranzösisch"}
+ 1694ACAD{"Klassisches Französisch"}
+ 1901{"Alte deutsche Rechtschreibung"}
+ 1994{"Standardisierte Resianische Rechtschreibung"}
+ 1996{"Neue deutsche Rechtschreibung"}
+ AREVELA{"Ostarmenisch"}
+ AREVMDA{"Westarmenisch"}
+ BAKU1926{"Einheitliches Türkisches Alphabet"}
+ BISKE{"Bela-Dialekt"}
+ BOONT{"Boontling"}
+ FONIPA{"IPA Phonetisch"}
+ FONUPA{"Phonetisch (UPA)"}
+ LIPAW{"Lipovaz-Dialekt"}
+ MONOTON{"Monotonisch"}
+ NEDIS{"Natisone-Dialekt"}
+ NJIVA{"Njiva-Dialekt"}
+ OSOJS{"Osojane-Dialekt"}
+ PINYIN{"Pinyin"}
+ POLYTON{"Polytonisch"}
+ POSIX{"Posix"}
+ REVISED{"Revidierte Rechtschreibung"}
+ ROZAJ{"Resianisch"}
+ SAAHO{"Saho"}
+ SCOTLAND{"Schottisches Standardenglisch"}
+ SCOUSE{"Scouse-Dialekt"}
+ SOLBA{"Solbica-Dialekt"}
+ TARASK{"Taraskievica-Orthographie"}
+ VALENCIA{"Valencianisch"}
+ WADEGILE{"Wade-Giles"}
+ }
+ Version{"2.0.48.64"}
+ codePatterns{
+ language{"Sprache: {0}"}
+ script{"Schrift: {0}"}
+ territory{"Region: {0}"}
+ }
+ localeDisplayPattern{
+ pattern{"{0} ({1})"}
+ separator{", "}
+ }
+}
diff --git a/src/icu-extradata/4.4.1/region/de_CH.txt b/src/icu-extradata/4.4.1/region/de_CH.txt
new file mode 100644
index 00000000..5a129f9f
--- /dev/null
+++ b/src/icu-extradata/4.4.1/region/de_CH.txt
@@ -0,0 +1,294 @@
+de_CH{
+ Countries{
+ 001{"Welt"}
+ 002{"Afrika"}
+ 003{"Nordamerika"}
+ 005{"Südamerika"}
+ 009{"Ozeanien"}
+ 011{"Westafrika"}
+ 013{"Mittelamerika"}
+ 014{"Ostafrika"}
+ 015{"Nordafrika"}
+ 017{"Zentralafrika"}
+ 018{"Südliches Afrika"}
+ 019{"Amerika"}
+ 021{"Nördliches Amerika"}
+ 029{"Karibik"}
+ 030{"Ostasien"}
+ 034{"Südasien"}
+ 035{"Südostasien"}
+ 039{"Südeuropa"}
+ 053{"Australien und Neuseeland"}
+ 054{"Melanesien"}
+ 057{"Mikronesisches Inselgebiet"}
+ 061{"Polynesien"}
+ 062{"Süd-Zentralasien"}
+ 142{"Asien"}
+ 143{"Zentralasien"}
+ 145{"Westasien"}
+ 150{"Europa"}
+ 151{"Osteuropa"}
+ 154{"Nordeuropa"}
+ 155{"Westeuropa"}
+ 172{"Gemeinschaft Unabhängiger Staaten"}
+ 419{"Lateinamerika und Karibik"}
+ 830{"Kanalinseln"}
+ AC{"Ascension"}
+ AD{"Andorra"}
+ AE{"Vereinigte Arabische Emirate"}
+ AF{"Afghanistan"}
+ AG{"Antigua und Barbuda"}
+ AI{"Anguilla"}
+ AL{"Albanien"}
+ AM{"Armenien"}
+ AN{"Niederländische Antillen"}
+ AO{"Angola"}
+ AQ{"Antarktis"}
+ AR{"Argentinien"}
+ AS{"Amerikanisch-Samoa"}
+ AT{"Österreich"}
+ AU{"Australien"}
+ AW{"Aruba"}
+ AX{"Alandinseln"}
+ AZ{"Aserbaidschan"}
+ BA{"Bosnien und Herzegowina"}
+ BB{"Barbados"}
+ BD{"Bangladesh"}
+ BE{"Belgien"}
+ BF{"Burkina Faso"}
+ BG{"Bulgarien"}
+ BH{"Bahrain"}
+ BI{"Burundi"}
+ BJ{"Benin"}
+ BL{"St. Barthélemy"}
+ BM{"Bermuda"}
+ BN{"Brunei"}
+ BO{"Bolivien"}
+ BR{"Brasilien"}
+ BS{"Bahamas"}
+ BT{"Bhutan"}
+ BV{"Bouvetinsel"}
+ BW{"Botswana"}
+ BY{"Weissrussland"}
+ BZ{"Belize"}
+ CA{"Kanada"}
+ CC{"Kokosinseln"}
+ CD{"Kongo-Kinshasa"}
+ CF{"Zentralafrikanische Republik"}
+ CG{"Kongo-Brazzaville"}
+ CH{"Schweiz"}
+ CI{"Côte d’Ivoire"}
+ CK{"Cookinseln"}
+ CL{"Chile"}
+ CM{"Kamerun"}
+ CN{"China"}
+ CO{"Kolumbien"}
+ CP{"Clipperton-Insel"}
+ CR{"Costa Rica"}
+ CS{"Serbien und Montenegro"}
+ CU{"Kuba"}
+ CV{"Kapverden"}
+ CX{"Weihnachtsinsel"}
+ CY{"Zypern"}
+ CZ{"Tschechische Republik"}
+ DE{"Deutschland"}
+ DG{"Diego Garcia"}
+ DJ{"Djibouti"}
+ DK{"Dänemark"}
+ DM{"Dominica"}
+ DO{"Dominikanische Republik"}
+ DZ{"Algerien"}
+ EA{"Ceuta und Melilla"}
+ EC{"Ecuador"}
+ EE{"Estland"}
+ EG{"Ägypten"}
+ EH{"Westsahara"}
+ ER{"Eritrea"}
+ ES{"Spanien"}
+ ET{"Äthiopien"}
+ EU{"Europäische Union"}
+ FI{"Finnland"}
+ FJ{"Fidschi"}
+ FK{"Falklandinseln"}
+ FM{"Mikronesien"}
+ FO{"Färöer"}
+ FR{"Frankreich"}
+ GA{"Gabun"}
+ GB{"Grossbritannien"}
+ GD{"Grenada"}
+ GE{"Georgien"}
+ GF{"Französisch-Guayana"}
+ GG{"Guernsey"}
+ GH{"Ghana"}
+ GI{"Gibraltar"}
+ GL{"Grönland"}
+ GM{"Gambia"}
+ GN{"Guinea"}
+ GP{"Guadeloupe"}
+ GQ{"Äquatorialguinea"}
+ GR{"Griechenland"}
+ GS{"Südgeorgien und die Südlichen Sandwichinseln"}
+ GT{"Guatemala"}
+ GU{"Guam"}
+ GW{"Guinea-Bissau"}
+ GY{"Guyana"}
+ HK{"Sonderverwaltungszone Hongkong"}
+ HM{"Heard- und McDonald-Inseln"}
+ HN{"Honduras"}
+ HR{"Kroatien"}
+ HT{"Haiti"}
+ HU{"Ungarn"}
+ IC{"Kanarische Inseln"}
+ ID{"Indonesien"}
+ IE{"Irland"}
+ IL{"Israel"}
+ IM{"Isle of Man"}
+ IN{"Indien"}
+ IO{"Britisches Territorium im Indischen Ozean"}
+ IQ{"Irak"}
+ IR{"Iran"}
+ IS{"Island"}
+ IT{"Italien"}
+ JE{"Jersey"}
+ JM{"Jamaika"}
+ JO{"Jordanien"}
+ JP{"Japan"}
+ KE{"Kenia"}
+ KG{"Kirgisistan"}
+ KH{"Kambodscha"}
+ KI{"Kiribati"}
+ KM{"Komoren"}
+ KN{"St. Kitts und Nevis"}
+ KP{"Demokratische Volksrepublik Korea"}
+ KR{"Republik Korea"}
+ KW{"Kuwait"}
+ KY{"Kaimaninseln"}
+ KZ{"Kasachstan"}
+ LA{"Laos"}
+ LB{"Libanon"}
+ LC{"St. Lucia"}
+ LI{"Liechtenstein"}
+ LK{"Sri Lanka"}
+ LR{"Liberia"}
+ LS{"Lesotho"}
+ LT{"Litauen"}
+ LU{"Luxemburg"}
+ LV{"Lettland"}
+ LY{"Libyen"}
+ MA{"Marokko"}
+ MC{"Monaco"}
+ MD{"Republik Moldau"}
+ ME{"Montenegro"}
+ MF{"St. Martin"}
+ MG{"Madagaskar"}
+ MH{"Marshall-Inseln"}
+ MK{"Mazedonien"}
+ ML{"Mali"}
+ MM{"Myanmar"}
+ MN{"Mongolei"}
+ MO{"Sonderverwaltungszone Macao"}
+ MP{"Nördliche Marianen"}
+ MQ{"Martinique"}
+ MR{"Mauretanien"}
+ MS{"Montserrat"}
+ MT{"Malta"}
+ MU{"Mauritius"}
+ MV{"Malediven"}
+ MW{"Malawi"}
+ MX{"Mexiko"}
+ MY{"Malaysia"}
+ MZ{"Mosambik"}
+ NA{"Namibia"}
+ NC{"Neukaledonien"}
+ NE{"Niger"}
+ NF{"Norfolkinsel"}
+ NG{"Nigeria"}
+ NI{"Nicaragua"}
+ NL{"Niederlande"}
+ NO{"Norwegen"}
+ NP{"Nepal"}
+ NR{"Nauru"}
+ NU{"Niue"}
+ NZ{"Neuseeland"}
+ OM{"Oman"}
+ PA{"Panama"}
+ PE{"Peru"}
+ PF{"Französisch-Polynesien"}
+ PG{"Papua-Neuguinea"}
+ PH{"Philippinen"}
+ PK{"Pakistan"}
+ PL{"Polen"}
+ PM{"St. Pierre und Miquelon"}
+ PN{"Pitcairn"}
+ PR{"Puerto Rico"}
+ PS{"Palästinensische Autonomiegebiete"}
+ PT{"Portugal"}
+ PW{"Palau"}
+ PY{"Paraguay"}
+ QA{"Katar"}
+ QO{"Äusseres Ozeanien"}
+ RE{"Réunion"}
+ RO{"Rumänien"}
+ RS{"Serbien"}
+ RU{"Russische Föderation"}
+ RW{"Rwanda"}
+ SA{"Saudi-Arabien"}
+ SB{"Salomon-Inseln"}
+ SC{"Seychellen"}
+ SD{"Sudan"}
+ SE{"Schweden"}
+ SG{"Singapur"}
+ SH{"St. Helena"}
+ SI{"Slowenien"}
+ SJ{"Svalbard und Jan Mayen"}
+ SK{"Slowakei"}
+ SL{"Sierra Leone"}
+ SM{"San Marino"}
+ SN{"Senegal"}
+ SO{"Somalia"}
+ SR{"Suriname"}
+ ST{"Sao Tomé und Principe"}
+ SV{"El Salvador"}
+ SY{"Syrien"}
+ SZ{"Swasiland"}
+ TA{"Tristan da Cunha"}
+ TC{"Turks- und Caicosinseln"}
+ TD{"Tschad"}
+ TF{"Französische Süd- und Antarktisgebiete"}
+ TG{"Togo"}
+ TH{"Thailand"}
+ TJ{"Tadschikistan"}
+ TK{"Tokelau"}
+ TL{"Osttimor"}
+ TM{"Turkmenistan"}
+ TN{"Tunesien"}
+ TO{"Tonga"}
+ TR{"Türkei"}
+ TT{"Trinidad und Tobago"}
+ TV{"Tuvalu"}
+ TW{"Taiwan"}
+ TZ{"Tansania"}
+ UA{"Ukraine"}
+ UG{"Uganda"}
+ UM{"Amerikanisch-Ozeanien"}
+ US{"Vereinigte Staaten"}
+ UY{"Uruguay"}
+ UZ{"Usbekistan"}
+ VA{"Vatikanstadt"}
+ VC{"St. Vincent und die Grenadinen"}
+ VE{"Venezuela"}
+ VG{"Britische Jungferninseln"}
+ VI{"Amerikanische Jungferninseln"}
+ VN{"Vietnam"}
+ VU{"Vanuatu"}
+ WF{"Wallis und Futuna"}
+ WS{"Samoa"}
+ YE{"Jemen"}
+ YT{"Mayotte"}
+ ZA{"Südafrika"}
+ ZM{"Sambia"}
+ ZW{"Zimbabwe"}
+ ZZ{"Unbekannte oder ungültige Region"}
+ }
+ Version{"2.0.48.64"}
+}
diff --git a/src/icu-extradata/icu-extradata.pro b/src/icu-extradata/icu-extradata.pro
new file mode 100644
index 00000000..397fc4aa
--- /dev/null
+++ b/src/icu-extradata/icu-extradata.pro
@@ -0,0 +1,85 @@
+include($${M_BUILD_TREE}/mkspecs/features/meegotouch_defines.prf)
+
+ICUBINDIR = $$system(icu-config --bindir)
+ICUVERSION = $$system(icu-config --version)
+ICUDATA = $$system(icu-config --icudata) # for example “icudt44l”
+ICUUSRDATA = $$replace(ICUDATA, icudt, usrdt) # for example “usrdt44l”
+
+greaterThan(ICUVERSION, 4.4) {
+ LOCALESTXT = $${ICUVERSION}/fi.txt \
+ $${ICUVERSION}/it.txt
+ LANGTXT = $${ICUVERSION}/lang/de_CH.txt
+ REGIONTXT = $${ICUVERSION}/region/de_CH.txt
+} else {
+ # old icu version, just do nothing
+ LOCALESTXT = # empty, do nothing
+ LANGTXT = # empty, do nothing
+ REGIONTXT = # empty, do nothing
+}
+
+defineReplace(installPaths){
+ for(a,$$1){
+ val = $$replace(a, $${ICUVERSION}, $${ICUUSRDATA})
+ val = $$replace(val, txt, res)
+ val = $$OUT_PWD/$$val
+ result += $$val
+ }
+ return($$result)
+}
+
+LOCALESRES = $$installPaths(LOCALESTXT)
+LANGRES = $$installPaths(LANGTXT)
+REGIONRES = $$installPaths(REGIONTXT)
+
+isEqual(TEMPLATE_PREFIX, vc):vcproj=1
+isEmpty(vcproj) {
+ QMAKE_LINK = @: IGNORE THIS LINE
+ OBJECTS_DIR =
+ win32:CONFIG -= embed_manifest_exe
+} else {
+ CONFIG += console
+ PHONY_DEPS = .
+ phony_src.input = PHONY_DEPS
+ phony_src.output = phony.c
+ phony_src.variable_out = GENERATED_SOURCES
+ phony_src.commands = echo int main() { return 0; } > phony.c
+ phony_src.name = CREATE phony.c
+ phony_src.CONFIG += combine
+ QMAKE_EXTRA_COMPILERS += phony_src
+}
+
+locales.name = icu-locales-extradata-builder
+locales.input = LOCALESTXT
+locales.output = $$OUT_PWD/$$ICUUSRDATA/${QMAKE_FILE_BASE}.res
+locales.commands += mkdir -p $$OUT_PWD/$$ICUUSRDATA && $$ICUBINDIR/genrb -d $$OUT_PWD/$$ICUUSRDATA -s $$IN_PWD -e UTF-8 ${QMAKE_FILE_IN}
+locales.CONFIG = no_link target_predeps
+QMAKE_EXTRA_COMPILERS += locales
+
+lang.name = icu-lang-extradata-builder
+lang.input = LANGTXT
+lang.output = $$OUT_PWD/$$ICUUSRDATA/lang/${QMAKE_FILE_BASE}.res
+lang.commands += mkdir -p $$OUT_PWD/$$ICUUSRDATA/lang && $$ICUBINDIR/genrb -d $$OUT_PWD/$$ICUUSRDATA/lang -s $$IN_PWD -e UTF-8 ${QMAKE_FILE_IN}
+lang.CONFIG = no_link target_predeps
+QMAKE_EXTRA_COMPILERS += lang
+
+region.name = icu-region-extradata-builder
+region.input = REGIONTXT
+region.output = $$OUT_PWD/$$ICUUSRDATA/region/${QMAKE_FILE_BASE}.res
+region.commands += mkdir -p $$OUT_PWD/$$ICUUSRDATA/region && $$ICUBINDIR/genrb -d $$OUT_PWD/$$ICUUSRDATA/region -s $$IN_PWD -e UTF-8 ${QMAKE_FILE_IN}
+region.CONFIG = no_link target_predeps
+QMAKE_EXTRA_COMPILERS += region
+
+localesres.files = $$LOCALESRES
+localesres.CONFIG += no_check_exist
+localesres.path = $$M_ICUEXTRADATA_DIR/$$ICUUSRDATA
+INSTALLS += localesres
+
+langres.files = $$LANGRES
+langres.CONFIG += no_check_exist
+langres.path = $$M_ICUEXTRADATA_DIR/$$ICUUSRDATA/lang
+INSTALLS += langres
+
+regionres.files = $$REGIONRES
+regionres.CONFIG += no_check_exist
+regionres.path = $$M_ICUEXTRADATA_DIR/$$ICUUSRDATA/region
+INSTALLS += regionres
diff --git a/src/include/MAbstractItemModel b/src/include/MAbstractItemModel
new file mode 100644
index 00000000..3401afc8
--- /dev/null
+++ b/src/include/MAbstractItemModel
@@ -0,0 +1 @@
+#include "mabstractitemmodel.h" \ No newline at end of file
diff --git a/src/include/MBubbleItem b/src/include/MBubbleItem
new file mode 100644
index 00000000..4c713274
--- /dev/null
+++ b/src/include/MBubbleItem
@@ -0,0 +1 @@
+#include "mbubbleitem.h" \ No newline at end of file
diff --git a/src/include/MListFilter b/src/include/MListFilter
new file mode 100644
index 00000000..8849ff39
--- /dev/null
+++ b/src/include/MListFilter
@@ -0,0 +1,2 @@
+#include "mlistfilter.h"
+
diff --git a/src/include/MListItem b/src/include/MListItem
new file mode 100644
index 00000000..97a327cd
--- /dev/null
+++ b/src/include/MListItem
@@ -0,0 +1 @@
+#include "mlistitem.h"
diff --git a/src/include/MSortFilterProxyModel b/src/include/MSortFilterProxyModel
new file mode 100644
index 00000000..e7f5ae7f
--- /dev/null
+++ b/src/include/MSortFilterProxyModel
@@ -0,0 +1 @@
+#include "msortfilterproxymodel.h" \ No newline at end of file
diff --git a/src/include/mabstractitemmodel.h b/src/include/mabstractitemmodel.h
new file mode 100644
index 00000000..b8104851
--- /dev/null
+++ b/src/include/mabstractitemmodel.h
@@ -0,0 +1,20 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#include "../corelib/widgets/mabstractitemmodel.h"
diff --git a/src/include/mbubbleitem.h b/src/include/mbubbleitem.h
new file mode 100644
index 00000000..467e03bd
--- /dev/null
+++ b/src/include/mbubbleitem.h
@@ -0,0 +1,20 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#include "../corelib/widgets/mbubbleitem.h"
diff --git a/src/include/mlistfilter.h b/src/include/mlistfilter.h
new file mode 100644
index 00000000..380f7b9c
--- /dev/null
+++ b/src/include/mlistfilter.h
@@ -0,0 +1,21 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#include "../corelib/widgets/mlistfilter.h"
+
diff --git a/src/include/mlistitem.h b/src/include/mlistitem.h
new file mode 100644
index 00000000..6394f2d5
--- /dev/null
+++ b/src/include/mlistitem.h
@@ -0,0 +1,20 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#include "../corelib/widgets/mlistitem.h"
diff --git a/src/include/msortfilterproxymodel.h b/src/include/msortfilterproxymodel.h
new file mode 100644
index 00000000..94def391
--- /dev/null
+++ b/src/include/msortfilterproxymodel.h
@@ -0,0 +1,20 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#include "../corelib/widgets/msortfilterproxymodel.h" \ No newline at end of file
diff --git a/src/views/animations/mwarpanimation.cpp b/src/views/animations/mwarpanimation.cpp
index 780d5a94..92a7ce3b 100644
--- a/src/views/animations/mwarpanimation.cpp
+++ b/src/views/animations/mwarpanimation.cpp
@@ -99,6 +99,12 @@ void MWarpAnimation::updateState(QAbstractAnimation::State newState,
offsetAnimation->setStartValue(QPointF(0, 0));
offsetAnimation->setEndValue(QPointF(style()->warpDistance(), 0));
}
+ } else if (newState == Stopped && target) {
+ if (warpDirection == OutFromLeft || warpDirection == OutFromRight) {
+ target->hide();
+ target->setOpacity(1);
+ target->setPaintOffset(QPointF(0, 0));
+ }
}
}
diff --git a/src/views/mapplicationmenuview.h b/src/views/mapplicationmenuview.h
index a3d51238..d9d4f073 100644
--- a/src/views/mapplicationmenuview.h
+++ b/src/views/mapplicationmenuview.h
@@ -36,9 +36,9 @@ class MApplicationMenuViewPrivate;
\section MApplicationMenuViewOverview Overview
MApplicationMenuView is used to visualize actions placed into the MApplicationMenu.
- MApplicationMenuView appears once the user clicks on the view menu title area. It is opened on
+ MApplicationMenuView appears once the user clicks on the application menu title area. It is opened on
top of the current application view. Background of the view is dimmed/blurred when application
- menu is open. The outlook of view menu can be changed using the styling attributes defined in
+ menu is open. The outlook of application menu can be changed using the styling attributes defined in
MApplicationMenuStyle and MSceneWindowStyle.
The following action widgets are supported for this particular view:
@@ -67,9 +67,9 @@ class MApplicationMenuViewPrivate;
\section MApplicationMenuInteractions Interactions
- The view can be closed by tapping anywhere outside the menu (anywhere in the dimmed area)
- - The view can also be closed from the top of screen (from the view menu title, or the top right corner)
- - Selecting an action command from the view menu closes the menu
- - Selecting a view style command closes the view menu and sets the view and its contents in
+ - The view can also be closed from the top of screen (from the application menu title, or the top right corner)
+ - Selecting an action command from the application menu closes the menu
+ - Selecting a view style command closes the application menu and sets the view and its contents in
the newly selected style.
\sa MApplicationMenu MApplicationMenuModel MApplicationMenuStyle
diff --git a/src/views/mbubbleitembackgroundview.cpp b/src/views/mbubbleitembackgroundview.cpp
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/views/mbubbleitembackgroundview.cpp
diff --git a/src/views/mbubbleitembackgroundview.h b/src/views/mbubbleitembackgroundview.h
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/views/mbubbleitembackgroundview.h
diff --git a/src/views/mbubbleitemview.cpp b/src/views/mbubbleitemview.cpp
new file mode 100644
index 00000000..55edc5e4
--- /dev/null
+++ b/src/views/mbubbleitemview.cpp
@@ -0,0 +1,299 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#include <MScalableImage>
+#include <MImageWidget>
+#include <MLabel>
+#include <MWidgetController>
+#include <MWidgetView>
+#include <MCancelEvent>
+#include <mviewcreator.h>
+#include <MSeparator>
+
+#include <QGraphicsGridLayout>
+#include <QGraphicsLinearLayout>
+#include <QGraphicsSceneEvent>
+
+#include "mbubbleitem.h"
+#include "mbubbleitemview.h"
+#include "mbubbleitemview_p.h"
+#include "mbubbleitembackground_p.h"
+
+MBubbleItemViewPrivate::MBubbleItemViewPrivate()
+ : avatar(0),
+ speechBubble(0),
+ timeStampLabel(0),
+ messageComposition(0),
+ numberOfCommentsLabel(0),
+ numberOfThumbsUpLabel(0),
+ separator(0),
+ currentCentralWidget(0)
+{
+ layout = new QGraphicsGridLayout;
+ layout->setContentsMargins(0, 0, 0, 0);
+ layout->setSpacing(0);
+
+ innerLayout = new QGraphicsLinearLayout(Qt::Vertical);
+
+ timeStampLabel = new MLabel();
+ timeStampLabel->setObjectName("MBubbleItemTimeStamp");
+ timeStampLabel->setAlignment(Qt::AlignRight);
+
+ messageComposition = new MLabel();
+ messageComposition->setWordWrap(true);
+ messageComposition->setAlignment(Qt::AlignLeft);
+}
+
+MBubbleItemViewPrivate::~MBubbleItemViewPrivate()
+{
+ clearLayout();
+}
+
+void MBubbleItemViewPrivate::initLayout()
+{
+ Q_Q(MBubbleItemView);
+
+ clearLayout();
+
+ replaceAvatar();
+
+ if (controller->messageType() == MBubbleItem::Incoming) {
+ if(controller->avatar()) {
+ layout->addItem(controller->avatar(), 0,0);
+ layout->addItem(speechBubble,0,1);
+ } else {
+ layout->addItem(speechBubble,0,0);
+ }
+ } else if(controller->messageType() == MBubbleItem::Outgoing) {
+ layout->addItem(speechBubble,0,0);
+ }
+
+ innerLayout = new QGraphicsLinearLayout(Qt::Vertical, speechBubble);
+ messageComposition->setObjectName("MBubbleItemMessage");
+
+ innerLayout->addItem(messageComposition);
+
+ if (q->model()->commentsString().isEmpty() && q->model()->thumbsUpString().isEmpty()) {
+ innerLayout->addItem(timeStampLabel);
+ timeStampLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
+ } else {
+ timeStampLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
+
+ QGraphicsLinearLayout* informationWidgetsLayout = new QGraphicsLinearLayout(Qt::Horizontal);
+ informationWidgetsLayout->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
+
+ MLabel* alignTimeStampToTheRight = new MLabel();
+ alignTimeStampToTheRight->setAlignment(Qt::AlignLeft);
+ alignTimeStampToTheRight->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum);
+ informationWidgetsLayout->addItem(alignTimeStampToTheRight);
+
+ if (!q->model()->commentsString().isEmpty()) {
+ MImageWidget* numberOfCommentsIcon = new MImageWidget("icon-s-common-presence-away");
+ numberOfCommentsIcon->setObjectName("MBubbleItemNumberOfCommentsIcon");
+
+ numberOfCommentsLabel = new MLabel(q->model()->commentsString());
+ numberOfCommentsLabel->setObjectName("MBubbleItemNumberOfCommentsLabel");
+
+ informationWidgetsLayout->addItem(numberOfCommentsIcon);
+ informationWidgetsLayout->addItem(numberOfCommentsLabel);
+ }
+ if (!q->model()->thumbsUpString().isEmpty()) {
+ MImageWidget* numberOfThumbsIcon = new MImageWidget("icon-s-common-presence-offline");
+ numberOfThumbsIcon->setObjectName("MBubbleItemNumberOfThumbsIcon");
+
+ numberOfThumbsUpLabel = new MLabel(q->model()->thumbsUpString());
+ numberOfThumbsUpLabel->setObjectName("MBubbleItemNumberofThumbsLabel");
+
+ informationWidgetsLayout->addItem(numberOfThumbsIcon);
+ informationWidgetsLayout->addItem(numberOfThumbsUpLabel);
+ }
+
+ informationWidgetsLayout->addItem(timeStampLabel);
+ innerLayout->addItem(informationWidgetsLayout);
+ }
+
+ setupCentralWidget();
+
+ controller->connect(speechBubble, SIGNAL(clicked()), controller, SIGNAL(bubbleClicked()));
+}
+
+void MBubbleItemViewPrivate::clearLayout()
+{
+ for (int i = 0; i < layout->count(); i++)
+ layout->removeAt(0);
+ for (int i = 0; i < innerLayout->count(); i++)
+ innerLayout->removeAt(0);
+}
+
+void MBubbleItemViewPrivate::replaceAvatar()
+{
+ if (avatar) {
+ for (int i = 0; i < layout->count(); i ++) {
+ if (layout->itemAt(i) == avatar)
+ layout->removeAt(i);
+ }
+ delete avatar;
+ avatar = 0;
+ }
+
+ if (controller->avatar() && controller->messageType() == MBubbleItem::Incoming) {
+ if (controller->avatar()->objectName().isEmpty())
+ controller->avatar()->setObjectName("MBubbleItemAvatar");
+ layout->addItem(controller->avatar(), 0, 0);
+ avatar = controller->avatar();
+ }
+}
+
+void MBubbleItemViewPrivate::setupCentralWidget()
+{
+ Q_Q(MBubbleItemView);
+
+ if (q->model()->centralWidget() &&
+ q->model()->centralWidget() != currentCentralWidget) {
+ separator = new MSeparator;
+ separator->setOrientation(Qt::Horizontal);
+ innerLayout->addItem(separator);
+
+ currentCentralWidget = q->model()->centralWidget();
+ innerLayout->addItem(currentCentralWidget);
+ } else {
+ if (separator) {
+ innerLayout->removeItem(separator);
+ delete separator;
+ separator = 0;
+ }
+
+ if (currentCentralWidget) {
+ innerLayout->removeItem(currentCentralWidget);
+ currentCentralWidget = 0;
+ }
+ }
+}
+
+void MBubbleItemViewPrivate::applyStyle()
+{
+}
+
+void MBubbleItemViewPrivate::updateMessageComposition()
+{
+ Q_Q(MBubbleItemView);
+
+ if (controller->messageType() == MBubbleItem::Incoming)
+ messageComposition->setText("<b>" + q->model()->senderName() + "</b>: " + q->model()->message());
+ else if (controller->messageType() == MBubbleItem::Outgoing)
+ messageComposition->setText(q->model()->message() + "<b></b>");
+}
+
+MBubbleItemView::MBubbleItemView(MBubbleItem *controller)
+ : MWidgetView(* new MBubbleItemViewPrivate, controller)
+{
+ Q_D(MBubbleItemView);
+ d->controller = controller;
+ controller->setLayout(d->layout);
+ d->layout->setParentLayoutItem(controller);
+}
+
+MBubbleItemView::MBubbleItemView(MBubbleItemViewPrivate &dd, MBubbleItem *controller)
+ : MWidgetView(dd, controller)
+{
+ Q_D(MBubbleItemView);
+ d->controller = controller;
+ controller->setLayout(d->layout);
+}
+
+MBubbleItemView::~MBubbleItemView()
+{
+}
+
+void MBubbleItemView::applyStyle()
+{
+ MWidgetView::applyStyle();
+
+ Q_D(MBubbleItemView);
+ d->applyStyle();
+}
+
+void MBubbleItemView::updateData(const QList<const char *> &modifications)
+{
+ Q_D(MBubbleItemView);
+
+ MWidgetView::updateData(modifications);
+
+ const char *member;
+ for (int i = 0; i < modifications.count(); i++) {
+ member = modifications[i];
+ if (member == MBubbleItemModel::Avatar) {
+ d->replaceAvatar();
+ } else if (member == MBubbleItemModel::SenderName) {
+ d->updateMessageComposition();
+ } else if (member == MBubbleItemModel::TimeStamp) {
+ d->timeStampLabel->setText(model()->timeStamp());
+ } else if (member == MBubbleItemModel::Message) {
+ d->updateMessageComposition();
+ } else if (member == MBubbleItemModel::CentralWidget) {
+ d->setupCentralWidget();
+ } else if (member == MBubbleItemModel::MessageType) {
+ d->speechBubble->setMessageType(static_cast<MBubbleItem::MessageType>(model()->messageType()));
+ d->updateMessageComposition();
+ d->initLayout();
+ } else if(member == MBubbleItemModel::CommentsString) {
+ if (d->numberOfCommentsLabel)
+ d->numberOfCommentsLabel->setText(model()->commentsString());
+ } else if(member == MBubbleItemModel::ThumbsUpString) {
+ if (d->numberOfCommentsLabel)
+ d->numberOfCommentsLabel->setText(model()->thumbsUpString());
+ }
+ }
+}
+
+void MBubbleItemView::setupModel()
+{
+ Q_D(MBubbleItemView);
+
+ MWidgetView::setupModel();
+
+ d->timeStampLabel->setText(model()->timeStamp());
+
+ connect(d->messageComposition, SIGNAL(linkActivated(QString)), d->controller, SIGNAL(linkActivated(QString)));
+ d->updateMessageComposition();
+
+ d->speechBubble = new MBubbleItemBackground(d->controller);
+ d->speechBubble->setMessageType(static_cast<MBubbleItem::MessageType>(model()->messageType()));
+
+ d->initLayout();
+}
+
+void MBubbleItemView::setSelected(bool selected)
+{
+ Q_UNUSED(selected);
+}
+
+void MBubbleItemView::mousePressEvent(QGraphicsSceneMouseEvent *event)
+{
+ Q_UNUSED(event);
+}
+
+void MBubbleItemView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
+{
+ Q_UNUSED(event);
+}
+
+
+M_REGISTER_VIEW_NEW(MBubbleItemView, MBubbleItem)
+
diff --git a/src/views/mbubbleitemview.h b/src/views/mbubbleitemview.h
new file mode 100644
index 00000000..a07254be
--- /dev/null
+++ b/src/views/mbubbleitemview.h
@@ -0,0 +1,74 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef MBUBBLEITEMVIEW_H__
+#define MBUBBLEITEMVIEW_H__
+
+#include "mwidgetview.h"
+#include <MImageWidget>
+#include "mimagewidgetview.h"
+#include "mbubbleitemmodel.h"
+#include "mbubbleitembackgroundstyle.h"
+
+class MBubbleItem;
+class MBubbleItemViewPrivate;
+
+/*!
+ \class MBubbleItemView
+ \brief View class for MBubbleItem.
+
+ \ingroup views
+
+ \section MBubbleItemView Overview
+ MBubbleItemView draws a MBubbleItem in 2 text lines and an avatar, and a speech bubble in the background.
+
+ \image html bubble-item.png
+ */
+class M_EXPORT MBubbleItemView : public MWidgetView
+{
+ Q_OBJECT
+ M_VIEW(MBubbleItemModel, MWidgetStyle)
+
+public:
+ MBubbleItemView(MBubbleItem *controller);
+ virtual ~MBubbleItemView();
+
+protected slots:
+ virtual void updateData(const QList<const char *> &modifications);
+ void mousePressEvent(QGraphicsSceneMouseEvent *event);
+ void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
+
+protected:
+ //! \reimp
+ virtual void setupModel();
+ virtual void applyStyle();
+ //! \reimp_end
+
+ void setSelected(bool selected);
+
+ //! \internal
+ MBubbleItemView(MBubbleItemViewPrivate &dd, MBubbleItem *controller);
+ //! \internal_end
+
+private:
+ Q_DISABLE_COPY(MBubbleItemView)
+ Q_DECLARE_PRIVATE(MBubbleItemView)
+};
+
+#endif
diff --git a/src/views/mbubbleitemview_p.h b/src/views/mbubbleitemview_p.h
new file mode 100644
index 00000000..150d162e
--- /dev/null
+++ b/src/views/mbubbleitemview_p.h
@@ -0,0 +1,70 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef MBUBBLEITEM_P_H__
+#define MBUBBLEITEM_P_H__
+
+#include "mbubbleitem.h"
+#include "core/mwidgetview_p.h"
+
+class MLabel;
+class MImageWidget;
+class MScalableImage;
+class MControllerWidget;
+class QGraphicsGridLayout;
+class MBubbleItemBackground;
+class MSeparator;
+class MImageWidget;
+
+class MBubbleItemViewPrivate : public MWidgetViewPrivate
+{
+ Q_DECLARE_PUBLIC(MBubbleItemView)
+
+public:
+ MBubbleItemViewPrivate();
+ virtual ~MBubbleItemViewPrivate();
+
+ void initLayout();
+ void clearLayout();
+ void replaceAvatar();
+ void setupCentralWidget();
+
+ void applyStyle();
+ void updateMessageComposition();
+
+ MImageWidget *avatar;
+ MBubbleItemBackground* speechBubble;
+
+ MLabel* timeStampLabel;
+ MLabel* messageComposition;
+ MLabel* numberOfCommentsLabel;
+ MLabel* numberOfThumbsUpLabel;
+
+ MImageWidget* serviceIcon;
+ MSeparator* separator;
+
+ QGraphicsWidget* currentCentralWidget;
+
+private:
+ MBubbleItem *controller;
+ QGraphicsGridLayout *layout;
+ QGraphicsLinearLayout *innerLayout;
+};
+
+#endif
diff --git a/src/views/mbuttonview.cpp b/src/views/mbuttonview.cpp
index b0fa0105..7daafe39 100644
--- a/src/views/mbuttonview.cpp
+++ b/src/views/mbuttonview.cpp
@@ -335,11 +335,18 @@ void MButtonView::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
rect.adjust(-RELEASE_MISS_DELTA, -RELEASE_MISS_DELTA,
RELEASE_MISS_DELTA, RELEASE_MISS_DELTA);
- bool pressed = rect.contains(touch);
-
- if ( pressed != model()->down()) {
- model()->setDown(pressed);
+ if (rect.contains(touch)) {
+ if (!model()->down()) {
+ model()->setDown(true);
+ style()->pressFeedback().play();
+ }
+ } else {
+ if (model()->down()) {
+ model()->setDown(false);
+ style()->cancelFeedback().play();
+ }
}
+
}
void MButtonView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
@@ -368,6 +375,9 @@ void MButtonView::cancelEvent(MCancelEvent *event)
if (!model()->down()) {
return;
}
+
+ style()->cancelFeedback().play();
+
model()->setDown(false);
}
diff --git a/src/views/mcontentitemview.cpp b/src/views/mcontentitemview.cpp
index 4e9e86cb..f400cfd7 100644
--- a/src/views/mcontentitemview.cpp
+++ b/src/views/mcontentitemview.cpp
@@ -286,9 +286,9 @@ void MContentItemViewPrivate::setImage(const QImage &i)
image()->setImage(i);
}
-void MContentItemViewPrivate::setImageID(const QString &id)
+void MContentItemViewPrivate::setImage(const QString &i, const QSize &s)
{
- image()->setImage(id);
+ image()->setImage(i, s);
}
void MContentItemViewPrivate::setOptionalImage(const QImage& i)
@@ -296,6 +296,11 @@ void MContentItemViewPrivate::setOptionalImage(const QImage& i)
optionalImage()->setImage(i);
}
+void MContentItemViewPrivate::setOptionalImage(const QString &i, const QSize &s)
+{
+ optionalImage()->setImage(i, s);
+}
+
void MContentItemViewPrivate::applyStyle()
{
Q_Q(MContentItemView);
@@ -371,16 +376,20 @@ void MContentItemView::updateData(const QList<const char *> &modifications)
d->setSubtitle(model()->subtitle());
} else if (member == MContentItemModel::ItemPixmap) {
d->setPixmap(model()->itemPixmap());
- } else if (member == MContentItemModel::ItemImageID) {
- d->setImageID(model()->itemImageID());
} else if (member == MContentItemModel::Selected) {
setSelected(model()->selected());
} else if(member == MContentItemModel::OptionalPixmap){
d->setOptionalPixmap(d->controller->optionalPixmap());
} else if(member == MContentItemModel::OptionalImage){
d->setOptionalImage(model()->optionalImage());
+ } else if(member == MContentItemModel::OptionalImageID ||
+ member == MContentItemModel::OptionalImageSize) {
+ d->setOptionalImage(model()->optionalImageID(), model()->optionalImageSize());
} else if(member == MContentItemModel::ItemImage) {
d->setImage(model()->itemImage());
+ } else if(member == MContentItemModel::ItemImageID ||
+ member == MContentItemModel::ItemImageSize) {
+ d->setImage(model()->itemImageID(), model()->itemImageSize());
} else if(member == MContentItemModel::AdditionalItem ||
member == MContentItemModel::SmallItem) {
if (d->configuredStyle == MContentItem::TwoIconsTwoWidgets) {
@@ -407,10 +416,12 @@ void MContentItemView::setupModel()
d->setOptionalPixmap(d->controller->optionalPixmap());
if(!d->controller->optionalImage().isNull())
d->setOptionalImage(d->controller->optionalImage());
+ if(!model()->optionalImageID().isNull())
+ d->setOptionalImage(model()->optionalImageID(), model()->optionalImageSize());
if(!d->controller->image().isNull())
d->setImage(d->controller->image());
if(!model()->itemImageID().isNull())
- d->setImageID(model()->itemImageID());
+ d->setImage(model()->itemImageID(), model()->itemImageSize());
d->initLayout(static_cast<MContentItem::ContentItemStyle>(model()->itemStyle()));
}
diff --git a/src/views/mcontentitemview_p.h b/src/views/mcontentitemview_p.h
index 1689c7f9..97aeba7f 100644
--- a/src/views/mcontentitemview_p.h
+++ b/src/views/mcontentitemview_p.h
@@ -48,8 +48,9 @@ public:
inline void setPixmap(const QPixmap& pixmap);
inline void setOptionalPixmap(const QPixmap& pixmap);
inline void setImage(const QImage& image);
- inline void setImageID(const QString &id);
+ inline void setImage(const QString& id, const QSize &s);
inline void setOptionalImage(const QImage& image);
+ inline void setOptionalImage(const QString& id, const QSize &s);
void initLayout(MContentItem::ContentItemStyle style);
void clearLayout();
diff --git a/src/views/mdialogview.cpp b/src/views/mdialogview.cpp
index c6c76fd1..ca7049a3 100644
--- a/src/views/mdialogview.cpp
+++ b/src/views/mdialogview.cpp
@@ -438,6 +438,10 @@ void MDialogViewPrivate::addButton(MButtonModel *buttonModel)
buttonAdded = true;
}
} while (!buttonAdded);
+ for (i = 0; i < buttonBoxLayout->count(); i++) {
+ buttonBoxLayoutPolicy->itemAt(i)->setPreferredWidth(
+ buttonBox->preferredWidth() / buttonBoxLayout->count());
+ }
}
int MDialogViewPrivate::stdButtonOrder(M::StandardButton buttonType)
diff --git a/src/views/mescapebuttonpanelview.cpp b/src/views/mescapebuttonpanelview.cpp
index 39879d3f..c64709cd 100644
--- a/src/views/mescapebuttonpanelview.cpp
+++ b/src/views/mescapebuttonpanelview.cpp
@@ -22,7 +22,6 @@
#include "mbutton.h"
#include "mviewcreator.h"
#include "mescapebuttonpanel.h"
-#include "animations/mwarpanimation.h"
#include "mdebug.h"
#include <QDebug>
@@ -41,6 +40,8 @@ MEscapeButtonPanelViewPrivate::MEscapeButtonPanelViewPrivate() :
MEscapeButtonPanelViewPrivate::~MEscapeButtonPanelViewPrivate()
{
+ delete warpInAnimation;
+ delete warpOutAnimation;
}
void MEscapeButtonPanelViewPrivate::init()
@@ -58,8 +59,14 @@ void MEscapeButtonPanelViewPrivate::init()
void MEscapeButtonPanelViewPrivate::animatedEscapeButtonTransition()
{
- MWarpAnimation *warpInAnimation = 0;
- MWarpAnimation *warpOutAnimation = 0;
+ if (warpInAnimation && warpInAnimation->state() == QAbstractAnimation::Running) {
+ warpInAnimation->setCurrentTime(warpInAnimation->duration());
+ delete warpInAnimation;
+ }
+ if (warpOutAnimation && warpOutAnimation->state() == QAbstractAnimation::Running) {
+ warpOutAnimation->setCurrentTime(warpOutAnimation->duration());
+ delete warpOutAnimation;
+ }
switch (escapeMode) {
case MEscapeButtonPanelModel::CloseMode:
diff --git a/src/views/mescapebuttonpanelview_p.h b/src/views/mescapebuttonpanelview_p.h
index 86c55558..8501b1cf 100644
--- a/src/views/mescapebuttonpanelview_p.h
+++ b/src/views/mescapebuttonpanelview_p.h
@@ -21,6 +21,8 @@
#define MESCAPEBUTTONPANELVIEW_P_H
#include "mescapebuttonpanelmodel.h"
+#include "animations/mwarpanimation.h"
+#include <QPointer>
class MEscapeButtonPanel;
class MButton;
@@ -46,6 +48,8 @@ public:
MEscapeButtonPanelModel::EscapeMode escapeMode;
MEscapeButtonPanel *controller;
+ QPointer<MWarpAnimation> warpInAnimation;
+ QPointer<MWarpAnimation> warpOutAnimation;
private:
void animatedEscapeButtonTransition();
diff --git a/src/views/mlabelview.cpp b/src/views/mlabelview.cpp
index 4bec5b8d..07867673 100644
--- a/src/views/mlabelview.cpp
+++ b/src/views/mlabelview.cpp
@@ -28,7 +28,6 @@
#include <QAbstractTextDocumentLayout>
#include <QGraphicsSceneMouseEvent>
#include <QGraphicsSceneResizeEvent>
-#include <QTapAndHoldGesture>
MLabelViewPrivate::MLabelViewPrivate()
{
@@ -208,23 +207,15 @@ void MLabelView::cancelEvent(MCancelEvent *event)
void MLabelView::longPressEvent(QGraphicsSceneContextMenuEvent *event)
{
- //FIXME
- //Functionality replaced by tapAndHoldGestureEvent, this function not needed any more
+ Q_D(MLabelView);
event->ignore();
+ d->impl->longPressEvent(event);
}
void MLabelView::tapAndHoldGestureEvent(QGestureEvent *event, QTapAndHoldGesture* gesture)
{
Q_UNUSED(event);
- Q_D(MLabelView);
-
- if (gesture->state() == Qt::GestureFinished) {
- QGraphicsSceneContextMenuEvent ev;
- ev.setPos(gesture->position());
- d->impl->longPressEvent(&ev);
- }
-
- event->accept();
+ Q_UNUSED(gesture);
}
diff --git a/src/views/mlistitemview.cpp b/src/views/mlistitemview.cpp
new file mode 100644
index 00000000..9ebc56cd
--- /dev/null
+++ b/src/views/mlistitemview.cpp
@@ -0,0 +1,129 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#include "mlistitemview.h"
+#include "mlistitemview_p.h"
+
+#include <MListItem>
+
+#include <QGraphicsSceneMouseEvent>
+
+#define RELEASE_MISS_DELTA 30.0
+
+MListItemViewPrivate::MListItemViewPrivate(MWidgetController *controller)
+ : MWidgetViewPrivate(),
+ down(false)
+{
+ this->controller = dynamic_cast<MListItem *>(controller);
+}
+
+MListItemViewPrivate::~MListItemViewPrivate()
+{
+}
+
+void MListItemViewPrivate::updateStyleMode()
+{
+ Q_Q(MListItemView);
+
+ if (down) {
+ q->style().setModePressed();
+ } else {
+ if (controller->isSelected())
+ q->style().setModeSelected();
+ else
+ q->style().setModeDefault();
+ }
+
+ q->applyStyle();
+ q->update();
+}
+
+void MListItemViewPrivate::click()
+{
+ controller->click();
+}
+
+MListItemView::MListItemView(MWidgetController *controller)
+ : MWidgetView(new MListItemViewPrivate(controller))
+{
+}
+
+void MListItemView::mousePressEvent(QGraphicsSceneMouseEvent *event)
+{
+ Q_UNUSED(event);
+ Q_D(MListItemView);
+
+ if (d->down)
+ return;
+
+ d->down = true;
+ d->updateStyleMode();
+}
+
+void MListItemView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
+{
+ Q_UNUSED(event);
+ Q_D(MListItemView);
+
+ if (!d->down)
+ return;
+
+ d->down = false;
+ d->updateStyleMode();
+
+ QPointF touch = event->scenePos();
+ QRectF rect = d->controller->sceneBoundingRect();
+ rect.adjust(-RELEASE_MISS_DELTA, -RELEASE_MISS_DELTA,
+ RELEASE_MISS_DELTA, RELEASE_MISS_DELTA);
+ bool pressed = rect.contains(touch);
+
+ if (pressed)
+ d->click();
+}
+
+void MListItemView::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
+{
+ Q_UNUSED(event);
+ Q_D(MListItemView);
+
+ QPointF touch = event->scenePos();
+ QRectF rect = d->controller->sceneBoundingRect();
+ rect.adjust(-RELEASE_MISS_DELTA, -RELEASE_MISS_DELTA,
+ RELEASE_MISS_DELTA, RELEASE_MISS_DELTA);
+ bool pressed = rect.contains(touch);
+
+ if (pressed != d->down) {
+ d->down = pressed;
+ d->updateStyleMode();
+ }
+}
+
+void MListItemView::cancelEvent(MCancelEvent *event)
+{
+ Q_UNUSED(event);
+ Q_D(MListItemView);
+
+ if (!d->down)
+ return;
+
+ d->down = false;
+ d->updateStyleMode();
+}
+
+M_REGISTER_VIEW_NEW(MListItemView, MListItem)
diff --git a/src/views/mlistitemview.h b/src/views/mlistitemview.h
new file mode 100644
index 00000000..c41535f5
--- /dev/null
+++ b/src/views/mlistitemview.h
@@ -0,0 +1,50 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef MLISTITEMVIEW_H
+#define MLISTITEMVIEW_H
+
+#include <MWidgetView>
+
+#include <mlistitemmodel.h>
+#include <mlistitemstyle.h>
+
+class MListItemViewPrivate;
+
+class MListItemView : public MWidgetView
+{
+ Q_OBJECT
+ M_VIEW(MListItemModel, MListItemStyle)
+
+public:
+ MListItemView(MWidgetController *controller);
+
+protected:
+ void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
+ void mousePressEvent(QGraphicsSceneMouseEvent *event);
+ void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
+
+ void cancelEvent(MCancelEvent *event);
+
+private:
+ Q_DISABLE_COPY(MListItemView)
+ Q_DECLARE_PRIVATE(MListItemView)
+};
+
+#endif // MLISTITEMVIEW_H
diff --git a/src/views/mlistitemview_p.h b/src/views/mlistitemview_p.h
new file mode 100644
index 00000000..2029f874
--- /dev/null
+++ b/src/views/mlistitemview_p.h
@@ -0,0 +1,44 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef MLISTITEMVIEW_P_H
+#define MLISTITEMVIEW_P_H
+
+#include <private/mwidgetview_p.h>
+
+class MListItem;
+
+class MListItemViewPrivate : public MWidgetViewPrivate
+{
+public:
+ MListItemViewPrivate(MWidgetController *controller);
+ virtual ~MListItemViewPrivate();
+
+ void updateStyleMode();
+ void click();
+
+private:
+ bool down;
+ MListItem *controller;
+
+private:
+ Q_DECLARE_PUBLIC(MListItemView)
+};
+
+#endif // MLISTITEMVIEW_P_H
diff --git a/src/views/mlistview.cpp b/src/views/mlistview.cpp
index 57cb9809..91a4d733 100644
--- a/src/views/mlistview.cpp
+++ b/src/views/mlistview.cpp
@@ -226,11 +226,12 @@ void MListView::dataChanged(const QModelIndex &topLeft, const QModelIndex &botto
*
* \sa QAbstractItemView::rowsInserted(), exposedRectUpdated()
*/
-void MListView::rowsInserted(const QModelIndex &parent, int start, int end)
+void MListView::rowsInserted(const QModelIndex &parent, int start, int end, bool animated)
{
Q_UNUSED(parent);
Q_UNUSED(start);
Q_UNUSED(end);
+ Q_UNUSED(animated);
layoutChanged();
}
@@ -241,11 +242,12 @@ void MListView::rowsInserted(const QModelIndex &parent, int start, int end)
*
* \sa rowsInserted(), exposedRectUpdated()
*/
-void MListView::rowsRemoved(const QModelIndex &parent, int start, int end)
+void MListView::rowsRemoved(const QModelIndex &parent, int start, int end, bool animated)
{
Q_UNUSED(parent);
Q_UNUSED(start);
Q_UNUSED(end);
+ Q_UNUSED(animated);
layoutChanged();
}
diff --git a/src/views/mlistview.h b/src/views/mlistview.h
index 10acd0aa..8a37e171 100644
--- a/src/views/mlistview.h
+++ b/src/views/mlistview.h
@@ -56,8 +56,9 @@ protected:
protected slots:
virtual void updateData(const QList<const char *>& modifications);
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
- void rowsInserted(const QModelIndex &parent, int start, int end);
- void rowsRemoved(const QModelIndex &parent, int start, int end);
+ void rowsInserted(const QModelIndex &parent, int start, int end, bool animated = false);
+ void rowsRemoved(const QModelIndex &parent, int start, int end, bool animated = false);
+
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
void itemClick();
void layoutChanged();
diff --git a/src/views/mlistview_p.cpp b/src/views/mlistview_p.cpp
index 2f743a6f..a3804ed8 100644
--- a/src/views/mlistview_p.cpp
+++ b/src/views/mlistview_p.cpp
@@ -21,6 +21,7 @@
#include <MSeparator>
#include <MList>
#include <MPannableViewport>
+#include <MAbstractItemModel>
#include <QItemSelectionModel>
@@ -311,7 +312,7 @@ void MListViewPrivate::resetModel(MListModel *mListModel)
disconnect(q_ptr, SLOT(dataChanged(QModelIndex, QModelIndex)));
disconnect(q_ptr, SLOT(rowsInserted(QModelIndex, int, int)));
- disconnect(q_ptr, SLOT(rowsRemoved(QModelIndex, int, int)));
+ disconnect(q_ptr, SLOT(rowsRemoved(QModelIndex, int, int, bool)));
disconnect(q_ptr, SLOT(layoutChanged()));
disconnect(q_ptr, SLOT(modelReset()));
disconnect(q_ptr, SLOT(rowsMoved(QModelIndex, int, int, QModelIndex, int)));
@@ -326,8 +327,13 @@ void MListViewPrivate::resetModel(MListModel *mListModel)
if (model) {
connect(model, SIGNAL(dataChanged(QModelIndex, QModelIndex)), q_ptr, SLOT(dataChanged(QModelIndex, QModelIndex)));
- connect(model, SIGNAL(rowsInserted(QModelIndex, int, int)), q_ptr, SLOT(rowsInserted(QModelIndex, int, int)));
- connect(model, SIGNAL(rowsRemoved(QModelIndex, int, int)), q_ptr, SLOT(rowsRemoved(QModelIndex, int, int)));
+ if (model->inherits("MAbstractItemModel")) {
+ connect(model, SIGNAL(rowsInserted(QModelIndex, int, int, bool)), q_ptr, SLOT(rowsInserted(QModelIndex, int, int, bool)));
+ connect(model, SIGNAL(rowsRemoved(QModelIndex, int, int, bool)), q_ptr, SLOT(rowsRemoved(QModelIndex, int, int, bool)));
+ } else {
+ connect(model, SIGNAL(rowsInserted(QModelIndex, int, int)), q_ptr, SLOT(rowsInserted(QModelIndex, int, int)));
+ connect(model, SIGNAL(rowsRemoved(QModelIndex, int, int)), q_ptr, SLOT(rowsRemoved(QModelIndex, int, int)));
+ }
connect(model, SIGNAL(layoutChanged()), q_ptr, SLOT(layoutChanged()));
connect(model, SIGNAL(modelReset()), q_ptr, SLOT(modelReset()));
connect(model, SIGNAL(rowsMoved(QModelIndex, int, int, QModelIndex, int)), q_ptr, SLOT(rowsMoved(QModelIndex, int, int, QModelIndex, int)));
diff --git a/src/views/mnavigationbarview.cpp b/src/views/mnavigationbarview.cpp
index 84ccdf2e..dc6d2091 100644
--- a/src/views/mnavigationbarview.cpp
+++ b/src/views/mnavigationbarview.cpp
@@ -69,7 +69,7 @@ void MNavigationBarViewPrivate::setMenuButtonwidth()
Q_Q(MNavigationBarView);
/* FIXME: Its there because the UI specs contains the following formula:
- width of view menu button = width of portrait view - width of home button - width of close button.
+ width of application menu button = width of portrait view - width of home button - width of close button.
This needs to be removed when there exists support for reading CSS constants in the code
*/
int widthofPortraitMode = MDeviceProfile::instance()->resolution().height();
diff --git a/src/views/mscenelayereffectdimview.cpp b/src/views/mscenelayereffectdimview.cpp
index 41ba6d47..abad48b0 100644
--- a/src/views/mscenelayereffectdimview.cpp
+++ b/src/views/mscenelayereffectdimview.cpp
@@ -62,6 +62,8 @@ void MSceneLayerEffectDimView::applyStyle()
{
Q_D(MSceneLayerEffectDimView);
+ MSceneWindowView::applyStyle();
+
d->controller->setOpacity(style()->opacity());
}
diff --git a/src/views/msliderview.cpp b/src/views/msliderview.cpp
index 121aecb3..67f8bfac 100644
--- a/src/views/msliderview.cpp
+++ b/src/views/msliderview.cpp
@@ -190,32 +190,51 @@ MSliderIndicator::~MSliderIndicator()
void MSliderIndicator::setText(const QString &text)
{
+ bool sizeHintChanged = false;
label->setVisible(!text.isEmpty());
label->setText(text);
- while (layout->count() > 0)
- layout->removeAt(0);
-
- layout->addAnchor(layout, Qt::AnchorVerticalCenter, label, Qt::AnchorVerticalCenter);
- layout->addAnchor(layout, Qt::AnchorVerticalCenter, image, Qt::AnchorVerticalCenter);
if (text.isEmpty()) {
- label->setMinimumSize(0, 0);
- label->setPreferredSize(0, 0);
- label->setMaximumSize(0, 0);
+ QSizeF emptySize(0, 0);
+
+ if (emptySize != label->minimumSize()) {
+ label->setMinimumSize(0, 0);
+ sizeHintChanged = true;
+ }
+ if (emptySize != label->preferredSize()) {
+ label->setPreferredSize(0, 0);
+ sizeHintChanged = true;
+ }
+ if (emptySize != label->maximumSize()) {
+ label->setMaximumSize(0, 0);
+ sizeHintChanged = true;
+ }
} else {
- label->setMinimumSize(label->sizeHint(Qt::PreferredSize));
- label->setPreferredSize(label->sizeHint(Qt::PreferredSize));
- label->setMaximumSize(label->sizeHint(Qt::PreferredSize));
+ if (label->sizeHint(Qt::PreferredSize) != label->minimumSize()) {
+ label->setMinimumSize(label->sizeHint(Qt::PreferredSize));
+ sizeHintChanged = true;
+ }
+ if (label->sizeHint(Qt::PreferredSize) != label->preferredSize()) {
+ label->setPreferredSize(label->sizeHint(Qt::PreferredSize));
+ sizeHintChanged = true;
+ }
+ if (label->sizeHint(Qt::PreferredSize) != label->maximumSize()) {
+ label->setMaximumSize(label->sizeHint(Qt::PreferredSize));
+ sizeHintChanged = true;
+ }
}
- label->resize(label->sizeHint(Qt::PreferredSize));
+ if (label->sizeHint(Qt::PreferredSize) != label->size())
+ label->resize(label->sizeHint(Qt::PreferredSize));
- updateGeometry();
+ if (sizeHintChanged)
+ updateGeometry();
}
void MSliderIndicator::setImage(const QString &id)
{
+ bool sizeHintChanged = false;
image->setVisible(!id.isEmpty());
imageName = id;
@@ -231,25 +250,41 @@ void MSliderIndicator::setImage(const QString &id)
delete pixmap;
}
- while (layout->count() > 0)
- layout->removeAt(0);
-
- layout->addAnchor(layout, Qt::AnchorVerticalCenter, label, Qt::AnchorVerticalCenter);
- layout->addAnchor(layout, Qt::AnchorVerticalCenter, image, Qt::AnchorVerticalCenter);
-
if (id.isEmpty()) {
- image->setMinimumSize(0, 0);
- image->setPreferredSize(0, 0);
- image->setMaximumSize(0, 0);
+ QSizeF emptySize(0, 0);
+
+ if (emptySize != image->minimumSize()) {
+ image->setMinimumSize(0, 0);
+ sizeHintChanged = true;
+ }
+ if (emptySize != image->preferredSize()) {
+ image->setPreferredSize(0, 0);
+ sizeHintChanged = true;
+ }
+ if (emptySize != image->maximumSize()) {
+ image->setMaximumSize(0, 0);
+ sizeHintChanged = true;
+ }
} else {
- image->setMinimumSize(image->sizeHint(Qt::PreferredSize));
- image->setPreferredSize(image->sizeHint(Qt::PreferredSize));
- image->setMaximumSize(image->sizeHint(Qt::PreferredSize));
+ if (image->sizeHint(Qt::PreferredSize) != image->minimumSize()) {
+ image->setMinimumSize(image->sizeHint(Qt::PreferredSize));
+ sizeHintChanged = true;
+ }
+ if (image->sizeHint(Qt::PreferredSize) != image->preferredSize()) {
+ image->setPreferredSize(image->sizeHint(Qt::PreferredSize));
+ sizeHintChanged = true;
+ }
+ if (image->sizeHint(Qt::PreferredSize) != image->maximumSize()) {
+ image->setMaximumSize(image->sizeHint(Qt::PreferredSize));
+ sizeHintChanged = true;
+ }
}
- image->resize(image->sizeHint(Qt::PreferredSize));
+ if (image->sizeHint(Qt::PreferredSize) != label->size())
+ image->resize(image->sizeHint(Qt::PreferredSize));
- updateGeometry();
+ if (sizeHintChanged)
+ updateGeometry();
}
QSizeF MSliderIndicator::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
@@ -388,6 +423,7 @@ void MSliderGroove::setSliderValues(int min, int max, int val)
handlePos.setX(valueToScreenCoordinate(value));
else
handlePos.setY(valueToScreenCoordinate(value));
+
updateHandlePos(handlePos);
update();
@@ -519,10 +555,14 @@ void MSliderGroove::raiseHandleIndicator()
{
QGraphicsItem *newParent = topLevelItem();
if (newParent) {
- sliderHandleIndicator->setParentItem(newParent);
-
- //by raising handle indicator will be shown
- sliderHandleIndicator->setVisible(true);
+ //reparents slider handle indicator only if it is necessary
+ if (newParent != sliderHandleIndicator->parentItem())
+ sliderHandleIndicator->setParentItem(newParent);
+
+ //by raising handle indicator will be shown (only if it
+ //is not already visible)
+ if (!sliderHandleIndicator->isVisible())
+ sliderHandleIndicator->setVisible(true);
}
updateHandleIndicatorPos();
@@ -746,6 +786,12 @@ void MSliderGroove::updateHandlePos(const QPointF &position)
x = qBound(sliderHandle->rect().width() / 2, x, rect().width() - (sliderHandle->rect().width() / 2));
+ QPointF newPos(x - (sliderHandle->rect().width() / 2), (rect().height() - sliderHandle->rect().height()) / 2);
+
+ //changes slider handle positions only if
+ //it is really necessary
+ if (newPos == sliderHandle->pos())
+ return;
sliderHandle->setPos(x - (sliderHandle->rect().width() / 2), (rect().height() - sliderHandle->rect().height()) / 2);
}
@@ -754,8 +800,16 @@ void MSliderGroove::updateHandlePos(const QPointF &position)
y = qBound(sliderHandle->rect().height() / 2, y, rect().height() - (sliderHandle->rect().height() / 2));
+ QPointF newPos((rect().width() - sliderHandle->rect().width()) / 2, y - (sliderHandle->rect().height() / 2));
+
+ //changes slider handle positions only if
+ //it is really necessary
+ if (newPos == sliderHandle->pos())
+ return;
+
sliderHandle->setPos((rect().width() - sliderHandle->rect().width()) / 2, y - (sliderHandle->rect().height() / 2));
}
+
updateHandleIndicatorPos();
}
@@ -815,7 +869,13 @@ void MSliderGroove::updateHandleIndicatorPos()
if (sliderHandleIndicatorParent)
grooveRelativePos = mapFromScene(scenePos()) - mapFromScene(sliderHandleIndicatorParent->scenePos());
- sliderHandleIndicator->setPos(grooveRelativePos + handleIndicatorPos);
+ //slider handle label position (and bounding rect)
+ //will be changed only if it is really necessary
+ QPointF newPos = grooveRelativePos + handleIndicatorPos;
+ if (newPos == pos())
+ return;
+
+ sliderHandleIndicator->setPos(newPos);
//recalculates bounding rect according to area occupied by handle indicator
//because that area still has to be redrawn whenever slider is redrawn
@@ -1081,21 +1141,41 @@ bool MSliderViewPrivate::isCollision(QGraphicsSceneMouseEvent *event) const
//to mouse cursor position
void MSliderViewPrivate::updateValue(QGraphicsSceneMouseEvent *event)
{
- if (valueAnimation == 0) {
- valueAnimation = new QPropertyAnimation(controller, "value", controller);
- valueAnimation->setDuration(50);
- valueAnimation->setEasingCurve(QEasingCurve::OutSine);
+ Q_Q(MSliderView);
+
+ bool needAnimation = false;
+
+ QRectF clickableHandleRect = sliderGroove->clickableHandleArea();
+ clickableHandleRect.translate(sliderGroove->pos());
+
+ //animation is necessary when tap point is further form
+ //slider handle middle point then slider handle width / height
+ //(depending on slider orientation)
+ if (q->model()->orientation() == Qt::Horizontal) {
+ if (qAbs(event->pos().x() - clickableHandleRect.center().x()) > clickableHandleRect.width())
+ needAnimation = true;
+ } else {
+ if (qAbs(event->pos().y() - clickableHandleRect.center().y()) > clickableHandleRect.height())
+ needAnimation = true;
}
//there are some margins around the view
//and those have to be considered
- Q_Q(MSliderView);
QPointF eventPos = event->pos();
eventPos.setX(eventPos.x() + q->marginLeft());
eventPos.setY(eventPos.y() + q->marginTop());
- valueAnimation->setEndValue(sliderGroove->screenPointToValue(eventPos));
- valueAnimation->start();
+ if (needAnimation) {
+ if (valueAnimation == 0) {
+ valueAnimation = new QPropertyAnimation(controller, "value", controller);
+ valueAnimation->setDuration(150);
+ valueAnimation->setEasingCurve(QEasingCurve::OutSine);
+ }
+
+ valueAnimation->setEndValue(sliderGroove->screenPointToValue(eventPos));
+ valueAnimation->start();
+ } else
+ controller->setValue(sliderGroove->screenPointToValue(eventPos));
}
//refreshes slider groove (min, max and value, slider state)
diff --git a/src/views/mstatusbarview.cpp b/src/views/mstatusbarview.cpp
index 6545faae..8e21fe7e 100644
--- a/src/views/mstatusbarview.cpp
+++ b/src/views/mstatusbarview.cpp
@@ -33,7 +33,8 @@
MStatusBarView::MStatusBarView(MStatusBar *controller) :
MSceneWindowView(controller),
- controller(controller)
+ controller(controller),
+ updatesEnabled(false)
{
#ifdef Q_WS_X11
pixmapDamage = 0;
@@ -41,7 +42,11 @@ MStatusBarView::MStatusBarView(MStatusBar *controller) :
MApplication *mApplication = static_cast<MApplication *>(QCoreApplication::instance());
connect(mApplication, SIGNAL(damageEvent(Qt::HANDLE&, short&, short&, unsigned short&, unsigned short&)),
SLOT(handlePixmapDamageEvent(Qt::HANDLE&, short&, short&, unsigned short&, unsigned short&)));
-
+ connect(controller, SIGNAL(displayExited()),
+ this, SLOT(disablePixmapUpdates()));
+ connect(controller, SIGNAL(displayEntered()),
+ this, SLOT(enablePixmapUpdates()));
+
updateSharedPixmap();
#endif
}
@@ -78,7 +83,7 @@ void MStatusBarView::drawContents(QPainter *painter, const QStyleOptionGraphicsI
sourceRect.setWidth(size().width());
sourceRect.setHeight(size().height());
}
-
+
painter->drawPixmap(QPointF(0.0, 0.0), sharedPixmap, sourceRect);
#else
Q_UNUSED(painter);
@@ -90,6 +95,9 @@ void MStatusBarView::updateSharedPixmap()
{
destroyXDamageForSharedPixmap();
+ if (!updatesEnabled)
+ return;
+
Qt::HANDLE handle;
if (fetchSharedPixmapHandle(&handle)) {
sharedPixmap = QPixmap::fromX11Pixmap(handle, QPixmap::ExplicitlyShared);
@@ -141,6 +149,19 @@ void MStatusBarView::handlePixmapDamageEvent(Qt::HANDLE &damage, short &x, short
controller->update(x, y, width, height);
}
}
+
+void MStatusBarView::enablePixmapUpdates()
+{
+ updatesEnabled = true;
+ updateSharedPixmap();
+}
+
+void MStatusBarView::disablePixmapUpdates()
+{
+ updatesEnabled = false;
+ destroyXDamageForSharedPixmap();
+}
+
#endif
M_REGISTER_VIEW_NEW(MStatusBarView, MStatusBar)
diff --git a/src/views/mstatusbarview.h b/src/views/mstatusbarview.h
index 7c907617..8185d92d 100644
--- a/src/views/mstatusbarview.h
+++ b/src/views/mstatusbarview.h
@@ -45,6 +45,7 @@ private:
Q_DISABLE_COPY(MStatusBarView)
MWidgetController *controller;
+ bool updatesEnabled;
#ifdef Q_WS_X11
void updateSharedPixmap();
@@ -58,6 +59,14 @@ private:
private Q_SLOTS:
void handlePixmapDamageEvent(Qt::HANDLE &damage, short &x, short &y,
unsigned short &width, unsigned short &height);
+
+ void enablePixmapUpdates();
+ void disablePixmapUpdates();
+
+#endif
+
+#ifdef UNIT_TEST
+ friend class Ut_MStatusBarView;
#endif
};
diff --git a/src/views/mtexteditview.cpp b/src/views/mtexteditview.cpp
index f27ec56c..8869bcb7 100644
--- a/src/views/mtexteditview.cpp
+++ b/src/views/mtexteditview.cpp
@@ -522,6 +522,12 @@ void MTextEditViewPrivate::handleDocumentSizeChange(const QSizeF &newSize)
checkScroll();
}
+void MTextEditViewPrivate::playTextFieldSelectionFeedback()
+{
+ Q_Q(const MTextEditView);
+
+ q->style()->changeSelectionFeedback().play();
+}
/*!
* \brief Method to start text selection
@@ -770,6 +776,7 @@ void MTextEditView::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(MTextEditView);
+ MTextEdit::TextFieldLocationType location;
int cursor = d->cursorPosition(event);
d->setMouseTarget(event->pos());
@@ -785,12 +792,23 @@ void MTextEditView::mousePressEvent(QGraphicsSceneMouseEvent *event)
d->ignoreSelection = !d->controller->isSelectionEnabled();
}
+ // let the controller react on click on a cursor index
+ d->controller->handleMousePress(cursor, event, &location);
+
if (model()->textInteractionFlags() != Qt::NoTextInteraction) {
- style()->pressFeedback().play();
+ if (location == MTextEdit::Word) {
+ style()->pressWordFeedback().play();
+ } else {
+ style()->pressBoundaryFeedback().play();
+ }
}
- // let the controller react on click on a cursor index
- d->controller->handleMousePress(cursor, event);
+ // Connect when pressing and disconnect when releasing
+ // to make sure that feedback is only given when user is
+ // making changes to the selection by touching.
+ QObject::connect(d->controller, SIGNAL(selectionChanged()),
+ d, SLOT(playTextFieldSelectionFeedback()),
+ Qt::UniqueConnection);
}
@@ -798,6 +816,7 @@ void MTextEditView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(MTextEditView);
+ MTextEdit::TextFieldLocationType location;
event->accept();
// controller shouldn't do anything for selection ending mouse release
@@ -805,12 +824,15 @@ void MTextEditView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
// don't send either focus gaining mouse click with autoselect
if (d->inAutoSelectionClick == false) {
int cursor = d->cursorPosition(event);
+ d->controller->handleMouseRelease(cursor, event, &location);
if (model()->textInteractionFlags() != Qt::NoTextInteraction) {
- style()->releaseFeedback().play();
+ if (location == MTextEdit::Word) {
+ style()->releaseWordFeedback().play();
+ } else {
+ style()->releaseBoundaryFeedback().play();
+ }
}
-
- d->controller->handleMouseRelease(cursor, event);
}
}
@@ -818,6 +840,9 @@ void MTextEditView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
d->inAutoSelectionClick = false;
d->longPressTimer->stop();
d->scrollTimer->stop();
+
+ QObject::disconnect(d->controller, SIGNAL(selectionChanged()),
+ d, SLOT(playTextFieldSelectionFeedback()));
}
@@ -973,9 +998,11 @@ void MTextEditView::changeEvent(QEvent *event)
void MTextEditView::cancelEvent(MCancelEvent *event)
{
Q_UNUSED(event);
+ Q_D(MTextEditView);
+
+ style()->cancelFeedback().play();
// restore state before as before mouse press
- Q_D(MTextEditView);
d->selecting = false;
d->inAutoSelectionClick = false;
d->longPressTimer->stop();
@@ -985,6 +1012,9 @@ void MTextEditView::cancelEvent(MCancelEvent *event)
if (d->controller->completer() && d->controller->completer()->isActive()) {
d->controller->completer()->hideCompleter();
}
+
+ QObject::disconnect(d->controller, SIGNAL(selectionChanged()),
+ d, SLOT(playTextFieldSelectionFeedback()));
}
diff --git a/src/views/mtexteditview_p.h b/src/views/mtexteditview_p.h
index cc117e99..5b0873d8 100644
--- a/src/views/mtexteditview_p.h
+++ b/src/views/mtexteditview_p.h
@@ -75,6 +75,7 @@ protected slots:
void checkSize();
void handleDocumentUpdate(int position, int charsRemoved, int charsAdded);
void handleDocumentSizeChange(const QSizeF &newSize);
+ void playTextFieldSelectionFeedback();
private:
void scrollingTestAndStart(QGraphicsSceneMouseEvent *event);
diff --git a/src/views/mtoolbarview.cpp b/src/views/mtoolbarview.cpp
index 56f5141e..67b53bbc 100644
--- a/src/views/mtoolbarview.cpp
+++ b/src/views/mtoolbarview.cpp
@@ -33,7 +33,7 @@
#include "mtoolbarview.h"
#include "mtoolbarview_p.h"
-const int MToolBarViewPrivate::maxWidgets = 4;
+const int maxSlots = 4;
/* Make a layout policy for aligning widgets nicely by
* adding spacers.
@@ -44,50 +44,120 @@ class ToolBarLayoutPolicy : public MLinearLayoutPolicy
public:
explicit ToolBarLayoutPolicy(MLayout *layout) :
MLinearLayoutPolicy(layout, Qt::Horizontal) {
+ textEditIndex = -1;
insertSpacer(0);
+ setSpacing(0);
}
~ToolBarLayoutPolicy() {
- for(int i = count()-1; i >= 0; i--)
- removeAt(i);
+ for(int i = widgetCount()-1; i >= 0; i--)
+ removeWidgetAt(i);
QGraphicsLayoutItem *item = MLinearLayoutPolicy::itemAt(0);
MLinearLayoutPolicy::removeAt(0);
delete item;
}
- virtual void insertItem(int index, QGraphicsLayoutItem *item)
+ void insertWidgetAndRemoveOverflow(int index, QGraphicsLayoutItem *item)
{
+ index = qMin((uint)index, (uint)widgetCount());
+ //A ugly hack to try to cope with QTBUG-11134
+ item->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
Q_ASSERT(item);
Q_ASSERT(MLinearLayoutPolicy::count() % 2);
Q_ASSERT(MLinearLayoutPolicy::count() > index*2);
+ if(dynamic_cast<MTextEdit *>(item->graphicsItem())) {
+ if(textEditIndex != -1) //Remove any previous text edit
+ removeWidgetAt(textEditIndex);
+ textEditIndex = index;
+ } else if(index <= textEditIndex)
+ textEditIndex++;
+
//Add an item and a spacer after the item
MLinearLayoutPolicy::insertItem(1 + index*2, item);
+
insertSpacer(2+index*2);
Q_ASSERT(MLinearLayoutPolicy::count() % 2);
+
+ //Prevent overflow - remove any that we've pushed off the end
+ while(takenSlots() > maxSlots) {
+ removeWidgetAt(widgetCount()-1);
+ }
}
- virtual void removeAt(int index)
+ bool roomForWidget(int index, bool textEdit) const {
+ index = qMin((uint)index, (uint)widgetCount());
+
+ if(textEdit) {
+ if(textEditIndex != -1 && index > textEditIndex) {
+ //If we come first, we push the old textedit out of the way
+ return false; //No room for us
+ } else if(index + 1 >= maxSlots) {
+ return false; //No room to add
+ }
+ }
+ else if(index >= maxSlots)
+ return false; //No room to add
+ else if(textEditIndex != -1 && index >= maxSlots -1)
+ return false; //No room to add because textedit takes up two spaces
+ return true;
+ }
+ void removeWidgetAt(int index)
{
+ if(index < 0 || index >= widgetCount())
+ return;
Q_ASSERT(MLinearLayoutPolicy::count() % 2);
Q_ASSERT(MLinearLayoutPolicy::count() > 2+index*2);
//Remove the item first
- QGraphicsLayoutItem *item = MLinearLayoutPolicy::itemAt(2+index*2);
+ if(index == textEditIndex)
+ textEditIndex = -1;
+ else if(textEditIndex != -1 && index < textEditIndex)
+ textEditIndex--;
MLinearLayoutPolicy::removeAt(2+index*2);
MLinearLayoutPolicy::removeAt(1+index*2);
- layout()->removeItem(item);
}
- virtual int count() const
+
+ int widgetCount() const
{
return (MLinearLayoutPolicy::count()-1)/2;
}
- virtual QGraphicsLayoutItem *itemAt(int index) const
+ int takenSlots() const
{
- return MLinearLayoutPolicy::itemAt(1+index*2);
+ if(textEditIndex != -1)
+ return widgetCount() + 1; //textedit counts for two slots
+ else
+ return widgetCount();
+ }
+ int widgetIndexOf(const QGraphicsLayoutItem *item) const {
+ for(int i = widgetCount() -1; i >= 0; i--) {
+ if(MLinearLayoutPolicy::itemAt(1+i*2) == item)
+ return i;
+ }
+ return -1;
+ }
+ void removeWidget(const QGraphicsLayoutItem *item)
+ {
+ removeWidgetAt(widgetIndexOf(item));
+ }
+
+protected:
+ /** Hide the normal functions since these include the spacers
+ * and we want to encourage the user to only use our functions */
+ virtual int count() const { return MLinearLayoutPolicy::count(); }
+ virtual QGraphicsLayoutItem *itemAt(int index) const { return MLinearLayoutPolicy::itemAt(index); }
+ virtual void insertItem(int index, QGraphicsLayoutItem *item) { return MLinearLayoutPolicy::insertItem(index, item); }
+ void indexOf(const QGraphicsLayoutItem *item) const;
+ virtual void removeAt(int index) {
+ //This can be called by the layout, and we need to make sure that we delete the spacer as well
+ removeWidgetAt((index-1)/2);
}
private:
+ int textEditIndex;
+
void insertSpacer(int position) {
+ //Create an item that will expand if necessary
QGraphicsWidget *item = new QGraphicsWidget;
- item->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
+ item->setPreferredSize(1,1); //Ugly hack around QTBUG-11134
+ item->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
MLinearLayoutPolicy::insertItem(position, item);
}
};
@@ -96,8 +166,6 @@ MToolBarViewPrivate::MToolBarViewPrivate(MToolBar *controller)
: QObject(),
q_ptr(0),
layout(0),
- landscapePolicy(0),
- portraitPolicy(0),
buttonGroup(0)
{
this->controller = controller;
@@ -133,11 +201,9 @@ void MToolBarViewPrivate::init()
layout->setContentsMargins(0, 0, 0, 0);
landscapePolicy = new ToolBarLayoutPolicy(layout);
- landscapePolicy->setSpacing(0);
layout->setLandscapePolicy(landscapePolicy);
portraitPolicy = new ToolBarLayoutPolicy(layout);
- portraitPolicy->setSpacing(0);
layout->setPortraitPolicy(portraitPolicy);
QGraphicsLinearLayout *controllerlayout = (QGraphicsLinearLayout *)(controller->layout());
@@ -149,23 +215,28 @@ void MToolBarViewPrivate::init()
}
}
-int MToolBarViewPrivate::policyIndexForAddingAction(QAction *action, MLinearLayoutPolicy *policy) const {
+int MToolBarViewPrivate::policyIndexForAddingAction(QAction *action, ToolBarLayoutPolicy *policy) const {
Q_Q(const MToolBarView);
//We need to add the action's given widget to the policy
//This is a bit complicated because we ideally want to add it in the right place,
//preserving the same order as in the controller->actions()
QList< QAction *> actions = controller->actions();
int parentIndex = actions.indexOf(action)+1;
+ int index = policy->widgetCount();
while(parentIndex < actions.size()) {
MWidget *w = q->getWidget(actions.at(parentIndex));
- if(!w) {
- int policyIndex = policy->indexOf(w);
- if(policyIndex >= 0)
- return policyIndex;
+ if(w) {
+ int policyIndex = policy->widgetIndexOf(w);
+ if(policyIndex >= 0) {
+ index = policyIndex;
+ break;
+ }
}
parentIndex++;
}
- return policy->count(); //Add it to the end
+ if(policy->roomForWidget(index, hasTextEditWidget(action)))
+ return index;
+ return -1;
}
void MToolBarViewPrivate::add(QAction *action)
@@ -174,63 +245,55 @@ void MToolBarViewPrivate::add(QAction *action)
return; //Cancel adding action
// add to policies only if the action is visible
- bool addToLandscape = isLocationValid(action, MAction::ToolBarLandscapeLocation) &&
- reserveSpaceForAction(action, landscapeData);
- bool addToPortrait = isLocationValid(action, MAction::ToolBarPortraitLocation) &&
- reserveSpaceForAction(action, portraitData);
- if (!addToLandscape && !addToPortrait)
+ int landscapeIndex = -1;
+ int portraitIndex = -1;
+ if (isLocationValid(action, MAction::ToolBarLandscapeLocation))
+ landscapeIndex = policyIndexForAddingAction(action, landscapePolicy);
+ if (isLocationValid(action, MAction::ToolBarPortraitLocation))
+ portraitIndex = policyIndexForAddingAction(action, portraitPolicy);
+
+ if (landscapeIndex == -1 && portraitIndex == -1)
return; //Cancel adding action
MWidget *widget = createWidget(action);
Q_ASSERT(widget);
- if (addToLandscape)
- landscapePolicy->insertItem( policyIndexForAddingAction(action, landscapePolicy), widget );
- if (addToPortrait)
- portraitPolicy->insertItem( policyIndexForAddingAction(action, portraitPolicy), widget );
+ if (landscapeIndex != -1)
+ landscapePolicy->insertWidgetAndRemoveOverflow( landscapeIndex, widget );
+ if (portraitIndex != -1)
+ portraitPolicy->insertWidgetAndRemoveOverflow( portraitIndex, widget );
updateWidgetFromAction(widget, action);
}
-void MToolBarViewPrivate::remove(QAction *action)
+void MToolBarViewPrivate::remove(QAction *action, bool hideOnly)
{
MButton *button = buttons.value(action);
MWidget *leased = leasedWidgets.value(action);
MWidget *widget = (button != 0) ? button : leased;
-
if(!widget)
- return; //Action already removed
- bool isTextEditWidget = hasTextEditWidget(action);
- if(landscapePolicy->indexOf(widget) >= 0) {
- if(isTextEditWidget) {
- landscapeData.hasTextEditor = false;
- //one text-edit widget takes space of two buttons
- landscapeData.placedActions -= 2;
- } else
- landscapeData.placedActions--;
- }
- if(portraitPolicy->indexOf(widget) >= 0) {
- if(isTextEditWidget) {
- portraitData.hasTextEditor = false;
- //one text-edit widget takes space of two buttons
- portraitData.placedActions -= 2;
- } else
- portraitData.placedActions--;
- }
-
- layout->removeItem(widget);
+ return;
- if (button) {
- buttons.remove(action);
- if(buttonGroup)
- buttonGroup->removeButton(button);
- delete button;
+ if(hideOnly) {
+ landscapePolicy->removeWidget(widget);
+ portraitPolicy->removeWidget(widget);
} else {
- releaseWidget(action, leased);
- leasedWidgets.remove(action);
+ //Need to fully remove the action
+ layout->removeItem(widget);
+
+ if (button) {
+ buttons.remove(action);
+ if(buttonGroup)
+ buttonGroup->removeButton(button);
+ delete button;
+ } else {
+ releaseWidget(action, leased);
+ leasedWidgets.remove(action);
+ }
}
//There might be space now any actions not already added. Signal a change action which
//will check if an item now has room to be shown
foreach(QAction *action, controller->actions()) {
- change(action);
+ if(action->isVisible())
+ change(action);
}
}
@@ -240,13 +303,13 @@ void MToolBarViewPrivate::change(QAction *action)
if(hasUnusableWidget(action))
return;
if(!action->isVisible()) {
- remove(action);
+ remove(action, true); //Remove action, but only hiding the widget, not deleting/releasing it
return;
}
bool validInLandscape = isLocationValid(action, MAction::ToolBarLandscapeLocation);
bool validInPortrait = isLocationValid(action, MAction::ToolBarPortraitLocation);
if (!validInLandscape && !validInPortrait) {
- remove(action);
+ remove(action, true);
return;
}
@@ -254,7 +317,7 @@ void MToolBarViewPrivate::change(QAction *action)
QList< QAction *> actions = controller->actions();
int indexOfAction = actions.indexOf(action);
if(indexOfAction == -1) {
- remove(action); // I don't think this is possible
+ remove(action, false); // I don't think this is possible
return;
}
@@ -266,23 +329,25 @@ void MToolBarViewPrivate::change(QAction *action)
}
//We have now an action and a widget for it
- int landscapeIndex = landscapePolicy->indexOf(widget);
- int portraitIndex = portraitPolicy->indexOf(widget);
+ int landscapeIndex = landscapePolicy->widgetIndexOf(widget);
+ int portraitIndex = portraitPolicy->widgetIndexOf(widget);
if(!validInLandscape && landscapeIndex >= 0) {
//We are showing it in landscape view but should not be
- landscapePolicy->removeAt(landscapeIndex);
+ landscapePolicy->removeWidgetAt(landscapeIndex);
}
if(!validInPortrait && portraitIndex >= 0) {
//We are showing it in portrait view but should not be
- portraitPolicy->removeAt(portraitIndex);
+ portraitPolicy->removeWidgetAt(portraitIndex);
}
if(validInLandscape && landscapeIndex == -1) {
- if( reserveSpaceForAction(action, landscapeData) )
- landscapePolicy->insertItem( policyIndexForAddingAction(action, landscapePolicy), widget );
+ int index = policyIndexForAddingAction(action, landscapePolicy);
+ if(index != -1)
+ landscapePolicy->insertWidgetAndRemoveOverflow( index, widget );
}
if(validInPortrait && portraitIndex == -1) {
- if( reserveSpaceForAction(action, portraitData) )
- portraitPolicy->insertItem( policyIndexForAddingAction(action, portraitPolicy), widget );
+ int index = policyIndexForAddingAction(action, portraitPolicy);
+ if(index != -1)
+ portraitPolicy->insertWidgetAndRemoveOverflow( index, widget );
}
updateWidgetFromAction(widget, action);
@@ -307,7 +372,7 @@ bool MToolBarViewPrivate::eventFilter(QObject *obj, QEvent *e)
{
switch (e->type()) {
case QEvent::ActionRemoved:
- remove(static_cast<QActionEvent *>(e)->action());
+ remove(static_cast<QActionEvent *>(e)->action(), false);
break;
case QEvent::ActionAdded:
add(static_cast<QActionEvent *>(e)->action());
@@ -336,6 +401,11 @@ MWidget *MToolBarViewPrivate::createWidget(QAction *action)
widget->show();
} else {
MButton *button = new MButton;
+
+ button->setObjectName("toolbaractioncommand");
+ if (widgetAction && !widgetAction->objectName().isEmpty())
+ button->setObjectName(button->objectName() + "_" + widgetAction->objectName());
+
if(buttonGroup) {
button->setViewType("toolbartab");
button->setCheckable(action->isCheckable());
@@ -401,22 +471,6 @@ MWidget *MToolBarView::getWidget(QAction *action) const
return d->leasedWidgets.value(action);
}
-bool MToolBarViewPrivate::reserveSpaceForAction(QAction *action, ActionPlacementData &policyData)
-{
- if(hasTextEditWidget(action)) {
- if (policyData.hasTextEditor || policyData.placedActions > maxWidgets)
- return false; //We can't add two text edits, and there must be two spaces available for a text edit
- policyData.hasTextEditor = true;
- //one text-edit widget takes space of two buttons
- policyData.placedActions += 2;
- } else {
- if (policyData.placedActions >= maxWidgets)
- return false; //no more room
- policyData.placedActions += 1;
- }
- return true;
-}
-
void MToolBarViewPrivate::_q_groupButtonClicked(bool checked)
{
Q_Q(MToolBarView);
diff --git a/src/views/mtoolbarview_p.h b/src/views/mtoolbarview_p.h
index 88705336..7acab644 100644
--- a/src/views/mtoolbarview_p.h
+++ b/src/views/mtoolbarview_p.h
@@ -37,6 +37,7 @@ class MWidgetAction;
class MLayout;
class QGraphicsLayoutItem;
class QGraphicsWidget;
+class ToolBarLayoutPolicy;
class MToolBarViewPrivate : public QObject
{
@@ -49,21 +50,20 @@ public:
void init();
void add(QAction *action);
- void remove(QAction *action);
+ void remove(QAction *action, bool hideOnly);
void change(QAction *action);
protected:
bool eventFilter(QObject *obj, QEvent *event);
MWidget *createWidget(QAction *action);
- int policyIndexForAddingAction(QAction *action, MLinearLayoutPolicy *policy) const;
+ int policyIndexForAddingAction(QAction *action, ToolBarLayoutPolicy *policy) const;
bool isLocationValid(QAction *action, MAction::Location loc) const;
bool releaseWidget(QAction *action, MWidget *widget) const;
bool hasTextEditWidget(QAction *action) const;
bool hasUnusableWidget(QAction *action) const;
void updateWidgetFromAction(MWidget *widget, QAction *action) const;
MWidget *getWidget(QAction *action) const;
-
void _q_groupButtonClicked(bool);
void _q_groupActionToggled(bool);
protected:
@@ -71,33 +71,13 @@ protected:
MToolBar *controller;
MWidget *widgetsContainer;
MLayout *layout;
- MLinearLayoutPolicy *landscapePolicy;
- MLinearLayoutPolicy *portraitPolicy;
QHash<QAction *, MWidget *> leasedWidgets;
QHash<QAction *, MButton *> buttons;
/* If this is non-null, created buttons will be placed in this group */
MButtonGroup * buttonGroup;
- static const int maxWidgets;
-
- enum PlacementMode {
- Managed = 0,
- Unmanaged
- };
-
- struct ActionPlacementData
- {
- ActionPlacementData() {
- hasTextEditor = false;
- placedActions = 0;
- }
- bool hasTextEditor;
- int placedActions;
- };
-
- ActionPlacementData landscapeData;
- ActionPlacementData portraitData;
- bool reserveSpaceForAction(QAction *action, ActionPlacementData &policyData);
+ ToolBarLayoutPolicy *landscapePolicy;
+ ToolBarLayoutPolicy *portraitPolicy;
};
#endif
diff --git a/src/views/style/mbubbleitembackgroundstyle.h b/src/views/style/mbubbleitembackgroundstyle.h
new file mode 100644
index 00000000..c63943f4
--- /dev/null
+++ b/src/views/style/mbubbleitembackgroundstyle.h
@@ -0,0 +1,50 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef MBUBBLEITEMBACKGROUNDSTYLE_H
+#define MBUBBLEITEMBACKGROUNDSTYLE_H
+
+#include <mwidgetstyle.h>
+
+/*!
+ * \internal
+ */
+
+class M_EXPORT MBubbleItemBackgroundStyle : public MWidgetStyle
+{
+ Q_OBJECT
+ M_STYLE(MBubbleItemBackgroundStyle)
+
+ M_STYLE_PTR_ATTRIBUTE(MScalableImage *, incomingBackground, IncomingBackground)
+ M_STYLE_PTR_ATTRIBUTE(MScalableImage *, incomingMirroredBackground, IncomingMirroredBackground)
+ M_STYLE_PTR_ATTRIBUTE(MScalableImage *, outgoingBackground, OutgoingBackground)
+ M_STYLE_PTR_ATTRIBUTE(MScalableImage *, outgoingMirroredBackground, OutgoingMirroredBackground)
+};
+
+/*!
+ * \internal
+ */
+
+class M_EXPORT MBubbleItemBackgroundStyleContainer : public MWidgetStyleContainer
+{
+ M_STYLE_CONTAINER(MBubbleItemBackgroundStyle)
+};
+
+#endif
+
diff --git a/src/views/style/mlistitemstyle.h b/src/views/style/mlistitemstyle.h
new file mode 100644
index 00000000..35f30ea9
--- /dev/null
+++ b/src/views/style/mlistitemstyle.h
@@ -0,0 +1,36 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#ifndef MLISTITEMSTYLE_H
+#define MLISTITEMSTYLE_H
+
+#include <mwidgetstyle.h>
+
+class M_EXPORT MListItemStyle : public MWidgetStyle
+{
+ Q_OBJECT
+ M_STYLE(MListItemStyle)
+};
+
+class M_EXPORT MListItemStyleContainer : public MWidgetStyleContainer
+{
+ M_STYLE_CONTAINER(MListItemStyle)
+};
+
+#endif // MLISTITEMSTYLE_H
diff --git a/src/views/style/mtexteditstyle.h b/src/views/style/mtexteditstyle.h
index 9a9ddfad..f4f19bd1 100644
--- a/src/views/style/mtexteditstyle.h
+++ b/src/views/style/mtexteditstyle.h
@@ -41,6 +41,36 @@ class M_EXPORT MTextEditStyle : public MWidgetStyle
M_STYLE_ATTRIBUTE(QString, pasteFailedIcon, PasteFailedIcon)
M_STYLE_ATTRIBUTE(int, pasteFailedDuration, PasteFailedDuration)
M_STYLE_ATTRIBUTE(int, maskingDelay, MaskingDelay)
+
+ /*!
+ \property MTextEditStyle::pressBoundaryFeedback
+ \brief Feedback given when pressing between words
+ */
+ M_STYLE_ATTRIBUTE(MFeedback, pressBoundaryFeedback, PressBoundaryFeedback)
+
+ /*!
+ \property MTextEditStyle::releaseBoundaryFeedback
+ \brief Feedback given when releasing between words
+ */
+ M_STYLE_ATTRIBUTE(MFeedback, releaseBoundaryFeedback, ReleaseBoundaryFeedback)
+
+ /*!
+ \property MTextEditStyle::pressWordFeedback
+ \brief Feedback given when pressing on top of a word
+ */
+ M_STYLE_ATTRIBUTE(MFeedback, pressWordFeedback, PressWordFeedback)
+
+ /*!
+ \property MTextEditStyle::releaseWordFeedback
+ \brief Feedback given when releasing on top of a word
+ */
+ M_STYLE_ATTRIBUTE(MFeedback, releaseWordFeedback, ReleaseWordFeedback)
+
+ /*!
+ \property MTextEditStyle::changeSelectionFeedback
+ \brief Feedback given when finger movement changes text selection
+ */
+ M_STYLE_ATTRIBUTE(MFeedback, changeSelectionFeedback, ChangeSelectionFeedback)
};
class M_EXPORT MTextEditStyleContainer : public MWidgetStyleContainer
diff --git a/src/views/style/style.pri b/src/views/style/style.pri
index d6a7e0b4..f6c85233 100644
--- a/src/views/style/style.pri
+++ b/src/views/style/style.pri
@@ -48,6 +48,8 @@ MGEN_STYLE_HEADERS += \
$$STYLE_SRC_DIR/mvideowidgetstyle.h \
$$STYLE_SRC_DIR/mlistindexstyle.h \
$$STYLE_SRC_DIR/mwarpanimationstyle.h \
+ $$STYLE_SRC_DIR/mlistitemstyle.h \
+ $$STYLE_SRC_DIR/mbubbleitembackgroundstyle.h \
PUBLIC_HEADERS += \
$$MGEN_STYLE_HEADERS \
diff --git a/src/views/views.pri b/src/views/views.pri
index 00f5ab9a..83438aa0 100644
--- a/src/views/views.pri
+++ b/src/views/views.pri
@@ -46,6 +46,8 @@ PUBLIC_HEADERS += \
mnavigationbarview.h \
mscenelayereffectdimview.h \
mlistindexview.h \
+ mlistitemview.h \
+ mbubbleitemview.h \
PRIVATE_HEADERS += \
mstylablewidgetview_p.h \
@@ -62,6 +64,7 @@ PRIVATE_HEADERS += \
mtoolbartabview_p.h \
mpannablewidgetview_p.h \
mlistindexview_p.h \
+ mlistitemview_p.h \
SOURCES += \
mapplicationpageview.cpp \
@@ -112,3 +115,5 @@ SOURCES += \
mnavigationbarview.cpp \
mscenelayereffectdimview.cpp \
mlistindexview.cpp \
+ mlistitemview.cpp \
+ mbubbleitemview.cpp \
diff --git a/src/views/widgets/mbubbleitembackground.cpp b/src/views/widgets/mbubbleitembackground.cpp
new file mode 100644
index 00000000..c7675237
--- /dev/null
+++ b/src/views/widgets/mbubbleitembackground.cpp
@@ -0,0 +1,129 @@
+/***************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui@nokia.com)
+**
+** This file is part of libmeegotouch.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui@nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it 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.
+**
+****************************************************************************/
+
+#include <QGraphicsSceneMouseEvent>
+
+#include "mbubbleitembackground_p.h"
+#include "mwidgetcreator.h"
+#include "mtheme.h"
+#include "mscalableimage.h"
+
+M_REGISTER_WIDGET(MBubbleItemBackground)
+
+M_REGISTER_VIEW(MBubbleItemBackgroundView, MBubbleItemBackground)
+
+/*
+ * View
+ */
+
+MBubbleItemBackgroundView::MBubbleItemBackgroundView(MBubbleItemBackground *_controller)
+ : MWidgetView(_controller),
+ rtl( false )
+{
+ controller = _controller;
+}
+
+void MBubbleItemBackgroundView::drawBackground(QPainter* painter, const QStyleOptionGraphicsItem* option) const
+{
+ Q_UNUSED(option);
+
+ QSizeF currentSize = size();
+ if (currentSize.width() == 0 || currentSize.height() == 0)
+ return;
+
+ qreal oldOpacity = painter->opacity();
+ painter->setOpacity(style()->backgroundOpacity() * effectiveOpacity());
+
+ if( controller->messageType() == MBubbleItem::Incoming ) {
+ if( !rtl ) {
+ if( style()->incomingBackground() )
+ style()->incomingBackground()->draw(0, 0, currentSize.width(), currentSize.height(), painter);
+ } else {
+ if( style()->incomingMirroredBackground() )
+ style()->incomingMirroredBackground()->draw(0, 0, currentSize.width(), currentSize.height(), painter);
+ }
+
+ } else if ( controller->messageType() == MBubbleItem::Outgoing ) {
+ if( !rtl ) {
+ if( style()->outgoingBackground() )
+ style()->outgoingBackground()->draw(0, 0, currentSize.width(), currentSize.height(), painter);
+ } else {
+ if( style()->outgoingMirroredBackground() )
+ style()->outgoingMirroredBackground()->draw(0, 0, currentSize.width(), currentSize.height(), painter);
+ }
+ }
+
+ painter->setOpacity(oldOpacity);
+}
+
+void MBubbleItemBackgroundView::applyStyle()
+{
+ MWidgetView::applyStyle();
+
+ if( controller->layoutDirection() == Qt::RightToLeft )
+ rtl = true;
+ else
+ rtl = false;
+}
+
+bool MBubbleItemBackgroundView::event(QEvent* event)
+{
+ if ( event->type() == QEvent::LayoutDirectionChange ) {
+ if(rtl)
+ rtl = false;
+ else
+ rtl = true;
+ }
+ return MWidgetView::event(event);
+}
+
+/*
+ * Controller
+ */
+
+MBubbleItemBackground::MBubbleItemBackground(QGraphicsItem * parent)
+ : MWidgetController(parent),
+ _messageType(MBubbleItem::Incoming)
+{
+ setView(new MBubbleItemBackgroundView(this));
+}
+
+void MBubbleItemBackground::mousePressEvent(QGraphicsSceneMouseEvent *event)
+{
+ Q_UNUSED(event);
+ style().setModePressed();
+ update();
+}
+
+void MBubbleItemBackground::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
+{
+ Q_UNUSED(event);
+ style().setModeDefault();
+ emit clicked();
+ update();
+}
+
+void MBubbleItemBackground::cancelEvent(MCancelEvent *event)
+{
+ Q_UNUSED(event);
+ style().setModeDefault();
+ emit canceled();
+ update();
+}
+
diff --git a/src/views/widgets/mbubbleitembackground_p.h b/src/views/widgets/mbubbleitembackground_p.h
new file mode 100644
index 00000000..cc05a178
--- /dev/null
+++ b/src/views/widgets/mbubbleitembackground_p.h
@@ -0,0 +1,94 @@
+/***************************************************************************
+ **
+ ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ ** All rights reserved.
+ ** Contact: Nokia Corporation (directui@nokia.com)
+ **
+ ** This file is part of libmeegotouch.
+ **
+ ** If you have questions regarding the use of this file, please contact
+ ** Nokia at directui@nokia.com.
+ **
+ ** This library is free software; you can redistribute it and/or
+ ** modify it 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.
+ **
+ ****************************************************************************/
+
+#ifndef MBUBBLEITEMBACKGROUND_H
+#define MBUBBLEITEMBACKGROUND_H
+
+#include <MWidgetController>
+#include <MWidgetView>
+#include "mbubbleitem.h"
+#include <MScalableImage>
+
+#include "mbubbleitembackgroundstyle.h"
+
+/*!
+ * \internal
+ */
+
+class MBubbleItemBackground;
+
+class MBubbleItemBackgroundView : public MWidgetView
+{
+ Q_OBJECT
+ M_VIEW(MWidgetModel, MBubbleItemBackgroundStyle)
+
+public:
+ MBubbleItemBackgroundView(MBubbleItemBackground *controller);
+ ~MBubbleItemBackgroundView(){}
+
+protected:
+ virtual void drawBackground(QPainter *painter, const QStyleOptionGraphicsItem *option) const;
+
+ virtual bool event(QEvent* event);
+ void applyStyle();
+
+private:
+ bool rtl;
+
+ MBubbleItemBackground* controller;
+ Q_DISABLE_COPY(MBubbleItemBackgroundView)
+};
+
+/*
+ * Controller
+ */
+
+class MBubbleItemBackground : public MWidgetController
+{
+ Q_OBJECT
+ M_CONTROLLER(MWidget) // uses MWidgetModel
+
+public:
+ MBubbleItemBackground(QGraphicsItem *parent = 0);
+ virtual ~MBubbleItemBackground() {}
+
+ void setMessageType(MBubbleItem::MessageType mt)
+ {
+ _messageType = mt;
+ }
+
+ MBubbleItem::MessageType messageType()
+ {
+ return _messageType;
+ }
+
+protected:
+ virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
+ virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
+ virtual void cancelEvent(MCancelEvent *event);
+
+Q_SIGNALS:
+ void clicked();
+ void canceled();
+
+private:
+ MBubbleItem::MessageType _messageType;
+};
+
+#endif
diff --git a/src/views/widgets/widgets.pri b/src/views/widgets/widgets.pri
index 4c20959d..87f615ad 100644
--- a/src/views/widgets/widgets.pri
+++ b/src/views/widgets/widgets.pri
@@ -12,8 +12,10 @@ MGEN_MODEL_HEADERS += \
PRIVATE_HEADERS += \
$$MGEN_MODEL_HEADERS \
$$WIDGETS_SRC_DIR/mcontainerheader_p.h \
+ $$WIDGETS_SRC_DIR/mbubbleitembackground_p.h \
SOURCES += \
$$WIDGETS_SRC_DIR/mapplicationmenubutton.cpp \
$$WIDGETS_SRC_DIR/mcontainerheader.cpp \
$$WIDGETS_SRC_DIR/mlistindex.cpp \
+ $$WIDGETS_SRC_DIR/mbubbleitembackground.cpp \