summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex <qt-info@nokia.com>2011-01-12 14:30:31 +1000
committerAlex <qt-info@nokia.com>2011-01-12 14:30:31 +1000
commit62c3d077ee18567d04b55c5e40a9095679e47cdd (patch)
treea89182655a93085be59d35235e00aa5f032d92dd
parentdce4b9bec2504854d14b21861f94b277fa42ec8c (diff)
parentf11c87f3eb8998de6ab1c6952ed9660a8d8d1ac9 (diff)
cxMerge branch 'master' of ../qtmobility
Conflicts: doc/src/bearermanagement.qdoc doc/src/index.qdoc
-rw-r--r--INSTALL.symbian80
-rw-r--r--config.tests/chwrmhaptics/chwrmhaptics.pro14
-rw-r--r--config.tests/chwrmhaptics/main.cpp (renamed from plugins/landmarks/qsparql/databasefilewatcher_p.h)46
-rw-r--r--config.tests/maemo6-landmarks/maemo6-landmarks.pro7
-rw-r--r--config.tests/maemo6-landmarks/main.cpp3
-rw-r--r--config.tests/qmf/qmf.pro3
-rw-r--r--configure.bat1
-rw-r--r--doc/src/bearermanagement.qdoc5
-rw-r--r--doc/src/contacts.qdoc1
-rw-r--r--doc/src/feedback.qdoc1
-rw-r--r--doc/src/index.qdoc4
-rw-r--r--doc/src/installation.qdoc6
-rw-r--r--doc/src/location.qdoc2
-rw-r--r--doc/src/multimedia.qdoc2
-rw-r--r--doc/src/plugins/qml-gallery.qdoc8
-rw-r--r--doc/src/plugins/qml-organizer.qdoc2
-rw-r--r--doc/src/sf.qdoc1
-rw-r--r--doc/src/si.qdoc1
-rw-r--r--examples/calendardemo/src/calendardemo.cpp16
-rw-r--r--examples/hapticsquare/hapticsquare.cpp2
-rw-r--r--examples/landmarkbrowser/landmarkbrowser.cpp25
-rw-r--r--examples/qmlorganizer/contents/DayView.qml10
-rw-r--r--examples/qmlorganizer/contents/MenuBar.qml2
-rw-r--r--examples/qmlorganizer/contents/MonthView.qml9
-rw-r--r--examples/qmlorganizer/contents/TimelineView.qml48
-rw-r--r--examples/qmlorganizer/contents/WeekView.qml19
-rw-r--r--examples/qmlorganizer/contents/test.ics116
-rw-r--r--examples/qmlorganizer/organizer.qml46
-rw-r--r--examples/qmlorganizer/qmlorganizer.pro1
-rw-r--r--examples/qmlorganizer/qmlorganizer.qrc1
-rw-r--r--examples/samplephonebook/contacteditor.cpp8
-rw-r--r--plugins/contacts/symbian/plugin/src/cntrelationship.cpp2
-rw-r--r--plugins/contacts/symbian/plugin/src/cntrelationshipgroup.cpp47
-rw-r--r--plugins/contacts/symbian/plugin/tsrc/ut_symbian/ut_cntrelationship.cpp82
-rw-r--r--plugins/contacts/symbian/plugin/tsrc/ut_symbian/ut_cntrelationship.h1
-rw-r--r--plugins/declarative/contacts/contacts.pro4
-rw-r--r--plugins/declarative/contacts/qdeclarativecontactfilter.cpp1
-rw-r--r--plugins/declarative/contacts/qdeclarativecontactmodel.cpp3
-rw-r--r--plugins/declarative/feedback/feedback.pro2
-rw-r--r--plugins/declarative/gallery/gallery.pro4
-rw-r--r--plugins/declarative/location/location.pro2
-rw-r--r--plugins/declarative/messaging/messaging.pro9
-rw-r--r--plugins/declarative/multimedia/multimedia.pro2
-rw-r--r--plugins/declarative/multimedia/qdeclarativecamera.cpp124
-rw-r--r--plugins/declarative/multimedia/qdeclarativecamera_p.h1
-rw-r--r--plugins/declarative/multimedia/qdeclarativemediabase.cpp8
-rw-r--r--plugins/declarative/multimedia/qdeclarativemediabase_p.h1
-rw-r--r--plugins/declarative/organizer/organizer.pro4
-rw-r--r--plugins/declarative/organizer/plugin.cpp2
-rw-r--r--plugins/declarative/organizer/qdeclarativeorganizeritem.cpp523
-rw-r--r--plugins/declarative/organizer/qdeclarativeorganizeritem_p.h5
-rw-r--r--plugins/declarative/organizer/qdeclarativeorganizeritemdetail.cpp131
-rw-r--r--plugins/declarative/organizer/qdeclarativeorganizeritemdetail_p.h64
-rw-r--r--plugins/declarative/organizer/qdeclarativeorganizeritemfilter.cpp25
-rw-r--r--plugins/declarative/organizer/qdeclarativeorganizeritemfilter_p.h24
-rw-r--r--plugins/declarative/organizer/qdeclarativeorganizeritemmetaobject.cpp78
-rw-r--r--plugins/declarative/organizer/qdeclarativeorganizeritemmetaobject_p.h8
-rw-r--r--plugins/declarative/organizer/qdeclarativeorganizeritemsortorder_p.h2
-rw-r--r--plugins/declarative/organizer/qdeclarativeorganizermodel.cpp272
-rw-r--r--plugins/declarative/organizer/qdeclarativeorganizermodel_p.h32
-rw-r--r--plugins/declarative/organizer/qdeclarativeorganizerrecurrencerule_p.h7
-rw-r--r--plugins/declarative/publishsubscribe/publishsubscribe.pro2
-rw-r--r--plugins/declarative/sensors/sensors.pro2
-rw-r--r--plugins/declarative/serviceframework/serviceframework.pro2
-rw-r--r--plugins/declarative/systeminfo/qdeclarativescreensaver.cpp52
-rw-r--r--plugins/declarative/systeminfo/qdeclarativescreensaver_p.h3
-rw-r--r--plugins/declarative/systeminfo/systeminfo.pro2
-rw-r--r--plugins/feedback/immersion/qfeedback.cpp6
-rw-r--r--plugins/feedback/symbian/qfeedback_chwrmhaptics.cpp429
-rw-r--r--plugins/feedback/symbian/qfeedback_chwrmvibra.cpp (renamed from plugins/feedback/symbian/qfeedback.cpp)239
-rw-r--r--plugins/feedback/symbian/qfeedback_symbian.cpp132
-rw-r--r--plugins/feedback/symbian/qfeedback_symbian.h (renamed from plugins/feedback/symbian/qfeedback.h)97
-rw-r--r--plugins/feedback/symbian/qfeedback_themed.cpp173
-rw-r--r--plugins/feedback/symbian/symbian.pro30
-rw-r--r--plugins/geoservices/nokia/qgeotiledmapdata_nokia.cpp3
-rw-r--r--plugins/landmarks/qsparql/databaseoperations.cpp748
-rw-r--r--plugins/landmarks/qsparql/databaseoperations_p.h41
-rw-r--r--plugins/landmarks/qsparql/qlandmarkmanagerengine_qsparql.cpp389
-rw-r--r--plugins/landmarks/qsparql/qlandmarkmanagerengine_qsparql_p.h26
-rw-r--r--plugins/landmarks/qsparql/qsparql.pro10
-rw-r--r--plugins/landmarks/sqlite/databaseoperations.cpp9
-rw-r--r--plugins/landmarks/sqlite/qlandmarkmanagerengine_sqlite.cpp2
-rw-r--r--plugins/landmarks/symbian_landmarks/src/qlandmarkdbeventhandler.cpp4
-rw-r--r--plugins/landmarks/symbian_landmarks/src/qlandmarkmanagerengine_symbian_p.cpp119
-rw-r--r--plugins/landmarks/symbian_landmarks/src/qlandmarkrequesthandler.cpp1
-rw-r--r--plugins/landmarks/symbian_landmarks/src/qlandmarkutility.cpp2
-rw-r--r--plugins/multimedia/directshow/dsserviceplugin.cpp9
-rw-r--r--plugins/multimedia/directshow/dsserviceplugin.h8
-rw-r--r--plugins/multimedia/gstreamer/camerabin/camerabincontrol.cpp54
-rw-r--r--plugins/multimedia/gstreamer/camerabin/camerabincontrol.h2
-rw-r--r--plugins/multimedia/gstreamer/camerabin/camerabinfocus.cpp103
-rw-r--r--plugins/multimedia/gstreamer/camerabin/camerabinfocus.h16
-rw-r--r--plugins/multimedia/gstreamer/camerabin/camerabinlocks.cpp24
-rw-r--r--plugins/multimedia/gstreamer/camerabin/camerabinlocks.h3
-rw-r--r--plugins/multimedia/gstreamer/camerabin/camerabinsession.cpp78
-rw-r--r--plugins/multimedia/gstreamer/camerabin/camerabinsession.h8
-rw-r--r--plugins/multimedia/gstreamer/gstvideoconnector.c70
-rw-r--r--plugins/multimedia/gstreamer/gstvideoconnector.h3
-rw-r--r--plugins/multimedia/gstreamer/mediaplayer/mediaplayer.pri6
-rw-r--r--plugins/multimedia/gstreamer/mediaplayer/playerresourcepolicy.cpp166
-rw-r--r--plugins/multimedia/gstreamer/mediaplayer/playerresourcepolicy.h89
-rw-r--r--plugins/multimedia/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp64
-rw-r--r--plugins/multimedia/gstreamer/mediaplayer/qgstreamerplayercontrol.h9
-rw-r--r--plugins/multimedia/gstreamer/mediaplayer/qgstreamerplayersession.cpp293
-rw-r--r--plugins/multimedia/gstreamer/mediaplayer/qgstreamerplayersession.h32
-rw-r--r--plugins/multimedia/gstreamer/qgstreamerserviceplugin.cpp15
-rw-r--r--plugins/multimedia/gstreamer/qgstreamerserviceplugin.h8
-rw-r--r--plugins/multimedia/gstreamer/qgstreamervideoinputdevicecontrol.cpp5
-rw-r--r--plugins/multimedia/gstreamer/qgstreamervideorendererinterface.h4
-rw-r--r--plugins/multimedia/symbian/ecam/camera_s60.pri3
-rw-r--r--plugins/multimedia/symbian/ecam/s60audioencodercontrol.cpp14
-rw-r--r--plugins/multimedia/symbian/ecam/s60cameraconstants.h18
-rw-r--r--plugins/multimedia/symbian/ecam/s60cameracontrol.cpp181
-rw-r--r--plugins/multimedia/symbian/ecam/s60cameracontrol.h1
-rw-r--r--plugins/multimedia/symbian/ecam/s60cameraengine.cpp33
-rw-r--r--plugins/multimedia/symbian/ecam/s60cameraengineobserver.h1
-rw-r--r--plugins/multimedia/symbian/ecam/s60cameraexposurecontrol.cpp22
-rw-r--r--plugins/multimedia/symbian/ecam/s60cameraflashcontrol.cpp3
-rw-r--r--plugins/multimedia/symbian/ecam/s60camerafocuscontrol.cpp10
-rw-r--r--plugins/multimedia/symbian/ecam/s60cameraimagecapturecontrol.cpp3
-rw-r--r--plugins/multimedia/symbian/ecam/s60cameraservice.cpp1
-rw-r--r--plugins/multimedia/symbian/ecam/s60camerasettings.cpp13
-rw-r--r--plugins/multimedia/symbian/ecam/s60cameraviewfinderengine.cpp113
-rw-r--r--plugins/multimedia/symbian/ecam/s60cameraviewfinderengine.h5
-rw-r--r--plugins/multimedia/symbian/ecam/s60imagecapturesession.cpp100
-rw-r--r--plugins/multimedia/symbian/ecam/s60imagecapturesession.h5
-rw-r--r--plugins/multimedia/symbian/ecam/s60imageencodercontrol.cpp10
-rw-r--r--plugins/multimedia/symbian/ecam/s60mediarecordercontrol.cpp5
-rw-r--r--plugins/multimedia/symbian/ecam/s60videocapturesession.cpp1199
-rw-r--r--plugins/multimedia/symbian/ecam/s60videocapturesession.h34
-rw-r--r--plugins/multimedia/symbian/ecam/s60videoencodercontrol.cpp51
-rw-r--r--plugins/multimedia/symbian/ecam/s60videowidgetcontrol.cpp4
-rw-r--r--plugins/multimedia/symbian/mmf/mediaplayer/mediaplayer_s60.pri9
-rw-r--r--plugins/multimedia/symbian/mmf/mediaplayer/s60audioplayersession.cpp29
-rw-r--r--plugins/multimedia/symbian/mmf/mediaplayer/s60audioplayersession.h1
-rw-r--r--plugins/multimedia/symbian/mmf/mediaplayer/s60mediaplayercontrol.cpp17
-rw-r--r--plugins/multimedia/symbian/mmf/mediaplayer/s60mediaplayercontrol.h2
-rw-r--r--plugins/multimedia/symbian/mmf/mediaplayer/s60mediaplayersession.cpp6
-rw-r--r--plugins/multimedia/symbian/mmf/mediaplayer/s60mediaplayersession.h1
-rw-r--r--plugins/multimedia/symbian/mmf/mediaplayer/s60videoplayersession.cpp23
-rw-r--r--plugins/multimedia/symbian/mmf/mediaplayer/s60videoplayersession.h2
-rw-r--r--plugins/multimedia/symbian/mmf/radio/s60radiotunercontrol_since32.cpp3
-rw-r--r--plugins/organizer/maemo5/maemo5.pro4
-rw-r--r--plugins/organizer/maemo5/qorganizerasynchprocess.cpp410
-rw-r--r--plugins/organizer/maemo5/qorganizerasynchprocess.h135
-rw-r--r--plugins/organizer/maemo5/qorganizermaemo5.cpp12
-rw-r--r--plugins/organizer/maemo5/qorganizermaemo5_p.h4
-rw-r--r--plugins/organizer/maemo5/qorganizermaemo5ids_p.h4
-rw-r--r--plugins/organizer/mkcal/qorganizerasynchmanager.cpp2
-rw-r--r--plugins/sensors/simulator/simulator.pro2
-rw-r--r--qtmobility.pro2
-rw-r--r--src/contacts/qcontactmanager.cpp3
-rw-r--r--src/gallery/qgalleryfilter.cpp4
-rw-r--r--src/global/qmobilitypluginsearch.h17
-rw-r--r--src/location/landmarks/qlandmark.h2
-rw-r--r--src/location/landmarks/qlandmarkabstractrequest.cpp7
-rw-r--r--src/location/landmarks/qlandmarkcategory.h2
-rw-r--r--src/location/landmarks/qlandmarkcategoryfetchrequest.cpp4
-rw-r--r--src/location/landmarks/qlandmarkcategoryid.h2
-rw-r--r--src/location/landmarks/qlandmarkcategoryidfetchrequest.cpp4
-rw-r--r--src/location/landmarks/qlandmarkfetchrequest.cpp4
-rw-r--r--src/location/landmarks/qlandmarkfilter.cpp2
-rw-r--r--src/location/landmarks/qlandmarkid.h2
-rw-r--r--src/location/landmarks/qlandmarkidfetchrequest.cpp4
-rw-r--r--src/location/landmarks/qlandmarkmanager_p.cpp1
-rw-r--r--src/location/landmarks/qlandmarkmanagerengine.cpp2
-rw-r--r--src/location/maps/qgeomapdata.cpp6
-rw-r--r--src/location/maps/tiled/qgeotiledmapcircleobjectinfo_p.cpp4
-rw-r--r--src/location/maps/tiled/qgeotiledmapobjectinfo_p.cpp2
-rw-r--r--src/location/maps/tiled/qgeotiledmappixmapobjectinfo_p.cpp8
-rw-r--r--src/location/maps/tiled/qgeotiledmappolygonobjectinfo_p.cpp6
-rw-r--r--src/location/maps/tiled/qgeotiledmappolylineobjectinfo_p.cpp6
-rw-r--r--src/location/maps/tiled/qgeotiledmaprectangleobjectinfo_p.cpp4
-rw-r--r--src/location/maps/tiled/qgeotiledmaprouteobjectinfo_p.cpp12
-rw-r--r--src/location/maps/tiled/qgeotiledmaptextobjectinfo_p.cpp16
-rw-r--r--src/location/qgeoaddress.cpp6
-rw-r--r--src/messaging/modestengine_maemo.cpp155
-rw-r--r--src/multimedia/audio/audio.pri5
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo.cpp5
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp138
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo_win32_p.h1
-rw-r--r--src/multimedia/audio/qaudioinput_win32_p.cpp21
-rw-r--r--src/multimedia/audio/qaudiooutput_alsa_p.cpp14
-rw-r--r--src/multimedia/audio/qaudiooutput_symbian_p.cpp9
-rw-r--r--src/multimedia/audio/qaudiooutput_win32_p.cpp23
-rw-r--r--src/multimedia/effects/qsoundeffect.cpp2
-rw-r--r--src/multimedia/effects/qwavedecoder_p.cpp145
-rw-r--r--src/multimedia/effects/qwavedecoder_p.h21
-rw-r--r--src/multimedia/qcamera.cpp10
-rw-r--r--src/multimedia/qcamerafocus.cpp1
-rw-r--r--src/multimedia/qgraphicsvideoitem_overlay.cpp1
-rw-r--r--src/multimedia/qmediaplayer.cpp22
-rw-r--r--src/multimedia/qmediastreamscontrol.cpp3
-rw-r--r--src/organizer/engines/qorganizeritemmemorybackend.cpp20
-rw-r--r--src/serviceframework/ipc/objectendpoint.cpp49
-rw-r--r--src/serviceframework/ipc/proxyobject.cpp18
-rw-r--r--src/serviceframework/ipc/qremoteserviceregister_s60.cpp19
-rw-r--r--src/serviceframework/ipc/qremoteserviceregister_s60_p.h2
-rw-r--r--src/serviceframework/qremoteserviceregister.cpp2
-rw-r--r--src/serviceframework/serviceframework.pro5
-rw-r--r--src/systeminfo/qsysteminfo_maemo.cpp6
-rw-r--r--src/systeminfo/qsysteminfo_s60.cpp43
-rw-r--r--src/systeminfo/qsysteminfo_s60_p.h1
-rw-r--r--src/versitorganizer/qversitorganizerexporter_p.cpp51
-rw-r--r--src/versitorganizer/qversitorganizerimporter_p.cpp59
-rw-r--r--src/versitorganizer/qversitorganizerimporter_p.h2
-rw-r--r--tests/auto/databasemanager/databasemanager.pro3
-rw-r--r--tests/auto/qabstractsecuritysession/qabstractsecuritysession.pro3
-rw-r--r--tests/auto/qcamera/tst_qcamera.cpp1
-rw-r--r--tests/auto/qcontactdetails/tst_qcontactdetails.cpp200
-rw-r--r--tests/auto/qcontactmanager/tst_qcontactmanager.cpp8
-rw-r--r--tests/auto/qgalleryfilter/tst_qgalleryfilter.cpp26
-rw-r--r--tests/auto/qlandmarkfilehandler_gpx/qlandmarkfilehandler_gpx.pro10
-rw-r--r--tests/auto/qlandmarkfilehandler_gpx/tst_qlandmarkfilehandler_gpx.cpp59
-rw-r--r--tests/auto/qlandmarkfilehandler_lmx/qlandmarkfilehandler_lmx.pro10
-rw-r--r--tests/auto/qlandmarkfilehandler_lmx/tst_qlandmarkfilehandler_lmx.cpp69
-rw-r--r--tests/auto/qlandmarkmanager/data/AUS-PublicToilet-AustralianCapitalTerritory.gpx2
-rw-r--r--tests/auto/qlandmarkmanager/data/malformed.kmz180
-rw-r--r--tests/auto/qlandmarkmanager/data/test.kmz180
-rwxr-xr-x[-rw-r--r--]tests/auto/qlandmarkmanager/tst_qlandmarkmanager.cpp914
-rw-r--r--tests/auto/qlandmarkmanagerdataholder.h130
-rw-r--r--tests/auto/qmediaplayer/tst_qmediaplayer.cpp32
-rwxr-xr-xtests/auto/qmediaplayer/tst_qmediaplayer.h1
-rw-r--r--tests/auto/qorganizercollection/tst_qorganizercollection.cpp131
-rw-r--r--tests/auto/qorganizeritem/tst_qorganizeritem.cpp132
-rw-r--r--tests/auto/qorganizeritemasync/unittest/tst_qorganizeritemasync.cpp13
-rw-r--r--tests/auto/qorganizeritemdetaildefinition/tst_qorganizeritemdetaildefinition.cpp98
-rw-r--r--tests/auto/qorganizermanager/tst_qorganizermanager.cpp18
-rw-r--r--tests/auto/qservicemanager/qservicemanager.pro3
-rw-r--r--tests/auto/qsoundeffect/qsoundeffect.pro6
-rw-r--r--tests/auto/qsoundeffect/tst_qsoundeffect.cpp28
-rw-r--r--tests/auto/qversitorganizerexporter/tst_qversitorganizerexporter.cpp40
-rw-r--r--tests/auto/qversitorganizerimporter/tst_qversitorganizerimporter.cpp48
-rw-r--r--tests/qmlauto/README8
-rw-r--r--tests/qmlauto/organizer/organizer.pro5
-rw-r--r--tests/qmlauto/organizer/testcases/addEvent.qml86
-rw-r--r--tests/qmlauto/organizer/testcases/tst_detailfilter.qml (renamed from plugins/landmarks/qsparql/databasefilewatcher.cpp)52
-rw-r--r--tests/qmlauto/organizer/testcases/tst_organizeritems.qml185
-rw-r--r--tests/qmlauto/organizer/testcases/tst_organizermodel.qml399
-rw-r--r--tests/qmlauto/organizer/tst_qmlorganizer.cpp43
-rw-r--r--tests/qmlauto/qmlauto.pri17
-rw-r--r--tests/qmlauto/qmlauto.pro7
242 files changed, 8430 insertions, 3749 deletions
diff --git a/INSTALL.symbian b/INSTALL.symbian
new file mode 100644
index 0000000000..0894d0e490
--- /dev/null
+++ b/INSTALL.symbian
@@ -0,0 +1,80 @@
+Installation steps of Qt Mobility for Symbian (for S60 3.1, 3.2 & 5.0 and Symbian SDKs)
+---------------------------------------------------------------------------------------
+
+The Mobility project information can be found at http://qt.nokia.com/developer/new-qt-apis
+
+Prerequisites
+-------------
+- install latest official Qt 4.7 for Symbian (first you need to have Symbian SDK(s) in place)
+ - Instructions available in Qt documentation: http://doc.qt.nokia.com/4.7-snapshot/install-symbian.html
+
+- ensure your PATH environment variable includes Qt 4.7 for Symbian SDKs bin folder. It's recommended to have it in the beginning of the PATH as the first make command that is found is used.
+
+QtMobility release information
+------------------------------
+Published QtMobility releases are tested with following Qt releases
+QtMobility 1.0.2 Qt 4.6.3
+QtMobility 1.1.0 Qt 4.7.0
+QtMobility 1.1.1 Qt 4.7.1
+
+Installing Qt Mobility for Symbian (for S60 3.1, 3.2 & 5.0 and Symbian SDKs)
+----------------------------------------------------------------------------
+
+- Once you have downloaded the Qt Mobility Symbian package, unzip the package
+
+The Symbian package is identical to the source package, with the following additions:
+
+ INSTALL.symbian
+ qt-mobility-symbian-x.y.z-epoc32-3.1.zip
+ qt-mobility-symbian-x.y.z-epoc32-3.2.zip
+ qt-mobility-symbian-x.y.z-epoc32-5.0.zip
+ qt-mobility-symbian-x.y.z-epoc32-symbian.zip
+ qt-mobility-symbian-x.y.z-s60.sis
+ qt-mobility-symbian-x.y.z-symbian3.sis
+
+ Where x.y.z is the version of the QtMobility release.
+
+- Installing the mobility libraries to your Symbian SDK happens by extracting the
+'qt-mobility-x.y.z-epoc32-<SYMBIAN_SDK>.zip' file to your Symbian SDK.
+ - First copy the zip file to your Symbian SDK next to \epoc32 folder, f.ex to C:\Symbian\9.4\S60_5th_Edition_SDK_v1.0_2
+ - extract the file
+ - Note that you need to repeat this step for all the Symbian SDKs you want to develop with Mobility APIs.
+
+- Enabling Mobility APIs to your device (Symbian 3rd Edition FP1 or newer, in case unsure see http://www.forum.nokia.com/devices/) :
+ - Prerequisite : Qt 4.7 for Symbian is installed. For Symbian Qt 4.7 installation package see: http://labs.qt.nokia.com/2010/10/18/qt-4-7-for-symbian3-developer-version-available/
+ - install the 'qt-mobility-symbian-x.y.z-s60.sis' or 'qt-mobility-symbian-x.y.z-symbian.sis' file to device. You can do this, for example, via bluetooth or through Nokia Ovi Suite (recommended)
+
+- Copy the <QTMOBILITYDIR>/features/mobility.prf.template file to QTDIR/mkspecs/features/mobility.prf
+ - The relevant Qt directory can be obtained by running 'qmake -v' within the build environment.
+
+
+The above steps create a working environment for new projects wanting to use the QtMobility libraries.
+
+Examples:
+
+- build an example with your device connected to Ovi suite, go to examples
+
+* cd examples
+* qmake [example].pro
+* make release-gcce
+* createpackage -i [example]_template.pkg release-gcce <certificate> <private key>
+
+The createpackage command creates a self signed symbian installer package. The -i parameter in createpackage command installs the example to your device connected to Nokia Ovi Suite.
+
+How to sign the packages that can be selfsigned? Easy, use createpackage as demonstrated in the installation instructions.
+What about the ones that require heavier signing? See http://www.forum.nokia.com/testing or http://developer.symbian.org/wiki/index.php/Complete_Guide_To_Symbian_Signed
+
+
+Followup and support for QtMobility
+-----------------------------------
+If you have questions about the examples, about using the APIs or want to provide us input you can do it via the following channels:
+
+The Mobility project information can be found at http://qt.nokia.com/developer/new-qt-apis
+
+QtMobility blogs can be found from: http://labs.qt.nokia.com/category/qtmobility/
+
+QtMobility mailing list: http://lists.trolltech.com/mailman/listinfo/qt-mobility-feedback.
+Qt Mobility discussion forum in http://discussion.forum.nokia.com/forum/forumdisplay.php?f=232
+
+
+Stay tuned for more exciting news on the mobility front! \ No newline at end of file
diff --git a/config.tests/chwrmhaptics/chwrmhaptics.pro b/config.tests/chwrmhaptics/chwrmhaptics.pro
new file mode 100644
index 0000000000..f97d02a45a
--- /dev/null
+++ b/config.tests/chwrmhaptics/chwrmhaptics.pro
@@ -0,0 +1,14 @@
+###############################################################################
+# Simple compilation test for the presence of CHWRMHaptics class
+###############################################################################
+
+CONFIG -= qt
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+
+SOURCES += main.cpp
+INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
+LIBS += -lhwrmhapticsclient
+
diff --git a/plugins/landmarks/qsparql/databasefilewatcher_p.h b/config.tests/chwrmhaptics/main.cpp
index 337a5b0f57..4248a3075c 100644
--- a/plugins/landmarks/qsparql/databasefilewatcher_p.h
+++ b/config.tests/chwrmhaptics/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -39,43 +39,11 @@
**
****************************************************************************/
+#include <hwrmhaptics.h>
+#include <hwrmlogicalactuators.h>
-#ifndef DATABASEWATCHER_P_H
-#define DATABASEwATCHER_P_H
-
-#include <QObject>
-
-#include <QStringList>
-#include <QString>
-#include <QFileSystemWatcher>
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-class DatabaseFileWatcher : public QObject
+int main(int, char**)
{
- Q_OBJECT
-public:
- DatabaseFileWatcher(const QString &databaseWatcherPath, QObject *parent = 0);
- void setEnabled(bool enabled);
-
-signals:
- void notifyChange();
-
-private slots:
- void databaseChanged(const QString &path);
-
-private:
- QFileSystemWatcher *m_watcher;
- QString m_databaseWatcherPath;
-};
-
-#endif
+ CHWRMHaptics *haptics = CHWRMHaptics::NewL( NULL, NULL );
+ return 0;
+}
diff --git a/config.tests/maemo6-landmarks/maemo6-landmarks.pro b/config.tests/maemo6-landmarks/maemo6-landmarks.pro
index ee6e1ba8a5..7b607336d7 100644
--- a/config.tests/maemo6-landmarks/maemo6-landmarks.pro
+++ b/config.tests/maemo6-landmarks/maemo6-landmarks.pro
@@ -3,10 +3,9 @@ TARGET =
DEPENDPATH += .
INCLUDEPATH += .
-LIBS += -lQtSparql
-
# Input
SOURCES += main.cpp
+QT+=core
-# CONFIG += link_pkgconfig
-# PKGCONFIG +=
+CONFIG += link_pkgconfig
+PKGCONFIG += QtSparql QtSparqlTrackerExtensions
diff --git a/config.tests/maemo6-landmarks/main.cpp b/config.tests/maemo6-landmarks/main.cpp
index db757cb21d..948d540536 100644
--- a/config.tests/maemo6-landmarks/main.cpp
+++ b/config.tests/maemo6-landmarks/main.cpp
@@ -39,6 +39,9 @@
**
****************************************************************************/
+#include <QtSparql/QSparqlConnection>
+#include <QtSparqlTrackerExtensions/TrackerChangeNotifier>
+
int main(int, char**)
{
return 0;
diff --git a/config.tests/qmf/qmf.pro b/config.tests/qmf/qmf.pro
index ebff326f6b..38d5fe1793 100644
--- a/config.tests/qmf/qmf.pro
+++ b/config.tests/qmf/qmf.pro
@@ -2,6 +2,9 @@ TEMPLATE = app
TARGET =
DEPENDPATH += .
+CONFIG += link_pkgconfig
+PKGCONFIG += qmfclient
+
macx:CONFIG-=app_bundle
QMF_INCLUDEDIR = $$(QMF_INCLUDEDIR)
diff --git a/configure.bat b/configure.bat
index 51d9a7eff2..8e03e0206f 100644
--- a/configure.bat
+++ b/configure.bat
@@ -572,6 +572,7 @@ call :compileTest Symbian_CamAutoFocus_31 symbian_camera_camautofocus
call :compileTest Symbian_ECamAdvancedSettings_Post31 symbian_camera_ecamadvsettings
call :compileTest Symbian_DevVideoRecord symbian_camera_devvideorecord
call :compileTest AdvancedTouchFeedback advancedtouchfeedback
+call :compileTest CHWRMHaptics chwrmhaptics
call :compileTest MDS mds
call :compileTest MDS_25 mds_25
call :compileTest MDS_25_92MCL mds_25_92mcl
diff --git a/doc/src/bearermanagement.qdoc b/doc/src/bearermanagement.qdoc
index 0e29db3042..71bc97b83f 100644
--- a/doc/src/bearermanagement.qdoc
+++ b/doc/src/bearermanagement.qdoc
@@ -70,8 +70,9 @@ enables to user to create, edit or delete network configurations.
The Bearer API has been migrated to the Qt 4.7 QtNetwork library. This enables
connection manager and roaming support for \l QNetworkAccessManager.
-Starting with Qt 4.7 the QtMobility version has been deprecated in favor of
-Qt's Bearer API. Furthermore the roaming enabled QNetworkAccessManager cannot be used in connection with QtMobility's Bearer API.
+Starting with Qt 4.7 the Mobility version has been deprecated in favor of
+Qt's Bearer API. Some platforms such as MeeGo are not even supported by the Mobility version.
+Last but not least the roaming enabled QNetworkAccessManager cannot be used in connection with Mobility's Bearer API.
The porting effort from QtMobility Bearer to Qt Bearer is minimal as
the relevant classes are source compatible. The only exception is the
diff --git a/doc/src/contacts.qdoc b/doc/src/contacts.qdoc
index 592580b63f..834ab3383b 100644
--- a/doc/src/contacts.qdoc
+++ b/doc/src/contacts.qdoc
@@ -390,3 +390,4 @@ See also: \l{Contacts API Usage}
For details on the QML support provided for the Contacts API see the documentation for the \l {Contacts QML Plugin}.
*/
+
diff --git a/doc/src/feedback.qdoc b/doc/src/feedback.qdoc
index 2fadf88ba6..f87853087c 100644
--- a/doc/src/feedback.qdoc
+++ b/doc/src/feedback.qdoc
@@ -176,3 +176,4 @@ For details on the QML support provided for the Feedback API see the documentati
*/
+
diff --git a/doc/src/index.qdoc b/doc/src/index.qdoc
index 2d90dfe500..a8dda6bd99 100644
--- a/doc/src/index.qdoc
+++ b/doc/src/index.qdoc
@@ -89,7 +89,9 @@
The QtMobility project APIs are placed into the \i{QtMobility} namespace, with
the important exception of Multimedia. This is done to facilitate the
- future migration of QtMobility APIs into Qt.
+ future migration of Mobility APIs into Qt.
+
+ \section2 Quickstart Guide
See the \l {Quickstart Example}{Quickstart guide} for an example on how
the namespace impacts on application development.
diff --git a/doc/src/installation.qdoc b/doc/src/installation.qdoc
index 79f38164a3..27a62fdf43 100644
--- a/doc/src/installation.qdoc
+++ b/doc/src/installation.qdoc
@@ -75,10 +75,10 @@ these domains have dependencies and these are outlined below:
{S60 Location Services} is probably the best source for LBT availability updates, as it
will be updated when the library is released.
- For landmark functionality on *nix platforms, QtLocation depends on QtSql. QtSql also needs the SQLite 3 driver (enabled by default) at runtime.
+ The landmarks backend for *nix,Windows and Fremantle platforms depends on QtSql. QtSql also needs the SQLite 3 driver (enabled by default in qt) at runtime.
-For landmark functionality on Harmattan, QtLocation depends on QtSparql, \l {http://project.gnome.org/Tracker}{Tracker}
- and tracker driver for QtSparql.
+ The landmarks backend on the harmattan platform depends on QtSparql and QtSparql Tracker Extensions. There is also a runtime dependency
+ for \l {http://project.gnome.org/Tracker}{Tracker} 0.9.30 or greater, and on libqtsparql-tracker which is the Tracker driver for QtSparql.
\row
\o Messaging
\o On Linux, QtMessaging depends on qtopiamail from \l {http://labs.trolltech.com/blogs/category/qtmessaging}{QMF}.
diff --git a/doc/src/location.qdoc b/doc/src/location.qdoc
index 8c60956268..d435cbf679 100644
--- a/doc/src/location.qdoc
+++ b/doc/src/location.qdoc
@@ -558,3 +558,5 @@ For details on the QML support provided for the Location API see the documentati
\note At the time of the QtMobility 1.1.0 release the QML support for the Maps and Navigation API was incomplete and likely to be refined and improved in the next patch release.
*/
+
+
diff --git a/doc/src/multimedia.qdoc b/doc/src/multimedia.qdoc
index 3a75cdb311..7cc3a08976 100644
--- a/doc/src/multimedia.qdoc
+++ b/doc/src/multimedia.qdoc
@@ -413,7 +413,7 @@ QVideoWidget classes.
\annotatedlist multimedia-serv
-\section2 QML Multimedia Elements
+\section2 QML Elements
\list
\o \l {SoundEffect}{SoundEffect: Low Latency Sound Effects}
\o \l {Audio}{Audio: Music playback}
diff --git a/doc/src/plugins/qml-gallery.qdoc b/doc/src/plugins/qml-gallery.qdoc
index 76ea8c42d6..7cc6d10df7 100644
--- a/doc/src/plugins/qml-gallery.qdoc
+++ b/doc/src/plugins/qml-gallery.qdoc
@@ -98,11 +98,9 @@
...
- model: DocumentGalleryQueryModel {
- gallery: DocumentGallery {}
-
- itemType: "Image"
- properties: ["thumbnailImage"]
+ model: DocumentGalleryModel {
+ rootType: DocumentGallery.Image
+ properties: ["url"]
filter: GalleryWildcardFilter {
property: "fileName";
value: "*.jpg";
diff --git a/doc/src/plugins/qml-organizer.qdoc b/doc/src/plugins/qml-organizer.qdoc
index 7f6b33706e..523196c42b 100644
--- a/doc/src/plugins/qml-organizer.qdoc
+++ b/doc/src/plugins/qml-organizer.qdoc
@@ -41,6 +41,8 @@
\section1 Overview
+ The identifying string for this component is \i {"QtMobility.organizer"}.
+ Use this in the QML \i {import} statement.
The Organizer API enables a client to request calendar, schedule and
personal data from local or remote backends. The QML Organizer Plugin
diff --git a/doc/src/sf.qdoc b/doc/src/sf.qdoc
index 1a2735caf8..b855e0fcd8 100644
--- a/doc/src/sf.qdoc
+++ b/doc/src/sf.qdoc
@@ -712,6 +712,7 @@ the client application.
\section1 QML Elements
+
The Qt Service Framework offers discovery and selection of services through declarative
UI by providing service and service list elements. Detailed information can be found
at \l{QML Service Framework Plugin}.
diff --git a/doc/src/si.qdoc b/doc/src/si.qdoc
index 865038c9f9..448913de1c 100644
--- a/doc/src/si.qdoc
+++ b/doc/src/si.qdoc
@@ -123,6 +123,7 @@ The backend selection is expected to disappear once the API is integrated into Q
\section1 QML Elements
+
The Qt SystemInfo offers access to system information through declarative
UI by providing systeminfo elements. Detailed information can be found
at \l{QML System Information Plugin}.
diff --git a/examples/calendardemo/src/calendardemo.cpp b/examples/calendardemo/src/calendardemo.cpp
index 1b82bbb42b..d68a3d55d2 100644
--- a/examples/calendardemo/src/calendardemo.cpp
+++ b/examples/calendardemo/src/calendardemo.cpp
@@ -55,6 +55,7 @@
#include "qversitorganizerexporter.h"
#endif
#include <QtGui>
+#include <QDesktopServices>
#include <qtorganizer.h>
QTM_USE_NAMESPACE
@@ -349,8 +350,13 @@ void CalendarDemo::importItems()
qWarning() << "No manager selected; cannot import";
return;
}
+ QString docPath = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
+ if (docPath.isEmpty())
+ docPath = QDesktopServices::storageLocation(QDesktopServices::HomeLocation);
+ if (docPath.isEmpty())
+ docPath = ".";
QString fileName = QFileDialog::getOpenFileName(this,
- tr("Select iCalendar file"), ".", tr("iCalendar files (*.ics)"));
+ tr("Select iCalendar file"), docPath, tr("iCalendar files (*.ics)"));
QFile file(fileName);
file.open(QIODevice::ReadOnly);
if (!file.isReadable()) {
@@ -388,8 +394,14 @@ void CalendarDemo::exportItems()
qWarning() << "No manager selected; cannot export";
return;
}
+ QString docPath = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
+ if (docPath.isEmpty())
+ docPath = QDesktopServices::storageLocation(QDesktopServices::HomeLocation);
+ if (docPath.isEmpty())
+ docPath = ".";
+ docPath.append("/calendar.ics");
QString fileName = QFileDialog::getSaveFileName(this, tr("Save iCalendar"),
- "./calendar.ics",
+ docPath,
tr("iCalendar files (*.ics)"));
QFile file(fileName);
file.open(QIODevice::WriteOnly);
diff --git a/examples/hapticsquare/hapticsquare.cpp b/examples/hapticsquare/hapticsquare.cpp
index 40ac3ebc1f..4521d80552 100644
--- a/examples/hapticsquare/hapticsquare.cpp
+++ b/examples/hapticsquare/hapticsquare.cpp
@@ -50,7 +50,7 @@ HapticSquare::HapticSquare()
m_rumble.setAttackIntensity(0.1);
m_rumble.setAttackTime(250);
m_rumble.setIntensity(1.0);
- m_rumble.setDuration(100);
+ m_rumble.setDuration(1000);
m_rumble.setFadeTime(250);
m_rumble.setFadeIntensity(0.1);
//! [0]
diff --git a/examples/landmarkbrowser/landmarkbrowser.cpp b/examples/landmarkbrowser/landmarkbrowser.cpp
index ccf413a416..34df30d86b 100644
--- a/examples/landmarkbrowser/landmarkbrowser.cpp
+++ b/examples/landmarkbrowser/landmarkbrowser.cpp
@@ -50,6 +50,7 @@
#include <QProgressBar>
#include <QDebug>
#include <QTimer>
+#include <QDesktopServices>
#include "landmarkbrowser.h"
#include "landmarkadddialog.cpp"
@@ -185,12 +186,12 @@ void LandmarkBrowser::on_importLandmarks_clicked()
fileFilterString = tr("Landmark files (*.gpx *.lmx *)");
#endif
- QString fileName;
-#if defined(Q_WS_MAEMO_6) || defined (Q_WS_MAEMO_5)
- fileName = QFileDialog::getOpenFileName(this,tr("Import File"),"/home/user",fileFilterString);
-#else
- fileName = QFileDialog::getOpenFileName(this,tr("Import File"), ".",fileFilterString);
-#endif
+ QString docPath = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
+ if (docPath.isEmpty())
+ docPath = QDesktopServices::storageLocation(QDesktopServices::HomeLocation);
+ if (docPath.isEmpty())
+ docPath = ".";
+ QString fileName = QFileDialog::getOpenFileName(this,tr("Import File"),docPath,fileFilterString);
if (!fileName.isEmpty()) {
landmarkImport->setFileName(fileName);
landmarkImport->start();
@@ -208,12 +209,12 @@ void LandmarkBrowser::on_exportLandmarks_clicked()
fileFilterString = tr("Landmark files (*.gpx *.lmx *)");
#endif
- QString fileName;
-#if defined(Q_WS_MAEMO_6) || defined (Q_WS_MAEMO_5)
- fileName = QFileDialog::getSaveFileName(this,tr("Export File"),"/home/user",fileFilterString);
-#else
- fileName = QFileDialog::getSaveFileName(this,tr("Export File"),".",fileFilterString);
-#endif
+ QString docPath = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
+ if (docPath.isEmpty())
+ docPath = QDesktopServices::storageLocation(QDesktopServices::HomeLocation);
+ if (docPath.isEmpty())
+ docPath = ".";
+ QString fileName = QFileDialog::getSaveFileName(this,tr("Export File"),docPath,fileFilterString);
if (!fileName.isEmpty()) {
landmarkExport->setFileName(fileName);
diff --git a/examples/qmlorganizer/contents/DayView.qml b/examples/qmlorganizer/contents/DayView.qml
index 96aaff8287..806770f5e8 100644
--- a/examples/qmlorganizer/contents/DayView.qml
+++ b/examples/qmlorganizer/contents/DayView.qml
@@ -45,7 +45,7 @@ import QtMobility.organizer 1.1
Rectangle
{
id:dayView
- property variant itemIds:calendar.organizer.itemIds(calendar.day)
+ property variant itemIds:calendar.organizer.itemIds(calendar.currentDate, new Date(calendar.year, calendar.month, calendar.day+1))
anchors.fill: parent
@@ -76,7 +76,6 @@ Rectangle
ListElement {hour : "21:00"}
ListElement {hour : "22:00"}
ListElement {hour : "23:00"}
- ListElement {hour : "0:00"}
}
Rectangle {
@@ -111,12 +110,7 @@ Rectangle
opacity : dayView.opacity * 0.8
itemId: modelData
-// Component.onCompleted: {
-// console.log ("startTime:" + startTime);
-// console.log ("endTime:" + endTime);
-// console.log ("height:" + height);
-// console.log ("anchors.top:" + timePos);
-// }
+
}
}
}
diff --git a/examples/qmlorganizer/contents/MenuBar.qml b/examples/qmlorganizer/contents/MenuBar.qml
index 5b469a827f..e18eadd7e5 100644
--- a/examples/qmlorganizer/contents/MenuBar.qml
+++ b/examples/qmlorganizer/contents/MenuBar.qml
@@ -63,7 +63,7 @@ Rectangle {
onClicked: Qt.quit()
}
}
- Button {id: todayButton; text: "Today";onClicked:calendar.day = new Date();}
+ Button {id: todayButton; text: "Today";onClicked:calendar.currentDate = new Date();}
Button { id: monthButton; text: "Month"; onClicked: calendar.state="MonthView";}
Button { id: weekButton; text: "Week";onClicked: calendar.state="WeekView";}
Button { id: dayButton; text: "Day";onClicked: calendar.state="DayView";}
diff --git a/examples/qmlorganizer/contents/MonthView.qml b/examples/qmlorganizer/contents/MonthView.qml
index 1b99dcde33..f72add57dc 100644
--- a/examples/qmlorganizer/contents/MonthView.qml
+++ b/examples/qmlorganizer/contents/MonthView.qml
@@ -44,11 +44,10 @@ import QtMobility.organizer 1.1
Rectangle {
id:monthView
- property int month: calendar.day.getMonth()
- property int year: calendar.day.getFullYear()
+ property int month
+ property int year
property date startDay:new Date(year, month, 1)
property int startWeekday:startDay.getDay()
-
anchors.fill: parent
Grid {
@@ -86,7 +85,7 @@ Rectangle {
color: {
if (Month.isToday(startDay, index - startWeekday +1))
return "lightsteelblue";
- else if (calendar.organizer.containsItems(Month.dateOfThisDay(startDay, index - startWeekday +1)))
+ else if (calendar.organizer.containsItems(Month.dateOfThisDay(startDay, index - startWeekday +1), Month.dateOfThisDay(startDay, index - startWeekday +2)))
return "yellow";
else
return Month.getColorOfDay(startDay, index - startWeekday +1);
@@ -115,7 +114,7 @@ Rectangle {
dayContainer.radius = 0;
}
onClicked: {
- calendar.day = new Date(calendar.day.getFullYear(), calendar.day.getMonth(), index - startWeekday +1);
+ calendar.currentDate = new Date(calendar.year, calendar.month, index - startWeekday +1);
calendar.state = "DayView";
}
}
diff --git a/examples/qmlorganizer/contents/TimelineView.qml b/examples/qmlorganizer/contents/TimelineView.qml
index d8a744ab22..db1cff6c33 100644
--- a/examples/qmlorganizer/contents/TimelineView.qml
+++ b/examples/qmlorganizer/contents/TimelineView.qml
@@ -46,20 +46,18 @@ Rectangle {
id : timelineView
anchors.fill : parent
opacity : parent.opacity
- property int year
- property int month
- property int day
+ property int year:calendar.year
+ property int month:calendar.month
+ property int day:calendar.day
Connections {
target: calendar
- onDayChanged : {
- year = calendar.day.getFullYear();
- month = calendar.day.getMonth();
- day = calendar.day.getDate();
+ onCurrentDateChanged : {
dayList.currentIndex = day - 1;
monthList.currentIndex = month;
yearList.currentIndex = year - yearModel.start;
}
}
+
//Day view
Rectangle {
id: dayView
@@ -97,11 +95,11 @@ Rectangle {
keyNavigationWraps : true
onCurrentIndexChanged : {
- calendar.day = new Date(calendar.day.getFullYear(), calendar.day.getMonth(), currentIndex + 1);
- timelineView.month = calendar.day.getMonth();
- timelineView.day = calendar.day.getDate();
- monthList.currentIndex = timelineView.month;
- currentIndex = timelineView.day - 1;
+ if (timelineView.opacity > 0) {
+ calendar.currentDate = new Date(timelineView.year, timelineView.month, currentIndex + 1);
+ monthList.currentIndex = timelineView.month;
+ currentIndex = timelineView.day - 1;
+ }
}
}
@@ -131,9 +129,8 @@ Rectangle {
}
Repeater {
focus: true
- model:calendar.organizer.itemIds(new Date(calendar.day.getFullYear(),
- calendar.day.getMonth(),
- index + 1))
+ model:calendar.organizer.itemIds(new Date(timelineView.year,timelineView.month, index + 1),
+ new Date(timelineView.year,timelineView.month, index + 2))
Text {
clip: true
@@ -222,11 +219,11 @@ Rectangle {
var d = Date.parse("Feb 31, 2010");
}
onCurrentIndexChanged : {
- calendar.day = new Date(calendar.day.getFullYear(), currentIndex, calendar.day.getDate());
- timelineView.month = calendar.day.getMonth();
- timelineView.day = calendar.day.getDate();
- currentIndex = timelineView.month;
- dayList.currentIndex = timelineView.day - 1;
+ if (timelineView.opacity > 0) {
+ calendar.currentDate = new Date(timelineView.year, currentIndex, timelineView.day);
+ currentIndex = timelineView.month;
+ dayList.currentIndex = timelineView.day - 1;
+ }
}
}
@@ -333,12 +330,11 @@ Rectangle {
Component.onCompleted: Timeline.extendYearModel(true);
onCurrentIndexChanged: {
Timeline.extendYearModel(false);
- calendar.day = new Date(yearModel.start + currentIndex, calendar.day.getMonth(), calendar.day.getDate());
- timelineView.year = calendar.day.getFullYear();
- timelineView.month = calendar.day.getMonth();
- timelineView.day = calendar.day.getDate();
- monthList.currentIndex = timelineView.month;
- dayList.currentIndex = timelineView.day - 1;
+ if (timelineView.opacity > 0) {
+ calendar.currentDate = new Date(yearModel.start + currentIndex, timelineView.month, timelineView.day);
+ monthList.currentIndex = timelineView.month;
+ dayList.currentIndex = timelineView.day - 1;
+ }
}
ListModel {
diff --git a/examples/qmlorganizer/contents/WeekView.qml b/examples/qmlorganizer/contents/WeekView.qml
index cfc11ceaa1..a105a9175e 100644
--- a/examples/qmlorganizer/contents/WeekView.qml
+++ b/examples/qmlorganizer/contents/WeekView.qml
@@ -45,8 +45,6 @@ Rectangle
{
id:weekView
anchors.fill: parent
- property int day:calendar.day.getDay()
-
ListView {
id : dayList
anchors.fill: parent
@@ -60,10 +58,8 @@ Rectangle
keyNavigationWraps : true
Component.onCompleted : positionViewAtIndex(currentIndex, ListView.Beginning)
onOpacityChanged: {
- //when back to week view, select the current day.
- if (opacity != 0)
- currentIndex = calendar.day.getDay();
- }
+ currentIndex = calendar.weekDay;
+ }
model : ListModel {
ListElement {day : "Sunday"}
@@ -96,9 +92,12 @@ Rectangle
Repeater {
focus: true
- model:calendar.organizer.itemIds(new Date(calendar.day.getFullYear(),
- calendar.day.getMonth(),
- index - calendar.day.getDay() + calendar.day.getDate()))
+ model:calendar.organizer.itemIds(new Date(calendar.year,
+ calendar.month,
+ index - calendar.weekDay + calendar.day),
+ new Date(calendar.year,
+ calendar.month,
+ index - calendar.weekDay + calendar.day + 1))
Text {
clip: true
@@ -117,7 +116,7 @@ Rectangle
anchors.fill: parent
onClicked: {
dayList.currentIndex = index
- calendar.day = new Date(calendar.day.getFullYear(), calendar.day.getMonth(), calendar.day.getDate() + dayList.currentIndex - weekView.day);
+ calendar.currentDate = new Date(calendar.year, calendar.month, calendar.day + dayList.currentIndex - calendar.weekDay);
calendar.state = "DayView"
}
}
diff --git a/examples/qmlorganizer/contents/test.ics b/examples/qmlorganizer/contents/test.ics
new file mode 100644
index 0000000000..5e04064b0d
--- /dev/null
+++ b/examples/qmlorganizer/contents/test.ics
@@ -0,0 +1,116 @@
+BEGIN:VCALENDAR
+PRODID:-//Google Inc//Google Calendar 70.9054//EN
+VERSION:2.0
+CALSCALE:GREGORIAN
+METHOD:PUBLISH
+X-WR-TIMEZONE:Australia/Brisbane
+BEGIN:VTIMEZONE
+TZID:Australia/Brisbane
+X-LIC-LOCATION:Australia/Brisbane
+BEGIN:STANDARD
+TZOFFSETFROM:+1000
+TZOFFSETTO:+1000
+TZNAME:EST
+DTSTART:19700101T000000
+END:STANDARD
+END:VTIMEZONE
+BEGIN:VEVENT
+DTSTART:20101208T220000Z
+DTEND:20101209T070000Z
+DTSTAMP:20101208T051153Z
+UID:2b0kl4063br3vsaeucrtcjbsjg@google.com
+CREATED:20101208T050327Z
+DESCRIPTION:starts 2010-12-09 8AM finishes 5PM
+LAST-MODIFIED:20101208T050327Z
+LOCATION:
+SEQUENCE:0
+STATUS:CONFIRMED
+SUMMARY:Event 2
+TRANSP:OPAQUE
+END:VEVENT
+BEGIN:VEVENT
+DTSTART:20101207T220000Z
+DTEND:20101208T030000Z
+DTSTAMP:20101208T051153Z
+UID:damefeu5f2nqh3gn4m5k8lb5uc@google.com
+CREATED:20101208T050202Z
+DESCRIPTION:starts 2010-12-08 8AM finishes 1PM
+LAST-MODIFIED:20101208T050202Z
+LOCATION:
+SEQUENCE:0
+STATUS:CONFIRMED
+SUMMARY:Event 1
+TRANSP:OPAQUE
+END:VEVENT
+BEGIN:VEVENT
+DTSTART:20101216T000000Z
+DTEND:20101216T060000Z
+DTSTAMP:20101208T051153Z
+UID:boml7lf8psqpm0162vqj950rhc@google.com
+CREATED:20101208T050550Z
+DESCRIPTION:starts after Event 3 and finishes 4PM
+LAST-MODIFIED:20101208T050550Z
+LOCATION:
+SEQUENCE:0
+STATUS:CONFIRMED
+SUMMARY:Event 4
+TRANSP:OPAQUE
+END:VEVENT
+BEGIN:VEVENT
+DTSTART:20101216T060000Z
+DTEND:20101216T070000Z
+DTSTAMP:20101208T051153Z
+UID:ev13id8q3hivd567snio7gcga4@google.com
+CREATED:20101208T050643Z
+DESCRIPTION:start after end of Event 4 finishing at 5PM
+LAST-MODIFIED:20101208T050643Z
+LOCATION:
+SEQUENCE:0
+STATUS:CONFIRMED
+SUMMARY:Event 5
+TRANSP:OPAQUE
+END:VEVENT
+BEGIN:VEVENT
+DTSTART:20101215T220000Z
+DTEND:20101216T000000Z
+DTSTAMP:20101208T051153Z
+UID:888gl35dsh59cp9pksj05c8ruc@google.com
+CREATED:20101208T050446Z
+DESCRIPTION:starts 2010-12-15 at 8AM finishes 10AM
+LAST-MODIFIED:20101208T051055Z
+LOCATION:
+SEQUENCE:0
+STATUS:CONFIRMED
+SUMMARY:Event 3
+TRANSP:OPAQUE
+END:VEVENT
+BEGIN:VEVENT
+DTSTART:20110108T010000Z
+DTEND:20110108T020000Z
+DTSTAMP:20101208T051153Z
+UID:uh7i70c6ir733bp2i1ccpmgeas@google.com
+CREATED:20101208T050752Z
+DESCRIPTION:start a month from 2010-12-08 at 11AM finish at 2PM
+LAST-MODIFIED:20101208T050752Z
+LOCATION:
+SEQUENCE:0
+STATUS:CONFIRMED
+SUMMARY:Event 6
+TRANSP:OPAQUE
+END:VEVENT
+BEGIN:VEVENT
+DTSTART;TZID=Australia/Brisbane:20101210T103000
+DTEND;TZID=Australia/Brisbane:20101210T113000
+RRULE:FREQ=WEEKLY;INTERVAL=4;BYDAY=FR
+DTSTAMP:20101208T051153Z
+UID:0oc9mbqeddtdag0406psh8ckic@google.com
+CREATED:20101208T050926Z
+DESCRIPTION:starts 2010-12-10 at 11AM finishing 1PM\, repeating for 4 weeks
+LAST-MODIFIED:20101208T050926Z
+LOCATION:
+SEQUENCE:0
+STATUS:CONFIRMED
+SUMMARY:Event 7
+TRANSP:OPAQUE
+END:VEVENT
+END:VCALENDAR
diff --git a/examples/qmlorganizer/organizer.qml b/examples/qmlorganizer/organizer.qml
index 71c0d5fb6c..1e7a725bb7 100644
--- a/examples/qmlorganizer/organizer.qml
+++ b/examples/qmlorganizer/organizer.qml
@@ -46,21 +46,12 @@ Rectangle {
id: calendar
width: 400
height: 640
- property date day: new Date()
- property string status:day.toDateString()
- property OrganizerModel organizer:OrganizerModel{
- id: organizer
- startPeriod:new Date(calendar.day.getFullYear(), 1, 1)
- endPeriod:new Date(calendar.day.getFullYear(), 12, 31)
- autoUpdate:false
- Component.onCompleted : {
- if (manager == "memory")
- organizer.importItems(Qt.resolvedUrl("contents/2010-FIFA-WorldCup.ics"));
- }
- }
- onDayChanged: {
- calendar.status = day.toDateString();
- }
+ property date currentDate:new Date()
+ property int year:currentDate.getFullYear()
+ property int month:currentDate.getMonth()
+ property int day:currentDate.getDate()
+ property int weekDay:currentDate.getDay()
+ property string status:currentDate.toDateString()
color: "#343434";
Image { source: "contents/images/stripes.png"; fillMode: Image.Tile; anchors.fill: parent; opacity: 1 }
@@ -68,6 +59,17 @@ Rectangle {
state: "MonthView";
SystemPalette { id: activePalette }
+ property OrganizerModel organizer:OrganizerModel{
+ id: organizer
+ manager:"qtorganizer:memory:id=qml"
+ startPeriod:'2009-01-01'
+ endPeriod:'2012-12-31'
+ autoUpdate:true
+ Component.onCompleted : {
+ if (managerName == "memory")
+ organizer.importItems(Qt.resolvedUrl("contents/test.ics"));
+ }
+ }
@@ -76,21 +78,21 @@ Rectangle {
id: statusBar; status:calendar.status; width: parent.width; height: 35; opacity: 0.9; anchors.bottom: calendar.bottom
onLeftClicked: {
if (calendar.state == "MonthView") {
- calendar.day = new Date(calendar.day.getFullYear(), calendar.day.getMonth() - 1, calendar.day.getDate());
+ calendar.currentDate = new Date(calendar.year, calendar.month - 1, calendar.day);
} else if (calendar.state == "WeekView") {
- calendar.day = new Date(calendar.day.getFullYear(), calendar.day.getMonth() , calendar.day.getDate() - 7);
+ calendar.currentDate = new Date(calendar.year, calendar.month , calendar.day - 7);
} else if (calendar.state == "DayView" || calendar.state == "TimelineView") {
- calendar.day = new Date(calendar.day.getFullYear(), calendar.day.getMonth() , calendar.day.getDate() - 1);
+ calendar.currentDate = new Date(calendar.year, calendar.month , calendar.day - 1);
}
}
onRightClicked: {
if (calendar.state == "MonthView") {
- calendar.day = new Date(calendar.day.getFullYear(), calendar.day.getMonth() + 1, calendar.day.getDate());
+ calendar.currentDate = new Date(calendar.year, calendar.month + 1, calendar.day);
} else if (calendar.state == "WeekView") {
- calendar.day = new Date(calendar.day.getFullYear(), calendar.day.getMonth() , calendar.day.getDate() + 7);
+ calendar.currentDate = new Date(calendar.year, calendar.month , calendar.day + 7);
} else if (calendar.state == "DayView" || calendar.state == "TimelineView") {
- calendar.day = new Date(calendar.day.getFullYear(), calendar.day.getMonth() , calendar.day.getDate() + 1);
+ calendar.currentDate = new Date(calendar.year, calendar.month , calendar.day + 1);
}
} //rightClick
}
@@ -126,6 +128,8 @@ Rectangle {
width: calendar.width;
height: calendar.height - menuBar.height - statusBar.height;
opacity: 0;
+ month:calendar.month
+ year:calendar.year
anchors.fill: contentArea;
}
TimelineView {
diff --git a/examples/qmlorganizer/qmlorganizer.pro b/examples/qmlorganizer/qmlorganizer.pro
index 5fa244abd2..1ac9b09270 100644
--- a/examples/qmlorganizer/qmlorganizer.pro
+++ b/examples/qmlorganizer/qmlorganizer.pro
@@ -38,6 +38,7 @@ OTHER_FILES += \
contents/images/button.png \
contents/month.js \
contents/MonthView.qml \
+ contents/test.ics \
contents/2010-FIFA-WorldCup.ics
symbian: {
diff --git a/examples/qmlorganizer/qmlorganizer.qrc b/examples/qmlorganizer/qmlorganizer.qrc
index 95b257796d..3d6e703c99 100644
--- a/examples/qmlorganizer/qmlorganizer.qrc
+++ b/examples/qmlorganizer/qmlorganizer.qrc
@@ -28,5 +28,6 @@
<file>contents/images/toolbutton.sci</file>
<file>contents/month.js</file>
<file>contents/2010-FIFA-WorldCup.ics</file>
+ <file>contents/test.ics</file>
</qresource>
</RCC>
diff --git a/examples/samplephonebook/contacteditor.cpp b/examples/samplephonebook/contacteditor.cpp
index 5bca4ccca0..d75110d122 100644
--- a/examples/samplephonebook/contacteditor.cpp
+++ b/examples/samplephonebook/contacteditor.cpp
@@ -41,6 +41,7 @@
#include "contacteditor.h"
#include <QtGui>
+#include <QDesktopServices>
const int MAX_AVATAR_DISPLAY_SIZE = 120;
@@ -263,8 +264,13 @@ void ContactEditor::clearAvatarClicked()
void ContactEditor::avatarClicked()
{
// put up a file dialog, and update the new avatar path.
+ QString docPath = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
+ if (docPath.isEmpty())
+ docPath = QDesktopServices::storageLocation(QDesktopServices::HomeLocation);
+ if (docPath.isEmpty())
+ docPath = ".";
QString fileName = QFileDialog::getOpenFileName(this,
- tr("Select Contact Picture"), ".", tr("Image Files (*.png *.jpg *.bmp)"));
+ tr("Select Contact Picture"), docPath, tr("Image Files (*.png *.jpg *.bmp)"));
if (!fileName.isEmpty()) {
m_newAvatarPath = fileName;
diff --git a/plugins/contacts/symbian/plugin/src/cntrelationship.cpp b/plugins/contacts/symbian/plugin/src/cntrelationship.cpp
index 51cb1bfbf4..af5aea1a3f 100644
--- a/plugins/contacts/symbian/plugin/src/cntrelationship.cpp
+++ b/plugins/contacts/symbian/plugin/src/cntrelationship.cpp
@@ -235,6 +235,7 @@ bool CntRelationship::saveRelationships(QSet<QContactLocalId> *affectedContactId
// if validation or batch save failed, or if there are many different relationship types,
// the relationships need to be added one by one
if (!returnValue || hasManyRelationshipTypes) {
+ returnValue = true;
for (int i = 0; i < relationships->count(); ++i) {
// save the relationship
saveRelationship(affectedContactIds, &(relationships->operator[](i)), &singleError);
@@ -317,6 +318,7 @@ bool CntRelationship::removeRelationships(QSet<QContactLocalId> *affectedContact
// if validation or batch remove failed, or if there are many relationship types,
// the relationships need to be removed one by one
if (!returnValue || hasManyRelationshipTypes) {
+ returnValue = true;
for (int i = 0; i < relationships.count(); ++i) {
//remove the relationships
removeRelationship(affectedContactIds, relationships.at(i), &singleError);
diff --git a/plugins/contacts/symbian/plugin/src/cntrelationshipgroup.cpp b/plugins/contacts/symbian/plugin/src/cntrelationshipgroup.cpp
index 25a531dc30..c5f6200cfb 100644
--- a/plugins/contacts/symbian/plugin/src/cntrelationshipgroup.cpp
+++ b/plugins/contacts/symbian/plugin/src/cntrelationshipgroup.cpp
@@ -119,8 +119,9 @@ bool CntRelationshipGroup::removeRelationshipL(QSet<QContactLocalId> *affectedCo
* Save many relationships
*
* \a affectedContactIds will include the affected contact ids
- * \a relationship to be saved
- * \a error t
+ * \a relationships to be saved
+ * \a error the error code
+ * \a return true if relationships was attempted to be saved, false otherwise
*/
bool CntRelationshipGroup::saveRelationshipsL(QSet<QContactLocalId> *affectedContactIds, QList<QContactRelationship> *relationships, QContactManager::Error* error)
{
@@ -129,21 +130,38 @@ bool CntRelationshipGroup::saveRelationshipsL(QSet<QContactLocalId> *affectedCon
if (relationships->count() == 0) {
return true;
}
-
+ bool success = true;
QContactLocalId groupId = relationships->at(0).first().localId();
affectedContactIds->insert(groupId);
foreach (QContactRelationship relationship, *relationships) {
+ if (relationship.first().localId()!= groupId) {
+ success = false;
+ break;
+ }
affectedContactIds->insert(relationship.second().localId());
idList.AppendL(TContactItemId(relationship.second().localId()));
}
- database()->AddContactsToGroupL(idList, TContactItemId(groupId));
-
*error = QContactManager::NoError;
- return true;
+ if (!success) {
+ affectedContactIds->clear();
+ }
+ else {
+ database()->AddContactsToGroupL(idList, TContactItemId(groupId));
+ }
+ idList.Close();
+ return success;
}
+/*!
+ * Delete many relationships
+ *
+ * \a affectedContactIds will include the affected contact ids
+ * \a relationships to be deleted
+ * \a error the error code in case of error, NoError otherwise
+ * \a return true if the deleting was attempted to be handled, false otherwise
+ */
bool CntRelationshipGroup::removeRelationshipsL(QSet<QContactLocalId> *affectedContactIds, const QList<QContactRelationship> &relationships, QContactManager::Error* error)
{
RArray<TContactItemId> idList;
@@ -151,19 +169,28 @@ bool CntRelationshipGroup::removeRelationshipsL(QSet<QContactLocalId> *affectedC
if (relationships.count() == 0) {
return true;
}
-
+ bool success = true;
QContactLocalId groupId = relationships.at(0).first().localId();
affectedContactIds->insert(groupId);
foreach (QContactRelationship relationship, relationships) {
+ if (relationship.first().localId()!= groupId) {
+ success = false;
+ break;
+ }
affectedContactIds->insert(relationship.second().localId());
idList.AppendL(TContactItemId(relationship.second().localId()));
}
- database()->RemoveContactsFromGroupL(idList, TContactItemId(groupId));
-
*error = QContactManager::NoError;
- return true;
+ if (!success) {
+ affectedContactIds->clear();
+ }
+ else {
+ database()->RemoveContactsFromGroupL(idList, TContactItemId(groupId));
+ }
+ idList.Close();
+ return success;
}
#endif
diff --git a/plugins/contacts/symbian/plugin/tsrc/ut_symbian/ut_cntrelationship.cpp b/plugins/contacts/symbian/plugin/tsrc/ut_symbian/ut_cntrelationship.cpp
index 776c264433..cb5f73ebae 100644
--- a/plugins/contacts/symbian/plugin/tsrc/ut_symbian/ut_cntrelationship.cpp
+++ b/plugins/contacts/symbian/plugin/tsrc/ut_symbian/ut_cntrelationship.cpp
@@ -406,6 +406,88 @@ void TestCntRelationship::invalidFirstAndSecondContactGroupRelationship()
QVERIFY(error != QContactManager::NoError);
}
+/*
+ * Test batch saving/removing group relationship functionality
+ */
+void TestCntRelationship::batchOperationGroupRelationship()
+{
+ //create two groups
+ QContact groupContact1;
+ groupContact1.setType(QContactType::TypeGroup);
+ QContactManager::Error err;
+ m_manager->saveContact(&groupContact1, &err);
+
+ QContact groupContact2;
+ groupContact2.setType(QContactType::TypeGroup);
+ m_manager->saveContact(&groupContact2, &err);
+
+ //create contacts
+ QContact contact1;
+ contact1.setType(QContactType::TypeContact);
+ m_manager->saveContact(&contact1, &err);
+
+ QContact contact2;
+ contact2.setType(QContactType::TypeContact);
+ m_manager->saveContact(&contact2, &err);
+
+ QList <QContactRelationship> inputList;
+ QList <QContactRelationship> relationshipList;
+ //create relationships
+ QContactRelationship relationship;
+ relationship.setRelationshipType(QContactRelationship::HasMember);
+ relationship.setFirst(groupContact1.id());
+ relationship.setSecond(contact1.id());
+ inputList.append(relationship);
+ relationship.setSecond(contact2.id());
+ inputList.append(relationship);
+ QSet<QContactLocalId> affectedContacts;
+ QMap<int,QContactManager::Error> errorMap;
+
+ QVERIFY(true==m_relationship->saveRelationships(&affectedContacts,&inputList,&errorMap, &err));
+ QVERIFY(err == QContactManager::NoError);
+ QVERIFY(affectedContacts.count() == 3);
+ relationshipList = m_relationship->relationships(QLatin1String(QContactRelationship::HasMember), groupContact1.id(), QContactRelationship::First, &err);
+ QVERIFY(relationshipList.count()==2);
+ QVERIFY(relationshipList[0].second()==contact1.id() || relationshipList[1].second()==contact1.id());
+ QVERIFY(relationshipList[0].second()==contact2.id() || relationshipList[1].second()==contact2.id());
+
+ //Remove the relationships
+ QVERIFY(true==m_relationship->removeRelationships(&affectedContacts,relationshipList,&errorMap, &err));
+ QVERIFY(err == QContactManager::NoError);
+ QVERIFY(affectedContacts.count() == 3);
+ relationshipList = m_relationship->relationships(QLatin1String(QContactRelationship::HasMember), groupContact1.id(), QContactRelationship::First, &err);
+ QVERIFY(relationshipList.count()==0);
+
+
+ //Save relationships to two different group
+ inputList.clear();
+ relationship.setRelationshipType(QContactRelationship::HasMember);
+ relationship.setFirst(groupContact1.id());
+ relationship.setSecond(contact1.id());
+ inputList.append(relationship);
+ relationship.setFirst(groupContact2.id());
+ relationship.setSecond(contact2.id());
+ inputList.append(relationship);
+ QVERIFY(true==m_relationship->saveRelationships(&affectedContacts,&inputList,&errorMap,&err));
+ QVERIFY(err == QContactManager::NoError);
+ //QVERIFY(affectedContacts.count() == 4);
+ relationshipList = m_relationship->relationships(QLatin1String(QContactRelationship::HasMember), groupContact1.id(), QContactRelationship::First, &err);
+ QVERIFY(relationshipList.count()==1);
+ QVERIFY(relationshipList[0].second()==contact1.id());
+ relationshipList = m_relationship->relationships(QLatin1String(QContactRelationship::HasMember), groupContact2.id(), QContactRelationship::First, &err);
+ QVERIFY(relationshipList.count()==1);
+ QVERIFY(relationshipList[0].second()==contact2.id());
+
+ //Remove the relationships
+ QVERIFY(true==m_relationship->removeRelationships(&affectedContacts,inputList,&errorMap,&err));
+ QVERIFY(err == QContactManager::NoError);
+ QVERIFY(affectedContacts.count() == 4);
+ relationshipList = m_relationship->relationships(QLatin1String(QContactRelationship::HasMember), groupContact1.id(), QContactRelationship::First, &err);
+ QVERIFY(relationshipList.count()==0);
+ relationshipList = m_relationship->relationships(QLatin1String(QContactRelationship::HasMember), groupContact2.id(), QContactRelationship::First, &err);
+ QVERIFY(relationshipList.count()==0);
+}
+
bool TestCntRelationship::validateRelationshipFilter(const QContactRelationship::Role role, const QContactId contactId, const QList<QContactLocalId> expectedContacts)
{
QContactRelationshipFilter filter;
diff --git a/plugins/contacts/symbian/plugin/tsrc/ut_symbian/ut_cntrelationship.h b/plugins/contacts/symbian/plugin/tsrc/ut_symbian/ut_cntrelationship.h
index cbd7305376..21833ec262 100644
--- a/plugins/contacts/symbian/plugin/tsrc/ut_symbian/ut_cntrelationship.h
+++ b/plugins/contacts/symbian/plugin/tsrc/ut_symbian/ut_cntrelationship.h
@@ -65,6 +65,7 @@ private slots:
void invalidFirstContactGroupRelationship();
void invalidSecondContactGroupRelationship();
void invalidFirstAndSecondContactGroupRelationship();
+ void batchOperationGroupRelationship();
private:
bool validateRelationshipFilter(const QContactRelationship::Role role, const QContactId contactId, const QList<QContactLocalId> expectedContacts);
diff --git a/plugins/declarative/contacts/contacts.pro b/plugins/declarative/contacts/contacts.pro
index 5effa57811..a6f21e0868 100644
--- a/plugins/declarative/contacts/contacts.pro
+++ b/plugins/declarative/contacts/contacts.pro
@@ -8,11 +8,11 @@ INCLUDEPATH += . \
../../../src/versit
DEPENDPATH += ../../../src/contacts
+TEMPLATE = lib
+CONFIG += plugin
TARGET = $$qtLibraryTarget(declarative_contacts)
TARGETPATH = QtMobility/contacts
-TEMPLATE = lib
-CONFIG += plugin
PLUGIN_TYPE = declarative
include(../../../common.pri)
diff --git a/plugins/declarative/contacts/qdeclarativecontactfilter.cpp b/plugins/declarative/contacts/qdeclarativecontactfilter.cpp
index 08eb6a8909..726c3e5ef8 100644
--- a/plugins/declarative/contacts/qdeclarativecontactfilter.cpp
+++ b/plugins/declarative/contacts/qdeclarativecontactfilter.cpp
@@ -122,7 +122,6 @@
\qmlclass DetailFilter QDeclarativeContactDetailFilter
\brief The \l DetailFilter element provides a filter based around a detail value criterion.
- \qmlmodule contacts
\ingroup qml-contacts
This element is part of the \bold{QtMobility.contacts 1.1} module.
diff --git a/plugins/declarative/contacts/qdeclarativecontactmodel.cpp b/plugins/declarative/contacts/qdeclarativecontactmodel.cpp
index 547ddf36ce..f0aad3c840 100644
--- a/plugins/declarative/contacts/qdeclarativecontactmodel.cpp
+++ b/plugins/declarative/contacts/qdeclarativecontactmodel.cpp
@@ -541,9 +541,6 @@ void QDeclarativeContactModel::requestUpdated()
d->m_contactMap.insert(c.localId(), dc);
}
}
- beginInsertRows(QModelIndex(), d->m_contacts.count(), req->contacts().count());
- d->m_contacts.append(dcs);
- endInsertRows();
}
emit contactsChanged();
emit errorChanged();
diff --git a/plugins/declarative/feedback/feedback.pro b/plugins/declarative/feedback/feedback.pro
index 7920ca5ce5..81f785a295 100644
--- a/plugins/declarative/feedback/feedback.pro
+++ b/plugins/declarative/feedback/feedback.pro
@@ -1,9 +1,9 @@
INCLUDEPATH += ../../../src/feedback
INCLUDEPATH += ../../../src/global
-TARGET = $$qtLibraryTarget(declarative_feedback)
TEMPLATE = lib
CONFIG += plugin
+TARGET = $$qtLibraryTarget(declarative_feedback)
TARGETPATH = QtMobility/feedback
PLUGIN_TYPE = declarative
include(../../../common.pri)
diff --git a/plugins/declarative/gallery/gallery.pro b/plugins/declarative/gallery/gallery.pro
index bbb6a7e168..4e015fd988 100644
--- a/plugins/declarative/gallery/gallery.pro
+++ b/plugins/declarative/gallery/gallery.pro
@@ -3,11 +3,11 @@ INCLUDEPATH += . \
../../../include \
../../../src/gallery
+TEMPLATE = lib
+CONFIG += plugin
TARGET = $$qtLibraryTarget(declarative_gallery)
TARGETPATH = QtMobility/gallery
-TEMPLATE = lib
-CONFIG += plugin
PLUGIN_TYPE = declarative
include(../../../common.pri)
diff --git a/plugins/declarative/location/location.pro b/plugins/declarative/location/location.pro
index 1993f6df98..a5db36c073 100644
--- a/plugins/declarative/location/location.pro
+++ b/plugins/declarative/location/location.pro
@@ -1,6 +1,6 @@
-TARGET = $$qtLibraryTarget(declarative_location)
TEMPLATE = lib
CONFIG += qt plugin mobility
+TARGET = $$qtLibraryTarget(declarative_location)
MOBILITY += location
PLUGIN_TYPE = declarative
QT += declarative network
diff --git a/plugins/declarative/messaging/messaging.pro b/plugins/declarative/messaging/messaging.pro
index 4f585d28f4..5cc7c96dbc 100644
--- a/plugins/declarative/messaging/messaging.pro
+++ b/plugins/declarative/messaging/messaging.pro
@@ -1,9 +1,9 @@
INCLUDEPATH += ../../../src/messaging
INCLUDEPATH += ../../../src/global
-TARGET = $$qtLibraryTarget(declarative_messaging)
TEMPLATE = lib
CONFIG += plugin
+TARGET = $$qtLibraryTarget(declarative_messaging)
TARGETPATH = QtMobility/messaging
PLUGIN_TYPE = declarative
@@ -37,7 +37,12 @@ simulator|contains(qmf_enabled, yes) {
QMAKE_LFLAGS += -F$$(QMF_LIBDIR)
LIBS += -framework qmfclient
} else {
- LIBS += -L$$(QMF_LIBDIR) -l$$qtLibraryTarget(qmfclient)
+ maemo6:meego {
+ CONFIG += link_pkgconfig
+ PKGCONFIG += qmfclient
+ } else {
+ LIBS += -L$$(QMF_LIBDIR) -l$$qtLibraryTarget(qmfclient)
+ }
}
}
diff --git a/plugins/declarative/multimedia/multimedia.pro b/plugins/declarative/multimedia/multimedia.pro
index bfb3fcd807..a5213d5d8a 100644
--- a/plugins/declarative/multimedia/multimedia.pro
+++ b/plugins/declarative/multimedia/multimedia.pro
@@ -3,9 +3,9 @@ INCLUDEPATH += ../../../src/multimedia \
../../../src/multimedia/video
INCLUDEPATH += ../../../src/global
-TARGET = $$qtLibraryTarget(declarative_multimedia)
TEMPLATE = lib
CONFIG += plugin
+TARGET = $$qtLibraryTarget(declarative_multimedia)
TARGETPATH = QtMultimediaKit
PLUGIN_TYPE = declarative
include(../../../common.pri)
diff --git a/plugins/declarative/multimedia/qdeclarativecamera.cpp b/plugins/declarative/multimedia/qdeclarativecamera.cpp
index fd574bebec..68c7b6c7d9 100644
--- a/plugins/declarative/multimedia/qdeclarativecamera.cpp
+++ b/plugins/declarative/multimedia/qdeclarativecamera.cpp
@@ -46,6 +46,7 @@
#include <qmediaservice.h>
#include <qpaintervideosurface_p.h>
#include <qvideorenderercontrol.h>
+#include <QtDeclarative/qdeclarativeinfo.h>
#include <QtCore/QTimer>
#include <QtGui/qevent.h>
@@ -144,7 +145,7 @@ void QDeclarativeCamera::_q_updateLockStatus(QCamera::LockType type,
if (type == QCamera::LockFocus) {
if (status == QCamera::Unlocked && reason == QCamera::LockFailed) {
//display failed focus points in red for 1 second
- m_focusFailedTime == QTime::currentTime();
+ m_focusFailedTime = QTime::currentTime();
QTimer::singleShot(1000, this, SLOT(_q_updateFocusZones()));
} else {
m_focusFailedTime = QTime();
@@ -242,8 +243,17 @@ QDeclarativeCamera::QDeclarativeCamera(QDeclarativeItem *parent) :
m_viewfinderItem(0),
m_imageSettingsChanged(false),
m_pendingState(ActiveState),
- m_isStateSet(false)
-{
+ m_isStateSet(false),
+ m_isValid(true)
+{
+#if defined(Q_OS_SYMBIAN)
+ RProcess thisProcess;
+ if (!thisProcess.HasCapability(ECapabilityUserEnvironment)) {
+ qmlInfo(this) << "Camera Element requires UserEnvironment Capability to be successfully used on Symbian";
+ m_isValid = false;
+ return;
+ }
+#endif
m_camera = new QCamera(this);
m_viewfinderItem = new QGraphicsVideoItem(this);
m_camera->setViewfinder(m_viewfinderItem);
@@ -287,21 +297,29 @@ QDeclarativeCamera::QDeclarativeCamera(QDeclarativeItem *parent) :
QDeclarativeCamera::~QDeclarativeCamera()
{
- m_camera->unload();
+ if (m_isValid) {
+ m_camera->unload();
- delete m_viewfinderItem;
- delete m_capture;
- delete m_camera;
+ delete m_viewfinderItem;
+ delete m_capture;
+ delete m_camera;
+ }
}
QDeclarativeCamera::Error QDeclarativeCamera::error() const
{
+ if (!m_isValid)
+ return QDeclarativeCamera::CameraError;
+
return QDeclarativeCamera::Error(m_camera->error());
}
QString QDeclarativeCamera::errorString() const
{
+ if (!m_isValid)
+ return QString();
+
return m_camera->errorString();
}
@@ -314,6 +332,9 @@ QString QDeclarativeCamera::errorString() const
QDeclarativeCamera::State QDeclarativeCamera::cameraState() const
{
+ if (!m_isValid)
+ return QDeclarativeCamera::UnloadedState;
+
return m_isStateSet ? QDeclarativeCamera::State(m_camera->state()) : m_pendingState;
}
@@ -322,7 +343,8 @@ QDeclarativeCamera::State QDeclarativeCamera::cameraState() const
*/
void QDeclarativeCamera::start()
{
- m_camera->start();
+ if (m_isValid)
+ m_camera->start();
}
/*!
@@ -330,11 +352,15 @@ void QDeclarativeCamera::start()
*/
void QDeclarativeCamera::stop()
{
- m_camera->stop();
+ if (m_isValid)
+ m_camera->stop();
}
void QDeclarativeCamera::setCameraState(QDeclarativeCamera::State state)
{
+ if (!m_isValid)
+ return;
+
if (!m_isStateSet) {
m_pendingState = state;
return;
@@ -360,6 +386,9 @@ void QDeclarativeCamera::setCameraState(QDeclarativeCamera::State state)
QDeclarativeCamera::LockStatus QDeclarativeCamera::lockStatus() const
{
+ if (!m_isValid)
+ return QDeclarativeCamera::Unlocked;
+
return QDeclarativeCamera::LockStatus(m_camera->lockStatus());
}
@@ -370,7 +399,8 @@ QDeclarativeCamera::LockStatus QDeclarativeCamera::lockStatus() const
*/
void QDeclarativeCamera::searchAndLock()
{
- m_camera->searchAndLock();
+ if (m_isValid)
+ m_camera->searchAndLock();
}
/*!
@@ -381,7 +411,8 @@ void QDeclarativeCamera::searchAndLock()
*/
void QDeclarativeCamera::unlock()
{
- m_camera->unlock();
+ if (m_isValid)
+ m_camera->unlock();
}
/*!
@@ -389,7 +420,8 @@ void QDeclarativeCamera::unlock()
*/
void QDeclarativeCamera::captureImage()
{
- m_capture->capture();
+ if (m_isValid)
+ m_capture->capture();
}
QImage QDeclarativeCamera::capturedImagePreview() const
@@ -416,6 +448,9 @@ void QDeclarativeCamera::geometryChanged(const QRectF &newGeometry, const QRectF
void QDeclarativeCamera::keyPressEvent(QKeyEvent * event)
{
+ if (!m_isValid)
+ return;
+
switch (event->key()) {
case Qt::Key_CameraFocus:
m_camera->searchAndLock();
@@ -433,6 +468,9 @@ void QDeclarativeCamera::keyPressEvent(QKeyEvent * event)
void QDeclarativeCamera::keyReleaseEvent(QKeyEvent * event)
{
+ if (!m_isValid)
+ return;
+
switch (event->key()) {
case Qt::Key_CameraFocus:
m_camera->unlock();
@@ -448,17 +486,23 @@ void QDeclarativeCamera::keyReleaseEvent(QKeyEvent * event)
QDeclarativeCamera::ExposureMode QDeclarativeCamera::exposureMode() const
{
+ if (!m_isValid)
+ return QDeclarativeCamera::ExposureAuto;
+
return ExposureMode(m_exposure->exposureMode());
}
int QDeclarativeCamera::flashMode() const
{
+ if (!m_isValid)
+ return 0;
+
return m_exposure->flashMode();
}
void QDeclarativeCamera::setFlashMode(int mode)
{
- if (m_exposure->flashMode() != mode) {
+ if (m_isValid && m_exposure->flashMode() != mode) {
m_exposure->setFlashMode(QCameraExposure::FlashModes(mode));
emit flashModeChanged(mode);
}
@@ -466,31 +510,47 @@ void QDeclarativeCamera::setFlashMode(int mode)
qreal QDeclarativeCamera::exposureCompensation() const
{
+ if (!m_isValid)
+ return 0.0;
+
return m_exposure->exposureCompensation();
}
void QDeclarativeCamera::setExposureCompensation(qreal ev)
{
- m_exposure->setExposureCompensation(ev);
+ if (m_isValid)
+ m_exposure->setExposureCompensation(ev);
}
int QDeclarativeCamera::isoSensitivity() const
{
+ if (!m_isValid)
+ return 0;
+
return m_exposure->isoSensitivity();
}
qreal QDeclarativeCamera::shutterSpeed() const
{
+ if (!m_isValid)
+ return 0.0;
+
return m_exposure->shutterSpeed();
}
qreal QDeclarativeCamera::aperture() const
{
+ if (!m_isValid)
+ return 0.0;
+
return m_exposure->aperture();
}
void QDeclarativeCamera::setExposureMode(QDeclarativeCamera::ExposureMode mode)
{
+ if (!m_isValid)
+ return;
+
if (exposureMode() != mode) {
m_exposure->setExposureMode(QCameraExposure::ExposureMode(mode));
emit exposureModeChanged(exposureMode());
@@ -499,17 +559,23 @@ void QDeclarativeCamera::setExposureMode(QDeclarativeCamera::ExposureMode mode)
void QDeclarativeCamera::setManualIsoSensitivity(int iso)
{
+ if (!m_isValid)
+ return;
+
m_exposure->setManualIsoSensitivity(iso);
}
QSize QDeclarativeCamera::captureResolution() const
{
+ if (!m_isValid)
+ return QSize();
+
return m_imageSettings.resolution();
}
void QDeclarativeCamera::setCaptureResolution(const QSize &resolution)
{
- if (m_imageSettings.resolution() != resolution) {
+ if (m_isValid && m_imageSettings.resolution() != resolution) {
m_imageSettings.setResolution(resolution);
if (!m_imageSettingsChanged) {
@@ -523,47 +589,67 @@ void QDeclarativeCamera::setCaptureResolution(const QSize &resolution)
qreal QDeclarativeCamera::maximumOpticalZoom() const
{
+ if (!m_isValid)
+ return 0.0;
+
return m_focus->maximumOpticalZoom();
}
qreal QDeclarativeCamera::maximumDigitalZoom() const
{
+ if (!m_isValid)
+ return 0.0;
+
return m_focus->maximumDigitalZoom();
}
qreal QDeclarativeCamera::opticalZoom() const
{
+ if (!m_isValid)
+ return 0.0;
+
return m_focus->opticalZoom();
}
qreal QDeclarativeCamera::digitalZoom() const
{
+ if (!m_isValid)
+ return 0.0;
+
return m_focus->digitalZoom();
}
void QDeclarativeCamera::setOpticalZoom(qreal value)
{
- m_focus->zoomTo(value, digitalZoom());
+ if (m_isValid)
+ m_focus->zoomTo(value, digitalZoom());
}
void QDeclarativeCamera::setDigitalZoom(qreal value)
{
- m_focus->zoomTo(opticalZoom(), value);
+ if (m_isValid)
+ m_focus->zoomTo(opticalZoom(), value);
}
QDeclarativeCamera::WhiteBalanceMode QDeclarativeCamera::whiteBalanceMode() const
{
+ if (!m_isValid)
+ return QDeclarativeCamera::WhiteBalanceAuto;
+
return WhiteBalanceMode(m_camera->imageProcessing()->whiteBalanceMode());
}
int QDeclarativeCamera::manualWhiteBalance() const
{
+ if (!m_isValid)
+ return 0;
+
return m_camera->imageProcessing()->manualWhiteBalance();
}
void QDeclarativeCamera::setWhiteBalanceMode(QDeclarativeCamera::WhiteBalanceMode mode) const
{
- if (whiteBalanceMode() != mode) {
+ if (m_isValid && whiteBalanceMode() != mode) {
m_camera->imageProcessing()->setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceMode(mode));
emit whiteBalanceModeChanged(whiteBalanceMode());
}
@@ -571,7 +657,7 @@ void QDeclarativeCamera::setWhiteBalanceMode(QDeclarativeCamera::WhiteBalanceMod
void QDeclarativeCamera::setManualWhiteBalance(int colorTemp) const
{
- if (manualWhiteBalance() != colorTemp) {
+ if (m_isValid && manualWhiteBalance() != colorTemp) {
m_camera->imageProcessing()->setManualWhiteBalance(colorTemp);
emit manualWhiteBalanceChanged(manualWhiteBalance());
}
diff --git a/plugins/declarative/multimedia/qdeclarativecamera_p.h b/plugins/declarative/multimedia/qdeclarativecamera_p.h
index 3b1ece9aa5..e477538b2c 100644
--- a/plugins/declarative/multimedia/qdeclarativecamera_p.h
+++ b/plugins/declarative/multimedia/qdeclarativecamera_p.h
@@ -290,6 +290,7 @@ private:
State m_pendingState;
bool m_isStateSet;
+ bool m_isValid;
};
QT_END_NAMESPACE
diff --git a/plugins/declarative/multimedia/qdeclarativemediabase.cpp b/plugins/declarative/multimedia/qdeclarativemediabase.cpp
index 72e2c13782..52a8d01785 100644
--- a/plugins/declarative/multimedia/qdeclarativemediabase.cpp
+++ b/plugins/declarative/multimedia/qdeclarativemediabase.cpp
@@ -43,6 +43,7 @@
#include <QtCore/qcoreevent.h>
#include <QtCore/qurl.h>
+#include <QtDeclarative/qdeclarativeinfo.h>
#include <qmediaplayercontrol.h>
#include <qmediaservice.h>
@@ -234,6 +235,7 @@ QDeclarativeMediaBase::QDeclarativeMediaBase()
, m_playbackRate(1.0)
, m_mediaService(0)
, m_playerControl(0)
+ , m_qmlObject(0)
, m_mediaObject(0)
, m_mediaProvider(0)
, m_metaDataControl(0)
@@ -261,6 +263,8 @@ void QDeclarativeMediaBase::shutdown()
void QDeclarativeMediaBase::setObject(QObject *object)
{
+ m_qmlObject = object;
+
if ((m_mediaProvider = QMediaServiceProvider::defaultServiceProvider()) != 0) {
if ((m_mediaService = m_mediaProvider->requestService(Q_MEDIASERVICE_MEDIAPLAYER)) != 0) {
m_playerControl = qobject_cast<QMediaPlayerControl *>(
@@ -471,7 +475,7 @@ int QDeclarativeMediaBase::position() const
void QDeclarativeMediaBase::setPosition(int position)
{
- if (m_position == position)
+ if (this->position() == position)
return;
m_position = position;
@@ -489,7 +493,7 @@ qreal QDeclarativeMediaBase::volume() const
void QDeclarativeMediaBase::setVolume(qreal volume)
{
if (volume < 0 || volume > 1) {
- qWarning("Audio: volume should be between 0.0 and 1.0");
+ qmlInfo(m_qmlObject) << m_qmlObject->tr("volume should be between 0.0 and 1.0");
return;
}
diff --git a/plugins/declarative/multimedia/qdeclarativemediabase_p.h b/plugins/declarative/multimedia/qdeclarativemediabase_p.h
index 673c2c1952..ffe0916148 100644
--- a/plugins/declarative/multimedia/qdeclarativemediabase_p.h
+++ b/plugins/declarative/multimedia/qdeclarativemediabase_p.h
@@ -165,6 +165,7 @@ protected:
QMediaService *m_mediaService;
QMediaPlayerControl *m_playerControl;
+ QObject *m_qmlObject;
QMediaObject *m_mediaObject;
QMediaServiceProvider *m_mediaProvider;
QMetaDataReaderControl *m_metaDataControl;
diff --git a/plugins/declarative/organizer/organizer.pro b/plugins/declarative/organizer/organizer.pro
index b9b545ac11..51ca56667a 100644
--- a/plugins/declarative/organizer/organizer.pro
+++ b/plugins/declarative/organizer/organizer.pro
@@ -9,11 +9,11 @@ INCLUDEPATH += . \
../../../src/versit \
../../../src/versitorganizer
+TEMPLATE = lib
+CONFIG += plugin
TARGET = $$qtLibraryTarget(declarative_organizer)
TARGETPATH = QtMobility/organizer
-TEMPLATE = lib
-CONFIG += plugin
PLUGIN_TYPE = declarative
include(../../../common.pri)
diff --git a/plugins/declarative/organizer/plugin.cpp b/plugins/declarative/organizer/plugin.cpp
index 76df6cd42e..c3eb9ad149 100644
--- a/plugins/declarative/organizer/plugin.cpp
+++ b/plugins/declarative/organizer/plugin.cpp
@@ -100,7 +100,7 @@ public:
//filters
qmlRegisterType<QDeclarativeOrganizerItemFilter>(uri, 1, 1, "Filter");
- qmlRegisterType<QDeclarativeOrganizerItemChangelogFilter>(uri, 1, 1, "ChangelogFilter");
+ qmlRegisterType<QDeclarativeOrganizerItemChangeLogFilter>(uri, 1, 1, "ChangeLogFilter");
qmlRegisterType<QDeclarativeOrganizerItemCollectionFilter>(uri, 1, 1, "CollectionFilter");
qmlRegisterType<QDeclarativeOrganizerItemDetailFilter>(uri, 1, 1, "DetailFilter");
qmlRegisterType<QDeclarativeOrganizerItemDetailRangeFilter>(uri, 1, 1, "DetailRangeFilter");
diff --git a/plugins/declarative/organizer/qdeclarativeorganizeritem.cpp b/plugins/declarative/organizer/qdeclarativeorganizeritem.cpp
index d1e490f82a..a4e4843075 100644
--- a/plugins/declarative/organizer/qdeclarativeorganizeritem.cpp
+++ b/plugins/declarative/organizer/qdeclarativeorganizeritem.cpp
@@ -148,6 +148,44 @@ bool QDeclarativeOrganizerItem::modified() const
return d->m_modified;
}
+/*!
+ \qmlproperty bool OrganizerItem::isFloatingTime
+
+ This property indicates whether the organizer item created with floating date time.
+ A floating time will always appear with the same value regardless of what time zone the user is in.
+ A non-floating (absolute) time represents the same time regardless of the time zone,
+ but will appear to change in value if the user's time zone changes.
+ This property is read only.
+
+ \since organizer 1.1.1
+ */
+bool QDeclarativeOrganizerItem::isFloatingTime() const
+{
+ switch (itemType()) {
+ case QDeclarativeOrganizerItem::Event:
+ case QDeclarativeOrganizerItem::EventOccurrence:
+ return d->m_item.detail<QOrganizerEventTime>().startDateTime().timeSpec() == Qt::LocalTime;
+ case QDeclarativeOrganizerItem::Todo:
+ case QDeclarativeOrganizerItem::TodoOccurrence:
+ return d->m_item.detail<QOrganizerTodoTime>().startDateTime().timeSpec() == Qt::LocalTime;
+ case QDeclarativeOrganizerItem::Journal:
+ return d->m_item.detail<QOrganizerJournalTime>().entryDateTime().timeSpec() == Qt::LocalTime;
+ case QDeclarativeOrganizerItem::Note:
+ default:
+ break;
+ }
+ return d->m_item.detail<QOrganizerItemTimestamp>().created().timeSpec() == Qt::LocalTime;
+}
+
+/*!
+ \qmlproperty bool OrganizerItem::itemStartTime
+
+ This property holds the start date time of the OrganizerItem object.
+ For differrent organizer item type, the return value is differrent, too.
+
+ \since organizer 1.1.1
+ \sa OrganizerItemType
+ */
QDateTime QDeclarativeOrganizerItem::itemStartTime() const
{
switch (itemType()) {
@@ -165,9 +203,19 @@ QDateTime QDeclarativeOrganizerItem::itemStartTime() const
default:
break;
}
- return item().detail<QOrganizerItemTimestamp>().created();
+ return item().detail<QOrganizerItemTimestamp>().created().toLocalTime();
}
+/*!
+ \qmlproperty bool OrganizerItem::itemEndTime
+
+ This property holds the end date time of the OrganizerItem object.
+ For differrent organizer item type, the return value is differrent, too.
+
+ \since organizer 1.1.1
+ \sa OrganizerItemType
+ */
+
QDateTime QDeclarativeOrganizerItem::itemEndTime() const
{
switch (itemType()) {
@@ -187,7 +235,7 @@ QDateTime QDeclarativeOrganizerItem::itemEndTime() const
break;
}
//there is no end time for note or customized items, make it 30mins later for display purpose
- return item().detail<QOrganizerItemTimestamp>().created().addSecs(60*30);
+ return item().detail<QOrganizerItemTimestamp>().created().toLocalTime().addSecs(60*30);
}
@@ -196,6 +244,11 @@ void QDeclarativeOrganizerItem::setModified()
d->m_modified = true;
}
+/*!
+ \qmlmethod QDeclarativeListProperty OrganizerItem::detail(name)
+
+ This method returns an ItemDetail object which detail name is \a name.
+ */
QVariant QDeclarativeOrganizerItem::detail(const QString& name)
{
return d->detail(name);
@@ -331,15 +384,17 @@ QDeclarativeOrganizerItem::OrganizerItemType QDeclarativeOrganizerItem::itemType
*/
QString QDeclarativeOrganizerItem::displayLabel() const
{
- return d->m_item.displayLabel();
+ QDeclarativeOrganizerItemDisplayLabel* dl = d->detail<QDeclarativeOrganizerItemDisplayLabel>();
+ if (dl)
+ return dl->label();
+ return QString();
}
void QDeclarativeOrganizerItem::setDisplayLabel(const QString& label)
{
- if (label != d->m_item.displayLabel()) {
- d->m_item.setDisplayLabel(label);
- emit itemChanged();
- }
+ QDeclarativeOrganizerItemDisplayLabel* dl = d->detail<QDeclarativeOrganizerItemDisplayLabel>();
+ if (dl)
+ dl->setLabel(label);
}
/*!
@@ -349,15 +404,17 @@ void QDeclarativeOrganizerItem::setDisplayLabel(const QString& label)
*/
QString QDeclarativeOrganizerItem::description() const
{
- return d->m_item.description();
+ QDeclarativeOrganizerItemDescription* desc = d->detail<QDeclarativeOrganizerItemDescription>();
+ if (desc)
+ return desc->description();
+ return QString();
}
void QDeclarativeOrganizerItem::setDescription(const QString& description)
{
- if (description != d->m_item.description()) {
- d->m_item.setDescription(description);
- emit itemChanged();
- }
+ QDeclarativeOrganizerItemDescription* desc = d->detail<QDeclarativeOrganizerItemDescription>();
+ if (desc)
+ desc->setDescription(description);
}
/*!
@@ -367,16 +424,30 @@ void QDeclarativeOrganizerItem::setDescription(const QString& description)
*/
QString QDeclarativeOrganizerItem::guid() const
{
- return d->m_item.guid();
+ QDeclarativeOrganizerItemGuid* id = d->detail<QDeclarativeOrganizerItemGuid>();
+ if (id)
+ return id->guid();
+ return QString();
}
void QDeclarativeOrganizerItem::setGuid(const QString& guid)
{
- if (guid != d->m_item.guid()) {
- d->m_item.setGuid(guid);
- emit itemChanged();
- }
+ QDeclarativeOrganizerItemGuid* id = d->detail<QDeclarativeOrganizerItemGuid>();
+ if (id)
+ id->setGuid(guid);
}
+/*!
+ \qmlproperty bool OrganizerItem::isOccurrence
+
+ If this OrganizerItem is an occurrence item, returns true, otherwise returns false.
+
+ This is a read only property.
+ \since organizer 1.1.1
+*/
+bool QDeclarativeOrganizerItem::isOccurrence() const
+{
+ return itemType() == QDeclarativeOrganizerItem::EventOccurrence || itemType() == QDeclarativeOrganizerItem::TodoOccurrence;
+}
///////////////////////QDeclarativeOrganizerEvent////////////////////////////////////
/*!
@@ -405,17 +476,17 @@ QDeclarativeOrganizerEvent::QDeclarativeOrganizerEvent(QObject *parent)
*/
void QDeclarativeOrganizerEvent::setStartDateTime(const QDateTime& datetime)
{
- if (datetime != startDateTime()){
- QOrganizerEventTime etr = d->m_item.detail<QOrganizerEventTime>();
- etr.setStartDateTime(datetime);
- d->m_item.saveDetail(&etr);
- emit valueChanged();
- }
+ QDeclarativeOrganizerEventTime* time = d->detail<QDeclarativeOrganizerEventTime>();
+ if (time)
+ time->setStartDateTime(datetime);
}
QDateTime QDeclarativeOrganizerEvent::startDateTime() const
{
- return d->m_item.detail<QOrganizerEventTime>().startDateTime();
+ QDeclarativeOrganizerEventTime* time = d->detail<QDeclarativeOrganizerEventTime>();
+ if (time)
+ return time->startDateTime();
+ return QDateTime();
}
/*!
@@ -426,17 +497,16 @@ QDateTime QDeclarativeOrganizerEvent::startDateTime() const
void QDeclarativeOrganizerEvent::setEndDateTime(const QDateTime& datetime)
{
- if (datetime != endDateTime()){
- QOrganizerEventTime etr = d->m_item.detail<QOrganizerEventTime>();
- etr.setEndDateTime(datetime);
- d->m_item. saveDetail(&etr);
- emit valueChanged();
- }
+ QDeclarativeOrganizerEventTime* time = d->detail<QDeclarativeOrganizerEventTime>();
+ if (time)
+ time->setEndDateTime(datetime);
}
QDateTime QDeclarativeOrganizerEvent::endDateTime() const
{
- QOrganizerEventTime etr = d->m_item. detail<QOrganizerEventTime>();
- return etr.endDateTime();
+ QDeclarativeOrganizerEventTime* time = d->detail<QDeclarativeOrganizerEventTime>();
+ if (time)
+ return time->endDateTime();
+ return QDateTime();
}
/*!
@@ -448,17 +518,15 @@ QDateTime QDeclarativeOrganizerEvent::endDateTime() const
*/
void QDeclarativeOrganizerEvent::setAllDay(bool allDay)
{
- if (allDay != isAllDay()) {
- QOrganizerEventTime etr = d->m_item.detail<QOrganizerEventTime>();
- etr.setAllDay(allDay);
- d->m_item.saveDetail(&etr);
- emit valueChanged();
- }
+ QDeclarativeOrganizerEventTime* time = d->detail<QDeclarativeOrganizerEventTime>();
+ if (time)
+ time->setAllDay(allDay);
}
bool QDeclarativeOrganizerEvent::isAllDay() const
{
- QOrganizerEventTime etr = d->m_item.detail<QOrganizerEventTime>();
- return etr.isAllDay();
+ QDeclarativeOrganizerEventTime* time = d->detail<QDeclarativeOrganizerEventTime>();
+ return time->isAllDay();
+ return false;
}
/*!
@@ -481,18 +549,16 @@ bool QDeclarativeOrganizerEvent::isAllDay() const
*/
void QDeclarativeOrganizerEvent::setPriority(QDeclarativeOrganizerItemPriority::PriorityType value)
{
- if (value != priority()) {
- QOrganizerItemPriority::Priority newPriority = static_cast<QOrganizerItemPriority::Priority>(value);
- QOrganizerItemPriority pd = d->m_item.detail<QOrganizerItemPriority>();
- pd.setPriority(newPriority);
- d->m_item.saveDetail(&pd);
- emit valueChanged();
- }
+ QDeclarativeOrganizerItemPriority* priority = d->detail<QDeclarativeOrganizerItemPriority>();
+ if (priority)
+ priority->setPriority(value);
}
QDeclarativeOrganizerItemPriority::PriorityType QDeclarativeOrganizerEvent::priority() const
{
- QOrganizerItemPriority pd = d->m_item.detail<QOrganizerItemPriority>();
- return static_cast<QDeclarativeOrganizerItemPriority::PriorityType>(pd.priority());
+ QDeclarativeOrganizerItemPriority* priority = d->detail<QDeclarativeOrganizerItemPriority>();
+ if (priority)
+ return priority->priority();
+ return QDeclarativeOrganizerItemPriority::Unknown;
}
/*!
@@ -502,21 +568,20 @@ QDeclarativeOrganizerItemPriority::PriorityType QDeclarativeOrganizerEvent::prio
*/
QString QDeclarativeOrganizerEvent::location() const
{
- QOrganizerItemLocation ld = d->m_item.detail<QOrganizerItemLocation>();
- return ld.label();
+ QDeclarativeOrganizerItemLocation* loc = d->detail<QDeclarativeOrganizerItemLocation>();
+ if (loc)
+ return loc->label();
+ return QString();
}
-void QDeclarativeOrganizerEvent::setLocation(const QString& loc)
+void QDeclarativeOrganizerEvent::setLocation(const QString& newLocation)
{
- if (loc != location()) {
- QOrganizerItemLocation ld = d->m_item.detail<QOrganizerItemLocation>();
- ld.setLabel(loc);
- d->m_item.saveDetail(&ld);
- emit valueChanged();
- }
+ QDeclarativeOrganizerItemLocation* loc = d->detail<QDeclarativeOrganizerItemLocation>();
+ if (loc)
+ loc->setLabel(newLocation);
}
/*!
- \qmlproperty ItemRecurrence Event::recurrence
+ \qmlproperty Recurrence Event::recurrence
This property holds the recurrence element of the event item.
*/
@@ -555,18 +620,17 @@ QDeclarativeOrganizerEventOccurrence::QDeclarativeOrganizerEventOccurrence(QObje
*/
void QDeclarativeOrganizerEventOccurrence::setOriginalDate(const QDate& date)
{
- if (date != originalDate()){
- QOrganizerItemParent origin = d->m_item.detail<QOrganizerItemParent>();
- origin.setOriginalDate(date);
- d->m_item.saveDetail(&origin);
- emit valueChanged();
- }
+ QDeclarativeOrganizerItemParent* parent = d->detail<QDeclarativeOrganizerItemParent>();
+ if (parent)
+ parent->setOriginalDate(date);
}
QDate QDeclarativeOrganizerEventOccurrence::originalDate() const
{
- QOrganizerItemParent origin = d->m_item.detail<QOrganizerItemParent>();
- return origin.originalDate();
+ QDeclarativeOrganizerItemParent* parent = d->detail<QDeclarativeOrganizerItemParent>();
+ if (parent)
+ return parent->originalDate();
+ return QDate();
}
/*!
@@ -576,18 +640,16 @@ QDate QDeclarativeOrganizerEventOccurrence::originalDate() const
*/
void QDeclarativeOrganizerEventOccurrence::setStartDateTime(const QDateTime& datetime)
{
- if (datetime != startDateTime()){
- QOrganizerEventTime etr = d->m_item.detail<QOrganizerEventTime>();
- etr.setStartDateTime(datetime);
- d->m_item.saveDetail(&etr);
- emit valueChanged();
- }
+ QDeclarativeOrganizerEventTime* time = d->detail<QDeclarativeOrganizerEventTime>();
+ if (time)
+ time->setStartDateTime(datetime);
}
QDateTime QDeclarativeOrganizerEventOccurrence::startDateTime() const
{
- QOrganizerEventTime etr = d->m_item.detail<QOrganizerEventTime>();
- return etr.startDateTime();
+ QDeclarativeOrganizerEventTime* time = d->detail<QDeclarativeOrganizerEventTime>();
+ return time->startDateTime();
+ return QDateTime();
}
/*!
@@ -597,19 +659,17 @@ QDateTime QDeclarativeOrganizerEventOccurrence::startDateTime() const
*/
void QDeclarativeOrganizerEventOccurrence::setParentId(const QString& pid)
{
- if (pid != parentId()) {
- QOrganizerItemId itemId = QOrganizerItemId::fromString(pid);
- QOrganizerItemParent origin = d->m_item.detail<QOrganizerItemParent>();
- origin.setParentId(itemId);
- d->m_item.saveDetail(&origin);
- emit valueChanged();
- }
+ QDeclarativeOrganizerItemParent* parent = d->detail<QDeclarativeOrganizerItemParent>();
+ if (parent)
+ parent->setParentId(pid);
}
QString QDeclarativeOrganizerEventOccurrence::parentId() const
{
- QOrganizerItemParent origin = d->m_item.detail<QOrganizerItemParent>();
- return origin.parentId().toString();
+ QDeclarativeOrganizerItemParent* parent = d->detail<QDeclarativeOrganizerItemParent>();
+ if (parent)
+ return parent->parentId();
+ return QString();
}
@@ -620,17 +680,15 @@ QString QDeclarativeOrganizerEventOccurrence::parentId() const
*/
void QDeclarativeOrganizerEventOccurrence::setEndDateTime(const QDateTime& datetime)
{
- if (datetime != endDateTime()){
- QOrganizerEventTime etr = d->m_item.detail<QOrganizerEventTime>();
- etr.setEndDateTime(datetime);
- d->m_item.saveDetail(&etr);
- emit valueChanged();
- }
+ QDeclarativeOrganizerEventTime* time = d->detail<QDeclarativeOrganizerEventTime>();
+ if (time)
+ time->setEndDateTime(datetime);
}
QDateTime QDeclarativeOrganizerEventOccurrence::endDateTime() const
{
- QOrganizerEventTime etr = d->m_item.detail<QOrganizerEventTime>();
- return etr.endDateTime();
+ QDeclarativeOrganizerEventTime* time = d->detail<QDeclarativeOrganizerEventTime>();
+ return time->endDateTime();
+ return QDateTime();
}
/*!
@@ -653,18 +711,16 @@ QDateTime QDeclarativeOrganizerEventOccurrence::endDateTime() const
*/
void QDeclarativeOrganizerEventOccurrence::setPriority(QDeclarativeOrganizerItemPriority::PriorityType value)
{
- if (value != priority()) {
- QOrganizerItemPriority::Priority newPriority = static_cast<QOrganizerItemPriority::Priority>(value);
- QOrganizerItemPriority pd = d->m_item.detail<QOrganizerItemPriority>();
- pd.setPriority(newPriority);
- d->m_item.saveDetail(&pd);
- emit valueChanged();
- }
+ QDeclarativeOrganizerItemPriority* priority = d->detail<QDeclarativeOrganizerItemPriority>();
+ if (priority)
+ priority->setPriority(value);
}
QDeclarativeOrganizerItemPriority::PriorityType QDeclarativeOrganizerEventOccurrence::priority() const
{
- QOrganizerItemPriority pd = d->m_item.detail<QOrganizerItemPriority>();
- return static_cast<QDeclarativeOrganizerItemPriority::PriorityType>(pd.priority());
+ QDeclarativeOrganizerItemPriority* priority = d->detail<QDeclarativeOrganizerItemPriority>();
+ if (priority)
+ return priority->priority();
+ return QDeclarativeOrganizerItemPriority::Unknown;
}
/*!
@@ -674,17 +730,16 @@ QDeclarativeOrganizerItemPriority::PriorityType QDeclarativeOrganizerEventOccurr
*/
QString QDeclarativeOrganizerEventOccurrence::location() const
{
- QOrganizerItemLocation ld =d->m_item.detail<QOrganizerItemLocation>();
- return ld.label();
+ QDeclarativeOrganizerItemLocation* loc = d->detail<QDeclarativeOrganizerItemLocation>();
+ if (loc)
+ return loc->label();
+ return QString();
}
-void QDeclarativeOrganizerEventOccurrence::setLocation(const QString& loc)
+void QDeclarativeOrganizerEventOccurrence::setLocation(const QString& newLocation)
{
- if (loc != location()) {
- QOrganizerItemLocation ld = d->m_item.detail<QOrganizerItemLocation>();
- ld.setLabel(loc);
- d->m_item.saveDetail(&ld);
- emit valueChanged();
- }
+ QDeclarativeOrganizerItemLocation* loc = d->detail<QDeclarativeOrganizerItemLocation>();
+ if (loc)
+ loc->setLabel(newLocation);
}
////////////////////////////////QDeclarativeOrganizerJournal////////////////////////////////////
@@ -715,18 +770,17 @@ QDeclarativeOrganizerJournal::QDeclarativeOrganizerJournal(QObject *parent)
*/
void QDeclarativeOrganizerJournal::setDateTime(const QDateTime& dt)
{
- if (dt != dateTime()) {
- QOrganizerJournalTime jtr = d->m_item.detail<QOrganizerJournalTime>();
- jtr.setEntryDateTime(dt);
- d->m_item.saveDetail(&jtr);
- emit valueChanged();
- }
+ QDeclarativeOrganizerJournalTime* time = d->detail<QDeclarativeOrganizerJournalTime>();
+ if (time)
+ time->setEntryDateTime(dt);
}
QDateTime QDeclarativeOrganizerJournal::dateTime() const
{
- QOrganizerJournalTime jtr = d->m_item.detail<QOrganizerJournalTime>();
- return jtr.entryDateTime();
+ QDeclarativeOrganizerJournalTime* time = d->detail<QDeclarativeOrganizerJournalTime>();
+ if (time)
+ return time->entryDateTime();
+ return QDateTime();
}
////////////////////QDeclarativeOrganizerNote////////////////////////
@@ -773,7 +827,7 @@ QDeclarativeOrganizerTodo::QDeclarativeOrganizerTodo(QObject *parent)
}
/*!
- \qmlproperty ItemRecurrence Todo::recurrence
+ \qmlproperty Recurrence Todo::recurrence
This property holds the recurrence element of the todo item.
*/
@@ -790,18 +844,17 @@ QDeclarativeOrganizerItemRecurrence* QDeclarativeOrganizerTodo::recurrence()
*/
void QDeclarativeOrganizerTodo::setStartDateTime(const QDateTime& datetime)
{
- if (datetime != startDateTime()) {
- QOrganizerTodoTime ttr = d->m_item.detail<QOrganizerTodoTime>();
- ttr.setStartDateTime(datetime);
- d->m_item.saveDetail(&ttr);
- emit valueChanged();
- }
+ QDeclarativeOrganizerTodoTime* time = d->detail<QDeclarativeOrganizerTodoTime>();
+ if (time)
+ time->setStartDateTime(datetime);
}
QDateTime QDeclarativeOrganizerTodo::startDateTime() const
{
- QOrganizerTodoTime ttr = d->m_item.detail<QOrganizerTodoTime>();
- return ttr.startDateTime();
+ QDeclarativeOrganizerTodoTime* time = d->detail<QDeclarativeOrganizerTodoTime>();
+ if (time)
+ return time->startDateTime();
+ return QDateTime();
}
/*!
@@ -811,18 +864,17 @@ QDateTime QDeclarativeOrganizerTodo::startDateTime() const
*/
void QDeclarativeOrganizerTodo::setDueDateTime(const QDateTime& datetime)
{
- if (datetime != dueDateTime()) {
- QOrganizerTodoTime ttr = d->m_item.detail<QOrganizerTodoTime>();
- ttr.setDueDateTime(datetime);
- d->m_item.saveDetail(&ttr);
- emit valueChanged();
- }
+ QDeclarativeOrganizerTodoTime* time = d->detail<QDeclarativeOrganizerTodoTime>();
+ if (time)
+ time->setDueDateTime(datetime);
}
QDateTime QDeclarativeOrganizerTodo::dueDateTime() const
{
- QOrganizerTodoTime ttr = d->m_item.detail<QOrganizerTodoTime>();
- return ttr.dueDateTime();
+ QDeclarativeOrganizerTodoTime* time = d->detail<QDeclarativeOrganizerTodoTime>();
+ if (time)
+ return time->dueDateTime();
+ return QDateTime();
}
/*!
@@ -834,18 +886,17 @@ QDateTime QDeclarativeOrganizerTodo::dueDateTime() const
*/
void QDeclarativeOrganizerTodo::setAllDay(bool allDay)
{
- if (allDay != isAllDay()) {
- QOrganizerTodoTime ttr = d->m_item.detail<QOrganizerTodoTime>();
- ttr.setAllDay(allDay);
- d->m_item.saveDetail(&ttr);
- emit valueChanged();
- }
+ QDeclarativeOrganizerTodoTime* time = d->detail<QDeclarativeOrganizerTodoTime>();
+ if (time)
+ time->setAllDay(allDay);
}
bool QDeclarativeOrganizerTodo::isAllDay() const
{
- QOrganizerTodoTime ttr =d->m_item.detail<QOrganizerTodoTime>();
- return ttr.isAllDay();
+ QDeclarativeOrganizerTodoTime* time = d->detail<QDeclarativeOrganizerTodoTime>();
+ if (time)
+ return time->isAllDay();
+ return false;
}
/*!
@@ -868,19 +919,17 @@ bool QDeclarativeOrganizerTodo::isAllDay() const
*/
void QDeclarativeOrganizerTodo::setPriority(QDeclarativeOrganizerItemPriority::PriorityType value)
{
- if (value != priority()) {
- QOrganizerItemPriority::Priority newPriority = static_cast<QOrganizerItemPriority::Priority>(value);
- QOrganizerItemPriority pd = d->m_item.detail<QOrganizerItemPriority>();
- pd.setPriority(newPriority);
- d->m_item.saveDetail(&pd);
- emit valueChanged();
- }
+ QDeclarativeOrganizerItemPriority* pri = d->detail<QDeclarativeOrganizerItemPriority>();
+ if (pri)
+ pri->setPriority(value);
}
QDeclarativeOrganizerItemPriority::PriorityType QDeclarativeOrganizerTodo::priority() const
{
- QOrganizerItemPriority pd = d->m_item.detail<QOrganizerItemPriority>();
- return static_cast<QDeclarativeOrganizerItemPriority::PriorityType>(pd.priority());
+ QDeclarativeOrganizerItemPriority* pri = d->detail<QDeclarativeOrganizerItemPriority>();
+ if (pri)
+ return pri->priority();
+ return QDeclarativeOrganizerItemPriority::Unknown;
}
/*!
@@ -890,18 +939,17 @@ QDeclarativeOrganizerItemPriority::PriorityType QDeclarativeOrganizerTodo::prior
*/
void QDeclarativeOrganizerTodo::setProgressPercentage(int percentage)
{
- if (percentage != progressPercentage()) {
- QOrganizerTodoProgress tp = d->m_item.detail<QOrganizerTodoProgress>();
- tp.setPercentageComplete(percentage);
- d->m_item.saveDetail(&tp);
- emit valueChanged();
- }
+ QDeclarativeOrganizerTodoProgress* progress = d->detail<QDeclarativeOrganizerTodoProgress>();
+ if (progress)
+ progress->setPercentageComplete(percentage);
}
int QDeclarativeOrganizerTodo::progressPercentage() const
{
- QOrganizerTodoProgress tp = d->m_item.detail<QOrganizerTodoProgress>();
- return tp.percentageComplete();
+ QDeclarativeOrganizerTodoProgress* progress = d->detail<QDeclarativeOrganizerTodoProgress>();
+ if (progress)
+ return progress->percentageComplete();
+ return 0;
}
@@ -918,19 +966,17 @@ int QDeclarativeOrganizerTodo::progressPercentage() const
*/
void QDeclarativeOrganizerTodo::setStatus(QDeclarativeOrganizerTodoProgress::StatusType value)
{
- if (value != status()) {
- QOrganizerTodoProgress::Status newStatus = static_cast<QOrganizerTodoProgress::Status>(value);
- QOrganizerTodoProgress tp = d->m_item.detail<QOrganizerTodoProgress>();
- tp.setStatus(newStatus);
- d->m_item.saveDetail(&tp);
- emit valueChanged();
- }
+ QDeclarativeOrganizerTodoProgress* progress = d->detail<QDeclarativeOrganizerTodoProgress>();
+ if (progress)
+ progress->setStatus(value);
}
QDeclarativeOrganizerTodoProgress::StatusType QDeclarativeOrganizerTodo::status() const
{
- QOrganizerTodoProgress tp = d->m_item.detail<QOrganizerTodoProgress>();
- return static_cast<QDeclarativeOrganizerTodoProgress::StatusType>(tp.status());
+ QDeclarativeOrganizerTodoProgress* progress = d->detail<QDeclarativeOrganizerTodoProgress>();
+ if (progress)
+ return progress->status();
+ return QDeclarativeOrganizerTodoProgress::NotStarted;
}
/*!
@@ -940,18 +986,17 @@ QDeclarativeOrganizerTodoProgress::StatusType QDeclarativeOrganizerTodo::status(
*/
void QDeclarativeOrganizerTodo::setFinishedDateTime(const QDateTime& datetime)
{
- if (datetime != finishedDateTime()) {
- QOrganizerTodoProgress tp =d->m_item.detail<QOrganizerTodoProgress>();
- tp.setFinishedDateTime(datetime);
- d->m_item.saveDetail(&tp);
- emit valueChanged();
- }
+ QDeclarativeOrganizerTodoProgress* progress = d->detail<QDeclarativeOrganizerTodoProgress>();
+ if (progress)
+ progress->setFinishedDateTime(datetime);
}
QDateTime QDeclarativeOrganizerTodo::finishedDateTime() const
{
- QOrganizerTodoProgress tp = d->m_item.detail<QOrganizerTodoProgress>();
- return tp.finishedDateTime();
+ QDeclarativeOrganizerTodoProgress* progress = d->detail<QDeclarativeOrganizerTodoProgress>();
+ if (progress)
+ return progress->finishedDateTime();
+ return QDateTime();
}
//////////////////////////QDeclarativeOrganizerTodoOccurrence////////////////////////////////
@@ -982,18 +1027,17 @@ QDeclarativeOrganizerTodoOccurrence::QDeclarativeOrganizerTodoOccurrence(QObject
*/
void QDeclarativeOrganizerTodoOccurrence::setStartDateTime(const QDateTime& datetime)
{
- if (datetime != startDateTime()) {
- QOrganizerTodoTime ttr = d->m_item.detail<QOrganizerTodoTime>();
- ttr.setStartDateTime(datetime);
- d->m_item.saveDetail(&ttr);
- emit valueChanged();
- }
+ QDeclarativeOrganizerTodoTime* time = d->detail<QDeclarativeOrganizerTodoTime>();
+ if (time)
+ time->setStartDateTime(datetime);
}
QDateTime QDeclarativeOrganizerTodoOccurrence::startDateTime() const
{
- QOrganizerTodoTime ttr = d->m_item.detail<QOrganizerTodoTime>();
- return ttr.startDateTime();
+ QDeclarativeOrganizerTodoTime* time = d->detail<QDeclarativeOrganizerTodoTime>();
+ if (time)
+ return time->startDateTime();
+ return QDateTime();
}
/*!
\qmlproperty date TodoOccurrence::dueDateTime
@@ -1002,18 +1046,17 @@ QDateTime QDeclarativeOrganizerTodoOccurrence::startDateTime() const
*/
void QDeclarativeOrganizerTodoOccurrence::setDueDateTime(const QDateTime& datetime)
{
- if (datetime != dueDateTime()) {
- QOrganizerTodoTime ttr = d->m_item.detail<QOrganizerTodoTime>();
- ttr.setDueDateTime(datetime);
- d->m_item.saveDetail(&ttr);
- emit valueChanged();
- }
+ QDeclarativeOrganizerTodoTime* time = d->detail<QDeclarativeOrganizerTodoTime>();
+ if (time)
+ time->setDueDateTime(datetime);
}
QDateTime QDeclarativeOrganizerTodoOccurrence::dueDateTime() const
{
- QOrganizerTodoTime ttr = d->m_item.detail<QOrganizerTodoTime>();
- return ttr.dueDateTime();
+ QDeclarativeOrganizerTodoTime* time = d->detail<QDeclarativeOrganizerTodoTime>();
+ if (time)
+ return time->dueDateTime();
+ return QDateTime();
}
/*!
@@ -1036,19 +1079,17 @@ QDateTime QDeclarativeOrganizerTodoOccurrence::dueDateTime() const
*/
void QDeclarativeOrganizerTodoOccurrence::setPriority(QDeclarativeOrganizerItemPriority::PriorityType value)
{
- if (value != priority()) {
- QOrganizerItemPriority::Priority newPriority = static_cast<QOrganizerItemPriority::Priority>(value);
- QOrganizerItemPriority pd = d->m_item.detail<QOrganizerItemPriority>();
- pd.setPriority(newPriority);
- d->m_item.saveDetail(&pd);
- emit valueChanged();
- }
+ QDeclarativeOrganizerItemPriority* pri = d->detail<QDeclarativeOrganizerItemPriority>();
+ if (pri)
+ pri->setPriority(value);
}
QDeclarativeOrganizerItemPriority::PriorityType QDeclarativeOrganizerTodoOccurrence::priority() const
{
- QOrganizerItemPriority pd =d->m_item.detail<QOrganizerItemPriority>();
- return static_cast<QDeclarativeOrganizerItemPriority::PriorityType>(pd.priority());
+ QDeclarativeOrganizerItemPriority* pri = d->detail<QDeclarativeOrganizerItemPriority>();
+ if (pri)
+ return pri->priority();
+ return QDeclarativeOrganizerItemPriority::Unknown;
}
/*!
@@ -1058,18 +1099,17 @@ QDeclarativeOrganizerItemPriority::PriorityType QDeclarativeOrganizerTodoOccurre
*/
void QDeclarativeOrganizerTodoOccurrence::setProgressPercentage(int percentage)
{
- if (percentage != progressPercentage()) {
- QOrganizerTodoProgress tp = d->m_item.detail<QOrganizerTodoProgress>();
- tp.setPercentageComplete(percentage);
- d->m_item.saveDetail(&tp);
- emit valueChanged();
- }
+ QDeclarativeOrganizerTodoProgress* progress = d->detail<QDeclarativeOrganizerTodoProgress>();
+ if (progress)
+ progress->setPercentageComplete(percentage);
}
int QDeclarativeOrganizerTodoOccurrence::progressPercentage() const
{
- QOrganizerTodoProgress tp = d->m_item.detail<QOrganizerTodoProgress>();
- return tp.percentageComplete();
+ QDeclarativeOrganizerTodoProgress* progress = d->detail<QDeclarativeOrganizerTodoProgress>();
+ if (progress)
+ return progress->percentageComplete();
+ return 0;
}
/*!
@@ -1085,20 +1125,17 @@ int QDeclarativeOrganizerTodoOccurrence::progressPercentage() const
*/
void QDeclarativeOrganizerTodoOccurrence::setStatus(QDeclarativeOrganizerTodoProgress::StatusType value)
{
- if (value != status()) {
- QOrganizerTodoProgress::Status newStatus = static_cast<QOrganizerTodoProgress::Status>(value);
- QOrganizerTodoProgress tp = d->m_item.detail<QOrganizerTodoProgress>();
- tp.setStatus(newStatus);
- d->m_item.saveDetail(&tp);
- emit valueChanged();
- }
+ QDeclarativeOrganizerTodoProgress* progress = d->detail<QDeclarativeOrganizerTodoProgress>();
+ if (progress)
+ progress->setStatus(value);
}
QDeclarativeOrganizerTodoProgress::StatusType QDeclarativeOrganizerTodoOccurrence::status() const
{
- QOrganizerTodoProgress tp = d->m_item.detail<QOrganizerTodoProgress>();
-
- return static_cast<QDeclarativeOrganizerTodoProgress::StatusType>( tp.status());
+ QDeclarativeOrganizerTodoProgress* progress = d->detail<QDeclarativeOrganizerTodoProgress>();
+ if (progress)
+ return progress->status();
+ return QDeclarativeOrganizerTodoProgress::NotStarted;
}
/*!
@@ -1108,18 +1145,17 @@ QDeclarativeOrganizerTodoProgress::StatusType QDeclarativeOrganizerTodoOccurrenc
*/
void QDeclarativeOrganizerTodoOccurrence::setFinishedDateTime(const QDateTime& datetime)
{
- if (datetime != finishedDateTime()) {
- QOrganizerTodoProgress tp = d->m_item.detail<QOrganizerTodoProgress>();
- tp.setFinishedDateTime(datetime);
- d->m_item.saveDetail(&tp);
- emit valueChanged();
- }
+ QDeclarativeOrganizerTodoProgress* progress = d->detail<QDeclarativeOrganizerTodoProgress>();
+ if (progress)
+ progress->setFinishedDateTime(datetime);
}
QDateTime QDeclarativeOrganizerTodoOccurrence::finishedDateTime() const
{
- QOrganizerTodoProgress tp = d->m_item.detail<QOrganizerTodoProgress>();
- return tp.finishedDateTime();
+ QDeclarativeOrganizerTodoProgress* progress = d->detail<QDeclarativeOrganizerTodoProgress>();
+ if (progress)
+ return progress->finishedDateTime();
+ return QDateTime();
}
/*!
@@ -1129,19 +1165,17 @@ QDateTime QDeclarativeOrganizerTodoOccurrence::finishedDateTime() const
*/
void QDeclarativeOrganizerTodoOccurrence::setParentId(const QString& pid)
{
- if (pid != parentId()) {
- QOrganizerItemId itemId = QOrganizerItemId::fromString(pid);
- QOrganizerItemParent origin = d->m_item.detail<QOrganizerItemParent>();
- origin.setParentId(itemId);
- d->m_item.saveDetail(&origin);
- emit valueChanged();
- }
+ QDeclarativeOrganizerItemParent* parent = d->detail<QDeclarativeOrganizerItemParent>();
+ if (parent)
+ parent->setParentId(pid);
}
QString QDeclarativeOrganizerTodoOccurrence::parentId() const
{
- QOrganizerItemParent origin = d->m_item.detail<QOrganizerItemParent>();
- return origin.parentId().toString();
+ QDeclarativeOrganizerItemParent* parent = d->detail<QDeclarativeOrganizerItemParent>();
+ if (parent)
+ return parent->parentId();
+ return QString();
}
/*!
\qmlproperty date TodoOccurrence::originalDate
@@ -1150,18 +1184,17 @@ QString QDeclarativeOrganizerTodoOccurrence::parentId() const
*/
void QDeclarativeOrganizerTodoOccurrence::setOriginalDate(const QDate& date)
{
- if (date != originalDate()) {
- QOrganizerItemParent origin = d->m_item.detail<QOrganizerItemParent>();
- origin.setOriginalDate(date);
- d->m_item.saveDetail(&origin);
- emit valueChanged();
- }
+ QDeclarativeOrganizerItemParent* parent = d->detail<QDeclarativeOrganizerItemParent>();
+ if (parent)
+ parent->setOriginalDate(date);
}
QDate QDeclarativeOrganizerTodoOccurrence::originalDate() const
{
- QOrganizerItemParent origin = d->m_item.detail<QOrganizerItemParent>();
- return origin.originalDate();
+ QDeclarativeOrganizerItemParent* parent = d->detail<QDeclarativeOrganizerItemParent>();
+ if (parent)
+ return parent->originalDate();
+ return QDate();
}
Q_DEFINE_LATIN1_CONSTANT(QDeclarativeOrganizerEvent::ItemName, "event");
diff --git a/plugins/declarative/organizer/qdeclarativeorganizeritem_p.h b/plugins/declarative/organizer/qdeclarativeorganizeritem_p.h
index a33e3eb790..16b35f3a60 100644
--- a/plugins/declarative/organizer/qdeclarativeorganizeritem_p.h
+++ b/plugins/declarative/organizer/qdeclarativeorganizeritem_p.h
@@ -67,6 +67,8 @@ class QDeclarativeOrganizerItem : public QObject
Q_PROPERTY (bool modified READ modified NOTIFY itemChanged)
Q_PROPERTY(QDateTime itemStartTime READ itemStartTime NOTIFY itemChanged)
Q_PROPERTY(QDateTime itemEndTime READ itemEndTime NOTIFY itemChanged)
+ Q_PROPERTY(bool isOccurrence READ isOccurrence)
+ Q_PROPERTY(bool isFloatingTime READ isFloatingTime)
Q_ENUMS(OrganizerItemType)
Q_CLASSINFO("DefaultProperty", "details")
@@ -91,6 +93,8 @@ public:
QString manager() const;
bool modified() const;
+ bool isFloatingTime() const;
+
QDateTime itemStartTime() const;
QDateTime itemEndTime() const;
void setItem(const QOrganizerItem& c);
@@ -113,6 +117,7 @@ public:
void setDescription(const QString& description);
QString guid() const;
void setGuid(const QString& guid);
+ bool isOccurrence() const;
public slots:
void save();
diff --git a/plugins/declarative/organizer/qdeclarativeorganizeritemdetail.cpp b/plugins/declarative/organizer/qdeclarativeorganizeritemdetail.cpp
index 7191ff6d9e..44ccb29862 100644
--- a/plugins/declarative/organizer/qdeclarativeorganizeritemdetail.cpp
+++ b/plugins/declarative/organizer/qdeclarativeorganizeritemdetail.cpp
@@ -134,6 +134,52 @@ QString QDeclarativeOrganizerItemDetail::definitionName(QDeclarativeOrganizerIte
{
switch (type) {
case QDeclarativeOrganizerItemDetail::EventTime:
+ return QOrganizerEventTime::DefinitionName;
+ case QDeclarativeOrganizerItemDetail::JournalTime:
+ return QOrganizerJournalTime::DefinitionName;
+ case QDeclarativeOrganizerItemDetail::TodoTime:
+ return QOrganizerTodoTime::DefinitionName;
+ case QDeclarativeOrganizerItemDetail::TodoProgress:
+ return QOrganizerTodoProgress::DefinitionName;
+ case QDeclarativeOrganizerItemDetail::Reminder:
+ return QOrganizerItemReminder::DefinitionName;
+ case QDeclarativeOrganizerItemDetail::AudibleReminder:
+ return QOrganizerItemAudibleReminder::DefinitionName;
+ case QDeclarativeOrganizerItemDetail::VisualReminder:
+ return QOrganizerItemVisualReminder::DefinitionName;
+ case QDeclarativeOrganizerItemDetail::EmailReminder:
+ return QOrganizerItemEmailReminder::DefinitionName;
+ case QDeclarativeOrganizerItemDetail::Comment:
+ return QOrganizerItemComment::DefinitionName;
+ case QDeclarativeOrganizerItemDetail::Description:
+ return QOrganizerItemDescription::DefinitionName;
+ case QDeclarativeOrganizerItemDetail::DisplayLabel:
+ return QOrganizerItemDisplayLabel::DefinitionName;
+ case QDeclarativeOrganizerItemDetail::Guid:
+ return QOrganizerItemGuid::DefinitionName;
+ case QDeclarativeOrganizerItemDetail::Location:
+ return QOrganizerItemLocation::DefinitionName;
+ case QDeclarativeOrganizerItemDetail::Parent:
+ return QOrganizerItemParent::DefinitionName;
+ case QDeclarativeOrganizerItemDetail::Priority:
+ return QOrganizerItemPriority::DefinitionName;
+ case QDeclarativeOrganizerItemDetail::Recurrence:
+ return QOrganizerItemRecurrence::DefinitionName;
+ case QDeclarativeOrganizerItemDetail::Timestamp:
+ return QOrganizerItemTimestamp::DefinitionName;
+ case QDeclarativeOrganizerItemDetail::Type:
+ return QOrganizerItemType::DefinitionName;
+ default:
+ break;
+ }
+ qWarning() << QString("Can't find the detail definition name for detail type '%1'").arg(type);
+ return QString();
+}
+
+QString QDeclarativeOrganizerItemDetail::detailName(QDeclarativeOrganizerItemDetail::ItemDetailType type)
+{
+ switch (type) {
+ case QDeclarativeOrganizerItemDetail::EventTime:
return QDeclarativeOrganizerEventTime::DetailName;
case QDeclarativeOrganizerItemDetail::JournalTime:
return QDeclarativeOrganizerJournalTime::DetailName;
@@ -177,48 +223,91 @@ QString QDeclarativeOrganizerItemDetail::definitionName(QDeclarativeOrganizerIte
}
-QDeclarativeOrganizerItemDetail::ItemDetailType QDeclarativeOrganizerItemDetail::detailType(const QString& definitionName)
+QDeclarativeOrganizerItemDetail::ItemDetailType QDeclarativeOrganizerItemDetail::detailTypeByDefinitionName(const QString& definitionName)
{
- if (definitionName == QDeclarativeOrganizerEventTime::DetailName)
+ if (definitionName == QOrganizerEventTime::DefinitionName)
return QDeclarativeOrganizerItemDetail::EventTime;
- if (definitionName == QDeclarativeOrganizerJournalTime::DetailName)
+ if (definitionName == QOrganizerJournalTime::DefinitionName)
return QDeclarativeOrganizerItemDetail::JournalTime;
- if (definitionName == QDeclarativeOrganizerTodoTime::DetailName)
+ if (definitionName == QOrganizerTodoTime::DefinitionName)
return QDeclarativeOrganizerItemDetail::TodoTime;
- if (definitionName == QDeclarativeOrganizerTodoProgress::DetailName)
+ if (definitionName == QOrganizerTodoProgress::DefinitionName)
return QDeclarativeOrganizerItemDetail::TodoProgress;
- if (definitionName == QDeclarativeOrganizerItemReminder::DetailName)
+ if (definitionName == QOrganizerItemReminder::DefinitionName)
return QDeclarativeOrganizerItemDetail::Reminder;
- if (definitionName == QDeclarativeOrganizerItemAudibleReminder::DetailName)
+ if (definitionName == QOrganizerItemAudibleReminder::DefinitionName)
return QDeclarativeOrganizerItemDetail::AudibleReminder;
- if (definitionName == QDeclarativeOrganizerItemVisualReminder::DetailName)
+ if (definitionName == QOrganizerItemVisualReminder::DefinitionName)
return QDeclarativeOrganizerItemDetail::VisualReminder;
- if (definitionName == QDeclarativeOrganizerItemEmailReminder::DetailName)
+ if (definitionName == QOrganizerItemEmailReminder::DefinitionName)
return QDeclarativeOrganizerItemDetail::EmailReminder;
- if (definitionName == QDeclarativeOrganizerItemComment::DetailName)
+ if (definitionName == QOrganizerItemComment::DefinitionName)
return QDeclarativeOrganizerItemDetail::Comment;
- if (definitionName == QDeclarativeOrganizerItemDescription::DetailName)
+ if (definitionName == QOrganizerItemDescription::DefinitionName)
return QDeclarativeOrganizerItemDetail::Description;
- if (definitionName == QDeclarativeOrganizerItemDisplayLabel::DetailName)
+ if (definitionName == QOrganizerItemDisplayLabel::DefinitionName)
return QDeclarativeOrganizerItemDetail::DisplayLabel;
- if (definitionName == QDeclarativeOrganizerItemGuid::DetailName)
+ if (definitionName == QOrganizerItemGuid::DefinitionName)
return QDeclarativeOrganizerItemDetail::Guid;
- if (definitionName == QDeclarativeOrganizerItemLocation::DetailName)
+ if (definitionName == QOrganizerItemLocation::DefinitionName)
return QDeclarativeOrganizerItemDetail::Location;
- if (definitionName == QDeclarativeOrganizerItemParent::DetailName)
+ if (definitionName == QOrganizerItemParent::DefinitionName)
return QDeclarativeOrganizerItemDetail::Parent;
- if (definitionName == QDeclarativeOrganizerItemPriority::DetailName)
+ if (definitionName == QOrganizerItemPriority::DefinitionName)
return QDeclarativeOrganizerItemDetail::Priority;
- if (definitionName == QDeclarativeOrganizerItemRecurrence::DetailName)
+ if (definitionName == QOrganizerItemRecurrence::DefinitionName)
return QDeclarativeOrganizerItemDetail::Recurrence;
- if (definitionName == QDeclarativeOrganizerItemTimestamp::DetailName)
+ if (definitionName == QOrganizerItemTimestamp::DefinitionName)
return QDeclarativeOrganizerItemDetail::Timestamp;
- if (definitionName == QDeclarativeOrganizerItemType::DetailName)
+ if (definitionName == QOrganizerItemType::DefinitionName)
return QDeclarativeOrganizerItemDetail::Type;
qWarning() << QString("Can't find the detail type for detail name '%1'").arg(definitionName);
return QDeclarativeOrganizerItemDetail::Customized;
}
+QDeclarativeOrganizerItemDetail::ItemDetailType QDeclarativeOrganizerItemDetail::detailTypeByDetailName(const QString& detailName)
+{
+ if (detailName == QDeclarativeOrganizerEventTime::DetailName)
+ return QDeclarativeOrganizerItemDetail::EventTime;
+ if (detailName == QDeclarativeOrganizerJournalTime::DetailName)
+ return QDeclarativeOrganizerItemDetail::JournalTime;
+ if (detailName == QDeclarativeOrganizerTodoTime::DetailName)
+ return QDeclarativeOrganizerItemDetail::TodoTime;
+ if (detailName == QDeclarativeOrganizerTodoProgress::DetailName)
+ return QDeclarativeOrganizerItemDetail::TodoProgress;
+ if (detailName == QDeclarativeOrganizerItemReminder::DetailName)
+ return QDeclarativeOrganizerItemDetail::Reminder;
+ if (detailName == QDeclarativeOrganizerItemAudibleReminder::DetailName)
+ return QDeclarativeOrganizerItemDetail::AudibleReminder;
+ if (detailName == QDeclarativeOrganizerItemVisualReminder::DetailName)
+ return QDeclarativeOrganizerItemDetail::VisualReminder;
+ if (detailName == QDeclarativeOrganizerItemEmailReminder::DetailName)
+ return QDeclarativeOrganizerItemDetail::EmailReminder;
+ if (detailName == QDeclarativeOrganizerItemComment::DetailName)
+ return QDeclarativeOrganizerItemDetail::Comment;
+ if (detailName == QDeclarativeOrganizerItemDescription::DetailName)
+ return QDeclarativeOrganizerItemDetail::Description;
+ if (detailName == QDeclarativeOrganizerItemDisplayLabel::DetailName)
+ return QDeclarativeOrganizerItemDetail::DisplayLabel;
+ if (detailName == QDeclarativeOrganizerItemGuid::DetailName)
+ return QDeclarativeOrganizerItemDetail::Guid;
+ if (detailName == QDeclarativeOrganizerItemLocation::DetailName)
+ return QDeclarativeOrganizerItemDetail::Location;
+ if (detailName == QDeclarativeOrganizerItemParent::DetailName)
+ return QDeclarativeOrganizerItemDetail::Parent;
+ if (detailName == QDeclarativeOrganizerItemPriority::DetailName)
+ return QDeclarativeOrganizerItemDetail::Priority;
+ if (detailName == QDeclarativeOrganizerItemRecurrence::DetailName)
+ return QDeclarativeOrganizerItemDetail::Recurrence;
+ if (detailName == QDeclarativeOrganizerItemTimestamp::DetailName)
+ return QDeclarativeOrganizerItemDetail::Timestamp;
+ if (detailName == QDeclarativeOrganizerItemType::DetailName)
+ return QDeclarativeOrganizerItemDetail::Type;
+ qWarning() << QString("Can't find the detail type for detail name '%1'").arg(detailName);
+ return QDeclarativeOrganizerItemDetail::Customized;
+}
+
+
QString QDeclarativeOrganizerItemDetail::fieldName(QDeclarativeOrganizerItemDetail::ItemDetailType detailType, int fieldType)
{
switch (detailType) {
@@ -762,9 +851,9 @@ QString QDeclarativeOrganizerItemTimestamp::fieldNameFromFieldType(int type)
*/
/*!
- \qmlproperty int Parent::parentId
+ \qmlproperty string Parent::parentId
- This property holds the id of the parent recurrent event or todo.
+ This property holds the organizer item id of the parent recurrent event or todo.
*/
/*!
diff --git a/plugins/declarative/organizer/qdeclarativeorganizeritemdetail_p.h b/plugins/declarative/organizer/qdeclarativeorganizeritemdetail_p.h
index a51176f083..185577ae6f 100644
--- a/plugins/declarative/organizer/qdeclarativeorganizeritemdetail_p.h
+++ b/plugins/declarative/organizer/qdeclarativeorganizeritemdetail_p.h
@@ -142,8 +142,10 @@ public:
return ok;
}
+ static QString detailName(ItemDetailType type) ;
static QString definitionName(ItemDetailType type) ;
- static ItemDetailType detailType(const QString& definitionName) ;
+ static ItemDetailType detailTypeByDefinitionName(const QString& definitionName) ;
+ static ItemDetailType detailTypeByDetailName(const QString& definitionName) ;
static QString fieldName(ItemDetailType detailType, int fieldType);
signals:
@@ -187,19 +189,19 @@ public:
void setStartDateTime(const QDateTime& datetime)
{
if (datetime != startDateTime() && !readOnly()) {
- m_detail.setValue(QOrganizerEventTime::FieldStartDateTime, datetime);
+ m_detail.setValue(QOrganizerEventTime::FieldStartDateTime, datetime.toUTC());
emit valueChanged();
}
}
- QDateTime startDateTime() const {return m_detail.value<QDateTime>(QOrganizerEventTime::FieldStartDateTime);}
+ QDateTime startDateTime() const {return m_detail.value<QDateTime>(QOrganizerEventTime::FieldStartDateTime).toLocalTime();}
void setEndDateTime(const QDateTime& datetime)
{
if (datetime != endDateTime() && !readOnly()) {
- m_detail.setValue(QOrganizerEventTime::FieldEndDateTime, datetime);
+ m_detail.setValue(QOrganizerEventTime::FieldEndDateTime, datetime.toUTC());
emit valueChanged();
}
}
- QDateTime endDateTime() const {return m_detail.value<QDateTime>(QOrganizerEventTime::FieldEndDateTime);}
+ QDateTime endDateTime() const {return m_detail.value<QDateTime>(QOrganizerEventTime::FieldEndDateTime).toLocalTime();}
void setAllDay(bool allDay)
{
if (allDay != isAllDay() && !readOnly()) {
@@ -369,7 +371,7 @@ QML_DECLARE_TYPE(QDeclarativeOrganizerItemGuid)
class QDeclarativeOrganizerItemParent : public QDeclarativeOrganizerItemDetail
{
Q_OBJECT
- Q_PROPERTY(uint parentId READ parentId WRITE setParentId NOTIFY valueChanged)
+ Q_PROPERTY(QString parentId READ parentId WRITE setParentId NOTIFY valueChanged)
Q_PROPERTY(QDate originalDate READ originalDate WRITE setOriginalDate NOTIFY valueChanged)
Q_ENUMS(FieldType)
@@ -393,16 +395,16 @@ public:
return QDeclarativeOrganizerItemDetail::Parent;
}
- void setParentId(uint newParentId)
+ void setParentId(const QString& newParentId)
{
if (newParentId != parentId() && !readOnly()) {
- m_detail.setValue(QOrganizerItemParent::FieldParentId, newParentId);
+ m_detail.setValue(QOrganizerItemParent::FieldParentId, QVariant::fromValue(QOrganizerItemId::fromString(newParentId)));
emit valueChanged();
}
}
- uint parentId() const
+ QString parentId() const
{
- return m_detail.variantValue(QOrganizerItemParent::FieldParentId).toInt();
+ return m_detail.variantValue(QOrganizerItemParent::FieldParentId).value<QOrganizerItemId>().toString();
}
@@ -636,10 +638,10 @@ QML_DECLARE_TYPE(QDeclarativeOrganizerItemRecurrence)
class QDeclarativeOrganizerItemReminder : public QDeclarativeOrganizerItemDetail
{
Q_OBJECT
- Q_PROPERTY(ReminderType reminderType READ reminderType NOTIFY valueChanged)
- Q_PROPERTY(int secondsBeforeStart READ secondsBeforeStart WRITE setSecondsBeforeStart NOTIFY valueChanged)
- Q_PROPERTY(int repetitionCount READ repetitionCount WRITE setRepetitionCount NOTIFY valueChanged)
- Q_PROPERTY(int repetitionDelay READ repetitionDelay WRITE setRepetitionDelay NOTIFY valueChanged)
+ Q_PROPERTY(ReminderType reminderType READ reminderType NOTIFY reminderChanged)
+ Q_PROPERTY(int secondsBeforeStart READ secondsBeforeStart WRITE setSecondsBeforeStart NOTIFY reminderChanged)
+ Q_PROPERTY(int repetitionCount READ repetitionCount WRITE setRepetitionCount NOTIFY reminderChanged)
+ Q_PROPERTY(int repetitionDelay READ repetitionDelay WRITE setRepetitionDelay NOTIFY reminderChanged)
Q_ENUMS(ReminderType)
Q_ENUMS(FieldType)
public:
@@ -664,7 +666,7 @@ public:
:QDeclarativeOrganizerItemDetail(parent)
{
setDetail(QOrganizerItemReminder());
- connect(this, SIGNAL(valueChanged()), SIGNAL(detailChanged()));
+ connect(this, SIGNAL(reminderChanged()), SIGNAL(detailChanged()));
}
virtual ItemDetailType type() const
@@ -689,7 +691,7 @@ public:
{
if (seconds != secondsBeforeStart() && !readOnly()) {
m_detail.setValue(QOrganizerItemReminder::FieldSecondsBeforeStart, seconds);
- emit valueChanged();
+ emit reminderChanged();
}
}
int secondsBeforeStart() const {return m_detail.value<int>(QOrganizerItemReminder::FieldSecondsBeforeStart);}
@@ -698,21 +700,21 @@ public:
{
if (delaySeconds != repetitionDelay() && !readOnly()) {
m_detail.setValue(QOrganizerItemReminder::FieldRepetitionDelay, delaySeconds);
- emit valueChanged();
+ emit reminderChanged();
}
}
void setRepetitionCount(int count)
{
if (count != repetitionCount() && !readOnly()) {
m_detail.setValue(QOrganizerItemReminder::FieldRepetitionCount, count);
- emit valueChanged();
+ emit reminderChanged();
}
}
int repetitionDelay() const {return m_detail.value<int>(QOrganizerItemReminder::FieldRepetitionDelay);}
int repetitionCount() const {return m_detail.value<int>(QOrganizerItemReminder::FieldRepetitionCount);}
signals:
- void valueChanged();
+ void reminderChanged();
};
QML_DECLARE_TYPE(QDeclarativeOrganizerItemReminder)
@@ -901,19 +903,19 @@ public:
void setLastModified(const QDateTime& timestamp)
{
if (timestamp != lastModified() && !readOnly()) {
- m_detail.setValue(QOrganizerItemTimestamp::FieldModificationTimestamp, timestamp);
+ m_detail.setValue(QOrganizerItemTimestamp::FieldModificationTimestamp, timestamp.toUTC());
emit valueChanged();
}
}
- QDateTime lastModified() const {return m_detail.value<QDateTime>(QOrganizerItemTimestamp::FieldModificationTimestamp);}
+ QDateTime lastModified() const {return m_detail.value<QDateTime>(QOrganizerItemTimestamp::FieldModificationTimestamp).toLocalTime();}
void setCreated(const QDateTime& timestamp)
{
if (timestamp != created() && !readOnly()) {
- m_detail.setValue(QOrganizerItemTimestamp::FieldCreationTimestamp, timestamp);
+ m_detail.setValue(QOrganizerItemTimestamp::FieldCreationTimestamp, timestamp.toUTC());
emit valueChanged();
}
}
- QDateTime created() const {return m_detail.value<QDateTime>(QOrganizerItemTimestamp::FieldCreationTimestamp);}
+ QDateTime created() const {return m_detail.value<QDateTime>(QOrganizerItemTimestamp::FieldCreationTimestamp).toLocalTime();}
signals:
void valueChanged();
@@ -1033,11 +1035,11 @@ public:
void setEntryDateTime(const QDateTime& datetime)
{
if (datetime != entryDateTime() && !readOnly()) {
- m_detail.setValue(QOrganizerJournalTime::FieldEntryDateTime, datetime);
+ m_detail.setValue(QOrganizerJournalTime::FieldEntryDateTime, datetime.toUTC());
emit valueChanged();
}
}
- QDateTime entryDateTime() const {return m_detail.value<QDateTime>(QOrganizerJournalTime::FieldEntryDateTime);}
+ QDateTime entryDateTime() const {return m_detail.value<QDateTime>(QOrganizerJournalTime::FieldEntryDateTime).toLocalTime();}
signals:
void valueChanged();
};
@@ -1082,11 +1084,11 @@ public:
void setFinishedDateTime(const QDateTime& datetime)
{
if (datetime != finishedDateTime() && !readOnly()) {
- m_detail.setValue(QOrganizerTodoProgress::FieldFinishedDateTime, datetime);
+ m_detail.setValue(QOrganizerTodoProgress::FieldFinishedDateTime, datetime.toUTC());
emit valueChanged();
}
}
- QDateTime finishedDateTime() const {return m_detail.value<QDateTime>(QOrganizerTodoProgress::FieldFinishedDateTime);}
+ QDateTime finishedDateTime() const {return m_detail.value<QDateTime>(QOrganizerTodoProgress::FieldFinishedDateTime).toLocalTime();}
void setPercentageComplete(int percentage)
{
@@ -1147,19 +1149,19 @@ public:
void setStartDateTime(const QDateTime& datetime)
{
if (datetime != startDateTime() && !readOnly()) {
- m_detail.setValue(QOrganizerTodoTime::FieldStartDateTime, datetime);
+ m_detail.setValue(QOrganizerTodoTime::FieldStartDateTime, datetime.toUTC());
emit valueChanged();
}
}
- QDateTime startDateTime() const {return m_detail.value<QDateTime>(QOrganizerTodoTime::FieldStartDateTime);}
+ QDateTime startDateTime() const {return m_detail.value<QDateTime>(QOrganizerTodoTime::FieldStartDateTime).toLocalTime();}
void setDueDateTime(const QDateTime& dateTime)
{
if (dateTime != dueDateTime() && !readOnly()) {
- m_detail.setValue(QOrganizerTodoTime::FieldDueDateTime, dateTime);
+ m_detail.setValue(QOrganizerTodoTime::FieldDueDateTime, dateTime.toUTC());
emit valueChanged();
}
}
- QDateTime dueDateTime() const {return m_detail.value<QDateTime>(QOrganizerTodoTime::FieldDueDateTime);}
+ QDateTime dueDateTime() const {return m_detail.value<QDateTime>(QOrganizerTodoTime::FieldDueDateTime).toLocalTime();}
void setAllDay(bool allDay)
{
diff --git a/plugins/declarative/organizer/qdeclarativeorganizeritemfilter.cpp b/plugins/declarative/organizer/qdeclarativeorganizeritemfilter.cpp
index 7e6b24df7c..e84621656b 100644
--- a/plugins/declarative/organizer/qdeclarativeorganizeritemfilter.cpp
+++ b/plugins/declarative/organizer/qdeclarativeorganizeritemfilter.cpp
@@ -107,7 +107,6 @@
/*!
\qmlclass DetailFilter QDeclarativeOrganizerItemDetailFilter
\brief The \l DetailFilter element provides a filter based around a detail value criterion.
- \qmlmodule organizer
\ingroup qml-organizer
This element is part of the \bold{QtMobility.organizer 1.1} module.
@@ -116,18 +115,20 @@
*/
/*!
- \qmlproperty enumeration DetailFilter::detail
+ \qmlproperty variant DetailFilter::detail
This property holds the detail type of which details will be matched to.
-
+ The property value could be either the enumeration value of ItemDetail::ItemDetailType
+ or detail names.
\sa ItemDetail::type
*/
/*!
- \qmlproperty int DetailFilter::field
+ \qmlproperty variant DetailFilter::field
This property holds the detail field type of which detail fields will be matched to.
- Detail field types are enumeration values defined in each detail elements.
+ Detail field types are enumeration values defined in each detail elements, you can also
+ set the value to be detail field names.
\sa EventTime
\sa JournalTime
@@ -183,20 +184,22 @@
*/
/*!
- \qmlproperty enumeration DetailRangeFilter::detail
+ \qmlproperty variant DetailRangeFilter::detail
This property holds the detail type of which details will be matched to.
-
+ The property value could be either the enumeration value of ItemDetail::ItemDetailType
+ or detail names.
\sa ItemDetail::type
\sa DetailFilter::detail
*/
/*!
- \qmlproperty int DetailRangeFilter::field
+ \qmlproperty variant DetailRangeFilter::field
This property holds the detail field type of which detail fields will be matched to.
- Detail field types are enumeration values defined in each detail elements.
+ Detail field types are enumeration values defined in each detail elements, you can also
+ set the value to be detail field names.
\sa EventTime
\sa JournalTime
@@ -262,7 +265,7 @@
*/
/*!
- \qmlproperty QDeclarativeListProperty IntersectionFilter::filters
+ \qmlproperty list<filter> IntersectionFilter::filters
This property holds the list of filters which form the intersection filter.
*/
@@ -280,7 +283,7 @@
*/
/*!
- \qmlproperty QDeclarativeListProperty UnionFilter::filters
+ \qmlproperty list<filter> UnionFilter::filters
This property holds the list of filters which form the union filter.
*/
diff --git a/plugins/declarative/organizer/qdeclarativeorganizeritemfilter_p.h b/plugins/declarative/organizer/qdeclarativeorganizeritemfilter_p.h
index f13d956da1..e0511a7573 100644
--- a/plugins/declarative/organizer/qdeclarativeorganizeritemfilter_p.h
+++ b/plugins/declarative/organizer/qdeclarativeorganizeritemfilter_p.h
@@ -113,7 +113,7 @@ QML_DECLARE_TYPE(QDeclarativeOrganizerItemFilter)
//changelog filter
-class QDeclarativeOrganizerItemChangelogFilter : public QDeclarativeOrganizerItemFilter
+class QDeclarativeOrganizerItemChangeLogFilter : public QDeclarativeOrganizerItemFilter
{
Q_OBJECT
Q_PROPERTY(QDateTime since READ since WRITE setSince NOTIFY valueChanged)
@@ -128,7 +128,7 @@ public:
EventRemoved = QOrganizerItemChangeLogFilter::EventRemoved
};
- QDeclarativeOrganizerItemChangelogFilter(QObject *parent = 0)
+ QDeclarativeOrganizerItemChangeLogFilter(QObject *parent = 0)
:QDeclarativeOrganizerItemFilter(parent)
{
connect(this, SIGNAL(valueChanged()), SIGNAL(filterChanged()));
@@ -143,7 +143,7 @@ public:
}
}
- EventType eventType() const { return static_cast<QDeclarativeOrganizerItemChangelogFilter::EventType>(d.eventType()); }
+ EventType eventType() const { return static_cast<QDeclarativeOrganizerItemChangeLogFilter::EventType>(d.eventType()); }
void setEventType(EventType type)
{
if (type != eventType()) {
@@ -164,7 +164,7 @@ private:
QOrganizerItemChangeLogFilter d;
};
-QML_DECLARE_TYPE(QDeclarativeOrganizerItemChangelogFilter)
+QML_DECLARE_TYPE(QDeclarativeOrganizerItemChangeLogFilter)
//collection filter
class QDeclarativeOrganizerItemCollectionFilter : public QDeclarativeOrganizerItemFilter
@@ -247,7 +247,7 @@ public:
QString dfn;
if (m_field.type() != QVariant::String) {
- QDeclarativeOrganizerItemDetail::ItemDetailType dt = static_cast<QDeclarativeOrganizerItemDetail::ItemDetailType>(QDeclarativeOrganizerItemDetail::detailType(ddn));
+ QDeclarativeOrganizerItemDetail::ItemDetailType dt = static_cast<QDeclarativeOrganizerItemDetail::ItemDetailType>(QDeclarativeOrganizerItemDetail::detailTypeByDefinitionName(ddn));
dfn = QDeclarativeOrganizerItemDetail::fieldName(dt, m_field.toInt());
} else {
dfn = m_field.toString();
@@ -372,7 +372,7 @@ public:
QString dfn;
if (m_field.type() != QVariant::String) {
- QDeclarativeOrganizerItemDetail::ItemDetailType dt = static_cast<QDeclarativeOrganizerItemDetail::ItemDetailType>(QDeclarativeOrganizerItemDetail::detailType(ddn));
+ QDeclarativeOrganizerItemDetail::ItemDetailType dt = static_cast<QDeclarativeOrganizerItemDetail::ItemDetailType>(QDeclarativeOrganizerItemDetail::detailTypeByDefinitionName(ddn));
dfn = QDeclarativeOrganizerItemDetail::fieldName(dt, m_field.toInt());
} else {
dfn = m_field.toString();
@@ -524,8 +524,8 @@ QML_DECLARE_TYPE(QDeclarativeOrganizerItemIdFilter)
class QDeclarativeOrganizerItemIntersectionFilter : public QDeclarativeOrganizerItemFilter
{
Q_OBJECT
- Q_PROPERTY(QDeclarativeListProperty<QDeclarativeOrganizerItemFilter> subFilters READ subFilters NOTIFY valueChanged)
- Q_CLASSINFO("DefaultProperty", "subFilters")
+ Q_PROPERTY(QDeclarativeListProperty<QDeclarativeOrganizerItemFilter> filters READ filters NOTIFY valueChanged)
+ Q_CLASSINFO("DefaultProperty", "filters")
public:
QDeclarativeOrganizerItemIntersectionFilter(QObject *parent = 0)
@@ -545,7 +545,7 @@ public:
return f;
}
- QDeclarativeListProperty<QDeclarativeOrganizerItemFilter> subFilters()
+ QDeclarativeListProperty<QDeclarativeOrganizerItemFilter> filters()
{
return QDeclarativeListProperty<QDeclarativeOrganizerItemFilter>(this, m_filters);
}
@@ -563,8 +563,8 @@ QML_DECLARE_TYPE(QDeclarativeOrganizerItemIntersectionFilter)
class QDeclarativeOrganizerItemUnionFilter : public QDeclarativeOrganizerItemFilter
{
Q_OBJECT
- Q_PROPERTY(QDeclarativeListProperty<QDeclarativeOrganizerItemFilter> subFilters READ subFilters NOTIFY valueChanged)
- Q_CLASSINFO("DefaultProperty", "subFilters")
+ Q_PROPERTY(QDeclarativeListProperty<QDeclarativeOrganizerItemFilter> filters READ filters NOTIFY valueChanged)
+ Q_CLASSINFO("DefaultProperty", "filters")
public:
QDeclarativeOrganizerItemUnionFilter(QObject *parent = 0)
@@ -584,7 +584,7 @@ public:
return f;
}
- QDeclarativeListProperty<QDeclarativeOrganizerItemFilter> subFilters()
+ QDeclarativeListProperty<QDeclarativeOrganizerItemFilter> filters()
{
return QDeclarativeListProperty<QDeclarativeOrganizerItemFilter>(this, m_filters);
}
diff --git a/plugins/declarative/organizer/qdeclarativeorganizeritemmetaobject.cpp b/plugins/declarative/organizer/qdeclarativeorganizeritemmetaobject.cpp
index be46291143..35e5502d99 100644
--- a/plugins/declarative/organizer/qdeclarativeorganizeritemmetaobject.cpp
+++ b/plugins/declarative/organizer/qdeclarativeorganizeritemmetaobject.cpp
@@ -40,7 +40,6 @@
****************************************************************************/
#include <QString>
-#include <QDebug>
#include "qdeclarativeorganizeritem_p.h"
#include "qorganizeritemdetails.h"
@@ -141,7 +140,7 @@ OrganizerItemDetailNameMap* QDeclarativeOrganizerItemMetaObject::detailMetaDataB
OrganizerItemDetailNameMap* QDeclarativeOrganizerItemMetaObject::detailMetaDataByDefinitionName(const char * name)
{
- return detailMetaDataByDetailType(QDeclarativeOrganizerItemDetail::detailType(name));
+ return detailMetaDataByDetailType(QDeclarativeOrganizerItemDetail::detailTypeByDefinitionName(name));
}
OrganizerItemDetailNameMap* QDeclarativeOrganizerItemMetaObject::detailMetaDataByDetailType(QDeclarativeOrganizerItemDetail::ItemDetailType type)
@@ -182,7 +181,6 @@ int QDeclarativeOrganizerItemMetaObject::createProperty(const char * name, cons
return -1;
}
-
QVariant QDeclarativeOrganizerItemMetaObject::detail(QDeclarativeOrganizerItemDetail::ItemDetailType type)
{
foreach(QDeclarativeOrganizerItemDetail* itemDetail, m_details) {
@@ -193,7 +191,7 @@ QVariant QDeclarativeOrganizerItemMetaObject::detail(QDeclarativeOrganizerItemDe
//Check should we create a new detail for this type
//XXX:TODO check mutable detail definition feature in manager?
- if (m_defs.isEmpty() || !m_defs.value(QDeclarativeOrganizerItemDetail::definitionName(type)).isEmpty()) {
+ if (m_defs.isEmpty() || !m_defs.value(QDeclarativeOrganizerItemDetail::detailName(type)).isEmpty()) {
QDeclarativeOrganizerItemDetail* itemDetail = createItemDetail(type, object());
m_details.append(itemDetail);
return QVariant::fromValue(itemDetail);
@@ -204,7 +202,7 @@ QVariant QDeclarativeOrganizerItemMetaObject::detail(QDeclarativeOrganizerItemDe
QVariant QDeclarativeOrganizerItemMetaObject::detail(const QString& name)
{
- return detail(QDeclarativeOrganizerItemDetail::detailType(name));
+ return detail(QDeclarativeOrganizerItemDetail::detailTypeByDetailName(name));
}
QVariant QDeclarativeOrganizerItemMetaObject::details(const QString& name)
@@ -228,7 +226,7 @@ QVariant QDeclarativeOrganizerItemMetaObject::details(const QString& name)
QVariant QDeclarativeOrganizerItemMetaObject::details(QDeclarativeOrganizerItemDetail::ItemDetailType type)
{
- return details(QDeclarativeOrganizerItemDetail::definitionName(type));
+ return details(QDeclarativeOrganizerItemDetail::detailName(type));
}
void QDeclarativeOrganizerItemMetaObject::setItem(const QOrganizerItem& item)
@@ -237,14 +235,12 @@ void QDeclarativeOrganizerItemMetaObject::setItem(const QOrganizerItem& item)
QList<QOrganizerItemDetail> details = m_item.details();
m_details.clear();
foreach (const QOrganizerItemDetail& detail, details) {
- QDeclarativeOrganizerItemDetail* itemDetail = new QDeclarativeOrganizerItemDetail(object());
+ QDeclarativeOrganizerItemDetail* itemDetail = createItemDetail(QDeclarativeOrganizerItemDetail::detailTypeByDefinitionName(detail.definitionName()), object());
itemDetail->setDetail(detail);
- itemDetail->connect(itemDetail, SIGNAL(detailChanged()), object(), SIGNAL(itemChanged()));
-
m_details.append(itemDetail);
}
- if (m_item.id().isNull ()) {
+ if (m_item.type() == QOrganizerItemType::TypeEventOccurrence || m_item.type() == QOrganizerItemType::TypeTodoOccurrence ) {
//create temporary id for occurrence items
m_id = QString("qtorganizer:occurrence:%1").arg (QUuid::createUuid ().toString ());
} else {
@@ -330,46 +326,68 @@ void QDeclarativeOrganizerItemMetaObject::detail_clear(QDeclarativeListProperty
QDeclarativeOrganizerItemDetail* QDeclarativeOrganizerItemMetaObject::createItemDetail(QDeclarativeOrganizerItemDetail::ItemDetailType type, QObject* parent)
{
+ Q_ASSERT(qobject_cast<QDeclarativeOrganizerItem*>(parent));
+ QDeclarativeOrganizerItemDetail* detail;
switch (type) {
case QDeclarativeOrganizerItemDetail::EventTime:
- return new QDeclarativeOrganizerEventTime(parent);
+ detail = new QDeclarativeOrganizerEventTime(parent);
+ break;
case QDeclarativeOrganizerItemDetail::JournalTime:
- return new QDeclarativeOrganizerJournalTime(parent);
+ detail = new QDeclarativeOrganizerJournalTime(parent);
+ break;
case QDeclarativeOrganizerItemDetail::TodoTime:
- return new QDeclarativeOrganizerTodoTime(parent);
+ detail = new QDeclarativeOrganizerTodoTime(parent);
+ break;
case QDeclarativeOrganizerItemDetail::TodoProgress:
- return new QDeclarativeOrganizerTodoProgress(parent);
+ detail = new QDeclarativeOrganizerTodoProgress(parent);
+ break;
case QDeclarativeOrganizerItemDetail::Reminder:
- return new QDeclarativeOrganizerItemReminder(parent);
+ detail = new QDeclarativeOrganizerItemReminder(parent);
+ break;
case QDeclarativeOrganizerItemDetail::AudibleReminder:
- return new QDeclarativeOrganizerItemAudibleReminder(parent);
+ detail = new QDeclarativeOrganizerItemAudibleReminder(parent);
+ break;
case QDeclarativeOrganizerItemDetail::VisualReminder:
- return new QDeclarativeOrganizerItemVisualReminder(parent);
+ detail = new QDeclarativeOrganizerItemVisualReminder(parent);
+ break;
case QDeclarativeOrganizerItemDetail::EmailReminder:
- return new QDeclarativeOrganizerItemEmailReminder(parent);
+ detail = new QDeclarativeOrganizerItemEmailReminder(parent);
+ break;
case QDeclarativeOrganizerItemDetail::Comment:
- return new QDeclarativeOrganizerItemComment(parent);
+ detail = new QDeclarativeOrganizerItemComment(parent);
+ break;
case QDeclarativeOrganizerItemDetail::Description:
- return new QDeclarativeOrganizerItemDescription(parent);
+ detail = new QDeclarativeOrganizerItemDescription(parent);
+ break;
case QDeclarativeOrganizerItemDetail::DisplayLabel:
- return new QDeclarativeOrganizerItemDisplayLabel(parent);
+ detail = new QDeclarativeOrganizerItemDisplayLabel(parent);
+ break;
case QDeclarativeOrganizerItemDetail::Guid:
- return new QDeclarativeOrganizerItemGuid(parent);
+ detail = new QDeclarativeOrganizerItemGuid(parent);
+ break;
case QDeclarativeOrganizerItemDetail::Location:
- return new QDeclarativeOrganizerItemLocation(parent);
+ detail = new QDeclarativeOrganizerItemLocation(parent);
+ break;
case QDeclarativeOrganizerItemDetail::Parent:
- return new QDeclarativeOrganizerItemParent(parent);
+ detail = new QDeclarativeOrganizerItemParent(parent);
+ break;
case QDeclarativeOrganizerItemDetail::Priority:
- return new QDeclarativeOrganizerItemPriority(parent);
+ detail = new QDeclarativeOrganizerItemPriority(parent);
+ break;
case QDeclarativeOrganizerItemDetail::Recurrence:
- return new QDeclarativeOrganizerItemRecurrence(parent);
+ detail = new QDeclarativeOrganizerItemRecurrence(parent);
+ break;
case QDeclarativeOrganizerItemDetail::Timestamp:
- return new QDeclarativeOrganizerItemTimestamp(parent);
+ detail = new QDeclarativeOrganizerItemTimestamp(parent);
+ break;
case QDeclarativeOrganizerItemDetail::Type:
- return new QDeclarativeOrganizerItemType(parent);
+ detail = new QDeclarativeOrganizerItemType(parent);
+ break;
default:
+ //customized
+ detail = new QDeclarativeOrganizerItemDetail(parent);
break;
}
- //customized
- return new QDeclarativeOrganizerItemDetail(parent);
+ QObject::connect(detail, SIGNAL(detailChanged()), parent, SIGNAL(itemChanged()));
+ return detail;
}
diff --git a/plugins/declarative/organizer/qdeclarativeorganizeritemmetaobject_p.h b/plugins/declarative/organizer/qdeclarativeorganizeritemmetaobject_p.h
index 4cbcb7dfa6..0257a54c31 100644
--- a/plugins/declarative/organizer/qdeclarativeorganizeritemmetaobject_p.h
+++ b/plugins/declarative/organizer/qdeclarativeorganizeritemmetaobject_p.h
@@ -74,6 +74,14 @@ public:
QVariant detail(const QString& name);
QVariant details(const QString& name);
+ /* Templated (type-specific) detail retrieval */
+ template <typename T>
+ T* detail()
+ {
+ QVariant v = detail(T::DetailName);
+ return qobject_cast<T*>(v.value<QDeclarativeOrganizerItemDetail*>());
+ }
+
QVariant detail(QDeclarativeOrganizerItemDetail::ItemDetailType type);
QVariant details(QDeclarativeOrganizerItemDetail::ItemDetailType type);
diff --git a/plugins/declarative/organizer/qdeclarativeorganizeritemsortorder_p.h b/plugins/declarative/organizer/qdeclarativeorganizeritemsortorder_p.h
index 6df07554f4..515c8996b3 100644
--- a/plugins/declarative/organizer/qdeclarativeorganizeritemsortorder_p.h
+++ b/plugins/declarative/organizer/qdeclarativeorganizeritemsortorder_p.h
@@ -151,7 +151,7 @@ public:
QString dfn;
if (m_field.type() != QVariant::String) {
- QDeclarativeOrganizerItemDetail::ItemDetailType dt = QDeclarativeOrganizerItemDetail::detailType(ddn);
+ QDeclarativeOrganizerItemDetail::ItemDetailType dt = QDeclarativeOrganizerItemDetail::detailTypeByDefinitionName(ddn);
dfn = QDeclarativeOrganizerItemDetail::fieldName(dt, m_field.toInt());
} else {
dfn = m_field.toString();
diff --git a/plugins/declarative/organizer/qdeclarativeorganizermodel.cpp b/plugins/declarative/organizer/qdeclarativeorganizermodel.cpp
index 8dd97a1a06..4cec401e22 100644
--- a/plugins/declarative/organizer/qdeclarativeorganizermodel.cpp
+++ b/plugins/declarative/organizer/qdeclarativeorganizermodel.cpp
@@ -138,12 +138,12 @@ QDeclarativeOrganizerModel::QDeclarativeOrganizerModel(QObject *parent) :
roleNames.insert(OrganizerItemRole, "item");
setRoleNames(roleNames);
- connect(this, SIGNAL(managerChanged()), SLOT(update()));
- connect(this, SIGNAL(filterChanged()), SLOT(update()));
- connect(this, SIGNAL(fetchHintChanged()), SLOT(update()));
- connect(this, SIGNAL(sortOrdersChanged()), SLOT(update()));
- connect(this, SIGNAL(startPeriodChanged()), SLOT(update()));
- connect(this, SIGNAL(endPeriodChanged()), SLOT(update()));
+ connect(this, SIGNAL(managerChanged()), SLOT(doUpdate()));
+ connect(this, SIGNAL(filterChanged()), SLOT(doUpdate()));
+ connect(this, SIGNAL(fetchHintChanged()), SLOT(doUpdate()));
+ connect(this, SIGNAL(sortOrdersChanged()), SLOT(doUpdate()));
+ connect(this, SIGNAL(startPeriodChanged()), SLOT(doUpdate()));
+ connect(this, SIGNAL(endPeriodChanged()), SLOT(doUpdate()));
//import vcard
connect(&d->m_reader, SIGNAL(stateChanged(QVersitReader::State)), this, SLOT(startImport(QVersitReader::State)));
@@ -152,11 +152,28 @@ QDeclarativeOrganizerModel::QDeclarativeOrganizerModel(QObject *parent) :
/*!
\qmlproperty string OrganizerModel::manager
- This property holds the manager uri of the organizer backend engine.
+ This property holds the manager name or manager uri of the organizer backend engine.
+ The manager uri format: qtorganizer:<managerid>:<key>=<value>&<key>=<value>.
+
+ \sa QOrganizerManager::fromUri()
*/
QString QDeclarativeOrganizerModel::manager() const
{
if (d->m_manager)
+ return d->m_manager->managerUri();
+ return QString();
+}
+
+/*!
+ \qmlproperty string OrganizerModel::managerName
+
+ This property holds the manager name of the organizer backend engine.
+ This property is read only.
+ \sa QOrganizerManager::fromUri()
+ */
+QString QDeclarativeOrganizerModel::managerName() const
+{
+ if (d->m_manager)
return d->m_manager->managerName();
return QString();
}
@@ -203,10 +220,17 @@ void QDeclarativeOrganizerModel::update()
{
if (!d->m_componentCompleted || d->m_updatePending)
return;
+
d->m_updatePending = true; // Disallow possible duplicate request triggering
QMetaObject::invokeMethod(this, "fetchAgain", Qt::QueuedConnection);
}
+void QDeclarativeOrganizerModel::doUpdate()
+{
+ if (d->m_autoUpdate)
+ update();
+}
+
/*!
\qmlmethod OrganizerModel::cancelUpdate()
@@ -315,11 +339,15 @@ int QDeclarativeOrganizerModel::rowCount(const QModelIndex &parent) const
void QDeclarativeOrganizerModel::setManager(const QString& managerName)
{
- if (d->m_manager)
+ if (d->m_manager) {
delete d->m_manager;
+ }
-
- d->m_manager = new QOrganizerManager(managerName);
+ if (managerName.startsWith("qtorganizer:")) {
+ d->m_manager = QOrganizerManager::fromUri(managerName, this);
+ } else {
+ d->m_manager = new QOrganizerManager(managerName, QMap<QString, QString>(), this);
+ }
connect(d->m_manager, SIGNAL(dataChanged()), this, SLOT(update()));
connect(d->m_manager, SIGNAL(itemsAdded(QList<QOrganizerItemId>)), this, SLOT(update()));
@@ -327,6 +355,7 @@ void QDeclarativeOrganizerModel::setManager(const QString& managerName)
connect(d->m_manager, SIGNAL(itemsChanged(QList<QOrganizerItemId>)), this, SLOT(itemsChanged(QList<QOrganizerItemId>)));
emit managerChanged();
}
+
void QDeclarativeOrganizerModel::componentComplete()
{
d->m_componentCompleted = true;
@@ -381,6 +410,13 @@ void QDeclarativeOrganizerModel::setFetchHint(QDeclarativeOrganizerItemFetchHint
emit fetchHintChanged();
}
}
+/*!
+ \qmlproperty int OrganizerModel::itemCount
+
+ This property holds the size of organizer items the OrganizerModel currently holds.
+
+ This property is read only.
+ */
int QDeclarativeOrganizerModel::itemCount() const
{
return d->m_items.size();
@@ -458,13 +494,12 @@ void QDeclarativeOrganizerModel::startImport(QVersitReader::State state)
importer.importDocument(d->m_reader.results().at(0));
QList<QOrganizerItem> items = importer.items();
-// qDebug() << "importing..." << items.size() << " items.";
delete d->m_reader.device();
d->m_reader.setDevice(0);
+
if (d->m_manager) {
if (d->m_manager->saveItems(&items)) {
- //qWarning() << "items imported.";
update();
}
}
@@ -472,14 +507,53 @@ void QDeclarativeOrganizerModel::startImport(QVersitReader::State state)
}
}
+bool QDeclarativeOrganizerModel::itemHasReccurence(const QOrganizerItem& oi) const
+{
+ if (oi.type() == QOrganizerItemType::TypeEvent || oi.type() == QOrganizerItemType::TypeTodo) {
+ QOrganizerItemRecurrence recur = oi.detail(QOrganizerItemRecurrence::DefinitionName);
+ return !recur.recurrenceDates().isEmpty() || !recur.recurrenceRules().isEmpty();
+ }
+
+ return false;
+}
+void QDeclarativeOrganizerModel::fetchOccurrences(const QOrganizerItem& item)
+{
+ QOrganizerItemOccurrenceFetchRequest* req = new QOrganizerItemOccurrenceFetchRequest(this);
+ req->setManager(d->m_manager);
+ req->setStartDate(d->m_startPeriod);
+ req->setEndDate(d->m_endPeriod);
+ req->setFetchHint(d->m_fetchHint ? d->m_fetchHint->fetchHint() : QOrganizerItemFetchHint());
+ req->setParentItem(item);
+
+ connect(req, SIGNAL(stateChanged(QOrganizerAbstractRequest::State)), this, SLOT(requestUpdated()));
+ req->start();
+
+}
+
void QDeclarativeOrganizerModel::addSorted(QDeclarativeOrganizerItem* item)
{
- removeItemsFromModel(QList<QString>() << item->itemId ());
+ removeItemsFromModel(QList<QString>() << item->itemId());
int idx = itemIndex(item);
beginInsertRows(QModelIndex(), idx, idx + 1);
d->m_items.insert(idx, item);
endInsertRows();
- d->m_itemMap.insert(item->itemId (), item);
+ d->m_itemMap.insert(item->itemId(), item);
+
+ if (itemHasReccurence(item->item())) {
+ foreach (QDeclarativeOrganizerItem* di, d->m_items) {
+ if (di->isOccurrence()) {
+ QOrganizerItemParent oip = di->item().detail<QOrganizerItemParent>();
+ if (oip.parentId() == item->item().id()) {
+ //delete this occurrence item, we will refetch it
+ d->m_itemMap.remove(di->itemId());
+ d->m_items.removeOne(di);
+ di->deleteLater();
+ }
+ }
+ }
+
+ fetchOccurrences(item->item());
+ }
}
int QDeclarativeOrganizerModel::itemIndex(const QDeclarativeOrganizerItem* item)
@@ -488,19 +562,20 @@ int QDeclarativeOrganizerModel::itemIndex(const QDeclarativeOrganizerItem* item)
for (int i = 0; i < d->m_items.size(); i++) {
// check to see if the new item should be inserted here
int comparison = QOrganizerManagerEngine::compareItem(d->m_items.at(i)->item(),
- item->item (),
+ item->item(),
d->m_sortOrders);
if (comparison > 0) {
return i;
}
}
}
- return d->m_items.size ();
+ return d->m_items.size();
}
void QDeclarativeOrganizerModel::clearItems()
{
- qDeleteAll(d->m_items);
+ foreach (QDeclarativeOrganizerItem* di, d->m_items)
+ di->deleteLater();
d->m_items.clear();
d->m_itemMap.clear();
}
@@ -508,23 +583,22 @@ void QDeclarativeOrganizerModel::clearItems()
QDeclarativeOrganizerItem* QDeclarativeOrganizerModel::createItem(const QOrganizerItem& item)
{
QDeclarativeOrganizerItem* di;
- if (item.type () == QOrganizerItemType::TypeEvent)
+ if (item.type() == QOrganizerItemType::TypeEvent)
di = new QDeclarativeOrganizerEvent(this);
- else if (item.type () == QOrganizerItemType::TypeEventOccurrence)
+ else if (item.type() == QOrganizerItemType::TypeEventOccurrence)
di = new QDeclarativeOrganizerEventOccurrence(this);
- else if (item.type () == QOrganizerItemType::TypeTodo)
+ else if (item.type() == QOrganizerItemType::TypeTodo)
di = new QDeclarativeOrganizerTodo(this);
- else if (item.type () == QOrganizerItemType::TypeTodoOccurrence)
+ else if (item.type() == QOrganizerItemType::TypeTodoOccurrence)
di = new QDeclarativeOrganizerTodoOccurrence(this);
- else if (item.type () == QOrganizerItemType::TypeJournal)
+ else if (item.type() == QOrganizerItemType::TypeJournal)
di = new QDeclarativeOrganizerJournal(this);
- else if (item.type () == QOrganizerItemType::TypeNote)
+ else if (item.type() == QOrganizerItemType::TypeNote)
di = new QDeclarativeOrganizerNote(this);
else
di = new QDeclarativeOrganizerItem(this);
-
- di->setItem (item);
- di->setDetailDefinitions (d->m_manager->detailDefinitions(item.type()));
+ di->setItem(item);
+ di->setDetailDefinitions(d->m_manager->detailDefinitions(item.type()));
return di;
}
@@ -539,18 +613,26 @@ void QDeclarativeOrganizerModel::fetchItems(const QList<QString>& itemIds)
QMetaObject::invokeMethod(this, "fetchAgain", Qt::QueuedConnection);
}
-bool QDeclarativeOrganizerModel::containsItems(const QDate& start, const QDate& end)
+/*!
+ \qmlmethod bool OrganizerModel::containsItems(date start, date end)
+ Returns true if there is at least one OrganizerItem between the given date range.
+ Both the \a start and \a end parameters are optional, if no \a end parameter, returns true
+ if there are item(s) after \a start, if neither start nor end date time provided, returns true if
+ items in the current model is not empty, otherwise return false.
+ \since organizer 1.1.1
+ \sa itemIds()
+ */
+bool QDeclarativeOrganizerModel::containsItems(QDateTime start, QDateTime end)
{
- //TODO: quick search this
- QDate endDate = end.isNull()? start:end;
- foreach (const QDeclarativeOrganizerItem* item, d->m_items) {
-
- if ( item->itemStartTime().date() >= start && item->itemStartTime().date() <= endDate)
- return true;
- }
- return false;
+ return !itemIds(start, end).isEmpty();
}
+/*!
+ \qmlmethod OrganizerItem OrganizerModel::item(string itemId)
+ Returns the OrganizerItem object which item id is the given \a itemId.
+
+ \since organizer 1.1.1
+ */
QDeclarativeOrganizerItem* QDeclarativeOrganizerModel::item(const QString& id)
{
@@ -559,16 +641,41 @@ QDeclarativeOrganizerItem* QDeclarativeOrganizerModel::item(const QString& id)
return 0;
}
-QStringList QDeclarativeOrganizerModel::itemIds(const QDate& start, const QDate& end)
+/*!
+ \qmlmethod list<string> OrganizerModel::itemIds(date start, date end)
+ Returns the list of organizer item ids between the given date range \a start and \a end,
+ Both the \a start and \a end parameters are optional, if no \a end parameter, returns all
+ item ids from \a start, if neither start nor end date time provided, returns all item ids in the
+ current model.
+
+ \since organizer 1.1.1
+ \sa containsItems()
+ */
+QStringList QDeclarativeOrganizerModel::itemIds(QDateTime start, QDateTime end)
{
//TODO: quick search this
QStringList ids;
- QDate endDate = end.isNull()? start:end;
- foreach (QDeclarativeOrganizerItem* item, d->m_items) {
- if ( item->itemStartTime().date() >= start && item->itemEndTime().date() <= endDate)
+ if (!end.isNull()){
+ // both start date and end date are valid
+ foreach (QDeclarativeOrganizerItem* item, d->m_items) {
+ if ( (item->itemStartTime() >= start && item->itemStartTime() <= end)
+ ||
+ (item->itemEndTime() >= start && item->itemEndTime() <= end)
+ ||
+ (item->itemEndTime() > end && item->itemStartTime() < start))
+ ids << item->itemId();
+ }
+ }else if (!start.isNull()){
+ // only a valid start date is valid
+ foreach (QDeclarativeOrganizerItem* item, d->m_items) {
+ if (item->itemStartTime() >= start)
+ ids << item->itemId();
+ }
+ }else{
+ // neither start nor end date is valid
+ foreach (QDeclarativeOrganizerItem* item, d->m_items)
ids << item->itemId();
}
-
return ids;
}
@@ -581,8 +688,8 @@ void QDeclarativeOrganizerModel::fetchAgain()
d->m_fetchRequest = new QOrganizerItemFetchRequest(this);
d->m_fetchRequest->setManager(d->m_manager);
d->m_fetchRequest->setSorting(d->m_sortOrders);
- d->m_fetchRequest->setStartDate (d->m_startPeriod);
- d->m_fetchRequest->setEndDate (d->m_endPeriod);
+ d->m_fetchRequest->setStartDate(d->m_startPeriod);
+ d->m_fetchRequest->setEndDate(d->m_endPeriod);
if (!d->m_updatedItemIds.isEmpty()) {
QOrganizerItemIdFilter f;
@@ -602,23 +709,20 @@ void QDeclarativeOrganizerModel::fetchAgain()
d->m_fetchRequest->setFetchHint(d->m_fetchHint ? d->m_fetchHint->fetchHint() : QOrganizerItemFetchHint());
-
-
- //fetch occurrences
- d->m_occurrenceFetchRequest = new QOrganizerItemOccurrenceFetchRequest(this);
- d->m_occurrenceFetchRequest->setManager (d->m_manager);
- d->m_occurrenceFetchRequest->setStartDate (d->m_startPeriod);
- d->m_occurrenceFetchRequest->setEndDate (d->m_endPeriod);
- d->m_occurrenceFetchRequest->setFetchHint (d->m_fetchRequest->fetchHint ());
-
- connect(d->m_occurrenceFetchRequest, SIGNAL(stateChanged(QOrganizerAbstractRequest::State)), this, SLOT(requestUpdated()));
- d->m_occurrenceFetchRequest->start();
-
connect(d->m_fetchRequest, SIGNAL(stateChanged(QOrganizerAbstractRequest::State)), this, SLOT(requestUpdated()));
d->m_fetchRequest->start();
-
}
+/*
+ This slot function is connected with item fetch requests and item occurrence fetch requests,
+ so the QObject::sender() must be checked for the right sender type.
+ During update() function, the fetchAgain() will be invoked, inside fetchAgain(), a QOrganizerItemFetchRequest object
+ is created and started, when this fetch request finished, this requestUpdate() slot will be invoked for the first time.
+ Then check each of the organizer items returned by the item fetch request, if the item is a recurrence item,
+ a QOrganizerItemOccurrenceFetchRequest object will be created and started. When each of these occurrence fetch requests
+ finishes, this requestUpdated() slot will be invoked again and insert the returned occurrence items into the d->m_items
+ list.
+ */
void QDeclarativeOrganizerModel::requestUpdated()
{
QList<QOrganizerItem> items;
@@ -627,33 +731,28 @@ void QDeclarativeOrganizerModel::requestUpdated()
items = ifr->items();
ifr->deleteLater();
d->m_fetchRequest = 0;
- if (!d->m_occurrenceFetchRequest)
- d->m_updatePending = false;
+ d->m_updatePending = false;
} else {
QOrganizerItemOccurrenceFetchRequest* iofr = qobject_cast<QOrganizerItemOccurrenceFetchRequest*>(QObject::sender());
- if (iofr && iofr->isFinished ()) {
- items = iofr->itemOccurrences ();
-
+ if (iofr && iofr->isFinished()) {
+ items = iofr->itemOccurrences();
iofr->deleteLater();
- d->m_occurrenceFetchRequest = 0;
- if (!d->m_fetchRequest)
- d->m_updatePending = false;
}
}
- if (!items.isEmpty ()) {
+ if (!items.isEmpty()) {
if (d->m_items.isEmpty()) {
QDeclarativeOrganizerItem* di;
- foreach (QOrganizerItem item, items) {
+ foreach (const QOrganizerItem& item, items) {
di = createItem(item);
addSorted(di);
}
} else {
//Partial updating, insert the fetched items into the the exist item list.
- foreach (QOrganizerItem item, items) {
+ foreach (const QOrganizerItem& item, items) {
QDeclarativeOrganizerItem* di;
if (d->m_itemMap.contains(item.id().toString())) {
- di = d->m_itemMap.value (item.id ().toString ());
+ di = d->m_itemMap.value(item.id().toString());
di->setItem(item);
} else {
di = createItem(item);
@@ -661,12 +760,18 @@ void QDeclarativeOrganizerModel::requestUpdated()
addSorted(di);
}
}
- emit itemsChanged();
+
+ emit modelChanged();
emit errorChanged();
}
}
+/*!
+ \qmlmethod OrganizerModel::saveItem(OrganizerItem item)
+ Saves the given \a item into the organizer backend.
+ \since organizer 1.1.1
+ */
void QDeclarativeOrganizerModel::saveItem(QDeclarativeOrganizerItem* di)
{
if (di) {
@@ -704,12 +809,19 @@ void QDeclarativeOrganizerModel::itemsSaved()
addSorted(di);
}
}
+
req->deleteLater();
emit errorChanged();
}
}
+/*!
+ \qmlmethod OrganizerModel::removeItem(string itemId)
+ Removes the organizer item with the given \a itemId from the backend.
+
+ \since organizer 1.1.1
+ */
void QDeclarativeOrganizerModel::removeItem(const QString& id)
{
QList<QString> ids;
@@ -717,6 +829,12 @@ void QDeclarativeOrganizerModel::removeItem(const QString& id)
removeItems(ids);
}
+/*!
+ \qmlmethod OrganizerModel::removeItem(list<string> itemId)
+ Removes the organizer items with the given \a ids from the backend.
+
+ \since organizer 1.1.1
+ */
void QDeclarativeOrganizerModel::removeItems(const QList<QString>& ids)
{
QOrganizerItemRemoveRequest* req = new QOrganizerItemRemoveRequest(this);
@@ -724,7 +842,7 @@ void QDeclarativeOrganizerModel::removeItems(const QList<QString>& ids)
QList<QOrganizerItemId> oids;
foreach (const QString& id, ids) {
- if (id.startsWith (QString("qtorganizer:occurrence"))) {
+ if (id.startsWith(QString("qtorganizer:occurrence"))) {
qWarning() << "Can't remove an occurrence item, please modify the parent item's recurrence rule instead!";
continue;
}
@@ -800,17 +918,17 @@ void QDeclarativeOrganizerModel::removeItemsFromModel(const QList<QString>& ids)
}
emit errorChanged();
if (emitSignal)
- emit itemsChanged();
+ emit modelChanged();
}
void QDeclarativeOrganizerModel::itemsRemoved(const QList<QOrganizerItemId>& ids)
{
- if (!ids.isEmpty ()) {
+ if (!ids.isEmpty()) {
QList<QString> idStrings;
foreach (const QOrganizerItemId& id, ids) {
- idStrings << id.toString ();
+ idStrings << id.toString();
}
- removeItemsFromModel (idStrings);
+ removeItemsFromModel(idStrings);
}
}
@@ -854,7 +972,7 @@ QDeclarativeListProperty<QDeclarativeOrganizerItem> QDeclarativeOrganizerModel::
{
//TODO:XXX
qWarning() << "OrganizerModel: occurrences is not currently supported.";
- return QDeclarativeListProperty<QDeclarativeOrganizerItem> ();
+ return QDeclarativeListProperty<QDeclarativeOrganizerItem>();
}
/*!
@@ -1005,7 +1123,7 @@ void QDeclarativeOrganizerModel::item_clear(QDeclarativeListProperty<QDeclarati
} else {
model->d->m_items.clear();
}
- emit model->itemsChanged();
+ emit model->modelChanged();
}
}
@@ -1015,7 +1133,7 @@ void QDeclarativeOrganizerModel::sortOrder_append(QDeclarativeListProperty<QDecl
if (model && sortOrder) {
QObject::connect(sortOrder, SIGNAL(sortOrderChanged()), model, SIGNAL(sortOrdersChanged()));
model->d->m_declarativeSortOrders.append(sortOrder);
- model->d->m_sortOrders.append (sortOrder->sortOrder ());
+ model->d->m_sortOrders.append(sortOrder->sortOrder());
emit model->sortOrdersChanged();
}
}
@@ -1051,7 +1169,7 @@ void QDeclarativeOrganizerModel::sortOrder_clear(QDeclarativeListProperty<QDecl
if (model) {
model->d->m_sortOrders.clear();
- model->d->m_declarativeSortOrders.clear ();
+ model->d->m_declarativeSortOrders.clear();
emit model->sortOrdersChanged();
}
}
diff --git a/plugins/declarative/organizer/qdeclarativeorganizermodel_p.h b/plugins/declarative/organizer/qdeclarativeorganizermodel_p.h
index 00e7257505..2183875fd5 100644
--- a/plugins/declarative/organizer/qdeclarativeorganizermodel_p.h
+++ b/plugins/declarative/organizer/qdeclarativeorganizermodel_p.h
@@ -61,6 +61,7 @@ class QDeclarativeOrganizerModel : public QAbstractListModel, public QDeclarativ
{
Q_OBJECT
Q_PROPERTY(QString manager READ manager WRITE setManager NOTIFY managerChanged)
+ Q_PROPERTY(QString managerName READ managerName NOTIFY managerChanged)
Q_PROPERTY(QStringList availableManagers READ availableManagers)
Q_PROPERTY(bool autoUpdate READ autoUpdate WRITE setAutoUpdate NOTIFY autoUpdateChanged)
Q_PROPERTY(QDateTime startPeriod READ startPeriod WRITE setStartPeriod NOTIFY startPeriodChanged)
@@ -68,16 +69,16 @@ class QDeclarativeOrganizerModel : public QAbstractListModel, public QDeclarativ
Q_PROPERTY(QDeclarativeOrganizerItemFilter* filter READ filter WRITE setFilter NOTIFY filterChanged)
Q_PROPERTY(QDeclarativeOrganizerItemFetchHint* fetchHint READ fetchHint WRITE setFetchHint NOTIFY fetchHintChanged)
Q_PROPERTY(QDeclarativeListProperty<QDeclarativeOrganizerItemSortOrder> sortOrders READ sortOrders NOTIFY sortOrdersChanged)
- Q_PROPERTY(QDeclarativeListProperty<QDeclarativeOrganizerItem> items READ items NOTIFY itemsChanged)
- Q_PROPERTY(QDeclarativeListProperty<QDeclarativeOrganizerItem> occurrences READ occurrences NOTIFY itemsChanged)
- Q_PROPERTY(QDeclarativeListProperty<QDeclarativeOrganizerItem> events READ events NOTIFY itemsChanged)
- Q_PROPERTY(QDeclarativeListProperty<QDeclarativeOrganizerItem> eventOccurrences READ eventOccurrences NOTIFY itemsChanged)
- Q_PROPERTY(QDeclarativeListProperty<QDeclarativeOrganizerItem> todos READ todos NOTIFY itemsChanged)
- Q_PROPERTY(QDeclarativeListProperty<QDeclarativeOrganizerItem> todoOccurrences READ todoOccurrences NOTIFY itemsChanged)
- Q_PROPERTY(QDeclarativeListProperty<QDeclarativeOrganizerItem> journals READ journals NOTIFY itemsChanged)
- Q_PROPERTY(QDeclarativeListProperty<QDeclarativeOrganizerItem> notes READ notes NOTIFY itemsChanged)
+ Q_PROPERTY(QDeclarativeListProperty<QDeclarativeOrganizerItem> items READ items NOTIFY modelChanged)
+ Q_PROPERTY(QDeclarativeListProperty<QDeclarativeOrganizerItem> occurrences READ occurrences NOTIFY modelChanged)
+ Q_PROPERTY(QDeclarativeListProperty<QDeclarativeOrganizerItem> events READ events NOTIFY modelChanged)
+ Q_PROPERTY(QDeclarativeListProperty<QDeclarativeOrganizerItem> eventOccurrences READ eventOccurrences NOTIFY modelChanged)
+ Q_PROPERTY(QDeclarativeListProperty<QDeclarativeOrganizerItem> todos READ todos NOTIFY modelChanged)
+ Q_PROPERTY(QDeclarativeListProperty<QDeclarativeOrganizerItem> todoOccurrences READ todoOccurrences NOTIFY modelChanged)
+ Q_PROPERTY(QDeclarativeListProperty<QDeclarativeOrganizerItem> journals READ journals NOTIFY modelChanged)
+ Q_PROPERTY(QDeclarativeListProperty<QDeclarativeOrganizerItem> notes READ notes NOTIFY modelChanged)
Q_PROPERTY(QString error READ error NOTIFY errorChanged)
- Q_PROPERTY(int itemCount READ itemCount NOTIFY itemsChanged)
+ Q_PROPERTY(int itemCount READ itemCount NOTIFY modelChanged)
Q_INTERFACES(QDeclarativeParserStatus)
public:
enum {
@@ -90,8 +91,10 @@ public:
QString error() const;
int itemCount() const;
+
QString manager() const;
- void setManager(const QString& managerName);
+ void setManager(const QString& managerUri);
+ QString managerName() const;
QStringList availableManagers() const;
QDateTime startPeriod() const;
void setStartPeriod(const QDateTime& start);
@@ -126,9 +129,9 @@ public:
Q_INVOKABLE void saveItem(QDeclarativeOrganizerItem* item);
Q_INVOKABLE void fetchItems(const QList<QString>& ids);
- Q_INVOKABLE bool containsItems(const QDate& start, const QDate& end = QDate());
+ Q_INVOKABLE bool containsItems(QDateTime start, QDateTime end = QDateTime());
Q_INVOKABLE QDeclarativeOrganizerItem* item(const QString& id);
- Q_INVOKABLE QStringList itemIds(const QDate& start, const QDate& end = QDate());
+ Q_INVOKABLE QStringList itemIds(QDateTime start=QDateTime(), QDateTime end = QDateTime());
bool autoUpdate() const;
void setAutoUpdate(bool autoUpdate);
@@ -141,7 +144,7 @@ signals:
void availableManagersChanged();
void filterChanged();
void fetchHintChanged();
- void itemsChanged();
+ void modelChanged();
void sortOrdersChanged();
void errorChanged();
void startPeriodChanged();
@@ -156,6 +159,7 @@ public slots:
private slots:
void fetchAgain();
void requestUpdated();
+ void doUpdate();
void itemsSaved();
@@ -172,6 +176,8 @@ private:
int itemIndex(const QDeclarativeOrganizerItem* item);
void addSorted(QDeclarativeOrganizerItem* item);
void removeItemsFromModel(const QList<QString>& ids);
+ bool itemHasReccurence(const QOrganizerItem& oi) const;
+ void fetchOccurrences(const QOrganizerItem& item);
QDeclarativeOrganizerItem* createItem(const QOrganizerItem& item);
static void item_append(QDeclarativeListProperty<QDeclarativeOrganizerItem> *p, QDeclarativeOrganizerItem *item);
static int item_count(QDeclarativeListProperty<QDeclarativeOrganizerItem> *p);
diff --git a/plugins/declarative/organizer/qdeclarativeorganizerrecurrencerule_p.h b/plugins/declarative/organizer/qdeclarativeorganizerrecurrencerule_p.h
index 2a6904e3cb..c096fe1a78 100644
--- a/plugins/declarative/organizer/qdeclarativeorganizerrecurrencerule_p.h
+++ b/plugins/declarative/organizer/qdeclarativeorganizerrecurrencerule_p.h
@@ -109,20 +109,21 @@ public:
void setLimit(const QVariant& value)
{
- if (value.userType() == QVariant::Date) {
+ if (value.type() == QVariant::Date) {
QDate v = value.value<QDate>();
if (v != m_rule.limitDate()) {
m_rule.setLimit(v);
emit recurrenceRuleChanged();
}
- } else if (value.type() == QVariant::Int) {
+ } else if ((value.type() == QVariant::Int) || (value.type() == QVariant::Double)) {
int v = value.value<int>();
if (v != m_rule.limitCount()) {
m_rule.setLimit(v);
emit recurrenceRuleChanged();
}
} else {
- qWarning() << "Invalid recurrence rule limit value:" << value;
+ // TODO throw an error event
+ qWarning() << "Invalid recurrence rule limit; value ," << value << ", did not match one of the types: date, integer or double";
}
}
diff --git a/plugins/declarative/publishsubscribe/publishsubscribe.pro b/plugins/declarative/publishsubscribe/publishsubscribe.pro
index 9917f3300e..d0eb485a42 100644
--- a/plugins/declarative/publishsubscribe/publishsubscribe.pro
+++ b/plugins/declarative/publishsubscribe/publishsubscribe.pro
@@ -2,9 +2,9 @@ INCLUDEPATH += ../../../src/publishsubscribe
DEPENDPATH += ../../../src/publishsubscribe
INCLUDEPATH += ../../../src/global
-TARGET = $$qtLibraryTarget(declarative_publishsubscribe)
TEMPLATE = lib
CONFIG += plugin
+TARGET = $$qtLibraryTarget(declarative_publishsubscribe)
TARGETPATH = QtMobility/publishsubscribe
PLUGIN_TYPE = declarative
include(../../../common.pri)
diff --git a/plugins/declarative/sensors/sensors.pro b/plugins/declarative/sensors/sensors.pro
index 87fc42e94d..996b90c846 100644
--- a/plugins/declarative/sensors/sensors.pro
+++ b/plugins/declarative/sensors/sensors.pro
@@ -1,9 +1,9 @@
INCLUDEPATH += ../../../src/sensors
INCLUDEPATH += ../../../src/global
-TARGET = $$qtLibraryTarget(declarative_sensors)
TEMPLATE = lib
CONFIG += plugin
+TARGET = $$qtLibraryTarget(declarative_sensors)
TARGETPATH = QtMobility/sensors
PLUGIN_TYPE = declarative
include(../../../common.pri)
diff --git a/plugins/declarative/serviceframework/serviceframework.pro b/plugins/declarative/serviceframework/serviceframework.pro
index 23f24ec14d..da048d3e52 100644
--- a/plugins/declarative/serviceframework/serviceframework.pro
+++ b/plugins/declarative/serviceframework/serviceframework.pro
@@ -2,9 +2,9 @@ INCLUDEPATH += ../../../src/serviceframework
INCLUDEPATH += ../../../src/global
INCLUDEPATH += .
-TARGET = $$qtLibraryTarget(declarative_serviceframework)
TEMPLATE = lib
CONFIG += qt plugin
+TARGET = $$qtLibraryTarget(declarative_serviceframework)
TARGETPATH = QtMobility/serviceframework
PLUGIN_TYPE = declarative
include(../../../common.pri)
diff --git a/plugins/declarative/systeminfo/qdeclarativescreensaver.cpp b/plugins/declarative/systeminfo/qdeclarativescreensaver.cpp
index 9f6db4288a..90c36082c6 100644
--- a/plugins/declarative/systeminfo/qdeclarativescreensaver.cpp
+++ b/plugins/declarative/systeminfo/qdeclarativescreensaver.cpp
@@ -41,13 +41,14 @@
#include "qdeclarativescreensaver_p.h"
+#include <QDebug>
QT_BEGIN_NAMESPACE
/*!
\qmlclass ScreenSaver QDeclarativeScreenSaver
- \brief The ScreenSaver element allows you to temporarily suppress the screensaver
+ \brief The ScreenSaver element allows you to temporarily suppress and delay the screensaver
from turning on or blanking the screen.
\inherits QObject
@@ -64,15 +65,29 @@ QDeclarativeScreenSaver::QDeclarativeScreenSaver(QObject *parent) :
{
}
+/*!
+ Destroys the QDeclarativeScreenSaver object.
+ */
+
QDeclarativeScreenSaver::~QDeclarativeScreenSaver()
{
+ if(screenSaverDelay) {
+ delete screensaverInfo;
+ screenSaverDelay = false;
+ }
}
+/*!
+ \qmlproperty void ScreenSaver::setScreenSaverDelayed(bool)
+
+ Delays the screensaver if \a on is true, otherwise continues the screensaver.
+*/
void QDeclarativeScreenSaver::setScreenSaverDelayed(bool on)
{
if(on && !screenSaverDelay) {
screensaverInfo = new QSystemScreenSaver(this);
- screenSaverDelay = true;
+ screensaverInfo->setScreenSaverInhibit();
+ screenSaverDelay = screensaverInfo->screenSaverInhibited();
} else if(screenSaverDelay) {
delete screensaverInfo;
screenSaverDelay = false;
@@ -80,7 +95,7 @@ void QDeclarativeScreenSaver::setScreenSaverDelayed(bool on)
}
/*!
- \qmlproperty string ScreenSaver::screenSaverDelayed
+ \qmlproperty bool ScreenSaver::screenSaverDelayed
Returns whether the screensaver has been suppressed, or not.
*/
@@ -90,3 +105,34 @@ bool QDeclarativeScreenSaver::screenSaverDelayed()
return screenSaverDelay;
}
+/*!
+ \brief Set the screensaver to be inhibited.
+
+ Temporarily inhibits the screensaver.
+
+ The screensaver will be set to a non inhibited state only when this QSystemScreenSaver object gets destroyed.
+
+ This is a non blocking function that will return true if the inhibit procedure was successful, otherwise false.
+
+
+ On platforms that support it, if screensaver is secure by policy, the policy will be honored
+ and this will fail.
+*/
+
+bool QDeclarativeScreenSaver::setScreenSaverInhibit()
+{
+ setScreenSaverDelayed(true);
+ return screenSaverDelay;
+}
+
+/*!
+ \property QSystemScreenSaver::screenSaverInhibited
+ \brief Screensaver inhibited.
+
+ Returns true if the screensaver is inhibited, otherwise false.
+*/
+
+bool QDeclarativeScreenSaver::screenSaverInhibited()
+{
+ return screenSaverDelay;
+}
diff --git a/plugins/declarative/systeminfo/qdeclarativescreensaver_p.h b/plugins/declarative/systeminfo/qdeclarativescreensaver_p.h
index b482f1736b..daa4862b3e 100644
--- a/plugins/declarative/systeminfo/qdeclarativescreensaver_p.h
+++ b/plugins/declarative/systeminfo/qdeclarativescreensaver_p.h
@@ -53,12 +53,15 @@ class QDeclarativeScreenSaver : public QObject
{
Q_OBJECT
Q_PROPERTY(bool screenSaverDelayed READ screenSaverDelayed WRITE setScreenSaverDelayed)
+ Q_PROPERTY(bool screenSaverInhibited READ screenSaverInhibited CONSTANT)
public:
explicit QDeclarativeScreenSaver(QObject *parent = 0);
virtual ~QDeclarativeScreenSaver();
bool screenSaverDelayed();
+ bool screenSaverInhibited();
+ Q_INVOKABLE bool setScreenSaverInhibit();
signals:
diff --git a/plugins/declarative/systeminfo/systeminfo.pro b/plugins/declarative/systeminfo/systeminfo.pro
index 37440230f7..81e3548dd5 100644
--- a/plugins/declarative/systeminfo/systeminfo.pro
+++ b/plugins/declarative/systeminfo/systeminfo.pro
@@ -2,9 +2,9 @@ INCLUDEPATH += ../../../src/systeminfo
DEPENDPATH += ../../../src/systeminfo
INCLUDEPATH += ../../../src/global
-TARGET = $$qtLibraryTarget(declarative_systeminfo)
TEMPLATE = lib
CONFIG += plugin
+TARGET = $$qtLibraryTarget(declarative_systeminfo)
TARGETPATH = QtMobility/systeminfo
PLUGIN_TYPE = declarative
include(../../../common.pri)
diff --git a/plugins/feedback/immersion/qfeedback.cpp b/plugins/feedback/immersion/qfeedback.cpp
index a952a548db..74370a96b5 100644
--- a/plugins/feedback/immersion/qfeedback.cpp
+++ b/plugins/feedback/immersion/qfeedback.cpp
@@ -440,8 +440,12 @@ QFeedbackEffect::State QFeedbackImmersion::updateImmState(const QFeedbackEffect
}
case VIBE_EFFECT_STATE_NOT_PLAYING:
default:
- effectHandles.remove(effect);
killTimerForHandle(effectHandle);
+ if (effectHandles.contains(effect)) {
+ effectHandles.remove(effect);
+ // because we kill the timer before it fires stateChanged, we need to emit stateChanged ourself.
+ QMetaObject::invokeMethod(const_cast<QFeedbackEffect*>(effect), "stateChanged");
+ }
return QFeedbackEffect::Stopped;
}
}
diff --git a/plugins/feedback/symbian/qfeedback_chwrmhaptics.cpp b/plugins/feedback/symbian/qfeedback_chwrmhaptics.cpp
new file mode 100644
index 0000000000..67ef905f77
--- /dev/null
+++ b/plugins/feedback/symbian/qfeedback_chwrmhaptics.cpp
@@ -0,0 +1,429 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qfeedbackactuator.h>
+#include "qfeedback_symbian.h"
+#include <QtCore/QVariant>
+#include <QtCore/QFile>
+#include <QtCore/QtPlugin>
+#include <QtGui/QApplication>
+
+#include <hwrmhaptics.h>
+#include <hwrmlogicalactuators.h>
+
+#define MAX_FILE_SIZE 16535 // XXX TODO: what should this be?
+#define VIBE_MAX_MAGNITUDE 10000 // XXX TODO: what should this be?
+
+/* ============================== Common Functions ============================== */
+CHWRMHaptics *QFeedbackSymbian::haptics(int actuator)
+{
+ THWRMLogicalActuators logicalActuator = static_cast<THWRMLogicalActuators>(actuator);
+ CHWRMHaptics* haptics = m_haptics.value(logicalActuator);
+ if (!haptics) {
+ QT_TRAP_THROWING(haptics = CHWRMHaptics::NewL(this, 0));
+ if (haptics) {
+ // no recovery is possible if this fails.
+ QT_TRAP_THROWING(haptics->OpenActuatorL(logicalActuator));
+
+ // Add our new haptics handle to our internal hash.
+ m_haptics.insert(logicalActuator, haptics);
+ }
+ }
+
+ return haptics;
+}
+
+/* ============================== Haptics Interface Functions ============================== */
+
+void QFeedbackSymbian::setActuatorProperty(const QFeedbackActuator &actuator, ActuatorProperty prop, const QVariant &value)
+{
+ // set the device property for the actuator.
+ switch(prop)
+ {
+ case Enabled:
+ TRAP_IGNORE(haptics(actuator.id())->SetDeviceProperty(CHWRMHaptics::EHWRMHapticsDisableEffects, (!(value.toBool()))));
+ // fall through.
+ default:
+ break; // we don't allow setting the name or the state.
+ }
+}
+
+QVariant QFeedbackSymbian::actuatorProperty(const QFeedbackActuator &actuator, ActuatorProperty prop)
+{
+ // return the device property for the actuator.
+ TInt value(0);
+ switch(prop)
+ {
+ case Name:
+ {
+ return QString("chwrmhaptics:actuator:%1").arg(actuator.id());
+ }
+ case State:
+ {
+ TInt status = 0;
+ TRAP_IGNORE(status = haptics(actuator.id())->HapticsStatus());
+ switch (status)
+ {
+ case MHWRMHapticsObserver::EHWRMHapticsStatusAvailable:
+ return QFeedbackActuator::Ready;
+ case MHWRMHapticsObserver::EHWRMHapticsStatusReserved:
+ return QFeedbackActuator::Busy;
+ case MHWRMHapticsObserver::EHWRMHapticsStatusSuspended:
+ return QFeedbackActuator::Busy; // a higher priority client is using the actuator.
+ default:
+ break;
+ }
+ return QFeedbackActuator::Unknown;
+ }
+ case Enabled:
+ {
+ TRAP_IGNORE(haptics(actuator.id())->GetDeviceProperty(CHWRMHaptics::EHWRMHapticsDisableEffects, value));
+ return (!value);
+ }
+ default:
+ {
+ break; // unknown property type. Just return 0 (false).
+ }
+ }
+
+ return QVariant::fromValue(value);
+}
+
+bool QFeedbackSymbian::isActuatorCapabilitySupported(const QFeedbackActuator &, QFeedbackActuator::Capability cap)
+{
+ switch(cap)
+ {
+ case QFeedbackActuator::Envelope:
+ case QFeedbackActuator::Period:
+ return true;
+ default:
+ break;
+ }
+ return false;
+}
+
+void QFeedbackSymbian::updateEffectProperty(const QFeedbackHapticsEffect *effect, EffectProperty prop)
+{
+ TInt errorCode(KErrNone);
+ TInt effectHandle = effectHandles.value(effect);
+
+ if (prop == Period) {
+ // We cannot change the period of a playing effect.
+ reportError(effect, QFeedbackEffect::DeviceBusy);
+ return;
+ }
+
+ // If we get here, it was some property other than Period which needed modification.
+ // In this case, we can modify the effect directly, without stopping and then recreating it.
+ if (effect->period() == -1) { // magnitude sweep (non-periodic) effect
+ // reconstruct the effect with the updated parameters
+ CHWRMHaptics::THWRMHapticsMagSweepEffect magnitudeSweepEffect;
+ magnitudeSweepEffect.iDuration = effect->duration(); // the ModifyPlayingXxxEffect() function is smart enough to modify the end time without resetting the play time.
+ magnitudeSweepEffect.iMagnitude = qRound(effect->intensity() * qreal(VIBE_MAX_MAGNITUDE));
+ magnitudeSweepEffect.iStyle = CHWRMHaptics::EHWRMHapticsStyleSmooth; // XXX TODO: support this?
+ magnitudeSweepEffect.iAttackTime = effect->attackTime();
+ magnitudeSweepEffect.iAttackLevel = qRound(effect->attackIntensity() * qreal(VIBE_MAX_MAGNITUDE));
+ magnitudeSweepEffect.iFadeTime = effect->fadeTime();
+ magnitudeSweepEffect.iFadeLevel = qRound(effect->fadeIntensity() * qreal(VIBE_MAX_MAGNITUDE));
+
+ // update the effect
+ TRAP(errorCode, haptics(effect->actuator()->id())->ModifyPlayingMagSweepEffect(effectHandle, magnitudeSweepEffect));
+ } else { // periodic effect
+ CHWRMHaptics::THWRMHapticsPeriodicEffect periodicEffect;
+ periodicEffect.iDuration = effect->duration(); // the ModifyPlayingXxxEffect() function is smart enough to modify the end time without resetting the play time.
+ periodicEffect.iMagnitude = qRound(effect->intensity() * qreal(VIBE_MAX_MAGNITUDE));
+ periodicEffect.iPeriod = effect->period();
+ periodicEffect.iStyle = CHWRMHaptics::EHWRMHapticsStyleSmooth; // XXX TODO: support this?
+ periodicEffect.iAttackTime = effect->attackTime();
+ periodicEffect.iAttackLevel = qRound(effect->attackIntensity() * qreal(VIBE_MAX_MAGNITUDE));
+ periodicEffect.iFadeTime = effect->fadeTime();
+ periodicEffect.iFadeLevel = qRound(effect->fadeIntensity() * qreal(VIBE_MAX_MAGNITUDE));
+
+ // update the effect
+ TRAP(errorCode, haptics(effect->actuator()->id())->ModifyPlayingPeriodicEffect(effectHandle, periodicEffect));
+ }
+
+ if (errorCode != KErrNone) {
+ reportError(effect, QFeedbackEffect::UnknownError);
+ }
+}
+
+void QFeedbackSymbian::setEffectState(const QFeedbackHapticsEffect *effect, QFeedbackEffect::State newState)
+{
+ // retrieve the handle for this effect.
+ TInt effectHandle = effectHandles.value(effect);
+
+ TInt err(KErrNone);
+ switch(newState)
+ {
+ case QFeedbackEffect::Stopped:
+ TRAP(err, haptics(effect->actuator()->id())->StopPlayingEffect(effectHandle));
+ if (err == KErrNone) {
+ // we remove the effect from our hashes if it's stopped.
+ effectHandles.remove(effect);
+ handleEffects.remove(effectHandle);
+ }
+ break;
+ case QFeedbackEffect::Paused:
+ TRAP(err, haptics(effect->actuator()->id())->PausePlayingEffect(effectHandle));
+ break;
+ case QFeedbackEffect::Running:
+ if (effect->state() == QFeedbackEffect::Paused) {
+ // if it was paused, we can resume it by specifying the handle
+ TRAP(err, haptics(effect->actuator()->id())->ResumePausedEffect(effectHandle));
+ } else {
+ // otherwise, we will receive a new handle from the PlayXxxEffect() functions
+ if (effect->period() == -1) {
+ // reconstruct the effect with the updated parameters
+ CHWRMHaptics::THWRMHapticsMagSweepEffect magnitudeSweepEffect;
+ magnitudeSweepEffect.iDuration = effect->duration();
+ magnitudeSweepEffect.iMagnitude = qRound(effect->intensity() * qreal(VIBE_MAX_MAGNITUDE));
+ magnitudeSweepEffect.iStyle = CHWRMHaptics::EHWRMHapticsStyleSmooth; // XXX TODO: support this?
+ magnitudeSweepEffect.iAttackTime = effect->attackTime();
+ magnitudeSweepEffect.iAttackLevel = qRound(effect->attackIntensity() * qreal(VIBE_MAX_MAGNITUDE));
+ magnitudeSweepEffect.iFadeTime = effect->fadeTime();
+ magnitudeSweepEffect.iFadeLevel = qRound(effect->fadeIntensity() * qreal(VIBE_MAX_MAGNITUDE));
+ TRAP(err, haptics(effect->actuator()->id())->PlayMagSweepEffect(magnitudeSweepEffect, effectHandle));
+ } else {
+ // find the handle for the effect
+ CHWRMHaptics::THWRMHapticsPeriodicEffect periodicEffect;
+ periodicEffect.iDuration = effect->duration();
+ periodicEffect.iMagnitude = qRound(effect->intensity() * qreal(VIBE_MAX_MAGNITUDE));
+ periodicEffect.iPeriod = effect->period();
+ periodicEffect.iStyle = CHWRMHaptics::EHWRMHapticsStyleSmooth; // XXX TODO: support this?
+ periodicEffect.iAttackTime = effect->attackTime();
+ periodicEffect.iAttackLevel = qRound(effect->attackIntensity() * qreal(VIBE_MAX_MAGNITUDE));
+ periodicEffect.iFadeTime = effect->fadeTime();
+ periodicEffect.iFadeLevel = qRound(effect->fadeIntensity() * qreal(VIBE_MAX_MAGNITUDE));
+ TRAP(err, haptics(effect->actuator()->id())->PlayPeriodicEffect(periodicEffect, effectHandle));
+ }
+ if (err == KErrNone) {
+ // replacement insert operation.
+ effectHandles.insert(effect, effectHandle);
+ handleEffects.insert(effectHandle, effect);
+ }
+ }
+ // fall through
+ default:
+ break;
+ }
+
+ // ugly hack: after starting the effect, we must update the intensity, or it doesn't work. Bug?
+ updateEffectProperty(effect, Intensity);
+
+ if (err != KErrNone)
+ reportError(effect, QFeedbackEffect::UnknownError);
+}
+
+QFeedbackEffect::State QFeedbackSymbian::effectState(const QFeedbackHapticsEffect *effect)
+{
+ TInt handle = effectHandles.value(effect);
+ if (handle) {
+ TInt state = CHWRMHaptics::EHWRMHapticsEffectNotPlaying;
+ if (haptics(effect->actuator()->id())->GetEffectState(handle, state) == KErrNone) {
+ switch (state) {
+ case CHWRMHaptics::EHWRMHapticsEffectNotPlaying:
+ default:
+ return QFeedbackEffect::Stopped;
+
+ case CHWRMHaptics::EHWRMHapticsEffectPlaying:
+ return QFeedbackEffect::Running;
+
+ case CHWRMHaptics::EHWRMHapticsEffectPaused:
+ return QFeedbackEffect::Paused;
+ }
+ }
+ }
+ return QFeedbackEffect::Stopped;
+}
+
+/* ============================== File Interface Functions ============================== */
+
+CHWRMHaptics* QFeedbackSymbian::fileHaptics()
+{
+ // XXX Which actuator for file effects?
+ // XXX TODO: add actuator selection API to QFeedbackFileEffect.
+ return haptics(EHWRMLogicalActuatorAny);
+}
+
+// MHWRMHapticsObserver functions
+void QFeedbackSymbian::EffectCompletedL(TInt error, TInt handle)
+{
+ Q_UNUSED(error); // The observer feedback function isn't called currently, so ignoring the error should be safe for now.
+ QFeedbackEffect* effect = const_cast<QFeedbackEffect*>(handleEffects.value(handle));
+ if (effect) {
+ QMetaObject::invokeMethod(effect, "stateChanged");
+ }
+}
+
+void QFeedbackSymbian::HapticsStatusChangedL(THWRMHapticsStatus aStatus)
+{
+ Q_UNUSED(aStatus);
+ // We don't currently care. Perhaps an actuator property should change?
+
+}
+
+void QFeedbackSymbian::setLoaded(QFeedbackFileEffect* effect, bool load)
+{
+ const QUrl url = effect->source();
+
+ // This doesn't handle qrc urls..
+ const QString fileName = url.toLocalFile();
+ if (fileName.isEmpty())
+ return;
+
+ if (!load && !fileData.contains(fileName))
+ return;
+
+ FileContent &fc = fileData[fileName];
+
+ if (load) {
+ bool success = true;
+ fc.refCount++;
+ if (fc.refCount == 1) {
+ // We need to load the data and put it into haptics
+ QFile file(fileName);
+ success = false;
+ if (file.size() < MAX_FILE_SIZE && file.open(QIODevice::ReadOnly)) {
+ fc.ba = file.readAll();
+ // XXX can we clear fc.ba after the load?
+ if (fileHaptics()->LoadEffectData(fc.constData(), fc.fileHandle) == KErrNone) {
+ success = true;
+ } else {
+ fileData.remove(fileName);
+ }
+ }
+ }
+ reportLoadFinished(effect, success);
+ } else {
+ //unload
+ fc.refCount--;
+ if (fc.refCount == 0) {
+ fileHaptics()->DeleteEffectData(fc.fileHandle);
+ fileData.remove(fileName);
+ }
+
+ // Also get rid of effectHandles
+ TInt effectHandle = effectHandles.value(effect);
+ if (effectHandle) {
+ handleEffects.remove(effectHandle);
+ effectHandles.remove(effect);
+ }
+ }
+}
+
+void QFeedbackSymbian::setEffectState(QFeedbackFileEffect * effect, QFeedbackEffect::State state)
+{
+ TInt effectHandle = effectHandles.value(effect);
+ TInt status = 0;
+
+ switch (state)
+ {
+ case QFeedbackEffect::Stopped:
+ if (effectHandle) {
+ status = fileHaptics()->StopPlayingEffect(effectHandle);
+ // The handle is invalid after calling stop() on it; remove it from our hashes.
+ effectHandles.remove(effect);
+ handleEffects.remove(effectHandle);
+ }
+ break;
+ case QFeedbackEffect::Paused:
+ if (effectHandle)
+ status = fileHaptics()->PausePlayingEffect(effectHandle);
+ break;
+ case QFeedbackEffect::Running:
+ if (effectHandle) {
+ // If the effect handle exists, we're resuming
+ status = fileHaptics()->ResumePausedEffect(effectHandle);
+ } else {
+ // Assuming we've loaded the effect, we just need to start it
+ QString fileName = effect->source().toLocalFile();
+ Q_ASSERT(fileData.contains(fileName)); // false if we haven't loaded it yet (prevented by upper levels?)
+
+ status = fileHaptics()->PlayEffect(fileData[fileName].fileHandle, 0, effectHandle);
+ if (status == KErrNone) {
+ effectHandles.insert(effect, effectHandle);
+ handleEffects.insert(effectHandle, effect);
+ }
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+QFeedbackEffect::State QFeedbackSymbian::effectState(const QFeedbackFileEffect * effect)
+{
+ TInt handle = effectHandles.value(effect);
+ if (handle) {
+ TInt state = CHWRMHaptics::EHWRMHapticsEffectNotPlaying;
+ if (fileHaptics()->GetEffectState(handle, state) == KErrNone) {
+ switch (state) {
+ case CHWRMHaptics::EHWRMHapticsEffectNotPlaying:
+ default:
+ return QFeedbackEffect::Stopped;
+
+ case CHWRMHaptics::EHWRMHapticsEffectPlaying:
+ return QFeedbackEffect::Running;
+
+ case CHWRMHaptics::EHWRMHapticsEffectPaused:
+ return QFeedbackEffect::Paused;
+ }
+ }
+ }
+ return QFeedbackEffect::Stopped;
+}
+
+int QFeedbackSymbian::effectDuration(const QFeedbackFileEffect* effect)
+{
+ TInt handle = effectHandles.value(effect);
+ if (handle) {
+ TInt duration = 0;
+ if (fileHaptics()->GetEffectDuration(handle, 0, duration) == KErrNone)
+ return duration;
+ }
+ return 0; // unknown
+}
+
+QStringList QFeedbackSymbian::supportedMimeTypes()
+{
+ return QStringList() << QLatin1String("vibra/ivt");
+}
diff --git a/plugins/feedback/symbian/qfeedback.cpp b/plugins/feedback/symbian/qfeedback_chwrmvibra.cpp
index 67a5dc528e..50a2e43e54 100644
--- a/plugins/feedback/symbian/qfeedback.cpp
+++ b/plugins/feedback/symbian/qfeedback_chwrmvibra.cpp
@@ -40,180 +40,23 @@
****************************************************************************/
#include <qfeedbackactuator.h>
-#include "qfeedback.h"
+#include "qfeedback_symbian.h"
#include <QtCore/QVariant>
#include <QtCore/QtPlugin>
#include <QtGui/QApplication>
-Q_EXPORT_PLUGIN2(feedback_symbian, QFeedbackSymbian)
-
-
-
-#define VIBRA_DEVICE 0
-#define TOUCH_DEVICE 1 //this one is only available if ADVANCED_TACTILE_SUPPORT is defined
-
-
-//TODO: is activeWindow good enough
-//or should we create a widget for that?
-CCoeControl *QFeedbackSymbian::defaultWidget()
-{
- QWidget *w = QApplication::activeWindow();
- return w ? w->winId() : 0;
-}
-
-#ifndef NO_TACTILE_SUPPORT
+#ifdef HAS_THEME_EFFECTS
#include <touchfeedback.h>
-
-static MTouchFeedback *touchInstance()
-{
- static MTouchFeedback *ret = 0;
- if (!ret) {
- QT_TRAP_THROWING(
- ret = MTouchFeedback::Instance();
- if (!ret)
- ret = MTouchFeedback::CreateInstanceL();
- )
- }
- return ret;
-}
-
-static TTouchLogicalFeedback convertToSymbian(QFeedbackEffect::ThemeEffect effect)
-{
-
- TTouchLogicalFeedback themeFeedbackSymbian = ETouchFeedbackBasic;
-
- switch (effect) {
- case QFeedbackEffect::ThemeBasic:
- themeFeedbackSymbian = ETouchFeedbackBasic;
- break;
- case QFeedbackEffect::ThemeSensitive:
- themeFeedbackSymbian = ETouchFeedbackSensitive;
- break;
-#ifdef ADVANCED_TACTILE_SUPPORT
- case QFeedbackEffect::ThemeBasicButton:
- themeFeedbackSymbian = ETouchFeedbackBasicButton;
- break;
- case QFeedbackEffect::ThemeSensitiveButton:
- themeFeedbackSymbian = ETouchFeedbackSensitiveButton;
- break;
- case QFeedbackEffect::ThemeBasicItem:
- themeFeedbackSymbian = ETouchFeedbackBasic; // Effects changing in 10.1 are mapped to basic.
- break;
- case QFeedbackEffect::ThemeSensitiveItem:
- themeFeedbackSymbian = ETouchFeedbackBasic; // Effects changing in 10.1 are mapped to basic.
- break;
- case QFeedbackEffect::ThemeBounceEffect:
- themeFeedbackSymbian = ETouchFeedbackBasic; // Effects changing in 10.1 are mapped to basic.
- break;
- case QFeedbackEffect::ThemePopupOpen:
- themeFeedbackSymbian = ETouchFeedbackBasic; // Effects changing in 10.1 are mapped to basic.
- break;
- case QFeedbackEffect::ThemePopupClose:
- themeFeedbackSymbian = ETouchFeedbackBasic; // Effects changing in 10.1 are mapped to basic.
- break;
- case QFeedbackEffect::ThemeBasicSlider:
- themeFeedbackSymbian = ETouchFeedbackBasic; // Effects changing in 10.1 are mapped to basic.
- break;
- case QFeedbackEffect::ThemeSensitiveSlider:
- themeFeedbackSymbian = ETouchFeedbackBasic; // Effects changing in 10.1 are mapped to basic.
- break;
- case QFeedbackEffect::ThemeStopFlick:
- themeFeedbackSymbian = ETouchFeedbackBasic; // Effects changing in 10.1 are mapped to basic.
- break;
- case QFeedbackEffect::ThemeFlick:
- themeFeedbackSymbian = ETouchFeedbackBasic; // Effects changing in 10.1 are mapped to basic.
- break;
- case QFeedbackEffect::ThemeEditor:
- themeFeedbackSymbian = ETouchFeedbackBasic; // Effects changing in 10.1 are mapped to basic.
- break;
- case QFeedbackEffect::ThemeTextSelection:
- themeFeedbackSymbian = ETouchFeedbackTextSelection;
- break;
- case QFeedbackEffect::ThemeBlankSelection:
- themeFeedbackSymbian = ETouchFeedbackBlankSelection;
- break;
- case QFeedbackEffect::ThemeLineSelection:
- themeFeedbackSymbian = ETouchFeedbackLineSelection;
- break;
- case QFeedbackEffect::ThemeEmptyLineSelection:
- themeFeedbackSymbian = ETouchFeedbackEmptyLineSelection;
- break;
- case QFeedbackEffect::ThemeCheckBox:
- themeFeedbackSymbian = ETouchFeedbackCheckbox;
- break;
- case QFeedbackEffect::ThemeMultipleCheckBox:
- themeFeedbackSymbian = ETouchFeedbackBasic; // Effects changing in 10.1 are mapped to basic.
- break;
- case QFeedbackEffect::ThemeSensitiveKeypad:
- themeFeedbackSymbian = ETouchFeedbackBasic; // Effects changing in 10.1 are mapped to basic.
- break;
- case QFeedbackEffect::ThemeBasicKeypad:
- themeFeedbackSymbian = ETouchFeedbackBasic; // Effects changing in 10.1 are mapped to basic.
- break;
- case QFeedbackEffect::ThemeMultiPointTouchActivate:
- themeFeedbackSymbian = ETouchFeedbackBasic; // Effects changing in 10.1 are mapped to basic.
- break;
- case QFeedbackEffect::ThemeRotateStep:
- themeFeedbackSymbian = ETouchFeedbackBasic; // Effects changing in 10.1 are mapped to basic.
- break;
- case QFeedbackEffect::ThemeItemDrop:
- themeFeedbackSymbian = ETouchFeedbackBasic; // Effects changing in 10.1 are mapped to basic.
- break;
- case QFeedbackEffect::ThemeItemMoveOver:
- themeFeedbackSymbian = ETouchFeedbackBasic; // Effects changing in 10.1 are mapped to basic.
- break;
- case QFeedbackEffect::ThemeItemPick:
- themeFeedbackSymbian = ETouchFeedbackBasic; // Effects changing in 10.1 are mapped to basic.
- break;
- case QFeedbackEffect::ThemeItemScroll:
- themeFeedbackSymbian = ETouchFeedbackBasic; // Effects changing in 10.1 are mapped to basic.
- break;
- case QFeedbackEffect::ThemePopUp:
- themeFeedbackSymbian = ETouchFeedbackPopUp;
- break;
- case QFeedbackEffect::ThemeLongPress:
- themeFeedbackSymbian = ETouchFeedbackBasic; // Effects changing in 10.1 are mapped to basic.
- break;
-#endif //ADVANCED_TACTILE_SUPPORT
- default:
- break;
- }
- return themeFeedbackSymbian;
-}
-
+#ifdef HAS_ADVANCED_TACTILE_SUPPORT
// This define is for the second parameter of StartFeedback, which needs to be of type
-// TTouchContinuousFeedback in platforms with ADVANCED_TACTILE_SUPPORT
+// TTouchContinuousFeedback in platforms with HAS_ADVANCED_TACTILE_SUPPORT
#define DEFAULT_CONTINUOUS_EFFECT ETouchContinuousSmooth
+#endif //HAS_ADVANCED_TACTILE_SUPPORT
+#endif // HAS_THEME_EFFECTS
-bool QFeedbackSymbian::play(QFeedbackEffect::ThemeEffect effect)
-{
- TInt err = KErrNone;
- TRAP(err, touchInstance()->InstantFeedback(convertToSymbian(effect)));
- return err == KErrNone;
-}
-
-#endif //NO_TACTILE_SUPPORT
-
-QFeedbackInterface::PluginPriority QFeedbackSymbian::pluginPriority()
-{
- return PluginLowPriority;
-}
-
-QFeedbackSymbian::QFeedbackSymbian() : m_vibra(0), m_vibraActive(true)
-{
-#ifndef NO_TACTILE_SUPPORT
- //if we don't have advanced tactile support then the MTouchFeedback doesn't really support custom effects
- if (touchInstance()->TouchFeedbackSupported()) {
- m_actuators << createFeedbackActuator(this, TOUCH_DEVICE);
- }
-#endif //NO_TACTILE_SUPPORT
- m_actuators << createFeedbackActuator(this, VIBRA_DEVICE);
-}
-
-QFeedbackSymbian::~QFeedbackSymbian()
-{
- delete m_vibra;
-}
+#ifdef USE_CHWRMVIBRA_PLZ
+#include <hwrmvibra.h>
+#endif //USE_CHWRMVIBRA_PLZ
CHWRMVibra *QFeedbackSymbian::vibra()
{
@@ -223,26 +66,21 @@ CHWRMVibra *QFeedbackSymbian::vibra()
return m_vibra;
}
-QList<QFeedbackActuator*> QFeedbackSymbian::actuators()
-{
- return m_actuators;
-}
-
void QFeedbackSymbian::setActuatorProperty(const QFeedbackActuator &actuator, ActuatorProperty prop, const QVariant &value)
{
- switch(prop)
+ switch (prop)
{
case Enabled:
- switch(actuator.id())
+ switch (actuator.id())
{
case VIBRA_DEVICE:
m_vibraActive = value.toBool();
break;
-#ifdef ADVANCED_TACTILE_SUPPORT
+#ifdef HAS_ADVANCED_TACTILE_SUPPORT
case TOUCH_DEVICE:
TRAP_IGNORE(touchInstance()->SetFeedbackEnabledForThisApp(value.toBool()));
break;
-#endif
+#endif //HAS_ADVANCED_TACTILE_SUPPORT
default:
break;
}
@@ -251,22 +89,24 @@ void QFeedbackSymbian::setActuatorProperty(const QFeedbackActuator &actuator, Ac
QVariant QFeedbackSymbian::actuatorProperty(const QFeedbackActuator &actuator, ActuatorProperty prop)
{
- switch(prop)
+ switch (prop)
{
case Name:
- switch(actuator.id())
+ switch (actuator.id())
{
case VIBRA_DEVICE:
return QLatin1String("Vibra");
+#ifdef HAS_ADVANCED_TACTILE_SUPPORT
case TOUCH_DEVICE:
return QLatin1String("Touch");
+#endif //HAS_ADVANCED_TACTILE_SUPPORT
default:
return QString();
}
case State:
{
QFeedbackActuator::State ret = QFeedbackActuator::Unknown;
- switch(actuator.id())
+ switch (actuator.id())
{
case VIBRA_DEVICE:
{
@@ -282,26 +122,28 @@ QVariant QFeedbackSymbian::actuatorProperty(const QFeedbackActuator &actuator, A
return QFeedbackActuator::Unknown;
}
}
+#ifdef HAS_ADVANCED_TACTILE_SUPPORT
case TOUCH_DEVICE:
//there is no way of getting the state of the device!
+#endif //HAS_ADVANCED_TACTILE_SUPPORT
default:
return QFeedbackActuator::Unknown;
}
return ret;
}
case Enabled:
- switch(actuator.id())
+ switch (actuator.id())
{
case VIBRA_DEVICE:
return m_vibraActive;
-#ifdef ADVANCED_TACTILE_SUPPORT
+#ifdef HAS_ADVANCED_TACTILE_SUPPORT
case TOUCH_DEVICE:
{
bool ret = false;
TRAP_IGNORE(ret = touchInstance()->FeedbackEnabledForThisApp());
return ret;
}
-#endif
+#endif //HAS_ADVANCED_TACTILE_SUPPORT
default:
return false;
}
@@ -311,8 +153,21 @@ QVariant QFeedbackSymbian::actuatorProperty(const QFeedbackActuator &actuator, A
}
-bool QFeedbackSymbian::isActuatorCapabilitySupported(const QFeedbackActuator &, QFeedbackActuator::Capability)
+bool QFeedbackSymbian::isActuatorCapabilitySupported(const QFeedbackActuator &, QFeedbackActuator::Capability cap)
{
+ switch(cap)
+ {
+ case QFeedbackActuator::Envelope:
+#ifdef HAS_ENVELOPE_SUPPORT
+ return true;
+#else
+ return false;
+#endif //HAS_ENVELOPE_SUPPORT
+ case QFeedbackActuator::Period:
+ return true;
+ default:
+ break;
+ }
return false;
}
@@ -323,22 +178,22 @@ void QFeedbackSymbian::updateEffectProperty(const QFeedbackHapticsEffect *effect
return;
}
TInt err = KErrNone;
- switch(prop)
+ switch (prop)
{
case Intensity:
if (!m_elapsed.contains(effect) || m_elapsed[effect].isPaused())
break;
- switch(effect->actuator()->id())
+ switch (effect->actuator()->id())
{
case VIBRA_DEVICE:
TRAP(err, vibra()->StartVibraL(effect->duration() - m_elapsed[effect].elapsed(), qRound(100 * effect->intensity())));
break;
-#ifdef ADVANCED_TACTILE_SUPPORT
+#ifdef HAS_ADVANCED_TACTILE_SUPPORT
case TOUCH_DEVICE:
TRAP(err, touchInstance()->ModifyFeedback(defaultWidget(), qRound(100 * effect->intensity())));
break;
-#endif //ADVANCED_TACTILE_SUPPORT
+#endif //HAS_ADVANCED_TACTILE_SUPPORT
default:
break;
}
@@ -355,9 +210,9 @@ void QFeedbackSymbian::setEffectState(const QFeedbackHapticsEffect *effect, QFee
if (!effect->actuator()) {
return;
}
- switch(effect->actuator()->id()) {
+ switch (effect->actuator()->id()) {
case VIBRA_DEVICE:
- switch(newState)
+ switch (newState)
{
case QFeedbackEffect::Stopped:
if (m_elapsed.contains(effect)) {
@@ -380,9 +235,9 @@ void QFeedbackSymbian::setEffectState(const QFeedbackHapticsEffect *effect, QFee
break;
}
break;
-#ifdef ADVANCED_TACTILE_SUPPORT
+#ifdef HAS_ADVANCED_TACTILE_SUPPORT
case TOUCH_DEVICE:
- switch(newState)
+ switch (newState)
{
case QFeedbackEffect::Stopped:
if (m_elapsed.contains(effect)) {
@@ -407,7 +262,7 @@ void QFeedbackSymbian::setEffectState(const QFeedbackHapticsEffect *effect, QFee
break;
}
break;
-#endif //ADVANCED_TACTILE_SUPPORT
+#endif //HAS_ADVANCED_TACTILE_SUPPORT
default:
break;
}
@@ -426,6 +281,6 @@ QFeedbackEffect::State QFeedbackSymbian::effectState(const QFeedbackHapticsEffec
return QFeedbackEffect::Running;
// Otherwise, the timer has elapsed or never started, so fall through to Stopped
}
-
+
return QFeedbackEffect::Stopped;
}
diff --git a/plugins/feedback/symbian/qfeedback_symbian.cpp b/plugins/feedback/symbian/qfeedback_symbian.cpp
new file mode 100644
index 0000000000..a0dfb23033
--- /dev/null
+++ b/plugins/feedback/symbian/qfeedback_symbian.cpp
@@ -0,0 +1,132 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qfeedbackactuator.h>
+#include "qfeedback_symbian.h"
+#include <QtCore/QVariant>
+#include <QtCore/QtPlugin>
+#include <QtGui/QApplication>
+
+#ifdef USE_CHWRMHAPTICS_PLZ
+#include <e32def.h>
+#include <hwrmhaptics.h>
+#include <hwrmlogicalactuators.h>
+#endif //USE_CHWRMHAPTICS_PLZ
+
+#ifdef USE_CHWRMVIBRA_PLZ
+#include <hwrmvibra.h>
+#endif //USE_CHWRMVIBRA_PLZ
+
+#ifdef HAS_THEME_EFFECTS
+#include <touchfeedback.h>
+#endif //HAS_THEME_EFFECTS
+
+Q_EXPORT_PLUGIN2(feedback_symbian, QFeedbackSymbian)
+
+
+//TODO: is activeWindow good enough
+//or should we create a widget for that?
+CCoeControl *QFeedbackSymbian::defaultWidget()
+{
+ QWidget *w = QApplication::activeWindow();
+ return w ? w->winId() : 0;
+}
+
+QFeedbackSymbian::QFeedbackSymbian()
+{
+#ifdef USE_CHWRMVIBRA_PLZ
+ m_vibra = 0;
+ m_vibraActive = false;
+#endif
+
+ initActuators();
+}
+
+QFeedbackSymbian::~QFeedbackSymbian()
+{
+#ifdef USE_CHWRMHAPTICS_PLZ
+ qDeleteAll(m_haptics);
+#endif
+}
+
+// TODO does this need to be vibra vs haptics?
+void QFeedbackSymbian::initActuators()
+{
+#ifdef USE_CHWRMHAPTICS_PLZ
+ // Retrieve the supported actuators from the haptics backend
+ // XXX TODO: is this correct? What about user-installed actuators?
+ TUint32 supportedActuators(0);
+ TInt err(KErrNone);
+ CHWRMHaptics* haptics(0);
+ QT_TRAP_THROWING(haptics = CHWRMHaptics::NewL(NULL, NULL));
+ if (!haptics)
+ return; // unable to initialize haptics backend.
+ haptics->SupportedActuators(supportedActuators);
+ if (EHWRMLogicalActuatorDevice & supportedActuators) {
+ m_actuators << createFeedbackActuator(this, EHWRMLogicalActuatorDevice);
+ }
+ if (EHWRMLogicalActuatorAny & supportedActuators) {
+ m_actuators << createFeedbackActuator(this, EHWRMLogicalActuatorAny);
+ }
+ delete haptics;
+ return;
+#endif //USE_CHWRMHAPTICS_PLZ
+
+#ifdef USE_CHWRMVIBRA_PLZ
+#ifdef HAS_ADVANCED_TACTILE_SUPPORT
+ //if we don't have advanced tactile support then the MTouchFeedback doesn't really support custom effects
+ if (touchInstance()->TouchFeedbackSupported()) {
+ m_actuators << createFeedbackActuator(this, TOUCH_DEVICE);
+ }
+#endif //HAS_ADVANCED_TACTILE_SUPPORT
+ m_actuators << createFeedbackActuator(this, VIBRA_DEVICE);
+#endif //USE_CHWRMVIBRA_PLZ
+}
+
+QFeedbackInterface::PluginPriority QFeedbackSymbian::pluginPriority()
+{
+ return PluginLowPriority;
+}
+
+QList<QFeedbackActuator*> QFeedbackSymbian::actuators()
+{
+ return m_actuators;
+}
diff --git a/plugins/feedback/symbian/qfeedback.h b/plugins/feedback/symbian/qfeedback_symbian.h
index 397eea8f17..b39e2dee48 100644
--- a/plugins/feedback/symbian/qfeedback.h
+++ b/plugins/feedback/symbian/qfeedback_symbian.h
@@ -51,28 +51,52 @@
#include <QtCore/QTime>
#endif
-
#include <qmobilityglobal.h>
-
#include <qfeedbackplugininterfaces.h>
-
#include <e32base.h>
+
+#ifdef USE_CHWRMVIBRA_PLZ
#include <hwrmvibra.h>
+#define VIBRA_DEVICE 0
+#endif //USE_CHWRMVIBRA_PLZ
+#ifdef HAS_THEME_EFFECTS
+class MTouchFeedback;
+#ifdef HAS_ADVANCED_TACTILE_SUPPORT
+#define TOUCH_DEVICE 1
+#endif //HAS_ADVANCED_TACTILE_SUPPORT
+#endif //HAS_THEME_EFFECTS
+
+#ifdef USE_CHWRMHAPTICS_PLZ
+#include <hwrmhaptics.h>
+#endif //USE_CHWRMHAPTICS_PLZ
QT_BEGIN_HEADER
QTM_USE_NAMESPACE
+// We have theme effects on 5.0 onwards
+// and file effects if CHWRMHaptics is found (s^3 onwards?)
+
+#ifdef HAS_CUSTOM_EFFECTS
class QFeedbackSymbian : public QObject, public QFeedbackHapticsInterface
-#ifndef NO_TACTILE_SUPPORT
+#ifdef HAS_THEME_EFFECTS
, public QFeedbackThemeInterface
-#endif //NO_TACTILE_SUPPORT
+#endif
+#ifdef HAS_FILE_EFFECTS
+, public QFeedbackFileInterface
+#endif
+#ifdef USE_CHWRMHAPTICS_PLZ
+, public MHWRMHapticsObserver
+#endif
{
Q_OBJECT
Q_INTERFACES(QTM_NAMESPACE::QFeedbackHapticsInterface)
-#ifndef NO_TACTILE_SUPPORT
+#ifdef HAS_THEME_EFFECTS
Q_INTERFACES(QTM_NAMESPACE::QFeedbackThemeInterface)
-#endif //NO_TACTILE_SUPPORT
+#endif
+#ifdef HAS_FILE_EFFECTS
+ Q_INTERFACES(QTM_NAMESPACE::QFeedbackFileInterface)
+#endif
public:
QFeedbackSymbian();
virtual ~QFeedbackSymbian();
@@ -90,16 +114,29 @@ public:
virtual void setEffectState(const QFeedbackHapticsEffect *, QFeedbackEffect::State);
virtual QFeedbackEffect::State effectState(const QFeedbackHapticsEffect *);
-#ifndef NO_TACTILE_SUPPORT
+#ifdef HAS_THEME_EFFECTS
virtual bool play(QFeedbackEffect::ThemeEffect);
-#endif // NO_TACTILE_SUPPORT
+#endif
+
+#ifdef HAS_FILE_EFFECTS
+ // File interface functions
+ virtual void setLoaded(QFeedbackFileEffect*, bool);
+ virtual void setEffectState(QFeedbackFileEffect *, QFeedbackEffect::State);
+ virtual QFeedbackEffect::State effectState(const QFeedbackFileEffect *);
+ virtual int effectDuration(const QFeedbackFileEffect*);
+ virtual QStringList supportedMimeTypes();
+#endif
+
+#ifdef USE_CHWRMHAPTICS_PLZ
+ // MHWRMHapticsObserver functions
+ void EffectCompletedL(TInt error, TInt handle);
+ void HapticsStatusChangedL(THWRMHapticsStatus aStatus);
+#endif
private:
+#ifdef USE_CHWRMVIBRA_PLZ
CHWRMVibra *vibra();
- QList<QFeedbackActuator*> m_actuators;
- CCoeControl *defaultWidget();
-
CHWRMVibra *m_vibra;
bool m_vibraActive;
@@ -112,7 +149,7 @@ private:
m_elapsedTimer.invalidate();
#else
m_elapsedTimer = QTime();
-#endif
+#endif //QT_VERSION
}
~PausableElapsedTimer()
@@ -145,7 +182,7 @@ private:
m_elapsedTimer.invalidate();
#else
m_elapsedTimer = QTime();
-#endif
+#endif //QT_VERSION
delete mTimer;
mTimer = 0;
}
@@ -165,14 +202,44 @@ private:
QElapsedTimer m_elapsedTimer;
#else
QTime m_elapsedTimer;
-#endif
+#endif //QT_VERSION
int pausedTime;
QTimer* mTimer;
};
QHash<const QFeedbackHapticsEffect*, PausableElapsedTimer> m_elapsed;
+
+#endif //USE_CHWRMVIBRA_PLZ
+#ifdef USE_CHWRMHAPTICS_PLZ
+ CHWRMHaptics *haptics(int actuator);
+ CHWRMHaptics *fileHaptics();
+
+ QHash<THWRMLogicalActuators, CHWRMHaptics*> m_haptics;
+
+ struct FileContent {
+ FileContent() : fileHandle(0), refCount(0) { }
+ FileContent(const QByteArray &arr) : fileHandle(0), ba(arr), refCount(1) { }
+ TPtrC8 constData() const {return TPtrC8(reinterpret_cast<const unsigned char *>(ba.constData()), ba.length());}
+ TInt fileHandle;
+
+ QByteArray ba;
+ int refCount;
+ };
+ QHash<QString, FileContent> fileData;
+ QHash<const QFeedbackEffect*, TInt> effectHandles;
+ QHash<TInt, const QFeedbackEffect*> handleEffects;
+#endif //USE_CHWRMHAPTICS_PLZ
+
+#ifdef HAS_THEME_EFFECTS
+ static MTouchFeedback *touchInstance();
+#endif //HAS_THEME_EFFECTS
+
+ void initActuators();
+ QList<QFeedbackActuator*> m_actuators;
+ CCoeControl *defaultWidget();
};
+#endif //HAS_CUSTOM_EFFECTS
QT_END_HEADER
diff --git a/plugins/feedback/symbian/qfeedback_themed.cpp b/plugins/feedback/symbian/qfeedback_themed.cpp
new file mode 100644
index 0000000000..16c34ab9fa
--- /dev/null
+++ b/plugins/feedback/symbian/qfeedback_themed.cpp
@@ -0,0 +1,173 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qfeedback_symbian.h"
+#include <QtCore/QVariant>
+#include <QtCore/QtPlugin>
+#include <QtGui/QApplication>
+
+// This is included if we have themed effect support
+
+#include <touchfeedback.h>
+
+MTouchFeedback *QFeedbackSymbian::touchInstance()
+{
+ static MTouchFeedback *ret = 0;
+ if (!ret) {
+ QT_TRAP_THROWING(
+ ret = MTouchFeedback::Instance();
+ if (!ret)
+ ret = MTouchFeedback::CreateInstanceL();
+ )
+ }
+ return ret;
+}
+
+static TTouchLogicalFeedback convertToSymbian(QFeedbackEffect::ThemeEffect effect)
+{
+
+ TTouchLogicalFeedback themeFeedbackSymbian = ETouchFeedbackBasic;
+
+ switch (effect) {
+ case QFeedbackEffect::ThemeBasic:
+ themeFeedbackSymbian = ETouchFeedbackBasic;
+ break;
+ case QFeedbackEffect::ThemeSensitive:
+ themeFeedbackSymbian = ETouchFeedbackSensitive;
+ break;
+#ifdef HAS_ADVANCED_TACTILE_SUPPORT
+ case QFeedbackEffect::ThemeBasicButton:
+ themeFeedbackSymbian = ETouchFeedbackBasicButton;
+ break;
+ case QFeedbackEffect::ThemeSensitiveButton:
+ themeFeedbackSymbian = ETouchFeedbackSensitiveButton;
+ break;
+ case QFeedbackEffect::ThemeBasicItem:
+ themeFeedbackSymbian = ETouchFeedbackBasic;
+ break;
+ case QFeedbackEffect::ThemeSensitiveItem:
+ themeFeedbackSymbian = ETouchFeedbackSensitive;
+ break;
+ case QFeedbackEffect::ThemeBounceEffect:
+ themeFeedbackSymbian = ETouchFeedbackBasic;
+ break;
+ case QFeedbackEffect::ThemePopupOpen:
+ themeFeedbackSymbian = ETouchFeedbackBasic;
+ break;
+ case QFeedbackEffect::ThemePopupClose:
+ themeFeedbackSymbian = ETouchFeedbackBasic;
+ break;
+ case QFeedbackEffect::ThemeBasicSlider:
+ themeFeedbackSymbian = ETouchFeedbackBasic;
+ break;
+ case QFeedbackEffect::ThemeSensitiveSlider:
+ themeFeedbackSymbian = ETouchFeedbackSensitive;
+ break;
+ case QFeedbackEffect::ThemeStopFlick:
+ themeFeedbackSymbian = ETouchFeedbackBasic;
+ break;
+ case QFeedbackEffect::ThemeFlick:
+ themeFeedbackSymbian = ETouchFeedbackBasic;
+ break;
+ case QFeedbackEffect::ThemeEditor:
+ themeFeedbackSymbian = ETouchFeedbackBasic;
+ break;
+ case QFeedbackEffect::ThemeTextSelection:
+ themeFeedbackSymbian = ETouchFeedbackTextSelection;
+ break;
+ case QFeedbackEffect::ThemeBlankSelection:
+ themeFeedbackSymbian = ETouchFeedbackBlankSelection;
+ break;
+ case QFeedbackEffect::ThemeLineSelection:
+ themeFeedbackSymbian = ETouchFeedbackLineSelection;
+ break;
+ case QFeedbackEffect::ThemeEmptyLineSelection:
+ themeFeedbackSymbian = ETouchFeedbackEmptyLineSelection;
+ break;
+ case QFeedbackEffect::ThemeCheckBox:
+ themeFeedbackSymbian = ETouchFeedbackCheckbox;
+ break;
+ case QFeedbackEffect::ThemeMultipleCheckBox:
+ themeFeedbackSymbian = ETouchFeedbackBasic;
+ break;
+ case QFeedbackEffect::ThemeSensitiveKeypad:
+ themeFeedbackSymbian = ETouchFeedbackSensitive;
+ break;
+ case QFeedbackEffect::ThemeBasicKeypad:
+ themeFeedbackSymbian = ETouchFeedbackBasic;
+ break;
+ case QFeedbackEffect::ThemeMultiPointTouchActivate:
+ themeFeedbackSymbian = ETouchFeedbackBasic;
+ break;
+ case QFeedbackEffect::ThemeRotateStep:
+ themeFeedbackSymbian = ETouchFeedbackBasic;
+ break;
+ case QFeedbackEffect::ThemeItemDrop:
+ themeFeedbackSymbian = ETouchFeedbackBasic;
+ break;
+ case QFeedbackEffect::ThemeItemMoveOver:
+ themeFeedbackSymbian = ETouchFeedbackBasic;
+ break;
+ case QFeedbackEffect::ThemeItemPick:
+ themeFeedbackSymbian = ETouchFeedbackBasic;
+ break;
+ case QFeedbackEffect::ThemeItemScroll:
+ themeFeedbackSymbian = ETouchFeedbackBasic;
+ break;
+ case QFeedbackEffect::ThemePopUp:
+ themeFeedbackSymbian = ETouchFeedbackPopUp;
+ break;
+ case QFeedbackEffect::ThemeLongPress:
+ themeFeedbackSymbian = ETouchFeedbackBasic;
+ break;
+#endif //HAS_ADVANCED_TACTILE_SUPPORT
+ default:
+ break;
+ }
+ return themeFeedbackSymbian;
+}
+
+bool QFeedbackSymbian::play(QFeedbackEffect::ThemeEffect effect)
+{
+ TInt err = KErrNone;
+ TRAP(err, touchInstance()->InstantFeedback(convertToSymbian(effect)));
+ return err == KErrNone;
+}
diff --git a/plugins/feedback/symbian/symbian.pro b/plugins/feedback/symbian/symbian.pro
index 6b4ffe068e..1cd2c5c612 100644
--- a/plugins/feedback/symbian/symbian.pro
+++ b/plugins/feedback/symbian/symbian.pro
@@ -5,25 +5,45 @@ PLUGIN_TYPE=feedback
include(../../../common.pri)
-HEADERS += qfeedback.h
-SOURCES += qfeedback.cpp
+HEADERS += qfeedback_symbian.h
+SOURCES += qfeedback_symbian.cpp
INCLUDEPATH += $$SOURCE_DIR/src/feedback
-LIBS += -lhwrmvibraclient
CONFIG += mobility
MOBILITY = feedback
symbian {
contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2) {
- DEFINES += NO_TACTILE_SUPPORT
+ # S60 3rd edition does not support theme effects, nor does it support
+ # envelope modifiers to custom effects (attack and fade).
} else {
+ # S60 5th edition supports theme effects, but it does not support
+ # envelope modifiers to custom effects (attack and fade).
+ DEFINES += HAS_THEME_EFFECTS
+ SOURCES += qfeedback_themed.cpp
LIBS += -ltouchfeedback
}
contains(advancedtouchfeedback_enabled, yes) {
- DEFINES += ADVANCED_TACTILE_SUPPORT
+ # this uses the same lib and headers as touchfeedback
+ # but on some platforms (S^3) includes more theme effects.
+ DEFINES += HAS_ADVANCED_TACTILE_SUPPORT
+ }
+
+ contains(chwrmhaptics_enabled, yes) {
+ DEFINES += HAS_FILE_EFFECTS
+ DEFINES += HAS_CUSTOM_EFFECTS
+ DEFINES += HAS_ENVELOPE_SUPPORT
+ DEFINES += USE_CHWRMHAPTICS_PLZ
+ SOURCES += qfeedback_chwrmhaptics.cpp
+ LIBS += -lhwrmhapticsclient
+ } else {
+ DEFINES += HAS_CUSTOM_EFFECTS
+ DEFINES += USE_CHWRMVIBRA_PLZ
+ SOURCES += qfeedback_chwrmvibra.cpp
+ LIBS += -lhwrmvibraclient
}
TARGET.EPOCALLOWDLLDATA=1
diff --git a/plugins/geoservices/nokia/qgeotiledmapdata_nokia.cpp b/plugins/geoservices/nokia/qgeotiledmapdata_nokia.cpp
index 6d328c5718..3fbab41dbb 100644
--- a/plugins/geoservices/nokia/qgeotiledmapdata_nokia.cpp
+++ b/plugins/geoservices/nokia/qgeotiledmapdata_nokia.cpp
@@ -88,6 +88,9 @@ static QGeoBoundingBox variantListToBoundingBox(const QVariantList & list) {
void QGeoTiledMapDataNokia::copyrightReplyFinished(QNetworkReply * reply)
{
+ if (reply->error() != QNetworkReply::NoError)
+ return;
+
JSONParser jp(reply->readAll());
QVariant root = jp.parse();
diff --git a/plugins/landmarks/qsparql/databaseoperations.cpp b/plugins/landmarks/qsparql/databaseoperations.cpp
index d2897dc935..bc22144c11 100644
--- a/plugins/landmarks/qsparql/databaseoperations.cpp
+++ b/plugins/landmarks/qsparql/databaseoperations.cpp
@@ -70,15 +70,20 @@
#include <qlandmarkimportrequest.h>
#include <qlandmarkexportrequest.h>
-#include <QFile>
+#include <QBuffer>
+#include <QDateTime>
#include <QDebug>
+#include <QEventLoop>
+#include <QFile>
#include <math.h>
-#include <QUuid>
-#include <QSet>
#include <QMetaMethod>
#include <qnumeric.h>
-#include <QXmlStreamReader>
+#include <QSet>
+#include <QSharedMemory>
#include <QStringList>
+#include <QTimer>
+#include <QUuid>
+#include <QXmlStreamReader>
#include <QtSparql/QSparqlConnection>
#include <QtSparql/QSparqlConnectionOptions>
@@ -314,21 +319,22 @@ QSparqlResult* executeQuery(QSparqlConnection *conn, const QString &statement, c
foreach(const QString &key, keys)
qsparqlSelectQuery.bindValue(key, bindValues.value(key));
}
- QSparqlResult* queryResult = conn->exec(qsparqlSelectQuery);
- queryResult->waitForFinished();
-
- if (!queryResult->hasError()) {
- if (error)
- *error = QLandmarkManager::NoError;
- if (errorString)
- *errorString ="";
- } else {
- if (error)
- *error = QLandmarkManager::UnknownError;
- if (errorString)
- *errorString ="";
- }
- return queryResult;
+ QSparqlResult* queryResult = conn->exec(qsparqlSelectQuery);
+ if (queryResult != 0) {
+ queryResult->waitForFinished();
+ if (!queryResult->hasError()) {
+ if (error)
+ *error = QLandmarkManager::NoError;
+ if (errorString)
+ *errorString ="";
+ } else {
+ if (error)
+ *error = QLandmarkManager::UnknownError;
+ if (errorString)
+ *errorString ="";
+ }
+ }
+ return queryResult;
}
QString queryStringForRadius(const QGeoCoordinate &coord, qreal radius)
@@ -343,7 +349,7 @@ QString queryStringForRadius(const QGeoCoordinate &coord, qreal radius)
QString landmarkIdsDefaultQueryString()
{
return "select ?u ?latitude ?longitude ?name {?g a slo:GeoLocation . ?u slo:location ?g . "
- "OPTIONAL { ?g nie:title ?name } . "
+ "OPTIONAL { ?u nie:title ?name } . "
"OPTIONAL { ?g slo:latitude ?latitude } . "
"OPTIONAL { ?g slo:longitude ?longitude }}";
}
@@ -372,9 +378,9 @@ QString landmarkIdsQueryString(const QList<QLandmarkId> ids)
QString landmarkIdsNameQueryString(const QLandmarkNameFilter &filter)
{
if (filter.matchFlags() & QLandmarkFilter::MatchCaseSensitive)
- return QString("select ?u {?g a slo:GeoLocation ; nie:title ?name . ?u slo:location ?g . FILTER regex( ?name, '%1') }").arg(filter.name());
+ return QString("select ?u {?g a slo:GeoLocation . ?u slo:location ?g . ?u nie:title ?name . FILTER regex( ?name, '%1') }").arg(filter.name());
else
- return QString("select ?u {?g a slo:GeoLocation ; nie:title ?name . ?u slo:location ?g . FILTER regex( ?name, '%1', 'i') }").arg(filter.name());
+ return QString("select ?u {?g a slo:GeoLocation . ?u slo:location ?g . ?u nie:title ?name . FILTER regex( ?name, '%1', 'i') }").arg(filter.name());
}
QString landmarkIdsCategoryQueryString(const QLandmarkCategoryFilter &filter)
@@ -419,7 +425,6 @@ QString landmarkIdsBoxQueryString(const QLandmarkBoxFilter &filter)
bool categoryNameCompare(const QLandmarkCategory &cat1, const QLandmarkCategory &cat2) {
return (cat1.name() < cat2.name());
}
-
}
/////////////////////////////////////////////////////////////
@@ -432,7 +437,8 @@ using namespace DatabaseOperationsHelpers;
DatabaseOperations::DatabaseOperations()
: connectionName(QString()),
managerUri(QString()),
- queryRun(0)
+ queryRun(0),
+ sharedMemory("QLandmarksSharedMemory")
{
m_conn = new QSparqlConnection("QTRACKER");
}
@@ -440,6 +446,75 @@ DatabaseOperations::DatabaseOperations()
DatabaseOperations::~DatabaseOperations()
{
delete m_conn;
+ if (sharedMemory.isAttached())
+ sharedMemory.detach();
+}
+
+void DatabaseOperations::dataChangedSignallingOnly(bool enabled)
+{
+ if (sharedMemory.isAttached())
+ sharedMemory.detach();
+ QBuffer buffer;
+ buffer.open( QBuffer::ReadWrite );
+ QDataStream out( &buffer );
+ QDateTime dateTime = QDateTime::currentDateTime();
+ qint64 timeStamp;
+ if (enabled)
+ timeStamp = (qint64)dateTime.toTime_t() *1000 + dateTime.time().msec() + 60000;
+ else
+ timeStamp = (qint64)dateTime.toTime_t() *1000 + dateTime.time().msec();
+ QString timeStampString;
+ timeStampString.setNum(timeStamp);
+ out << timeStampString;
+ int size = buffer.size();
+ if (!sharedMemory.attach()) {
+ if (!sharedMemory.create(size)) {
+ qWarning() << "Unable to create shared memory segment.";
+ return;
+ } else {
+ // Write into the shared memory
+ sharedMemory.lock();
+ char *to = (char*)sharedMemory.data();
+ const char *from = buffer.data().data();
+ memcpy( to, from, qMin( sharedMemory.size(), size ) );
+ sharedMemory.unlock();
+ }
+ } else {
+ if (!enabled) {
+ // When disabling this functionality, the time stamp in shared
+ // memory is updated only if it is equal to the time stamp saved
+ // by this thread. So the signalling of an other large operation
+ // started afterwards by other landmark manager will not be
+ // interrupted.
+ QBuffer readBuffer;
+ QDataStream in(&readBuffer);
+ QString timeStampInSharedMemory;
+ sharedMemory.lock();
+ readBuffer.setData((char*)sharedMemory.constData(), sharedMemory.size());
+ readBuffer.open(QBuffer::ReadOnly);
+ in >> timeStampInSharedMemory;
+ sharedMemory.unlock();
+ if (m_timeStamp != timeStampInSharedMemory.toLongLong())
+ return;
+ }
+ // Write into the shared memory
+ sharedMemory.lock();
+ char *to = (char*)sharedMemory.data();
+ const char *from = buffer.data().data();
+ memcpy( to, from, qMin( sharedMemory.size(), size ) );
+ sharedMemory.unlock();
+ }
+ if (enabled) {
+ m_timeStamp = timeStamp;
+ } else {
+ // If an asynchronous operation ends, this delay is needed for
+ // giving each landmark manager an opportunity to read shared
+ // memory before it is detached by this thread (in destructor)
+ // and then released by the system.
+ QEventLoop eventLoop;
+ QTimer::singleShot(1000, &eventLoop, SLOT(quit()));
+ eventLoop.exec();
+ }
}
QLandmark DatabaseOperations::retrieveLandmark(const QLandmarkId &landmarkId,
@@ -472,15 +547,17 @@ QLandmark DatabaseOperations::retrieveLandmark(const QLandmarkId &landmarkId,
if (queryRun && queryRun->isCanceled) {
return QLandmark();
}
-
- QString queryString = QString("select ?u ?name ?latitude ?longitude ?altitude {?g a slo:GeoLocation . ?u slo:location ?g . "
- "OPTIONAL { ?g nie:title ?name } . OPTIONAL { ?g slo:latitude ?latitude } . "
- "OPTIONAL { ?g slo:longitude ?longitude } . OPTIONAL { ?g slo:altitude ?altitude } . "
+ QSparqlConnection conn("QTRACKER");
+ QString queryString = QString("select ?u nie:title(?u) slo:latitude(?g) slo:longitude(?g) slo:altitude(?g) "
+ "slo:iconUrl(?u) nie:description(?u) slo:radius(?g) "
+ "nco:country(?pa) nco:region(?pa) nco:locality(?pa) nco:streetAddress(?pa) nco:postalcode(?pa) "
+ "nco:url(?c) nco:hasPhoneNumber(?c) "
+ "{?u a slo:Landmark ; slo:location ?g ; slo:hasContact ?c . "
+ "?g a slo:GeoLocation ; slo:postalAddress ?pa . ?c a nco:PersonContact "
"FILTER regex( ?u, '^%1$') }").arg(landmarkId.localId());
QSparqlQuery qsparqlQuery = QSparqlQuery(queryString, QSparqlQuery::SelectStatement);
-
- QSparqlResult* qsparqlResult = m_conn->exec(qsparqlQuery);
+ QSparqlResult* qsparqlResult = conn.exec(qsparqlQuery);
qsparqlResult->waitForFinished();
if (qsparqlResult->hasError()) {
if (error)
@@ -494,7 +571,8 @@ QLandmark DatabaseOperations::retrieveLandmark(const QLandmarkId &landmarkId,
return QLandmark();
}
- bool found=false;
+ bool found = false;
+ bool lmHasPhoneNumber = false;
while (qsparqlResult->next()) {
if (found) {
if (error)
@@ -553,13 +631,44 @@ QLandmark DatabaseOperations::retrieveLandmark(const QLandmarkId &landmarkId,
}
}
lm.setCoordinate(coord);
- }
+ if (!qsparqlResult->value(5).toString().isEmpty())
+ lm.setIconUrl(QUrl(qsparqlResult->value(5).toString()));
+ if (!qsparqlResult->value(6).toString().isEmpty())
+ lm.setDescription(qsparqlResult->value(6).toString());
+ else
+ lm.setDescription("");
+ if (!qsparqlResult->value(7).toString().isEmpty()) {
+ if (qsparqlResult->value(7).toString().toFloat() != 0)
+ lm.setRadius(qsparqlResult->value(7).toString().toFloat());
+ else
+ lm.setRadius(0.0);
+ } else {
+ lm.setRadius(0.0);
+ }
+ QGeoAddress address = lm.address();
+ if (!qsparqlResult->value(8).toString().isEmpty())
+ address.setCountry(qsparqlResult->value(8).toString());
+ if (!qsparqlResult->value(9).toString().isEmpty())
+ address.setState(qsparqlResult->value(9).toString());
+ if (!qsparqlResult->value(10).toString().isEmpty())
+ address.setCity(qsparqlResult->value(10).toString());
+ if (!qsparqlResult->value(11).toString().isEmpty())
+ address.setStreet(qsparqlResult->value(11).toString());
+ if (!qsparqlResult->value(12).toString().isEmpty())
+ address.setPostcode(qsparqlResult->value(12).toString());
+ lm.setAddress(address);
+ if (!qsparqlResult->value(13).toString().isEmpty())
+ lm.setUrl(QUrl(qsparqlResult->value(13).toString()));
+ if (!qsparqlResult->value(14).toString().isEmpty())
+ lmHasPhoneNumber = true;
+ }
+ delete qsparqlResult;
if (found) {
lm.setLandmarkId(landmarkId);
- QString queryString2 = QString("select ?u {?u a slo:LandmarkCategory . "
- "?landmarkId slo:belongsToCategory ?u . FILTER regex( ?landmarkId, '^%1$') }").arg(landmarkId.localId());
- QSparqlQuery qsparqlQuery2 = QSparqlQuery(queryString2, QSparqlQuery::SelectStatement);
- QSparqlResult* qsparqlResult2 = m_conn->exec(qsparqlQuery2);
+ queryString = QString("select ?u {?u a slo:LandmarkCategory . "
+ "?landmarkId slo:belongsToCategory ?u . FILTER regex( ?landmarkId, '^%1$') }").arg(landmarkId.localId());
+ qsparqlQuery = QSparqlQuery(queryString, QSparqlQuery::SelectStatement);
+ QSparqlResult* qsparqlResult2 = conn.exec(qsparqlQuery);
qsparqlResult2->waitForFinished();
if (qsparqlResult2->hasError()) {
@@ -580,80 +689,19 @@ QLandmark DatabaseOperations::retrieveLandmark(const QLandmarkId &landmarkId,
lm.addCategoryId(id);
}
}
- QMap<QString,QVariant> bindValues;
- QString q0 = QString("select ?a {?u a slo:Landmark ; slo:iconUrl ?a . FILTER regex( ?u, '^%1$') }").arg(landmarkId.localId());
- QSparqlResult* queryResult = executeQuery(m_conn, q0,bindValues,error,errorString);
- if(!queryResult->hasError()) {
- queryResult->next();
- if (!queryResult->value(0).toString().isEmpty())
- lm.setIconUrl(QUrl(queryResult->value(0).toString()));
- }
- q0 = QString("select ?r { ?u a slo:Landmark ; slo:hasContact ?c . ?c a nco:PersonContact ; nco:url ?r"
- " . FILTER regex( ?u, '^%1$') }").arg(landmarkId.localId());
- queryResult = executeQuery(m_conn, q0,bindValues,error,errorString);
- if(!queryResult->hasError()) {
- queryResult->next();
- if (!queryResult->value(0).toString().isEmpty())
- lm.setUrl(QUrl(queryResult->value(0).toString()));
- }
- q0 = QString("select ?a {?u a slo:Landmark ; nie:description ?a . FILTER regex( ?u, '^%1$') }").arg(landmarkId.localId());
- queryResult = executeQuery(m_conn, q0,bindValues,error,errorString);
- if(!queryResult->hasError()) {
- if (queryResult->next()) {
- if (!queryResult->value(0).toString().isEmpty())
- lm.setDescription(queryResult->value(0).toString());
- else
- lm.setDescription("");
- } else {
- lm.setDescription("");
+ delete qsparqlResult2;
+ if (lmHasPhoneNumber) {
+ queryString = QString("select ?p { ?u a slo:Landmark ; slo:hasContact ?c . ?c a nco:PersonContact ; nco:hasPhoneNumber ?pn"
+ " . ?pn a nco:PhoneNumber ; nco:phoneNumber ?p . FILTER regex( ?u, '^%1$') }").arg(landmarkId.localId());
+ qsparqlQuery = QSparqlQuery(queryString, QSparqlQuery::SelectStatement);
+ QSparqlResult* qsparqlResult3 = conn.exec(qsparqlQuery);
+ qsparqlResult3->waitForFinished();
+ if(!qsparqlResult3->hasError()) {
+ qsparqlResult3->next();
+ if (!qsparqlResult3->value(0).toString().isEmpty())
+ lm.setPhoneNumber(qsparqlResult3->value(0).toString());
}
- }
- q0 = QString("select ?a {?g a slo:GeoLocation ; "
- "slo:radius ?a . "
- "?u slo:location ?g . FILTER regex( ?u, '^%1$') }").arg(landmarkId.localId());
- queryResult = executeQuery(m_conn, q0,bindValues,error,errorString);
- if(!queryResult->hasError()) {
- if (queryResult->next()) {
- if (!queryResult->value(0).toString().isEmpty()) {
- if (queryResult->value(0).toString().toFloat() != 0)
- lm.setRadius(queryResult->value(0).toString().toFloat());
- else
- lm.setRadius(0.0);
- } else {
- lm.setRadius(0.0);
- }
- } else {
- lm.setRadius(0.0);
- }
- }
- q0 = QString("select ?country ?region ?city ?street ?postcode {?g a slo:GeoLocation . "
- "?u slo:location ?g . ?g slo:postalAddress ?pa . "
- "OPTIONAL { ?pa nco:country ?country } . OPTIONAL { ?pa nco:region ?region } . "
- "OPTIONAL { ?pa nco:locality ?city } . OPTIONAL { ?pa nco:streetAddress ?street } . "
- "OPTIONAL { ?pa nco:postalcode ?postcode } . FILTER regex( ?u, '^%1$') }").arg(landmarkId.localId());
- queryResult = executeQuery(m_conn, q0,bindValues,error,errorString);
- if(!queryResult->hasError()) {
- QGeoAddress address = lm.address();
- queryResult->next();
- if (!queryResult->value(0).toString().isEmpty())
- address.setCountry(queryResult->value(0).toString());
- if (!queryResult->value(1).toString().isEmpty())
- address.setState(queryResult->value(1).toString());
- if (!queryResult->value(2).toString().isEmpty())
- address.setCity(queryResult->value(2).toString());
- if (!queryResult->value(3).toString().isEmpty())
- address.setStreet(queryResult->value(3).toString());
- if (!queryResult->value(4).toString().isEmpty())
- address.setPostcode(queryResult->value(4).toString());
- lm.setAddress(address);
- }
- q0 = QString("select ?p { ?u a slo:Landmark ; slo:hasContact ?c . ?c a nco:PersonContact ; nco:hasPhoneNumber ?pn"
- " . ?pn a nco:PhoneNumber ; nco:phoneNumber ?p . FILTER regex( ?u, '^%1$') }").arg(landmarkId.localId());
- queryResult = executeQuery(m_conn, q0,bindValues,error,errorString);
- if(!queryResult->hasError()) {
- queryResult->next();
- if (!queryResult->value(0).toString().isEmpty())
- lm.setPhoneNumber(queryResult->value(0).toString());
+ delete qsparqlResult3;
}
} else {
Q_ASSERT(error);
@@ -758,20 +806,21 @@ QList<QLandmarkId> DatabaseOperations::landmarkIds(const QLandmarkFilter& filter
}
if (selectAll) {
queryString = QString("select ?u ?name {?g a slo:GeoLocation . ?u slo:location ?g . "
- "OPTIONAL { ?g nie:title ?name }");
+ "OPTIONAL { ?u nie:title ?name }");
break;
} else {
+ queryString = QString("select ?u {?u a slo:Landmark . ?u slo:hasContact ?pc . ?u slo:location ?g . "
+ "OPTIONAL { ?pc nco:hasPhoneNumber ?pn } . OPTIONAL { ?pn nco:phoneNumber ?phoneNumber } . "
+ "OPTIONAL { ?g slo:postalAddress ?pa } . "
+ "OPTIONAL { ?u nie:title ?name } . OPTIONAL { ?g slo:latitude ?latitude } . "
+ "OPTIONAL { ?g slo:longitude ?longitude } . OPTIONAL { ?g slo:altitude ?altitude } . "
+ "OPTIONAL { ?g slo:radius ?radius } . OPTIONAL { ?u nie:description ?description } . "
+ "OPTIONAL { ?pa nco:country ?country } . OPTIONAL { ?pa nco:region ?region } . "
+ "OPTIONAL { ?pa nco:locality ?locality } . OPTIONAL { ?pa nco:streetAddress ?street } . "
+ "OPTIONAL { ?pa nco:postalcode ?postcode }. FILTER ( ");
if (attributeFilter.operationType() == QLandmarkAttributeFilter::AndOperation) {
QStringList lmLocalIds;
bool filterAdded = false;
- queryString = QString("select ?u {?g a slo:GeoLocation . ?u slo:location ?g . "
- "?g slo:postalAddress ?pa ."
- "OPTIONAL { ?g nie:title ?name } . OPTIONAL { ?g slo:latitude ?latitude } . "
- "OPTIONAL { ?g slo:longitude ?longitude } . OPTIONAL { ?g slo:altitude ?altitude } . "
- "OPTIONAL { ?g slo:radius ?radius } . OPTIONAL { ?u nie:description ?description } . "
- "OPTIONAL { ?pa nco:country ?country } . OPTIONAL { ?pa nco:region ?region } . "
- "OPTIONAL { ?pa nco:locality ?locality } . OPTIONAL { ?pa nco:streetAddress ?street } . FILTER ( ");
-
if (attributeFilter.attributeKeys().contains("name")) {
QString regexVariable = createRegex(attributeFilter, "name");
QString nameString;
@@ -852,12 +901,38 @@ QList<QLandmarkId> DatabaseOperations::landmarkIds(const QLandmarkFilter& filter
queryString.append(streetString);
filterAdded = true;
}
-
+ if (attributeFilter.attributeKeys().contains("postcode")) {
+ QString regexVariable = createRegex(attributeFilter, "postcode");
+ QString postcodeString;
+ if (attributeFilter.matchFlags("postcode") & QLandmarkFilter::MatchCaseSensitive ||
+ attributeFilter.matchFlags("postcode") == QLandmarkFilter::MatchExactly)
+ postcodeString = QString("regex( ?postcode, '%1' ) && ").arg(regexVariable);
+ else
+ postcodeString = QString("regex( ?postcode, '%1', 'i' ) && ").arg(regexVariable);
+ queryString.append(postcodeString);
+ filterAdded = true;
+ }
+ if (attributeFilter.attributeKeys().contains("phoneNumber")) {
+ QString regexVariable = createRegex(attributeFilter, "phoneNumber");
+ QString phoneNumberString;
+ if (attributeFilter.matchFlags("phoneNumber") & QLandmarkFilter::MatchCaseSensitive ||
+ attributeFilter.matchFlags("phoneNumber") == QLandmarkFilter::MatchExactly)
+ phoneNumberString = QString("regex( ?phoneNumber, '%1' ) && ").arg(regexVariable);
+ else
+ phoneNumberString = QString("regex( ?phoneNumber, '%1', 'i' ) && ").arg(regexVariable);
+ queryString.append(phoneNumberString);
+ if (!attributeFilter.attribute("phoneNumber").toString().isEmpty()) {
+ queryString.replace( "OPTIONAL { ?pc nco:hasPhoneNumber ?pn } . "
+ "OPTIONAL { ?pn nco:phoneNumber ?phoneNumber } . ", "?pc nco:hasPhoneNumber ?pn . "
+ "?pn nco:phoneNumber ?phoneNumber . ");
+ }
+ filterAdded = true;
+ }
if (filterAdded) {
queryString.chop(3);
queryString.append(" )");
} else {
- queryString.chop(7);
+ queryString.chop(9);
}
queryString.append("}");
@@ -873,7 +948,8 @@ QList<QLandmarkId> DatabaseOperations::landmarkIds(const QLandmarkFilter& filter
}
while(qsparqlResult->next()) {
if (!qsparqlResult->value(0).toString().isEmpty()) {
- lmLocalIds << qsparqlResult->value(0).toString();
+ if(!lmLocalIds.contains(qsparqlResult->value(0).toString()))
+ lmLocalIds << qsparqlResult->value(0).toString();
}
}
QLandmarkId id;
@@ -885,14 +961,6 @@ QList<QLandmarkId> DatabaseOperations::landmarkIds(const QLandmarkFilter& filter
} else {
QStringList lmLocalIds;
bool filterAdded = false;
- queryString = QString("select ?u {?g a slo:GeoLocation . ?u slo:location ?g . "
- "?g slo:postalAddress ?pa ."
- "OPTIONAL { ?g nie:title ?name } . OPTIONAL { ?g slo:latitude ?latitude } . "
- "OPTIONAL { ?g slo:longitude ?longitude } . OPTIONAL { ?g slo:altitude ?altitude } . "
- "OPTIONAL { ?g slo:radius ?radius } . OPTIONAL { ?u nie:description ?description } . "
- "OPTIONAL { ?pa nco:country ?country } . OPTIONAL { ?pa nco:region ?region } . "
- "OPTIONAL { ?pa nco:locality ?locality } . OPTIONAL { ?pa nco:streetAddress ?street } . FILTER ( ");
-
if (attributeFilter.attributeKeys().contains("name")) {
QString regexVariable = createRegex(attributeFilter, "name");
QString nameString;
@@ -973,12 +1041,38 @@ QList<QLandmarkId> DatabaseOperations::landmarkIds(const QLandmarkFilter& filter
queryString.append(streetString);
filterAdded = true;
}
-
+ if (attributeFilter.attributeKeys().contains("postcode")) {
+ QString regexVariable = createRegex(attributeFilter, "postcode");
+ QString postcodeString;
+ if (attributeFilter.matchFlags("postcode") & QLandmarkFilter::MatchCaseSensitive ||
+ attributeFilter.matchFlags("postcode") == QLandmarkFilter::MatchExactly)
+ postcodeString = QString("regex( ?postcode, '%1' ) || ").arg(regexVariable);
+ else
+ postcodeString = QString("regex( ?postcode, '%1', 'i' ) || ").arg(regexVariable);
+ queryString.append(postcodeString);
+ filterAdded = true;
+ }
+ if (attributeFilter.attributeKeys().contains("phoneNumber")) {
+ QString regexVariable = createRegex(attributeFilter, "phoneNumber");
+ QString phoneNumberString;
+ if (attributeFilter.matchFlags("phoneNumber") & QLandmarkFilter::MatchCaseSensitive ||
+ attributeFilter.matchFlags("phoneNumber") == QLandmarkFilter::MatchExactly)
+ phoneNumberString = QString("regex( ?phoneNumber, '%1' ) || ").arg(regexVariable);
+ else
+ phoneNumberString = QString("regex( ?phoneNumber, '%1', 'i' ) || ").arg(regexVariable);
+ queryString.append(phoneNumberString);
+ if (!attributeFilter.attribute("phoneNumber").toString().isEmpty()) {
+ queryString.replace( "OPTIONAL { ?pc nco:hasPhoneNumber ?pn } . "
+ "OPTIONAL { ?pn nco:phoneNumber ?phoneNumber } . ", "?pc nco:hasPhoneNumber ?pn . "
+ "?pn nco:phoneNumber ?phoneNumber . ");
+ }
+ filterAdded = true;
+ }
if (filterAdded) {
queryString.chop(3);
queryString.append(" )");
} else {
- queryString.chop(7);
+ queryString.chop(9);
}
queryString.append("}");
@@ -994,10 +1088,10 @@ QList<QLandmarkId> DatabaseOperations::landmarkIds(const QLandmarkFilter& filter
}
while(qsparqlResult->next()) {
if (!qsparqlResult->value(0).toString().isEmpty()) {
- lmLocalIds << qsparqlResult->value(0).toString();
+ if(!lmLocalIds.contains(qsparqlResult->value(0).toString()))
+ lmLocalIds << qsparqlResult->value(0).toString();
}
}
-
QLandmarkId id;
id.setManagerUri(managerUri);
foreach(const QString &localId, lmLocalIds) {
@@ -1020,13 +1114,13 @@ QList<QLandmarkId> DatabaseOperations::landmarkIds(const QLandmarkFilter& filter
*errorString = "The name filter's configuration is not supported";
return result;
}
- queryString = QString("select ?u { ?g a slo:GeoLocation . ?u slo:location ?g . OPTIONAL { ?g nie:title ?name } . FILTER ");
+ queryString = QString("select ?u { ?g a slo:GeoLocation . ?u slo:location ?g . OPTIONAL { ?u nie:title ?name } . FILTER ");
QString nameKey = "?name";
QString nameValue = nameFilter.name();
QString regex;
if (nameValue.isEmpty()) {
queryString = QString("select ?u ?name {?g a slo:GeoLocation . ?u slo:location ?g . "
- "OPTIONAL { ?g nie:title ?name }}");
+ "OPTIONAL { ?u nie:title ?name }}");
} else if (nameFilter.matchFlags() == QLandmarkFilter::MatchExactly) {
if (nameFilter.matchFlags() & QLandmarkFilter::MatchCaseSensitive)
regex = QString("regex( ?name, '^%1$' ) }").arg(nameValue);
@@ -1100,9 +1194,10 @@ QList<QLandmarkId> DatabaseOperations::landmarkIds(const QLandmarkFilter& filter
*error = QLandmarkManager::NoError;
if (errorString)
*errorString = "";
+ delete qsparqlResult;
return result;
}
-
+ delete qsparqlResult;
queryString = landmarkIdsCategoryQueryString(categoryFilter);
break;
}
@@ -1281,6 +1376,7 @@ QList<QLandmarkId> DatabaseOperations::landmarkIds(const QLandmarkFilter& filter
result.clear();
return result;
}
+ delete qsparqlResult;
} else {
result << idList;
}
@@ -1365,6 +1461,7 @@ QList<QLandmarkId> DatabaseOperations::landmarkIds(const QLandmarkFilter& filter
if (qsparqlResult->hasError()) {
if (error)
*error = QLandmarkManager::UnknownError;
+ delete qsparqlResult;
return result;
}
QLandmarkId id;
@@ -1374,6 +1471,7 @@ QList<QLandmarkId> DatabaseOperations::landmarkIds(const QLandmarkFilter& filter
*error = QLandmarkManager::CancelError;
if (errorString)
*errorString = "Fetch operation canceled";
+ delete qsparqlResult;
return QList<QLandmarkId>();
}
@@ -1427,6 +1525,7 @@ QList<QLandmarkId> DatabaseOperations::landmarkIds(const QLandmarkFilter& filter
result << id;
}
}
+ delete qsparqlResult;
}
if (offset >= result.count()) {
result.clear();
@@ -1563,7 +1662,7 @@ bool DatabaseOperations::saveLandmarkHelper(QLandmark *landmark,
return false;
}
}
- QSparqlConnection conn("QTRACKER");
+ QSparqlConnection conn("QTRACKER");
QString queryString;
queryString.append("insert { ?:uri_value a slo:Landmark ");
@@ -1600,7 +1699,20 @@ bool DatabaseOperations::saveLandmarkHelper(QLandmark *landmark,
if (errorString)
*errorString = "Landmark contains category that belongs to another manager";
return false;
- }
+ }
+ delete categoryResult;
+ }
+ queryString.append("; nie:identifier \"");
+ QDateTime dateTime = QDateTime::currentDateTime();
+ qint64 timeStamp = (qint64)dateTime.toTime_t() *1000 + dateTime.time().msec();
+ QString timeStampString;
+ queryString.append(timeStampString.setNum(timeStamp));
+ queryString.append("\" ");
+
+ if (!landmark->name().isEmpty()) {
+ queryString.append("; nie:title \"");
+ queryString.append(landmark->name());
+ queryString.append("\" ");
}
if (!landmark->description().isEmpty()) {
queryString.append("; nie:description \"");
@@ -1617,11 +1729,6 @@ bool DatabaseOperations::saveLandmarkHelper(QLandmark *landmark,
queryString.append("; slo:location _:x . ");
queryString.append("_:x a slo:GeoLocation ");
- if (!landmark->name().isEmpty()) {
- queryString.append("; nie:title \"");
- queryString.append(landmark->name());
- queryString.append("\" ");
- }
QGeoCoordinate geoCoord;
geoCoord = landmark->coordinate();
@@ -1661,17 +1768,6 @@ bool DatabaseOperations::saveLandmarkHelper(QLandmark *landmark,
queryString.append(landmark->address().country());
queryString.append("\" ");
}
- /*
- if (!landmark->address().state().isEmpty()) {
- queryString.append("; nco:region \"");
- queryString.append(landmark->address().state());
- queryString.append("\" ");
- } else if (!landmark->address().county().isEmpty()) {
- queryString.append("; nco:region \'");
- queryString.append(landmark->address().county());
- queryString.append("\' ");
- }
- */
if (!landmark->address().city().isEmpty()) {
queryString.append("; nco:locality \"");
queryString.append(landmark->address().city());
@@ -1715,6 +1811,7 @@ bool DatabaseOperations::saveLandmarkHelper(QLandmark *landmark,
queryString.append("\" ");
}
}
+ delete phoneResult;
}
queryString.append(". }");
@@ -1728,6 +1825,7 @@ bool DatabaseOperations::saveLandmarkHelper(QLandmark *landmark,
qsparqlInsertQuery.bindValue(uriValue);
}
QSparqlResult* insertResult = conn.exec(qsparqlInsertQuery);
+
insertResult->waitForFinished();
if (!insertResult->hasError()) {
@@ -1743,8 +1841,10 @@ bool DatabaseOperations::saveLandmarkHelper(QLandmark *landmark,
*error = QLandmarkManager::UnknownError;
if (errorString)
*errorString = "Unable to execute insert statement. ";
+ delete insertResult;
return false;
}
+ delete insertResult;
if (error)
*error = QLandmarkManager::NoError;
if (errorString)
@@ -1758,28 +1858,15 @@ bool DatabaseOperations::saveLandmark(QLandmark* landmark,
{
QList<QLandmarkId> addedIds;
QList<QLandmarkId> changedIds;
- bool update = landmark->landmarkId().isValid();
bool result = saveLandmarkHelper(landmark, error, errorString);
- if (result) {
- if(update) {
- changedIds << landmark->landmarkId();
- emit landmarksChanged(changedIds);
- }
- else {
- addedIds << landmark->landmarkId();
- emit landmarksAdded(addedIds);
- }
- }
- return result;
+ return result;
}
bool DatabaseOperations::saveLandmarks(QList<QLandmark> * landmark,
QMap<int, QLandmarkManager::Error> *errorMap,
QLandmarkManager::Error *error,
- QString *errorString,
- QList<QLandmarkId> *addedIds,
- QList<QLandmarkId> *changedIds)
+ QString *errorString)
{
Q_ASSERT(error);
Q_ASSERT(errorString);
@@ -1792,6 +1879,11 @@ bool DatabaseOperations::saveLandmarks(QList<QLandmark> * landmark,
QLandmarkManager::Error loopError;
QString loopErrorString;
bool result;
+ bool dataChangedOnly = false;
+ if (landmark->size() > 50) {
+ dataChangedSignallingOnly(true);
+ dataChangedOnly = true;
+ }
for (int i = 0; i < landmark->size(); ++i) {
loopError = QLandmarkManager::NoError;
loopErrorString = "";
@@ -1806,7 +1898,6 @@ bool DatabaseOperations::saveLandmarks(QList<QLandmark> * landmark,
noErrors = false;
break;
}
- bool update = landmark->at(i).landmarkId().isValid();
result = saveLandmarkHelper(&(landmark->operator [](i)), &loopError, &loopErrorString);
if (errorMap && (loopError != QLandmarkManager::NoError))
@@ -1816,11 +1907,6 @@ bool DatabaseOperations::saveLandmarks(QList<QLandmark> * landmark,
noErrors = false;
lastError = loopError;
lastErrorString = loopErrorString;
- } else {
- if(update)
- changedIds->append(landmark->at(i).landmarkId());
- else
- addedIds->append(landmark->at(i).landmarkId());
}
}
@@ -1835,19 +1921,8 @@ bool DatabaseOperations::saveLandmarks(QList<QLandmark> * landmark,
if (errorString)
*errorString = lastErrorString;
}
-
- if (addedIds->size() != 0) {
- if (addedIds->size() < 50)
- emit landmarksAdded(*addedIds);
- else
- emit dataChanged();
- }
- if (changedIds->size() != 0) {
- if (changedIds->size() < 50)
- emit landmarksChanged(*changedIds);
- else
- emit dataChanged();
- }
+ if (dataChangedOnly)
+ dataChangedSignallingOnly(false);
return noErrors;
}
@@ -1867,6 +1942,7 @@ bool DatabaseOperations::removeLandmarkHelper(const QLandmarkId &landmarkId,
if (errorString)
*errorString = QString("Landmark with local id %1, does not exist in database.")
.arg(landmarkId.localId());
+ delete queryResult;
return false;
}
if (!queryResult->next()) {
@@ -1875,6 +1951,7 @@ bool DatabaseOperations::removeLandmarkHelper(const QLandmarkId &landmarkId,
if (errorString)
*errorString = QString("Landmark with local id %1, does not exist in database")
.arg(landmarkId.localId());
+ delete queryResult;
return false;
}
if (landmarkId.managerUri() != managerUri) {
@@ -1882,8 +1959,10 @@ bool DatabaseOperations::removeLandmarkHelper(const QLandmarkId &landmarkId,
*error = QLandmarkManager::BadArgumentError;
if (errorString)
*errorString = "Landmark id comes from different landmark manager.";
+ delete queryResult;
return false;
- }
+ }
+ delete queryResult;
QSparqlConnection conn("QTRACKER");
bool otherContactHasSameNumber = false;
QString phoneQueryString = QString("select ?c { ?u a slo:Landmark ; slo:hasContact ?pc . "
@@ -1904,6 +1983,7 @@ bool DatabaseOperations::removeLandmarkHelper(const QLandmarkId &landmarkId,
}
}
}
+ delete phoneResult;
QString deleteQuery = QString( "delete { ?c a nco:PersonContact . } "
"WHERE { ?:landmark_uri slo:hasContact ?c . } "
"delete { ?pa a nco:PostalAddress . } "
@@ -1913,6 +1993,10 @@ bool DatabaseOperations::removeLandmarkHelper(const QLandmarkId &landmarkId,
"WHERE { ?:landmark_uri slo:location ?g . } "
"delete { ?:landmark_uri nie:description ?des . } "
"WHERE { ?:landmark_uri nie:description ?des . } "
+ "delete { ?:landmark_uri nie:identifier ?ide . } "
+ "WHERE { ?:landmark_uri nie:identifier ?ide . } "
+ "delete { ?:landmark_uri nie:title ?name . } "
+ "WHERE { ?:landmark_uri nie:title ?name . } "
"delete { ?:landmark_uri a slo:Landmark . }");
if (!otherContactHasSameNumber) {
@@ -1938,8 +2022,10 @@ bool DatabaseOperations::removeLandmarkHelper(const QLandmarkId &landmarkId,
*error = QLandmarkManager::UnknownError;
if (errorString)
*errorString = QString("Unable to execute remove landmark statement.");
+ delete deleteResult;
return false;
}
+ delete deleteResult;
return true;
}
@@ -1950,17 +2036,13 @@ bool DatabaseOperations::removeLandmark(const QLandmarkId &landmarkId,
QList<QLandmarkId> removedIds;
bool result = removeLandmarkHelper(landmarkId, error, errorString, managerUri);
- if (result) {
- removedIds.append(landmarkId);
- emit landmarksRemoved(removedIds);
- }
return result;
}
bool DatabaseOperations::removeLandmarks(const QList<QLandmarkId> &landmarkIds,
QMap<int, QLandmarkManager::Error> *errorMap,
QLandmarkManager::Error *error,
- QString *errorString, QList<QLandmarkId> *removedIds)
+ QString *errorString)
{
Q_ASSERT(error);
Q_ASSERT(errorString);
@@ -1973,6 +2055,11 @@ bool DatabaseOperations::removeLandmarks(const QList<QLandmarkId> &landmarkIds,
QLandmarkManager::Error loopError;
QString loopErrorString;
bool result;
+ bool dataChangedOnly = false;
+ if (landmarkIds.size() > 50) {
+ dataChangedSignallingOnly(true);
+ dataChangedOnly = true;
+ }
for (int i = 0; i < landmarkIds.size(); ++i) {
loopError = QLandmarkManager::NoError;
loopErrorString.clear();
@@ -1987,10 +2074,7 @@ bool DatabaseOperations::removeLandmarks(const QList<QLandmarkId> &landmarkIds,
noErrors = false;
break;
}
- result = removeLandmarkHelper(landmarkIds.at(i), &loopError, &loopErrorString, managerUri);
- if (result) {
- removedIds->append(landmarkIds.at(i));
- }
+ result = removeLandmarkHelper(landmarkIds.at(i), &loopError, &loopErrorString, managerUri);
if (errorMap && loopError != QLandmarkManager::NoError)
errorMap->insert(i, loopError);
@@ -2011,9 +2095,8 @@ bool DatabaseOperations::removeLandmarks(const QList<QLandmarkId> &landmarkIds,
if (errorString)
*errorString = lastErrorString;
}
- if (removedIds->size() != 0)
- emit landmarksRemoved(*removedIds);
-
+ if (dataChangedOnly)
+ dataChangedSignallingOnly(false);
return noErrors;
}
@@ -2065,6 +2148,7 @@ QList<QLandmarkCategoryId> DatabaseOperations::categoryIds(const QLandmarkNameSo
id.setLocalId(queryResult->value(0).toString());
result << id;
}
+
if (error)
*error = QLandmarkManager::NoError;
if (errorString)
@@ -2144,6 +2228,7 @@ QLandmarkCategory DatabaseOperations::category(const QLandmarkCategoryId &landma
if (errorString)
*errorString = "";
}
+ delete queryResult;
return cat;
}
@@ -2265,7 +2350,6 @@ bool DatabaseOperations::saveCategoryHelper(QLandmarkCategory *category,
bool update = category->categoryId().isValid();
QSparqlConnection conn("QTRACKER");
-
QString checkString = QString("select ?c { ?c a slo:LandmarkCategory ; nie:title ?name . FILTER regex( ?name, '^%1$') }").arg(category->name());
QSparqlQuery query = QSparqlQuery(checkString, QSparqlQuery::SelectStatement);
QSparqlResult* queryResult = conn.exec(query);
@@ -2286,6 +2370,7 @@ bool DatabaseOperations::saveCategoryHelper(QLandmarkCategory *category,
return false;
}
}
+ delete queryResult;
if (update) {
bool removeResult = removeCategoryHelper(category->categoryId(), error, errorString);
@@ -2301,6 +2386,13 @@ bool DatabaseOperations::saveCategoryHelper(QLandmarkCategory *category,
queryString.append(category->name());
queryString.append("\' ");
}
+ queryString.append("; nie:identifier \"");
+ QDateTime dateTime = QDateTime::currentDateTime();
+ qint64 timeStamp = (qint64)dateTime.toTime_t() *1000 + dateTime.time().msec();
+ QString timeStampString;
+ queryString.append(timeStampString.setNum(timeStamp));
+ queryString.append("\" ");
+
if (!category->iconUrl().toString().isEmpty()) {
queryString.append("; slo:categoryIconUrl \'");
queryString.append(category->iconUrl().toString());
@@ -2336,11 +2428,12 @@ bool DatabaseOperations::saveCategoryHelper(QLandmarkCategory *category,
*errorString = "Landmark Category adding failed.";
return false;
}
-if (error)
- *error = QLandmarkManager::NoError;
-if (errorString)
- *errorString="";
-return true;
+ delete insertResult;
+ if (error)
+ *error = QLandmarkManager::NoError;
+ if (errorString)
+ *errorString="";
+ return true;
}
bool DatabaseOperations::saveCategory(QLandmarkCategory *category,
@@ -2348,28 +2441,15 @@ bool DatabaseOperations::saveCategory(QLandmarkCategory *category,
{
QList<QLandmarkCategoryId> addedIds;
QList<QLandmarkCategoryId> changedIds;
- bool update = category->categoryId().isValid();
bool result = saveCategoryHelper(category, error, errorString);
- if (result) {
- if(update) {
- changedIds << category->categoryId();
- emit categoriesChanged(changedIds);
- }
- else {
- addedIds << category->categoryId();
- emit categoriesAdded(addedIds);
- }
- }
return result;
}
bool DatabaseOperations::saveCategories(QList<QLandmarkCategory> * categories,
QMap<int, QLandmarkManager::Error> *errorMap,
QLandmarkManager::Error *error,
- QString *errorString,
- QList<QLandmarkCategoryId> *addedIds,
- QList<QLandmarkCategoryId> *changedIds)
+ QString *errorString)
{
Q_ASSERT(error);
Q_ASSERT(errorString);
@@ -2381,11 +2461,14 @@ bool DatabaseOperations::saveCategories(QList<QLandmarkCategory> * categories,
QString lastErrorString;
QLandmarkManager::Error loopError;
QString loopErrorString;
-
+ bool dataChangedOnly = false;
+ if (categories->size() > 50) {
+ dataChangedSignallingOnly(true);
+ dataChangedOnly = true;
+ }
for (int i = 0; i < categories->size(); ++i) {
loopError = QLandmarkManager::NoError;
loopErrorString = "";
- bool update = categories->at(i).categoryId().isValid();
bool result = saveCategoryHelper(&(categories->operator [](i)), &loopError, &loopErrorString);
if (!result) {
@@ -2394,11 +2477,6 @@ bool DatabaseOperations::saveCategories(QList<QLandmarkCategory> * categories,
lastErrorString = loopErrorString;
if (errorMap)
errorMap->insert(i, loopError);
- } else {
- if(update)
- changedIds->append(categories->at(i).categoryId());
- else
- addedIds->append(categories->at(i).categoryId());
}
}
@@ -2413,18 +2491,8 @@ bool DatabaseOperations::saveCategories(QList<QLandmarkCategory> * categories,
if (errorString)
*errorString = lastErrorString;
}
- if (addedIds->size() != 0) {
- if (addedIds->size() < 50)
- emit categoriesAdded(*addedIds);
- else
- emit dataChanged();
- }
- if (changedIds->size() != 0) {
- if (changedIds->size() < 50)
- emit categoriesChanged(*changedIds);
- else
- emit dataChanged();
- }
+ if (dataChangedOnly)
+ dataChangedSignallingOnly(false);
return noErrors;
}
@@ -2434,10 +2502,6 @@ bool DatabaseOperations::removeCategory(const QLandmarkCategoryId &categoryId,
QList<QLandmarkCategoryId> removedIds;
bool result = removeCategoryHelper(categoryId, error, errorString);
- if (result) {
- removedIds.append(categoryId);
- emit categoriesRemoved(removedIds);
- }
return result;
}
@@ -2483,13 +2547,18 @@ bool DatabaseOperations::removeCategoryHelper(const QLandmarkCategoryId &categor
*errorString = QString("Category is not removable.");
return false;
}
+ delete queryResult;
QSparqlQuery qsparqlDeleteQuery = QSparqlQuery(
- "delete { ?:category_uri a rdfs:Resource . }",
+ "delete { ?:category_uri nie:identifier ?ide . } "
+ "WHERE { ?:category_uri nie:identifier ?ide . } "
+ "delete { ?:category_uri nie:title ?title . } "
+ "WHERE { ?:category_uri nie:title ?title . } "
+ "delete { ?:category_uri a slo:LandmarkCategory . }",
QSparqlQuery::DeleteStatement);
qsparqlDeleteQuery.unbindValues();
- qsparqlDeleteQuery.bindValue("category_uri", categoryId.localId());
+ qsparqlDeleteQuery.bindValue("category_uri", QUrl(categoryId.localId()));
QSparqlResult* deleteResult = m_conn->exec(qsparqlDeleteQuery);
deleteResult->waitForFinished();
@@ -2500,6 +2569,7 @@ bool DatabaseOperations::removeCategoryHelper(const QLandmarkCategoryId &categor
*errorString = QString("Unable to execute remove category statement.");
return false;
}
+ delete deleteResult;
if (error)
*error = QLandmarkManager::NoError;
if (errorString)
@@ -2510,7 +2580,7 @@ bool DatabaseOperations::removeCategoryHelper(const QLandmarkCategoryId &categor
bool DatabaseOperations::removeCategories(const QList<QLandmarkCategoryId> &categoryIds,
QMap<int, QLandmarkManager::Error> *errorMap,
QLandmarkManager::Error *error,
- QString *errorString, QList<QLandmarkCategoryId> *removedIds)
+ QString *errorString)
{
Q_ASSERT(error);
Q_ASSERT(errorString);
@@ -2522,6 +2592,11 @@ bool DatabaseOperations::removeCategories(const QList<QLandmarkCategoryId> &cate
QLandmarkManager::Error loopError;
QString loopErrorString;
bool result;
+ bool dataChangedOnly = false;
+ if (categoryIds.size() > 50) {
+ dataChangedSignallingOnly(true);
+ dataChangedOnly = true;
+ }
for (int i = 0; i < categoryIds.size(); ++i) {
loopError = QLandmarkManager::NoError;
loopErrorString.clear();
@@ -2536,8 +2611,6 @@ bool DatabaseOperations::removeCategories(const QList<QLandmarkCategoryId> &cate
lastError = loopError;
lastErrorString = loopErrorString;
}
- if (result)
- removedIds->append(categoryIds.at(i));
}
if (noErrors) {
if (error)
@@ -2550,9 +2623,8 @@ bool DatabaseOperations::removeCategories(const QList<QLandmarkCategoryId> &cate
if (errorString)
*errorString = lastErrorString;
}
- if (removedIds->size() != 0)
- emit categoriesRemoved(*removedIds);
-
+ if (dataChangedOnly)
+ dataChangedSignallingOnly(false);
return noErrors;
}
@@ -2562,8 +2634,6 @@ bool DatabaseOperations::importLandmarks(QIODevice *device,
const QLandmarkCategoryId &categoryId,
QLandmarkManager::Error *error,
QString *errorString,
- QList<QLandmarkId> *addedLandmarkIds,
- QList<QLandmarkCategoryId> *addedCategoryIds,
QueryRun *queryRun,
QList<QLandmarkId> *landmarkIds)
{
@@ -2588,7 +2658,6 @@ bool DatabaseOperations::importLandmarks(QIODevice *device,
*errorString = QString("Import operation failed, file does not exist: %1").arg(file->fileName());
return false;
}
-
if (!file->open(QIODevice::ReadOnly)) {
if (file->error() == QFile::OpenError) {
if (error)
@@ -2641,28 +2710,15 @@ bool DatabaseOperations::importLandmarks(QIODevice *device,
bool result = false;
if (detectedFormat == QLandmarkManager::Lmx) {
- result = importLandmarksLmx(device, option, categoryId, error, errorString, queryRun, landmarkIds,
- addedLandmarkIds, addedCategoryIds);
+ result = importLandmarksLmx(device, option, categoryId, error, errorString, queryRun, landmarkIds);
device->close();
- if (addedLandmarkIds->size() + addedCategoryIds->size() > 50) {
- emit dataChanged();
- } else {
- if (addedLandmarkIds->size() != 0)
- emit landmarksAdded(*addedLandmarkIds);
- if (addedCategoryIds->size() != 0)
- emit categoriesAdded(*addedCategoryIds);
- }
return result;
} else if (detectedFormat == QLandmarkManager::Gpx) {
- result = importLandmarksGpx(device, option, categoryId, error, errorString, queryRun, landmarkIds,
- addedLandmarkIds);
- device->close();
- if (addedLandmarkIds->size() > 50) {
- emit dataChanged();
- } else {
- if (addedLandmarkIds->size() != 0)
- emit landmarksAdded(*addedLandmarkIds);
- }
+ result = importLandmarksGpx(device, option, categoryId, error, errorString, queryRun, landmarkIds);
+ if (file)
+ file->close();
+ else
+ device->close();
return result;
} else {
if (error)
@@ -2693,7 +2749,6 @@ bool DatabaseOperations::exportLandmarks( QIODevice *device,
QFile *file = qobject_cast<QFile *>(device);
if (file) {
-
if (!file->open(QIODevice::WriteOnly)) {
if (file->error() == QFile::OpenError) {
if (error)
@@ -2749,9 +2804,7 @@ bool DatabaseOperations::importLandmarksLmx(QIODevice *device,
QLandmarkManager::Error *error,
QString *errorString,
QueryRun *queryRun,
- QList<QLandmarkId> *landmarkIds,
- QList<QLandmarkId> *addedLandmarkIds,
- QList<QLandmarkCategoryId> *addedCategoryIds)
+ QList<QLandmarkId> *landmarkIds)
{
QLandmarkFileHandlerLmx lmxHandler(queryRun?&(queryRun->isCanceled):0);
@@ -2773,6 +2826,11 @@ bool DatabaseOperations::importLandmarksLmx(QIODevice *device,
}
QList<QLandmark> landmarks = lmxHandler.landmarks();
+ bool dataChangedOnly = false;
+ if (landmarks.count() > 50) {
+ dataChangedSignallingOnly(true);
+ dataChangedOnly = true;
+ }
QHash<QString, QLandmarkCategoryId> catIdLookup;
QList<QStringList> landmarkCategoryNames;
@@ -2782,6 +2840,8 @@ bool DatabaseOperations::importLandmarksLmx(QIODevice *device,
QList<QLandmarkCategory> categories;
categories = this->categories(QList<QLandmarkCategoryId>(),QLandmarkNameSort(),-1, 0,error,errorString,true);
if (*error != QLandmarkManager::NoError) {
+ if (dataChangedOnly)
+ dataChangedSignallingOnly(false);
return false;
}
@@ -2789,9 +2849,9 @@ bool DatabaseOperations::importLandmarksLmx(QIODevice *device,
catIdLookup.insert(category.name(), category.categoryId());
}
}
-
QStringList categoryNames;
QList<QLandmarkCategoryId> categoryIds;
+ QList<QLandmarkCategoryId> addedCategoryIds;
for (int i=0; i < landmarks.count(); ++i) {
categoryIds.clear();
if (option == QLandmarkManager::IncludeCategoryData) {
@@ -2804,9 +2864,11 @@ bool DatabaseOperations::importLandmarksLmx(QIODevice *device,
if (*error != QLandmarkManager::NoError) {
if (landmarkIds)
landmarkIds->clear();
+ if (dataChangedOnly)
+ dataChangedSignallingOnly(false);
return false;
} else {
- addedCategoryIds->append(category.categoryId());
+ addedCategoryIds.append(category.categoryId());
}
catIdLookup.insert(category.name(), category.categoryId());
}
@@ -2826,15 +2888,27 @@ bool DatabaseOperations::importLandmarksLmx(QIODevice *device,
} else {
saveLandmarkHelper(&(landmarks[i]),error, errorString);
}
-
if (*error != QLandmarkManager::NoError) {
+ for(int j=0; j < i; ++j) {
+ QLandmarkManager::Error *removeError = new QLandmarkManager::Error();
+ QString *removeErrorString = new QString();
+ removeLandmarkHelper(landmarks[j].landmarkId(), removeError, removeErrorString, managerUri);
+ delete removeError;
+ delete removeErrorString;
+ }
+ for(int j=0; j<addedCategoryIds.count(); ++j) {
+ QLandmarkManager::Error *removeError = new QLandmarkManager::Error();
+ QString *removeErrorString = new QString();
+ removeCategoryHelper(addedCategoryIds.at(j), removeError, removeErrorString);
+ delete removeError;
+ delete removeErrorString;
+ }
if(landmarkIds)
landmarkIds->clear();
+ if (dataChangedOnly)
+ dataChangedSignallingOnly(false);
return false;
- } else {
- addedLandmarkIds->append(landmarks[i].landmarkId());
}
-
if (landmarkIds)
landmarkIds->append(landmarks[i].landmarkId());
}
@@ -2842,6 +2916,8 @@ bool DatabaseOperations::importLandmarksLmx(QIODevice *device,
*error = QLandmarkManager::NoError;
if (errorString)
*errorString = "";
+ if (dataChangedOnly)
+ dataChangedSignallingOnly(false);
return true;
}
@@ -2851,8 +2927,7 @@ bool DatabaseOperations::importLandmarksGpx(QIODevice *device,
QLandmarkManager::Error *error,
QString *errorString,
QueryRun *queryRun,
- QList<QLandmarkId> *landmarkIds,
- QList<QLandmarkId> *addedLandmarkIds)
+ QList<QLandmarkId> *landmarkIds)
{
Q_ASSERT(error);
Q_ASSERT(errorString);
@@ -2875,6 +2950,12 @@ bool DatabaseOperations::importLandmarksGpx(QIODevice *device,
}
QList<QLandmark> landmarks = gpxHandler.waypoints();
+ bool dataChangedOnly = false;
+ if (landmarks.count() > 50) {
+ dataChangedSignallingOnly(true);
+ dataChangedOnly = true;
+ }
+
for(int i =0; i < landmarks.count(); ++i) {
if (option == QLandmarkManager::AttachSingleCategory)
landmarks[i].addCategoryId(categoryId);
@@ -2887,15 +2968,20 @@ bool DatabaseOperations::importLandmarksGpx(QIODevice *device,
} else {
saveLandmarkHelper(&(landmarks[i]),error, errorString);
}
-
if (*error != QLandmarkManager::NoError) {
+ for(int j=0; j < i; ++j) {
+ QLandmarkManager::Error *removeError = new QLandmarkManager::Error();
+ QString *removeErrorString = new QString();
+ removeLandmarkHelper(landmarks[j].landmarkId(), removeError, removeErrorString, managerUri);
+ delete removeError;
+ delete removeErrorString;
+ }
if (landmarkIds)
landmarkIds->clear();
+ if (dataChangedOnly)
+ dataChangedSignallingOnly(false);
return false;
- } else {
- addedLandmarkIds->append(landmarks[i].landmarkId());
}
-
if (landmarkIds)
landmarkIds->append(landmarks[i].landmarkId());
}
@@ -2903,6 +2989,8 @@ bool DatabaseOperations::importLandmarksGpx(QIODevice *device,
*error = QLandmarkManager::NoError;
if (errorString)
*errorString = "";
+ if (dataChangedOnly)
+ dataChangedSignallingOnly(false);
return true;
}
@@ -3016,14 +3104,18 @@ bool DatabaseOperations::isReadOnly(const QLandmarkCategoryId &categoryId, QLand
QSparqlResult *queryResult = executeQuery(m_conn, q0,bindValues,error,errorString);
if (queryResult->hasError()) {
+ delete queryResult;
return false;
}
if (!queryResult->next()) {
+ delete queryResult;
return false;
}
if((queryResult->value(0).toString().compare("true", Qt::CaseSensitive)) == 0) {
+ delete queryResult;
return false;
} else {
+ delete queryResult;
return true;
}
}
@@ -3172,15 +3264,6 @@ void QueryRun::run()
error = QLandmarkManager::NoError;
errorString ="";
errorMap.clear();
- isCanceled = false;
-
- if (!isDeleted) {
- QMetaObject::invokeMethod(engine, "updateRequestState",
- Qt::QueuedConnection,
- Q_ARG(QLandmarkAbstractRequest *, request),
- Q_ARG(QLandmarkAbstractRequest::State, QLandmarkAbstractRequest::ActiveState),
- Q_ARG(unsigned int, runId));
- }
switch(requestType){
case QLandmarkAbstractRequest::LandmarkIdFetchRequest: {
@@ -3223,7 +3306,6 @@ void QueryRun::run()
case QLandmarkAbstractRequest::LandmarkFetchRequest: {
QLandmarkFetchRequest *fetchRequest;
QList<QLandmark> lms;
-
if (!isDeleted) {
ml.relock();
if (engine->m_requestRunHash.contains(request)) {
@@ -3252,7 +3334,7 @@ void QueryRun::run()
Q_ARG(QLandmarkManager::Error, error),
Q_ARG(QString, errorString),
Q_ARG(QLandmarkAbstractRequest::State,QLandmarkAbstractRequest::FinishedState),
- Q_ARG(unsigned int, runId));
+ Q_ARG(unsigned int, runId));
}
break;
}
@@ -3302,17 +3384,7 @@ void QueryRun::run()
saveRequest = static_cast<QLandmarkSaveRequest *> (request);
lms = saveRequest->landmarks();
ml.unlock();
- QList<QLandmarkId> addedIds;
- QList<QLandmarkId> changedIds;
- databaseOperations.saveLandmarks(&lms, &errorMap, &error, &errorString, &addedIds, &changedIds);
- if (addedIds.size() + changedIds.size() > 50) {
- engine->dataChanging();
- } else {
- if (addedIds.size() != 0)
- engine->landmarksAdding(addedIds);
- if (changedIds.size() != 0)
- engine->landmarksChanging(changedIds);
- }
+ databaseOperations.saveLandmarks(&lms, &errorMap, &error, &errorString);
}
ml.unlock();
}
@@ -3345,15 +3417,7 @@ void QueryRun::run()
removeRequest= static_cast<QLandmarkRemoveRequest *> (request);
QList<QLandmarkId> lmIds = removeRequest->landmarkIds();
ml.unlock();
- QList<QLandmarkId> removedIds;
- databaseOperations.removeLandmarks(lmIds, &errorMap, &error, &errorString, &removedIds);
- if (removedIds.size() != 0) {
- if (removedIds.size() > 50) {
- engine->dataChanging();
- } else {
- engine->landmarksRemoving(removedIds);
- }
- }
+ databaseOperations.removeLandmarks(lmIds, &errorMap, &error, &errorString);
}
ml.unlock();
}
@@ -3496,17 +3560,7 @@ void QueryRun::run()
saveRequest = static_cast<QLandmarkCategorySaveRequest *> (request);
categories = saveRequest->categories();
ml.unlock();
- QList<QLandmarkCategoryId> addedIds;
- QList<QLandmarkCategoryId> changedIds;
- databaseOperations.saveCategories( &categories, &errorMap, &error, &errorString, &addedIds, &changedIds);
- if (addedIds.size() + changedIds.size() > 50) {
- engine->dataChanging();
- } else {
- if (addedIds.size() != 0)
- engine->categoriesAdding(addedIds);
- if (changedIds.size() != 0)
- engine->categoriesChanging(changedIds);
- }
+ databaseOperations.saveCategories( &categories, &errorMap, &error, &errorString);
}
ml.unlock();
}
@@ -3544,17 +3598,9 @@ void QueryRun::run()
removeRequest = static_cast<QLandmarkCategoryRemoveRequest *> (request);
QList<QLandmarkCategoryId> categoryIds = removeRequest->categoryIds();
ml.unlock();
- QList<QLandmarkCategoryId> removedIds;
databaseOperations.removeCategories(categoryIds,
&errorMap, &error,
- &errorString, &removedIds);
- if (removedIds.size() != 0) {
- if (removedIds.size() > 50) {
- engine->dataChanging();
- } else {
- engine->categoriesRemoving(removedIds);
- }
- }
+ &errorString);
}
ml.unlock();
}
@@ -3593,31 +3639,21 @@ void QueryRun::run()
QLandmarkManager::TransferOption transferOption = importRequest->transferOption();
QLandmarkCategoryId categoryId = importRequest->categoryId();
ml.unlock();
- QList<QLandmarkId> addedLandmarkIds;
- QList<QLandmarkCategoryId> addedCategoryIds;
databaseOperations.importLandmarks(device,
format, transferOption,
categoryId,
&error, &errorString,
- &addedLandmarkIds, &addedCategoryIds,
this, &landmarkIds);
- if (addedLandmarkIds.size() + addedCategoryIds.size() > 50) {
- engine->dataChanging();
- } else {
- if (addedLandmarkIds.size() != 0)
- engine->landmarksAdding(addedLandmarkIds);
- if (addedCategoryIds.size() != 0)
- engine->categoriesAdding(addedCategoryIds);
- }
}
ml.unlock();
- }
+ }
if (!isDeleted) {
ml.relock();
if (engine->m_requestRunHash.contains(request))
engine->m_requestRunHash.remove(request);
ml.unlock();
+
QMetaObject::invokeMethod(engine, "updateLandmarkImportRequest",
Q_ARG(QLandmarkImportRequest *, importRequest),
Q_ARG(QList<QLandmarkId>, landmarkIds),
@@ -3678,27 +3714,25 @@ const QStringList DatabaseOperations::coreGenericAttributes = QStringList()
<< "description"
<< "iconUrl"
<< "radius"
- << "countryCode"
<< "country"
<< "state"
<< "county"
<< "city"
<< "district"
<< "street"
- << "postCode"
+ << "postcode"
<< "phoneNumber"
<< "url";
const QStringList DatabaseOperations::supportedSearchableAttributes = QStringList() << "name"
<< "description"
- << "countryCode"
<< "country"
<< "state"
<< "county"
<< "city"
<< "district"
<< "street"
- << "postCode"
+ << "postcode"
<< "phoneNumber";
const QStringList DatabaseOperations::coreCategoryAttributes = QStringList()
diff --git a/plugins/landmarks/qsparql/databaseoperations_p.h b/plugins/landmarks/qsparql/databaseoperations_p.h
index 8db25b2660..a1b6db6187 100644
--- a/plugins/landmarks/qsparql/databaseoperations_p.h
+++ b/plugins/landmarks/qsparql/databaseoperations_p.h
@@ -57,6 +57,7 @@
#include <QRunnable>
#include <QMap>
#include <QtSparql/QSparqlConnection>
+#include <qsharedmemory.h>
QTM_USE_NAMESPACE
@@ -95,16 +96,7 @@ public:
unsigned int runId;
};
-class DatabaseOperations : public QObject {
- Q_OBJECT
- signals:
- void dataChanged();
- void landmarksAdded(QList<QLandmarkId> ids);
- void landmarksChanged(QList<QLandmarkId> ids);
- void landmarksRemoved(QList<QLandmarkId> ids);
- void categoriesAdded(QList<QLandmarkCategoryId> ids);
- void categoriesChanged(QList<QLandmarkCategoryId> ids);
- void categoriesRemoved(QList<QLandmarkCategoryId> ids);
+class DatabaseOperations {
public:
QString connectionName;
@@ -114,6 +106,9 @@ class DatabaseOperations : public QObject {
DatabaseOperations();
~DatabaseOperations();
+
+ void dataChangedSignallingOnly(bool enabled);
+
QLandmark retrieveLandmark(const QLandmarkId &landmarkId,
QLandmarkManager::Error *error, QString *errorString) const;
@@ -139,8 +134,7 @@ class DatabaseOperations : public QObject {
bool saveLandmarks(QList<QLandmark> * landmark,
QMap<int, QLandmarkManager::Error> *errorMap,
- QLandmarkManager::Error *error, QString *errorString,
- QList<QLandmarkId> *addedIds, QList<QLandmarkId> *changedIds);
+ QLandmarkManager::Error *error, QString *errorString);
bool removeLandmarkHelper(const QLandmarkId &landmarkId,
QLandmarkManager::Error *error,
@@ -152,7 +146,7 @@ class DatabaseOperations : public QObject {
bool removeLandmarks(const QList<QLandmarkId> &landmarkIds,
QMap<int, QLandmarkManager::Error> *errorMap,
QLandmarkManager::Error *error,
- QString *errorString, QList<QLandmarkId> *removedIds);
+ QString *errorString);
QList<QLandmarkCategoryId> categoryIds(const QLandmarkNameSort &nameSort,
int limit, int offet,
@@ -180,9 +174,7 @@ class DatabaseOperations : public QObject {
bool saveCategories(QList<QLandmarkCategory> * categories,
QMap<int, QLandmarkManager::Error> *errorMap,
- QLandmarkManager::Error *error, QString *errorString,
- QList<QLandmarkCategoryId> *addedIds,
- QList<QLandmarkCategoryId> *changedIds);
+ QLandmarkManager::Error *error, QString *errorString);
bool removeCategoryHelper(const QLandmarkCategoryId &categoryId,
QLandmarkManager::Error *error,
@@ -195,7 +187,7 @@ class DatabaseOperations : public QObject {
bool removeCategories(const QList<QLandmarkCategoryId> &categoryIds,
QMap<int, QLandmarkManager::Error> *errorMap,
QLandmarkManager::Error *error,
- QString *errorString, QList<QLandmarkCategoryId> *removedIds);
+ QString *errorString);
bool importLandmarks(QIODevice *device,
const QString &format,
@@ -203,8 +195,6 @@ class DatabaseOperations : public QObject {
const QLandmarkCategoryId &categoryId,
QLandmarkManager::Error *error,
QString *errorString,
- QList<QLandmarkId> *addedLandmarkIds,
- QList<QLandmarkCategoryId> *addedCategoryIds,
QueryRun *queryRun =0,
QList<QLandmarkId> *landmarkIds = 0);
@@ -221,9 +211,7 @@ class DatabaseOperations : public QObject {
QLandmarkManager::Error *error,
QString *errorString,
QueryRun *queryRun=0,
- QList<QLandmarkId> *landmarkIds = 0,
- QList<QLandmarkId> *addedLandmarkIds = 0,
- QList<QLandmarkCategoryId> *addedCategoryIds = 0);
+ QList<QLandmarkId> *landmarkIds = 0);
bool importLandmarksGpx(QIODevice *device,
QLandmarkManager::TransferOption option,
@@ -231,8 +219,7 @@ class DatabaseOperations : public QObject {
QLandmarkManager::Error *error,
QString *errorString,
QueryRun *queryRun =0,
- QList<QLandmarkId> *landmarkIds = 0,
- QList<QLandmarkId> *addedLandmarkIds = 0);
+ QList<QLandmarkId> *landmarkIds = 0);
bool exportLandmarksLmx(QIODevice *device,
const QList<QLandmarkId> &landmarkIds,
@@ -256,7 +243,11 @@ class DatabaseOperations : public QObject {
static const QStringList coreGenericAttributes;
static const QStringList supportedSearchableAttributes;
static const QStringList coreCategoryAttributes;
- static const QStringList coreGenericCategoryAttributes;
+ static const QStringList coreGenericCategoryAttributes;
+
+ private:
+ QSharedMemory sharedMemory;
+ qint64 m_timeStamp;
};
#endif
diff --git a/plugins/landmarks/qsparql/qlandmarkmanagerengine_qsparql.cpp b/plugins/landmarks/qsparql/qlandmarkmanagerengine_qsparql.cpp
index 14d93c72fd..c1de348758 100644
--- a/plugins/landmarks/qsparql/qlandmarkmanagerengine_qsparql.cpp
+++ b/plugins/landmarks/qsparql/qlandmarkmanagerengine_qsparql.cpp
@@ -44,19 +44,28 @@
#include "qlandmarkfilehandler_lmx_p.h"
#include "databaseoperations_p.h"
+#include <QBuffer>
#include <QDateTime>
#include <QDebug>
#include <QDir>
+#include <QEventLoop>
#include <QFileInfo>
#include <QMutexLocker>
+#include <QSettings>
+#include <QSharedMemory>
#include <QString>
#include <QStringList>
#include <QTextStream>
-#include <QSettings>
-
#include <QThreadPool>
+#include <QTimer>
#include <QUuid>
+#include <QtSparql/QSparqlConnection>
+#include <QtSparql/QSparqlConnectionOptions>
+#include <QtSparql/QSparqlQuery>
+#include <QtSparql/QSparqlResult>
+#include <QtSparqlTrackerExtensions/TrackerChangeNotifier>
+
#include <qlandmarkabstractrequest.h>
#include <qlandmarkidfetchrequest.h>
#include <qlandmarkfetchrequest.h>
@@ -97,15 +106,17 @@ Q_DECLARE_METATYPE(ERROR_MAP)
QLandmarkManagerEngineQsparql::QLandmarkManagerEngineQsparql(const QString &filename, QLandmarkManager::Error * error,
QString *errorString)
- : m_dbWatcherFilename(filename),
+ : m_filename(filename),
m_dbConnectionName(QUuid::createUuid().toString()),
- m_dbWatcher(NULL),
m_isCustomAttributesEnabled(false),
- m_databaseOperations()
+ m_databaseOperations(),
+ sharedMemory("QLandmarksSharedMemory")
{
m_changeNotificationsEnabled = false;
*error = QLandmarkManager::NoError;
*errorString ="";
+ m_timeStamp = QString("");
+ m_signalsPrevented = false;
qRegisterMetaType<ERROR_MAP >();
qRegisterMetaType<QList<QLandmarkCategoryId> >();
@@ -128,54 +139,93 @@ QLandmarkManagerEngineQsparql::QLandmarkManagerEngineQsparql(const QString &file
qRegisterMetaType<QLandmarkExportRequest *>();
qRegisterMetaType<QLandmarkManager::Error>();
- if (m_dbWatcherFilename.isEmpty()) {
+ if (m_filename.isEmpty()) {
QSettings settings(QSettings::IniFormat, QSettings::UserScope,
QLatin1String("Nokia"), QLatin1String("QtLandmarks"));
QFileInfo fi(settings.fileName());
QDir dir = fi.dir();
dir.mkpath(dir.path());
- m_dbWatcherFilename = dir.path() + QDir::separator() + QString("QtLandmarks") + QLatin1String(".txt");
+ m_filename = dir.path() + QDir::separator() + QString("QtLandmarks") + QLatin1String(".db");
}
if (filename == ":memory:")
return;
- QFileInfo fileInfo(m_dbWatcherFilename);
- if (!fileInfo.exists()) {
- QFile file;
- file.setFileName(m_dbWatcherFilename);
- if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
- QTextStream out(&file);
- out << "This file is needed by the database changes watcher of the Landmarks API.";
- }
- file.close();
- }
-
+ m_filename = filename;
m_databaseOperations.managerUri = managerUri();
- connect(&m_databaseOperations,SIGNAL(dataChanged()), this, SLOT(dataChanging()));
-
- connect(&m_databaseOperations,SIGNAL(landmarksAdded(QList<QLandmarkId>)),
- this, SLOT(landmarksAdding(QList<QLandmarkId>)));
- connect(&m_databaseOperations,SIGNAL(landmarksChanged(QList<QLandmarkId>)),
- this, SLOT(landmarksChanging(QList<QLandmarkId>)));
- connect(&m_databaseOperations,SIGNAL(landmarksRemoved(QList<QLandmarkId>)),
- this, SLOT(landmarksRemoving(QList<QLandmarkId>)));
-
- connect(&m_databaseOperations,SIGNAL(categoriesAdded(QList<QLandmarkCategoryId>)),
- this, SLOT(categoriesAdding(QList<QLandmarkCategoryId>)));
- connect(&m_databaseOperations,SIGNAL(categoriesChanged(QList<QLandmarkCategoryId>)),
- this, SLOT(categoriesChanging(QList<QLandmarkCategoryId>)));
- connect(&m_databaseOperations,SIGNAL(categoriesRemoved(QList<QLandmarkCategoryId>)),
- this, SLOT(categoriesRemoving(QList<QLandmarkCategoryId>)));
+ QSparqlConnection conn("QTRACKER");
+ QSparqlQuery landmarkQuery("select ?id ?u {?u a slo:Landmark . OPTIONAL { ?u nie:identifier ?id }}");
+ QSparqlResult* r = conn.exec(landmarkQuery);
+ r->waitForFinished();
+ if (!r->hasError()) {
+ while (r->next()) {
+ if (!r->value(1).toString().isEmpty()) {
+ m_landmarkHash.insert(r->value(1).toString(), r->value(0).toString());
+ }
+ }
+ }
+ delete r;
+
+ QSparqlQuery categoryQuery("select ?id ?u {?u a slo:LandmarkCategory . OPTIONAL { ?u nie:identifier ?id }}");
+ r = conn.exec(categoryQuery);
+ r->waitForFinished();
+ if (!r->hasError()) {
+ while (r->next()) {
+ if (!r->value(1).toString().isEmpty()) {
+ m_categoryHash.insert(r->value(1).toString(), r->value(0).toString());
+ }
+ }
+ }
+ delete r;
+
+ // Query: what's the current name of the landmark class?
+ QString className;
+ QSparqlQuery lq("select tracker:uri(tracker:id(slo:Landmark)) "
+ "{}");
+ r = conn.exec(lq);
+ r->waitForFinished();
+ if (r->hasError()) {
+ className = QString("slo:Landmark");
+ }
+ if (r->next()) {
+ className = r->value(0).toString();
+ }
+ else
+ className = QString("slo:Landmark");
+ delete r;
+ m_landmarkNotifier = new TrackerChangeNotifier(className, this);
+ connect(m_landmarkNotifier, SIGNAL(changed(QList<TrackerChangeNotifier::Quad>, QList<TrackerChangeNotifier::Quad>)),
+ this, SLOT(landmarksNotified(QList<TrackerChangeNotifier::Quad>, QList<TrackerChangeNotifier::Quad>)));
+
+ // Query: what's the current name of the landmarkCategory class?
+ QSparqlQuery cq("select tracker:uri(tracker:id(slo:LandmarkCategory)) "
+ "{}");
+ r = conn.exec(cq);
+ r->waitForFinished();
+ if (r->hasError()) {
+ className = QString("slo:LandmarkCategory");
+ }
+ if (r->next()) {
+ className = r->value(0).toString();
+ }
+ else
+ className = QString("slo:LandmarkCategory");
+ delete r;
+ m_categoryNotifier = new TrackerChangeNotifier(className, this);
+ connect(m_categoryNotifier, SIGNAL(changed(QList<TrackerChangeNotifier::Quad>, QList<TrackerChangeNotifier::Quad>)),
+ this, SLOT(categoriesNotified(QList<TrackerChangeNotifier::Quad>, QList<TrackerChangeNotifier::Quad>)));
}
QLandmarkManagerEngineQsparql::~QLandmarkManagerEngineQsparql()
{
QThreadPool *threadPool = QThreadPool::globalInstance();
threadPool->waitForDone();
- if (m_dbWatcher !=0)
- delete m_dbWatcher;
+
+ if (m_landmarkNotifier != 0)
+ delete m_landmarkNotifier;
+ if (m_categoryNotifier != 0)
+ delete m_categoryNotifier;
}
/* URI reporting */
@@ -188,7 +238,7 @@ QMap<QString, QString> QLandmarkManagerEngineQsparql::managerParameters() const
{
QMap<QString, QString> parameters;
- parameters["filename"] = m_dbWatcherFilename;
+ parameters["filename"] = m_filename;
return parameters;
}
@@ -276,9 +326,7 @@ bool QLandmarkManagerEngineQsparql::saveLandmarks(QList<QLandmark> * landmarks,
QLandmarkManager::Error *error,
QString *errorString)
{
- QList <QLandmarkId> addedIds;
- QList <QLandmarkId> changedIds;
- return m_databaseOperations.saveLandmarks(landmarks, errorMap, error, errorString, &addedIds, &changedIds);
+ return m_databaseOperations.saveLandmarks(landmarks, errorMap, error, errorString);
}
bool QLandmarkManagerEngineQsparql::removeLandmark(const QLandmarkId &landmarkId,
@@ -293,8 +341,7 @@ bool QLandmarkManagerEngineQsparql::removeLandmarks(const QList<QLandmarkId> &la
QLandmarkManager::Error *error,
QString *errorString)
{
- QList <QLandmarkId> removedIds;
- return m_databaseOperations.removeLandmarks(landmarkIds , errorMap, error, errorString, &removedIds);
+ return m_databaseOperations.removeLandmarks(landmarkIds , errorMap, error, errorString);
}
bool QLandmarkManagerEngineQsparql::saveCategory(QLandmarkCategory* category,
@@ -309,9 +356,7 @@ bool QLandmarkManagerEngineQsparql::saveCategories(QList<QLandmarkCategory> * ca
QLandmarkManager::Error *error,
QString *errorString)
{
- QList<QLandmarkCategoryId> addedIds;
- QList<QLandmarkCategoryId> changedIds;
- return m_databaseOperations.saveCategories(categories, errorMap, error, errorString, &addedIds, &changedIds);
+ return m_databaseOperations.saveCategories(categories, errorMap, error, errorString);
}
bool QLandmarkManagerEngineQsparql::removeCategory(const QLandmarkCategoryId &categoryId,
@@ -326,8 +371,7 @@ bool QLandmarkManagerEngineQsparql::removeCategories(const QList<QLandmarkCatego
QLandmarkManager::Error *error,
QString *errorString)
{
- QList<QLandmarkCategoryId> removedIds;
- return m_databaseOperations.removeCategories(categoryIds , errorMap, error, errorString, &removedIds);
+ return m_databaseOperations.removeCategories(categoryIds , errorMap, error, errorString);
}
bool QLandmarkManagerEngineQsparql::importLandmarks(QIODevice *device,
@@ -337,9 +381,7 @@ bool QLandmarkManagerEngineQsparql::importLandmarks(QIODevice *device,
QLandmarkManager::Error *error,
QString *errorString)
{
- QList<QLandmarkId> addedLandmarkIds;
- QList<QLandmarkCategoryId> addedCategoryIds;
- return m_databaseOperations.importLandmarks(device, format, option, categoryId, error, errorString, &addedLandmarkIds, &addedCategoryIds);
+ return m_databaseOperations.importLandmarks(device, format, option, categoryId, error, errorString);
}
bool QLandmarkManagerEngineQsparql::exportLandmarks(QIODevice *device,
@@ -511,6 +553,7 @@ bool QLandmarkManagerEngineQsparql::startRequest(QLandmarkAbstractRequest* reque
return false;
}
+ QLandmarkManagerEngine::updateRequestState(request, QLandmarkAbstractRequest::ActiveState);
QThreadPool::globalInstance()->start(queryRun);
return true;
}
@@ -529,80 +572,212 @@ bool QLandmarkManagerEngineQsparql::cancelRequest(QLandmarkAbstractRequest* requ
bool QLandmarkManagerEngineQsparql::waitForRequestFinished(QLandmarkAbstractRequest* request,
int msecs)
{
- Q_UNUSED(request);
- Q_UNUSED(msecs);
- return false;
-}
-
-void QLandmarkManagerEngineQsparql::databaseChanged()
-{
- emit dataChanged();
-}
-
-void QLandmarkManagerEngineQsparql::dataChanging() {
- emit dataChanged();
- touchWatcherFile();
-}
+ //Aside: the request at least already be in the active state for this function to
+ //to be called.
-void QLandmarkManagerEngineQsparql::landmarksAdding(QList<QLandmarkId> ids) {
- if (m_changeNotificationsEnabled)
- emit landmarksAdded(ids);
- touchWatcherFile();
-}
-
-void QLandmarkManagerEngineQsparql::landmarksChanging(QList<QLandmarkId> ids) {
- if (m_changeNotificationsEnabled)
- emit landmarksChanged(ids);
- touchWatcherFile();
-}
+ QMutexLocker ml(&m_mutex);
+ if (!m_requestRunHash.contains(request))
+ return false;
+ ml.unlock();
+ QEventLoop eventLoop;
-void QLandmarkManagerEngineQsparql::landmarksRemoving(QList<QLandmarkId> ids) {
- if (m_changeNotificationsEnabled)
- emit landmarksRemoved(ids);
- touchWatcherFile();
-}
+ if (msecs > 0)
+ QTimer::singleShot(msecs, &eventLoop, SLOT(quit()));
- void QLandmarkManagerEngineQsparql::categoriesAdding(QList<QLandmarkCategoryId> ids) {
- if (m_changeNotificationsEnabled)
- emit categoriesAdded(ids);
- touchWatcherFile();
-}
+ QObject::connect(request, SIGNAL(stateChanged(QLandmarkAbstractRequest::State)),
+ &eventLoop,SLOT(quit()));
+ if (request->state() == QLandmarkAbstractRequest::FinishedState)
+ return true;
+ else
+ eventLoop.exec();
-void QLandmarkManagerEngineQsparql::categoriesChanging(QList<QLandmarkCategoryId> ids) {
- if (m_changeNotificationsEnabled)
- emit categoriesChanged(ids);
- touchWatcherFile();
-}
+ if (request->state() == QLandmarkAbstractRequest::FinishedState)
+ return true;
-void QLandmarkManagerEngineQsparql::categoriesRemoving(QList<QLandmarkCategoryId> ids) {
- if (m_changeNotificationsEnabled)
- emit categoriesRemoved(ids);
- touchWatcherFile();
+ return false;
}
-void QLandmarkManagerEngineQsparql::setChangeNotificationsEnabled(bool enabled)
+void QLandmarkManagerEngineQsparql::landmarksNotified(QList<TrackerChangeNotifier::Quad>, QList<TrackerChangeNotifier::Quad>)
{
- if (!m_dbWatcher) {
- m_dbWatcher = new DatabaseFileWatcher(m_dbWatcherFilename);
- connect(m_dbWatcher, SIGNAL(notifyChange()),this,SLOT(databaseChanged()));
+ if (m_changeNotificationsEnabled) {
+ bool dataChangedSignallingOnly = false;
+ QDateTime dateTime = QDateTime::currentDateTime();
+ qint64 currentTime = (qint64)dateTime.toTime_t() *1000 + dateTime.time().msec();
+
+ if (sharedMemory.attach()) {
+ QBuffer buffer;
+ QDataStream in(&buffer);
+ QString timeStamp;
+ sharedMemory.lock();
+ buffer.setData((char*)sharedMemory.constData(), sharedMemory.size());
+ buffer.open(QBuffer::ReadOnly);
+ in >> timeStamp;
+ sharedMemory.unlock();
+ sharedMemory.detach();
+ if (currentTime < timeStamp.toLongLong()) {
+ m_signalsPrevented = true;
+ } else {
+ m_signalsPrevented = false;
+ if (timeStamp.compare(m_timeStamp) != 0) {
+ dataChangedSignallingOnly = true;
+ }
+ }
+ m_timeStamp = timeStamp;
+ } else {
+ m_signalsPrevented = false;
+ }
+ QLandmarkId landmarkId;
+ landmarkId.setManagerUri(managerUri());
+ QList<QLandmarkId> addedLandmarkIds;
+ QList<QLandmarkId> changedLandmarkIds;
+ QList<QLandmarkId> removedLandmarkIds;
+ QHash<QString, QString> landmarkHash;
+
+ QSparqlConnection conn("QTRACKER");
+ QSparqlQuery landmarkQuery("select ?id ?u {?u a slo:Landmark . OPTIONAL { ?u nie:identifier ?id }}");
+ QSparqlResult* r = conn.exec(landmarkQuery);
+ r->waitForFinished();
+ if (!r->hasError()) {
+ while (r->next()) {
+ if (!r->value(1).toString().isEmpty()) {
+ landmarkHash.insert(r->value(1).toString(), r->value(0).toString());
+ }
+ }
+ }
+ delete r;
+ if (!m_signalsPrevented) {
+ if (dataChangedSignallingOnly) {
+ emit dataChanged();
+ } else {
+ foreach(QString localId, m_landmarkHash.keys()) {
+ if (!landmarkHash.contains(localId)) {
+ landmarkId.setLocalId(localId);
+ removedLandmarkIds << landmarkId;
+ }
+ }
+ foreach(QString localId, landmarkHash.keys()) {
+ if (!m_landmarkHash.contains(localId)) {
+ landmarkId.setLocalId(localId);
+ addedLandmarkIds << landmarkId;
+ } else {
+ if(m_landmarkHash.value(localId).compare(landmarkHash.value(localId), Qt::CaseSensitive) != 0) {
+ landmarkId.setLocalId(localId);
+ changedLandmarkIds << landmarkId;
+ }
+ }
+ }
+ int totalChangeCount = addedLandmarkIds.count() + changedLandmarkIds.count() + removedLandmarkIds.count();
+
+ if (totalChangeCount > 50 ) {
+ emit dataChanged();
+ } else {
+ if (addedLandmarkIds.count() > 0)
+ emit landmarksAdded(addedLandmarkIds);
+ if (changedLandmarkIds.count() > 0)
+ emit landmarksChanged(changedLandmarkIds);
+ if (removedLandmarkIds.count() > 0)
+ emit landmarksRemoved(removedLandmarkIds);
+ }
+ }
+ }
+ m_landmarkHash.clear();
+ m_landmarkHash = landmarkHash;
}
- m_dbWatcher->setEnabled(enabled);
- m_changeNotificationsEnabled = enabled;
}
-void QLandmarkManagerEngineQsparql::touchWatcherFile()
+void QLandmarkManagerEngineQsparql::categoriesNotified(QList<TrackerChangeNotifier::Quad>, QList<TrackerChangeNotifier::Quad>)
{
if (m_changeNotificationsEnabled) {
- // dbWatcher should not react to touches by its own manager
- m_dbWatcher->setEnabled(false);
- QFile file;
- file.setFileName(m_dbWatcherFilename );
- file.open(QIODevice::WriteOnly | QIODevice::Text);
- file.close();
- m_dbWatcher->setEnabled(true);
+ bool dataChangedSignallingOnly = false;
+ QDateTime dateTime = QDateTime::currentDateTime();
+ qint64 currentTime = (qint64)dateTime.toTime_t() *1000 + dateTime.time().msec();
+
+ if (sharedMemory.attach()) {
+ QBuffer buffer;
+ QDataStream in(&buffer);
+ QString timeStamp;
+ sharedMemory.lock();
+ buffer.setData((char*)sharedMemory.constData(), sharedMemory.size());
+ buffer.open(QBuffer::ReadOnly);
+ in >> timeStamp;
+ sharedMemory.unlock();
+ sharedMemory.detach();
+ if (currentTime < timeStamp.toLongLong()) {
+ m_signalsPrevented = true;
+ } else {
+ m_signalsPrevented = false;
+ if (timeStamp.compare(m_timeStamp) != 0) {
+ dataChangedSignallingOnly = true;
+ }
+ }
+ m_timeStamp = timeStamp;
+ } else {
+ m_signalsPrevented = false;
+ }
+ QLandmarkCategoryId categoryId;
+ categoryId.setManagerUri(managerUri());
+ QList<QLandmarkCategoryId> addedCategoryIds;
+ QList<QLandmarkCategoryId> changedCategoryIds;
+ QList<QLandmarkCategoryId> removedCategoryIds;
+ QHash<QString, QString> categoryHash;
+
+ QSparqlConnection conn("QTRACKER");
+ QSparqlQuery landmarkQuery("select ?id ?u {?u a slo:LandmarkCategory . OPTIONAL { ?u nie:identifier ?id }}");
+ QSparqlResult* r = conn.exec(landmarkQuery);
+ r->waitForFinished();
+ if (!r->hasError()) {
+ while (r->next()) {
+ if (!r->value(1).toString().isEmpty()) {
+ categoryHash.insert(r->value(1).toString(), r->value(0).toString());
+ }
+ }
+ }
+ delete r;
+ if (!m_signalsPrevented) {
+ if (dataChangedSignallingOnly) {
+ emit dataChanged();
+ } else {
+
+ foreach(QString localId, m_categoryHash.keys()) {
+ if (!categoryHash.contains(localId)) {
+ categoryId.setLocalId(localId);
+ removedCategoryIds << categoryId;
+ }
+ }
+ foreach(QString localId, categoryHash.keys()) {
+ if (!m_categoryHash.contains(localId)) {
+ categoryId.setLocalId(localId);
+ addedCategoryIds << categoryId;
+ } else {
+ if(m_categoryHash.value(localId).compare(categoryHash.value(localId), Qt::CaseSensitive) != 0) {
+ categoryId.setLocalId(localId);
+ changedCategoryIds << categoryId;
+ }
+ }
+ }
+ int totalChangeCount = addedCategoryIds.count() + changedCategoryIds.count() + removedCategoryIds.count();
+
+ if (totalChangeCount > 50 ) {
+ emit dataChanged();
+ } else {
+ if (addedCategoryIds.count() > 0)
+ emit categoriesAdded(addedCategoryIds);
+ if (changedCategoryIds.count() > 0)
+ emit categoriesChanged(changedCategoryIds);
+ if (removedCategoryIds.count() > 0)
+ emit categoriesRemoved(removedCategoryIds);
+ }
+ }
+ }
+ m_categoryHash.clear();
+ m_categoryHash = categoryHash;
}
}
+void QLandmarkManagerEngineQsparql::setChangeNotificationsEnabled(bool enabled)
+{
+ m_changeNotificationsEnabled = enabled;
+}
void QLandmarkManagerEngineQsparql::connectNotify(const char *signal)
{
diff --git a/plugins/landmarks/qsparql/qlandmarkmanagerengine_qsparql_p.h b/plugins/landmarks/qsparql/qlandmarkmanagerengine_qsparql_p.h
index aa9fe60a89..79e1116d5f 100644
--- a/plugins/landmarks/qsparql/qlandmarkmanagerengine_qsparql_p.h
+++ b/plugins/landmarks/qsparql/qlandmarkmanagerengine_qsparql_p.h
@@ -54,13 +54,14 @@
//
#include <qlandmarkmanagerengine.h>
-#include "databasefilewatcher_p.h"
+#include "databaseoperations_p.h"
#include <QSqlDatabase>
#include <QHash>
#include <QSet>
#include <QMutex>
-#include "databaseoperations_p.h"
+#include <QtSparqlTrackerExtensions/TrackerChangeNotifier>
+#include <qsharedmemory.h>
QTM_USE_NAMESPACE
@@ -207,14 +208,8 @@ public slots:
void updateRequestState(QLandmarkAbstractRequest *req, QLandmarkAbstractRequest::State state, unsigned int id);
private slots:
- void databaseChanged();
- void dataChanging();
- void landmarksAdding(QList<QLandmarkId> ids);
- void landmarksChanging(QList<QLandmarkId> ids);
- void landmarksRemoving(QList<QLandmarkId> ids);
- void categoriesAdding(QList<QLandmarkCategoryId> ids);
- void categoriesChanging(QList<QLandmarkCategoryId> ids);
- void categoriesRemoving(QList<QLandmarkCategoryId> ids);
+ void landmarksNotified(QList<TrackerChangeNotifier::Quad> deletes, QList<TrackerChangeNotifier::Quad> inserts);
+ void categoriesNotified(QList<TrackerChangeNotifier::Quad> deletes, QList<TrackerChangeNotifier::Quad> inserts);
public:
static QList<QLandmarkId> sortLandmarks(const QList<QLandmark>& landmarks, const QList<QLandmarkSortOrder> &sortOrders) {
@@ -227,17 +222,22 @@ protected:
private:
bool m_changeNotificationsEnabled;
- void touchWatcherFile();
+ bool m_signalsPrevented;
+ QHash<QString, QString> m_landmarkHash;
+ QHash<QString, QString> m_categoryHash;
void setChangeNotificationsEnabled(bool enabled);
- QString m_dbWatcherFilename;
+ QString m_filename;
QString m_dbConnectionName;
- DatabaseFileWatcher *m_dbWatcher;
+ TrackerChangeNotifier *m_landmarkNotifier;
+ TrackerChangeNotifier *m_categoryNotifier;
QHash<QLandmarkAbstractRequest *, QueryRun *> m_requestRunHash;
QHash<QLandmarkAbstractRequest *, unsigned int> m_activeRequestsRunIdHash;
bool m_isCustomAttributesEnabled;
DatabaseOperations m_databaseOperations;
friend class QueryRun;
QMutex m_mutex;//protects m_requestRunHash and m_activeRequests
+ QSharedMemory sharedMemory;
+ QString m_timeStamp;
};
#endif // QLANDMARKMANAGERENGINE_QSPARQL_P_H
diff --git a/plugins/landmarks/qsparql/qsparql.pro b/plugins/landmarks/qsparql/qsparql.pro
index f3f3b5aae0..c832e1eb33 100644
--- a/plugins/landmarks/qsparql/qsparql.pro
+++ b/plugins/landmarks/qsparql/qsparql.pro
@@ -1,6 +1,7 @@
TEMPLATE = lib
CONFIG += plugin
QT += sql
+QT += dbus
TARGET = $$qtLibraryTarget(qtlandmarks_qsparql)
PLUGIN_TYPE=landmarks
@@ -9,20 +10,17 @@ include(../../../common.pri)
CONFIG += mobility link_pkgconfig
MOBILITY = location
-#LIBS += ../../../lib/libQtLocation.so \
-LIBS += -lQtSparql
+LIBS += -lQtSparql \
+ -lqtsparqltrackerextensions
HEADERS += qlandmarkmanagerengine_qsparql_p.h \
qlandmarkmanagerenginefactory_qsparql_p.h \
- databasefilewatcher_p.h \
databaseoperations_p.h \
qlandmarkfilehandler_lmx_p.h \
- qlandmarkfilehandler_gpx_p.h \
-
+ qlandmarkfilehandler_gpx_p.h
SOURCES += qlandmarkmanagerengine_qsparql.cpp \
qlandmarkmanagerenginefactory_qsparql.cpp \
- databasefilewatcher.cpp \
databaseoperations.cpp \
qlandmarkfilehandler_lmx.cpp \
qlandmarkfilehandler_gpx.cpp
diff --git a/plugins/landmarks/sqlite/databaseoperations.cpp b/plugins/landmarks/sqlite/databaseoperations.cpp
index 01bd03909d..3b452c2fca 100644
--- a/plugins/landmarks/sqlite/databaseoperations.cpp
+++ b/plugins/landmarks/sqlite/databaseoperations.cpp
@@ -3142,15 +3142,6 @@ void QueryRun::run()
error = QLandmarkManager::NoError;
errorString ="";
errorMap.clear();
- isCanceled = false;
-
- if (!isDeleted) {
- QMetaObject::invokeMethod(engine, "updateRequestState",
- Qt::QueuedConnection,
- Q_ARG(QLandmarkAbstractRequest *, request),
- Q_ARG(QLandmarkAbstractRequest::State, QLandmarkAbstractRequest::ActiveState),
- Q_ARG(unsigned int, runId));
- }
switch(requestType){
case QLandmarkAbstractRequest::LandmarkIdFetchRequest: {
diff --git a/plugins/landmarks/sqlite/qlandmarkmanagerengine_sqlite.cpp b/plugins/landmarks/sqlite/qlandmarkmanagerengine_sqlite.cpp
index 1a0bfa57a9..32bd785fa8 100644
--- a/plugins/landmarks/sqlite/qlandmarkmanagerengine_sqlite.cpp
+++ b/plugins/landmarks/sqlite/qlandmarkmanagerengine_sqlite.cpp
@@ -529,6 +529,7 @@ bool QLandmarkManagerEngineSqlite::startRequest(QLandmarkAbstractRequest* reques
return false;
}
+ QLandmarkManagerEngine::updateRequestState(request, QLandmarkAbstractRequest::ActiveState);
QThreadPool::globalInstance()->start(queryRun);
return true;
}
@@ -549,7 +550,6 @@ bool QLandmarkManagerEngineSqlite::waitForRequestFinished(QLandmarkAbstractReque
{
//Aside: the request at least already be in the active state for this function to
//to be called.
-
QMutexLocker ml(&m_mutex);
if (!m_requestRunHash.contains(request))
return false;
diff --git a/plugins/landmarks/symbian_landmarks/src/qlandmarkdbeventhandler.cpp b/plugins/landmarks/symbian_landmarks/src/qlandmarkdbeventhandler.cpp
index 0463ff98fe..0aaa577a77 100644
--- a/plugins/landmarks/symbian_landmarks/src/qlandmarkdbeventhandler.cpp
+++ b/plugins/landmarks/symbian_landmarks/src/qlandmarkdbeventhandler.cpp
@@ -42,9 +42,6 @@
#include "qlandmarkdbeventhandler.h"
#include <qdebug.h>
-//Constants
-//const TInt KInitialSemaphoreCount = 0;
-
CLandmarkDbEventHandler::CLandmarkDbEventHandler() :
CActive(EPriorityStandard)
{
@@ -128,7 +125,6 @@ void CLandmarkDbEventHandler::RunL()
void CLandmarkDbEventHandler::DoCancel()
{
// Cancel landmark database notification request
- // TODO: What if CancelNotifyDatabaseEvent fails?
iDatabase->CancelNotifyDatabaseEvent();
}
diff --git a/plugins/landmarks/symbian_landmarks/src/qlandmarkmanagerengine_symbian_p.cpp b/plugins/landmarks/symbian_landmarks/src/qlandmarkmanagerengine_symbian_p.cpp
index 415b1f58af..9f754c7803 100644
--- a/plugins/landmarks/symbian_landmarks/src/qlandmarkmanagerengine_symbian_p.cpp
+++ b/plugins/landmarks/symbian_landmarks/src/qlandmarkmanagerengine_symbian_p.cpp
@@ -116,13 +116,13 @@
// constants
_LIT(KDefaultTextCriteria,"*");
_LIT(KDefaultSpaceTextSearch,"* ");
-_LIT8( KPosMimeTypeLandmarkCollectionXml,"application/vnd.nokia.landmarkcollection+xml" );
+_LIT8(KPosMimeTypeLandmarkCollectionXml,"application/vnd.nokia.landmarkcollection+xml");
#define KAllLandmarks -1
#define KDefaultIndex 0
#define KExtrachars 3
-#define KMaxRetryWait 100 // micro-seconds
-#define KMaxRetry 10
+#define KMaxRetryWait 120 // micro-seconds
+#define KMaxRetry 12
#ifndef M_PI
#define M_PI 3.14159265358979323846
@@ -132,7 +132,8 @@ static const double EARTH_MEAN_RADIUS = 6371.0072;
//
QTM_BEGIN_NAMESPACE
-uint qHash(const QLandmarkId& key) {
+uint qHash(const QLandmarkId& key)
+{
return qHash(key.localId());
}
QTM_END_NAMESPACE
@@ -366,26 +367,19 @@ QList<QLandmarkId> LandmarkManagerEngineSymbianPrivate::landmarkIds(const QLandm
break;
}
- int maxMatches;
-
if (offset < 0)
offset = 0;
- if (limit < 0)
- maxMatches = -1;
- else
- maxMatches = limit + offset;
-
int err = KErrGeneral;
int retryCnt = 0;
while (ETrue) {
result.clear();
if (sortOrders.size() > 0) {
- TRAP(err, result = searchWithFilterL(filter,sortOrders.at(0),maxMatches);)
+ TRAP(err, result = searchWithFilterL(filter,sortOrders.at(0),KAllLandmarks);)
}
else {
- TRAP(err, result = searchWithFilterL(filter,QLandmarkSortOrder(),maxMatches);)
+ TRAP(err, result = searchWithFilterL(filter,QLandmarkSortOrder(),KAllLandmarks);)
}
if (err == KErrNone)
break;
@@ -537,8 +531,6 @@ QList<QLandmarkId> LandmarkManagerEngineSymbianPrivate::landmarkIds(const QLandm
}
}//switch closure
- sortFetchedLmIds(limit, offset, sortOrders, result, filter.type(), error, errorString);
-
if (filter.type() == QLandmarkFilter::ProximityFilter) {
QLandmarkProximityFilter proximityFilter = filter;
if (proximityFilter.radius() < 0)
@@ -567,6 +559,8 @@ QList<QLandmarkId> LandmarkManagerEngineSymbianPrivate::landmarkIds(const QLandm
}
}
+ sortFetchedLmIds(limit, offset, sortOrders, result, filter.type(), error, errorString);
+
return result;
}
@@ -943,10 +937,6 @@ bool LandmarkManagerEngineSymbianPrivate::saveLandmark(QLandmark* landmark,
m_LmEventObserver.handleLandmarkEvent(LandmarkEventObserver::landmarkUpdated, landmarkIds);
}
- if (!result) {
- //qDebug() << "Error " << *error << " = " << *errorString;
- }
-
return result;
}
@@ -1100,9 +1090,6 @@ bool LandmarkManagerEngineSymbianPrivate::removeLandmark(const QLandmarkId &land
m_LmEventObserver.handleLandmarkEvent(LandmarkEventObserver::landmarkRemoved, landmarkIds);
}
- if (!result) {
- //qDebug() << "Error " << *error << " = " << *errorString;
- }
return result;
}
@@ -1199,10 +1186,6 @@ bool LandmarkManagerEngineSymbianPrivate::removeLandmarks(const QList<QLandmarkI
m_LmEventObserver.handleLandmarkEvent(LandmarkEventObserver::landmarkRemoved, removedIds);
}
- if (!noErrors) {
- //qDebug() << "Error " << *error << " = " << *errorString;
- }
-
return noErrors;
}
@@ -1268,9 +1251,6 @@ bool LandmarkManagerEngineSymbianPrivate::saveCategory(QLandmarkCategory* catego
QLandmarkId> (), categoryIds);
}
- if (!result) {
- //qDebug() << "Error " << *error << " = " << *errorString;
- }
return result;
}
@@ -1626,7 +1606,7 @@ bool LandmarkManagerEngineSymbianPrivate::isReadOnly(QLandmarkManager::Error *er
it is considered writable unless the manager engine. is exclusively read-only.
*/
-bool LandmarkManagerEngineSymbianPrivate::isReadOnly(const QLandmarkId &landmarkId,
+bool LandmarkManagerEngineSymbianPrivate::isReadOnly(const QLandmarkId &/*landmarkId*/,
QLandmarkManager::Error *error, QString *errorString) const
{
Q_ASSERT(error);
@@ -1999,8 +1979,6 @@ bool LandmarkManagerEngineSymbianPrivate::startRequestL(QLandmarkAbstractRequest
case QLandmarkAbstractRequest::LandmarkFetchRequest:
{
QLandmarkFilter filter;
- int maxMatches = 0;
-
QList<QLandmarkSortOrder> sortOrders;
if (request->type() == QLandmarkAbstractRequest::LandmarkIdFetchRequest) {
@@ -2023,10 +2001,6 @@ bool LandmarkManagerEngineSymbianPrivate::startRequestL(QLandmarkAbstractRequest
if (lmIdFetchRequest->limit() == 0) {
User::Leave(KErrNone);
}
- else if (lmIdFetchRequest->limit() < 0)
- maxMatches = -1;
- else
- maxMatches = lmIdFetchRequest->limit() + lmIdFetchRequest->offset();
}
if (request->type() == QLandmarkAbstractRequest::LandmarkFetchRequest) {
@@ -2047,10 +2021,6 @@ bool LandmarkManagerEngineSymbianPrivate::startRequestL(QLandmarkAbstractRequest
if (lmFetchRequest->limit() == 0) {
User::Leave(KErrNone);
}
- else if (lmFetchRequest->limit() < 0)
- maxMatches = -1;
- else
- maxMatches = lmFetchRequest->limit() + lmFetchRequest->offset();
}
bool multiplefetch = false;
@@ -2062,7 +2032,6 @@ bool LandmarkManagerEngineSymbianPrivate::startRequestL(QLandmarkAbstractRequest
if (filter.type() == QLandmarkFilter::LandmarkIdFilter || multiplefetch) {
// create request AO and start async request
CLandmarkRequestAO* requestAO = CLandmarkRequestAO::NewL(this);
- CleanupStack::PushL(requestAO);
TInt retn = m_RequestHandler.AddAsyncRequest(request, requestAO);
if (retn != KErrNone) {
CleanupStack::Pop(requestAO);
@@ -2070,7 +2039,6 @@ bool LandmarkManagerEngineSymbianPrivate::startRequestL(QLandmarkAbstractRequest
}
// start the request
requestAO->StartRequest(NULL);
- CleanupStack::Pop(requestAO);
break;
}
@@ -2081,15 +2049,14 @@ bool LandmarkManagerEngineSymbianPrivate::startRequestL(QLandmarkAbstractRequest
CPosLmOperation* lmOperation = NULL;
if (sortOrders.isEmpty())
lmOperation = getOperationL(landmarkSearch, searchCriteria, QLandmarkSortOrder(),
- maxMatches);
+ KAllLandmarks);
else
lmOperation = getOperationL(landmarkSearch, searchCriteria, sortOrders.at(0),
- maxMatches);
+ KAllLandmarks);
if (lmOperation == NULL) {
delete landmarkSearch;
landmarkSearch = NULL;
}
- //delete searchCriteria;
// create request AO and start async request
CLandmarkRequestAO* requestAO = CLandmarkRequestAO::NewL(this, lmOperation);
@@ -2114,15 +2081,12 @@ bool LandmarkManagerEngineSymbianPrivate::startRequestL(QLandmarkAbstractRequest
case QLandmarkAbstractRequest::CategoryFetchByIdRequest:
{
CLandmarkRequestAO* requestAO = CLandmarkRequestAO::NewL(this);
- CleanupStack::PushL(requestAO);
-
TInt retn = m_RequestHandler.AddAsyncRequest(request, requestAO);
if (retn != KErrNone) {
CleanupStack::Pop(requestAO);
User::Leave(retn);
}
requestAO->StartRequest(NULL);
- CleanupStack::Pop(requestAO);
result = true;
break;
}
@@ -2228,7 +2192,6 @@ bool LandmarkManagerEngineSymbianPrivate::startRequestL(QLandmarkAbstractRequest
CleanupStack::PopAndDestroy(importPath);
User::Leave(KErrArgument);
-
}
//Open the file in the specified path
@@ -2659,7 +2622,7 @@ bool LandmarkManagerEngineSymbianPrivate::saveLandmarkInternalL(QLandmark* landm
User::Leave(err);
User::After(KMaxRetryWait);
- qDebug() << "retrying addition = " << retryCnt;
+ //qDebug() << "retrying addition = " << retryCnt;
}
QLandmarkId savedQtLmId = LandmarkUtility::convertToQtLandmarkId(managerUri(),
@@ -2746,7 +2709,7 @@ bool LandmarkManagerEngineSymbianPrivate::removeLandmarkInternalL(const QLandmar
TRAPD(err, m_LandmarkDb->RemoveLandmarkL(symbianLmId);)
if (err == KErrNone)
break;
- qDebug() << "Landmark remove err = " << err;
+ //qDebug() << "Landmark remove err = " << err;
if (err != KErrLocked)
User::Leave(err);
retryCnt++;
@@ -3236,7 +3199,7 @@ CPosLmSearchCriteria* LandmarkManagerEngineSymbianPrivate::getSearchCriteriaL(
}
else {
QGeoCoordinate center;
- double radius; //use double since these are going to be usd in calculation with lat/long
+ double radius = 0.0; //use double since these are going to be usd in calculation with lat/long
if (filter.type() == QLandmarkFilter::ProximityFilter) {
@@ -3877,8 +3840,6 @@ void LandmarkManagerEngineSymbianPrivate::HandleCompletionL(CLandmarkRequestData
case QLandmarkAbstractRequest::LandmarkIdFetchRequest:
case QLandmarkAbstractRequest::LandmarkFetchRequest:
{
- QLandmarkIdFetchRequest *lmIdFetchRequest;
- QLandmarkFetchRequest *lmfetchRequest;
int limit = KAllLandmarks;
int offset = KDefaultIndex;
QLandmarkIntersectionFilter intersectionFilter;
@@ -3889,7 +3850,8 @@ void LandmarkManagerEngineSymbianPrivate::HandleCompletionL(CLandmarkRequestData
if (aData->iQtRequest->type() == QLandmarkAbstractRequest::LandmarkIdFetchRequest) {
- lmIdFetchRequest = static_cast<QLandmarkIdFetchRequest *> (aData->iQtRequest);
+ QLandmarkIdFetchRequest *lmIdFetchRequest =
+ static_cast<QLandmarkIdFetchRequest *> (aData->iQtRequest);
limit = lmIdFetchRequest->limit();
offset = lmIdFetchRequest->offset();
@@ -3905,7 +3867,8 @@ void LandmarkManagerEngineSymbianPrivate::HandleCompletionL(CLandmarkRequestData
}
else {
- lmfetchRequest = static_cast<QLandmarkFetchRequest*> (aData->iQtRequest);
+ QLandmarkFetchRequest *lmfetchRequest =
+ static_cast<QLandmarkFetchRequest*> (aData->iQtRequest);
limit = lmfetchRequest->limit();
offset = lmfetchRequest->offset();
@@ -3989,9 +3952,6 @@ void LandmarkManagerEngineSymbianPrivate::HandleCompletionL(CLandmarkRequestData
}
}
- sortFetchedLmIds(limit, offset, sortOrders, aData->iLandmarkIds, filterType, &error,
- &errorString);
-
if (filterType == QLandmarkFilter::ProximityFilter && proxyFilter.radius() >= 0) {
QMap<int, QLandmarkManager::Error> errorMap;
@@ -4018,10 +3978,15 @@ void LandmarkManagerEngineSymbianPrivate::HandleCompletionL(CLandmarkRequestData
}
}
+ sortFetchedLmIds(limit, offset, sortOrders, aData->iLandmarkIds, filterType, &error,
+ &errorString);
+
//qDebug() << "final aData->iLandmarkIds.size() = " << aData->iLandmarkIds.size();
if (aData->iQtRequest->type() == QLandmarkAbstractRequest::LandmarkIdFetchRequest) {
+ QLandmarkIdFetchRequest *lmIdFetchRequest =
+ static_cast<QLandmarkIdFetchRequest *> (aData->iQtRequest);
QLandmarkManagerEngineSymbian::updateLandmarkIdFetchRequest(lmIdFetchRequest,
aData->iLandmarkIds, error, errorString, QLandmarkAbstractRequest::FinishedState);
}
@@ -4044,6 +4009,9 @@ void LandmarkManagerEngineSymbianPrivate::HandleCompletionL(CLandmarkRequestData
errorString.clear();
}
+ QLandmarkFetchRequest *lmfetchRequest =
+ static_cast<QLandmarkFetchRequest*> (aData->iQtRequest);
+
QLandmarkManagerEngineSymbian::updateLandmarkFetchRequest(lmfetchRequest,
aData->iLandmarks, error, errorString, QLandmarkAbstractRequest::FinishedState);
}
@@ -4453,7 +4421,7 @@ void LandmarkManagerEngineSymbianPrivate::HandleExecutionL(CLandmarkRequestData*
removeResult = removeLandmarkInternalL(qtLmId, &error, &errorString, &removed);
)
- qDebug() << "async landmark removal error = " << err;
+ //qDebug() << "async landmark removal error = " << err;
if (err == KErrNone && removeResult) {
aData->iLandmarkIds.append(qtLmId);
@@ -4647,9 +4615,6 @@ void LandmarkManagerEngineSymbianPrivate::HandleExecutionL(CLandmarkRequestData*
QLandmarkFilter::FilterType filterType = QLandmarkFilter::DefaultFilter;
QList<QLandmarkFilter> filters;
QList<QLandmarkSortOrder> sortOrders;
- int maxMatches = KAllLandmarks;
- int limit = KAllLandmarks;
- int offset = KDefaultIndex;
// for LandmarkIdFetchRequest
if (aData->iQtRequest->type() == QLandmarkAbstractRequest::LandmarkIdFetchRequest) {
@@ -4675,15 +4640,6 @@ void LandmarkManagerEngineSymbianPrivate::HandleExecutionL(CLandmarkRequestData*
QLandmarkUnionFilter unionFilter = fetchRequest->filter();
filters = unionFilter.filters();
}
-
- limit = fetchRequest->limit();
- offset = fetchRequest->offset();
- if (offset < 0)
- offset = 0;
- if (limit <= 0)
- maxMatches = -1;
- else
- maxMatches = limit + offset;
}
// for LandmarkFetchRequest
else if (aData->iQtRequest->type() == QLandmarkAbstractRequest::LandmarkFetchRequest) {
@@ -4709,15 +4665,6 @@ void LandmarkManagerEngineSymbianPrivate::HandleExecutionL(CLandmarkRequestData*
QLandmarkUnionFilter unionFilter = fetchRequest->filter();
filters = unionFilter.filters();
}
-
- limit = fetchRequest->limit();
- offset = fetchRequest->offset();
- if (offset < 0)
- offset = 0;
- if (limit <= 0)
- maxMatches = -1;
- else
- maxMatches = limit + offset;
}
//qDebug() << "aData->iOpCount = " << aData->iOpCount;
@@ -4730,9 +4677,6 @@ void LandmarkManagerEngineSymbianPrivate::HandleExecutionL(CLandmarkRequestData*
break;
}
- // update request result
- //if (aData->iOpCount > 0) {
-
// collect searched landmark ids
QList<QLandmarkId> result;
@@ -4851,10 +4795,10 @@ void LandmarkManagerEngineSymbianPrivate::HandleExecutionL(CLandmarkRequestData*
if (sortOrders.isEmpty())
lmOperation = getOperationL(aData->iLandmarkSearch, searchCriteria,
- QLandmarkSortOrder(), maxMatches);
+ QLandmarkSortOrder(), KAllLandmarks);
else
lmOperation = getOperationL(aData->iLandmarkSearch, searchCriteria, sortOrders.at(0),
- maxMatches);
+ KAllLandmarks);
if (lmOperation == NULL && aData->iLandmarkSearch) {
delete aData->iLandmarkSearch;
@@ -5155,9 +5099,6 @@ QList<QLandmarkId> LandmarkManagerEngineSymbianPrivate::importLandmarksL(QIODevi
}
- // TODO : uncomment if needed to check format,
- // else the format will be autodetected internally using mimetype for file input.
- // check for the format
/*
if (format.isEmpty()) {
qDebug() << "Invalid Format Type";
diff --git a/plugins/landmarks/symbian_landmarks/src/qlandmarkrequesthandler.cpp b/plugins/landmarks/symbian_landmarks/src/qlandmarkrequesthandler.cpp
index 64263c8737..eb0e001995 100644
--- a/plugins/landmarks/symbian_landmarks/src/qlandmarkrequesthandler.cpp
+++ b/plugins/landmarks/symbian_landmarks/src/qlandmarkrequesthandler.cpp
@@ -266,7 +266,6 @@ void CLandmarkRequestAO::DoCancel()
iOperation = NULL;
}
else {
- // TODO: Modify this hack if required
if (IsActive())
memset(&iStatus, 0, sizeof(TRequestStatus));
}
diff --git a/plugins/landmarks/symbian_landmarks/src/qlandmarkutility.cpp b/plugins/landmarks/symbian_landmarks/src/qlandmarkutility.cpp
index 097869b4ed..446aa08397 100644
--- a/plugins/landmarks/symbian_landmarks/src/qlandmarkutility.cpp
+++ b/plugins/landmarks/symbian_landmarks/src/qlandmarkutility.cpp
@@ -56,7 +56,7 @@ _LIT( KDoubleSlash, "//");
//used for url field to identify protocol present or not
_LIT( KProtocol, ":" );
//used as default protocol for url field.
-_LIT(KHttp, "http://");
+//_LIT(KHttp, "http://");
/*
* Landmark Utility To convert qt landmark data class to symbian landmark data classes
diff --git a/plugins/multimedia/directshow/dsserviceplugin.cpp b/plugins/multimedia/directshow/dsserviceplugin.cpp
index f5cae27a4c..ebc5805eec 100644
--- a/plugins/multimedia/directshow/dsserviceplugin.cpp
+++ b/plugins/multimedia/directshow/dsserviceplugin.cpp
@@ -100,6 +100,15 @@ void DSServicePlugin::release(QMediaService *service)
delete service;
}
+QMediaServiceProviderHint::Features DSServicePlugin::supportedFeatures(
+ const QByteArray &service) const
+{
+ if (service == Q_MEDIASERVICE_MEDIAPLAYER)
+ return QMediaServiceProviderHint::StreamPlayback;
+ else
+ return QMediaServiceProviderHint::Features();
+}
+
QList<QByteArray> DSServicePlugin::devices(const QByteArray &service) const
{
#ifdef QMEDIA_DIRECTSHOW_CAMERA
diff --git a/plugins/multimedia/directshow/dsserviceplugin.h b/plugins/multimedia/directshow/dsserviceplugin.h
index a6365605eb..93d42e6d09 100644
--- a/plugins/multimedia/directshow/dsserviceplugin.h
+++ b/plugins/multimedia/directshow/dsserviceplugin.h
@@ -46,15 +46,21 @@
QT_USE_NAMESPACE
-class DSServicePlugin : public QMediaServiceProviderPlugin, public QMediaServiceSupportedDevicesInterface
+class DSServicePlugin
+ : public QMediaServiceProviderPlugin
+ , public QMediaServiceSupportedDevicesInterface
+ , public QMediaServiceFeaturesInterface
{
Q_OBJECT
Q_INTERFACES(QMediaServiceSupportedDevicesInterface)
+ Q_INTERFACES(QMediaServiceFeaturesInterface)
public:
QStringList keys() const;
QMediaService* create(QString const& key);
void release(QMediaService *service);
+ QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const;
+
QList<QByteArray> devices(const QByteArray &service) const;
QString deviceDescription(const QByteArray &service, const QByteArray &device);
diff --git a/plugins/multimedia/gstreamer/camerabin/camerabincontrol.cpp b/plugins/multimedia/gstreamer/camerabin/camerabincontrol.cpp
index ad2f55747c..56b9e84bc5 100644
--- a/plugins/multimedia/gstreamer/camerabin/camerabincontrol.cpp
+++ b/plugins/multimedia/gstreamer/camerabin/camerabincontrol.cpp
@@ -95,6 +95,9 @@ CameraBinControl::CameraBinControl(CameraBinSession *session)
SLOT(handleResourcesLost()));
connect(m_resourcePolicy, SIGNAL(resourcesLost()),
SLOT(handleResourcesLost()));
+
+ connect(m_session, SIGNAL(busyChanged(bool)),
+ SLOT(handleBusyChanged(bool)));
}
CameraBinControl::~CameraBinControl()
@@ -140,6 +143,18 @@ void CameraBinControl::setState(QCamera::State state)
if (m_state != state) {
m_state = state;
+ //special case for stopping the camera while it's busy,
+ //it should be delayed until the camera is idle
+ if (state == QCamera::LoadedState &&
+ m_session->state() == QCamera::ActiveState &&
+ m_session->isBusy()) {
+#ifdef CAMEABIN_DEBUG
+ qDebug() << Q_FUNC_INFO << "Camera is busy, QCamera::stop() is delayed";
+#endif
+ emit stateChanged(m_state);
+ return;
+ }
+
CamerabinResourcePolicy::ResourceSet resourceSet;
switch (state) {
case QCamera::UnloadedState:
@@ -190,10 +205,17 @@ void CameraBinControl::updateStatus()
m_status = QCamera::UnloadedStatus;
break;
case QCamera::LoadedState:
- if (sessionState != QCamera::UnloadedState)
- m_status = QCamera::LoadedStatus;
- else
+ switch (sessionState) {
+ case QCamera::UnloadedState:
m_status = QCamera::LoadingStatus;
+ break;
+ case QCamera::LoadedState:
+ m_status = QCamera::LoadedStatus;
+ break;
+ case QCamera::ActiveState:
+ m_status = QCamera::ActiveStatus;
+ break;
+ }
break;
case QCamera::ActiveState:
switch (sessionState) {
@@ -224,8 +246,11 @@ void CameraBinControl::reloadLater()
#endif
if (!m_reloadPending && m_state == QCamera::ActiveState) {
m_reloadPending = true;
- m_session->setState(QCamera::LoadedState);
- QMetaObject::invokeMethod(this, "delayedReload", Qt::QueuedConnection);
+
+ if (!m_session->isBusy()) {
+ m_session->setState(QCamera::LoadedState);
+ QMetaObject::invokeMethod(this, "delayedReload", Qt::QueuedConnection);
+ }
}
}
@@ -243,8 +268,8 @@ void CameraBinControl::handleResourcesGranted()
qDebug() << Q_FUNC_INFO << ENUM_NAME(QCamera, "State", m_state);
#endif
- //camera will be started soon
- if (m_reloadPending)
+ //camera will be started soon by delayedReload()
+ if (m_reloadPending && m_state == QCamera::ActiveState)
return;
if (m_state == QCamera::ActiveState && m_session->isReady())
@@ -253,6 +278,21 @@ void CameraBinControl::handleResourcesGranted()
m_session->setState(QCamera::LoadedState);
}
+void CameraBinControl::handleBusyChanged(bool busy)
+{
+ if (!busy && m_session->state() == QCamera::ActiveState) {
+ if (m_state == QCamera::LoadedState) {
+ //handle delayed stop() because of busy camera
+ m_resourcePolicy->setResourceSet(CamerabinResourcePolicy::LoadedResources);
+ m_session->setState(QCamera::LoadedState);
+ } else if (m_state == QCamera::ActiveState && m_reloadPending) {
+ //handle delayed reload because of busy camera
+ m_session->setState(QCamera::LoadedState);
+ QMetaObject::invokeMethod(this, "delayedReload", Qt::QueuedConnection);
+ }
+ }
+}
+
void CameraBinControl::delayedReload()
{
#ifdef CAMEABIN_DEBUG
diff --git a/plugins/multimedia/gstreamer/camerabin/camerabincontrol.h b/plugins/multimedia/gstreamer/camerabin/camerabincontrol.h
index 2e02007054..5e45d7a4df 100644
--- a/plugins/multimedia/gstreamer/camerabin/camerabincontrol.h
+++ b/plugins/multimedia/gstreamer/camerabin/camerabincontrol.h
@@ -81,6 +81,8 @@ private slots:
void handleResourcesGranted();
void handleResourcesLost();
+ void handleBusyChanged(bool);
+
private:
void updateSupportedResolutions(const QString &device);
diff --git a/plugins/multimedia/gstreamer/camerabin/camerabinfocus.cpp b/plugins/multimedia/gstreamer/camerabin/camerabinfocus.cpp
index 069ed979c5..cf7c9ecd8a 100644
--- a/plugins/multimedia/gstreamer/camerabin/camerabinfocus.cpp
+++ b/plugins/multimedia/gstreamer/camerabin/camerabinfocus.cpp
@@ -45,13 +45,22 @@
#include <gst/interfaces/photography.h>
#include <QDebug>
+#include <QtCore/qmetaobject.h>
+
+//#define CAMERABIN_DEBUG 1
+#define ENUM_NAME(c,e,v) (c::staticMetaObject.enumerator(c::staticMetaObject.indexOfEnumerator(e)).valueToKey((v)))
CameraBinFocus::CameraBinFocus(CameraBinSession *session)
:QCameraFocusControl(session),
m_session(session),
m_focusMode(QCameraFocus::AutoFocus),
+ m_focusStatus(QCamera::Unlocked),
m_focusZoneStatus(QCameraFocusZone::Selected)
{
+ connect(m_session, SIGNAL(stateChanged(QCamera::State)),
+ this, SLOT(_q_handleCameraStateChange(QCamera::State)));
+ connect(m_session, SIGNAL(imageCaptured(int,QImage)),
+ this, SLOT(_q_handleCapturedImage()));
}
CameraBinFocus::~CameraBinFocus()
@@ -140,23 +149,97 @@ void CameraBinFocus::setCustomFocusPoint(const QPointF &point)
Q_UNUSED(point);
}
-void CameraBinFocus::_q_updateLockStatus(QCamera::LockType lockType,
- QCamera::LockStatus lockStatus,
- QCamera::LockChangeReason reason)
+QCameraFocusZoneList CameraBinFocus::focusZones() const
{
- if (lockType == QCamera::LockFocus) {
- QCameraFocusZone::FocusZoneStatus status =
- lockStatus == QCamera::Locked ?
+ return QCameraFocusZoneList() << QCameraFocusZone(QRectF(0.35, 0.35, 0.3, 0.3), m_focusZoneStatus);
+}
+
+
+void CameraBinFocus::handleFocusMessage(GstMessage *gm)
+{
+ //it's a sync message, so it's called from non main thread
+ if (gst_structure_has_name(gm->structure, GST_PHOTOGRAPHY_AUTOFOCUS_DONE)) {
+ gint status = GST_PHOTOGRAPHY_FOCUS_STATUS_NONE;
+ gst_structure_get_int (gm->structure, "status", &status);
+ QCamera::LockStatus focusStatus = m_focusStatus;
+ QCamera::LockChangeReason reason = QCamera::UserRequest;
+
+ switch (status) {
+ case GST_PHOTOGRAPHY_FOCUS_STATUS_FAIL:
+ focusStatus = QCamera::Unlocked;
+ reason = QCamera::LockFailed;
+ break;
+ case GST_PHOTOGRAPHY_FOCUS_STATUS_SUCCESS:
+ focusStatus = QCamera::Locked;
+ break;
+ case GST_PHOTOGRAPHY_FOCUS_STATUS_NONE:
+ break;
+ case GST_PHOTOGRAPHY_FOCUS_STATUS_RUNNING:
+ focusStatus = QCamera::Searching;
+ break;
+ default:
+ break;
+ }
+
+ static int signalIndex = metaObject()->indexOfSlot(
+ "_q_setFocusStatus(QCamera::LockStatus,QCamera::LockChangeReason)");
+ metaObject()->method(signalIndex).invoke(this,
+ Qt::QueuedConnection,
+ Q_ARG(QCamera::LockStatus,focusStatus),
+ Q_ARG(QCamera::LockChangeReason,reason));
+ }
+}
+
+void CameraBinFocus::_q_setFocusStatus(QCamera::LockStatus status, QCamera::LockChangeReason reason)
+{
+#ifdef CAMERABIN_DEBUG
+ qDebug() << Q_FUNC_INFO << "Current:"
+ << ENUM_NAME(QCamera, "LockStatus", m_focusStatus)
+ << "New:"
+ << ENUM_NAME(QCamera, "LockStatus", status) << ENUM_NAME(QCamera, "LockChangeReason", reason);
+#endif
+
+ if (m_focusStatus != status) {
+ m_focusStatus = status;
+
+ QCameraFocusZone::FocusZoneStatus zonesStatus =
+ m_focusStatus == QCamera::Locked ?
QCameraFocusZone::Focused : QCameraFocusZone::Selected;
- if (m_focusZoneStatus != status) {
- m_focusZoneStatus = status;
+ if (m_focusZoneStatus != zonesStatus) {
+ m_focusZoneStatus = zonesStatus;
emit focusZonesChanged();
}
+
+ emit _q_focusStatusChanged(m_focusStatus, reason);
}
}
-QCameraFocusZoneList CameraBinFocus::focusZones() const
+void CameraBinFocus::_q_handleCameraStateChange(QCamera::State state)
{
- return QCameraFocusZoneList() << QCameraFocusZone(QRectF(0.35, 0.35, 0.3, 0.3), m_focusZoneStatus);
+ if (state != QCamera::ActiveState)
+ _q_setFocusStatus(QCamera::Unlocked, QCamera::LockLost);
+}
+
+void CameraBinFocus::_q_handleCapturedImage()
+{
+#ifdef Q_WS_MAEMO_5
+ //N900 lost focus after image capture
+ if (m_focusStatus != QCamera::Unlocked) {
+ m_focusStatus = QCamera::Unlocked;
+ emit _q_focusStatusChanged(QCamera::Unlocked, QCamera::LockLost);
+ }
+#endif
+}
+
+void CameraBinFocus::_q_startFocusing()
+{
+ _q_setFocusStatus(QCamera::Searching, QCamera::UserRequest);
+ gst_photography_set_autofocus(m_session->photography(), TRUE);
+}
+
+void CameraBinFocus::_q_stopFocusing()
+{
+ gst_photography_set_autofocus(m_session->photography(), FALSE);
+ _q_setFocusStatus(QCamera::Unlocked, QCamera::UserRequest);
}
diff --git a/plugins/multimedia/gstreamer/camerabin/camerabinfocus.h b/plugins/multimedia/gstreamer/camerabin/camerabinfocus.h
index e970edbdb4..e496d2e3b4 100644
--- a/plugins/multimedia/gstreamer/camerabin/camerabinfocus.h
+++ b/plugins/multimedia/gstreamer/camerabin/camerabinfocus.h
@@ -79,14 +79,26 @@ public:
QCameraFocusZoneList focusZones() const;
+ void handleFocusMessage(GstMessage*);
+ QCamera::LockStatus focusStatus() const { return m_focusStatus; }
+
+Q_SIGNALS:
+ void _q_focusStatusChanged(QCamera::LockStatus status, QCamera::LockChangeReason reason);
+
+public Q_SLOTS:
+ void _q_startFocusing();
+ void _q_stopFocusing();
+
private Q_SLOTS:
- void _q_updateLockStatus(QCamera::LockType, QCamera::LockStatus, QCamera::LockChangeReason);
+ void _q_setFocusStatus(QCamera::LockStatus status, QCamera::LockChangeReason reason);
+ void _q_handleCameraStateChange(QCamera::State state);
+ void _q_handleCapturedImage();
private:
CameraBinSession *m_session;
QCameraFocus::FocusMode m_focusMode;
+ QCamera::LockStatus m_focusStatus;
QCameraFocusZone::FocusZoneStatus m_focusZoneStatus;
-
};
#endif // CAMERABINFOCUSCONTROL_H
diff --git a/plugins/multimedia/gstreamer/camerabin/camerabinlocks.cpp b/plugins/multimedia/gstreamer/camerabin/camerabinlocks.cpp
index 007908c898..66da126f83 100644
--- a/plugins/multimedia/gstreamer/camerabin/camerabinlocks.cpp
+++ b/plugins/multimedia/gstreamer/camerabin/camerabinlocks.cpp
@@ -41,6 +41,7 @@
#include "camerabinlocks.h"
#include "camerabinsession.h"
+#include "camerabinfocus.h"
#include <gst/interfaces/photography.h>
@@ -49,9 +50,9 @@
CameraBinLocks::CameraBinLocks(CameraBinSession *session)
:QCameraLocksControl(session),
m_session(session),
- m_focusStatus(QCamera::Unlocked)
+ m_focus(m_session->cameraFocusControl())
{
- connect(m_session, SIGNAL(focusStatusChanged(QCamera::LockStatus, QCamera::LockChangeReason)),
+ connect(m_focus, SIGNAL(_q_focusStatusChanged(QCamera::LockStatus, QCamera::LockChangeReason)),
this, SLOT(updateFocusStatus(QCamera::LockStatus, QCamera::LockChangeReason)));
}
@@ -66,29 +67,22 @@ QCamera::LockTypes CameraBinLocks::supportedLocks() const
QCamera::LockStatus CameraBinLocks::lockStatus(QCamera::LockType lock) const
{
- return lock == QCamera::LockFocus ? m_focusStatus : QCamera::Unlocked;
+ return lock == QCamera::LockFocus ? m_focus->focusStatus() : QCamera::Unlocked;
}
void CameraBinLocks::searchAndLock(QCamera::LockTypes locks)
{
- if (locks & QCamera::LockFocus) {
- m_focusStatus = QCamera::Searching;
- gst_photography_set_autofocus(m_session->photography(), TRUE);
- emit lockStatusChanged(QCamera::LockFocus, m_focusStatus, QCamera::UserRequest);
- }
+ if (locks & QCamera::LockFocus)
+ m_focus->_q_startFocusing();
}
void CameraBinLocks::unlock(QCamera::LockTypes locks)
{
- if (locks & QCamera::LockFocus) {
- m_focusStatus = QCamera::Unlocked;
- gst_photography_set_autofocus(m_session->photography(), FALSE);
- emit lockStatusChanged(QCamera::LockFocus, m_focusStatus, QCamera::UserRequest);
- }
+ if (locks & QCamera::LockFocus)
+ m_focus->_q_stopFocusing();
}
void CameraBinLocks::updateFocusStatus(QCamera::LockStatus status, QCamera::LockChangeReason reason)
{
- if (m_focusStatus != status)
- emit lockStatusChanged(QCamera::LockFocus, m_focusStatus = status, reason);
+ emit lockStatusChanged(QCamera::LockFocus, status, reason);
}
diff --git a/plugins/multimedia/gstreamer/camerabin/camerabinlocks.h b/plugins/multimedia/gstreamer/camerabin/camerabinlocks.h
index 5248777664..29c4f2ece1 100644
--- a/plugins/multimedia/gstreamer/camerabin/camerabinlocks.h
+++ b/plugins/multimedia/gstreamer/camerabin/camerabinlocks.h
@@ -49,6 +49,7 @@
#include <glib.h>
class CameraBinSession;
+class CameraBinFocus;
QT_USE_NAMESPACE
@@ -72,7 +73,7 @@ private slots:
private:
CameraBinSession *m_session;
- QCamera::LockStatus m_focusStatus;
+ CameraBinFocus *m_focus;
};
#endif
diff --git a/plugins/multimedia/gstreamer/camerabin/camerabinsession.cpp b/plugins/multimedia/gstreamer/camerabin/camerabinsession.cpp
index 9e58c51233..8b38434e56 100644
--- a/plugins/multimedia/gstreamer/camerabin/camerabinsession.cpp
+++ b/plugins/multimedia/gstreamer/camerabin/camerabinsession.cpp
@@ -129,7 +129,7 @@
//using GST_STATE_READY for QCamera::LoadedState
//doesn't work reliably at least with some webcams.
-#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_5)
+#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6)
#define USE_READY_STATE_ON_LOADED
#endif
@@ -142,6 +142,7 @@ CameraBinSession::CameraBinSession(QObject *parent)
m_recordingActive(false),
m_pendingResolutionUpdate(false),
m_muted(false),
+ m_busy(false),
m_captureMode(QCamera::CaptureStillImage),
m_audioInputFactory(0),
m_videoInputFactory(0),
@@ -163,6 +164,7 @@ CameraBinSession::CameraBinSession(QObject *parent)
m_pipeline = gst_element_factory_make("camerabin", "camerabin");
g_signal_connect(G_OBJECT(m_pipeline), IMAGE_DONE_SIGNAL, G_CALLBACK(imgCaptured), this);
+ g_signal_connect(G_OBJECT(m_pipeline), "notify::idle", G_CALLBACK(updateBusyStatus), this);
gstRef(m_pipeline);
@@ -181,9 +183,6 @@ CameraBinSession::CameraBinSession(QObject *parent)
m_cameraFocusControl = new CameraBinFocus(this);
m_imageProcessingControl = new CameraBinImageProcessing(this);
m_cameraLocksControl = new CameraBinLocks(this);
-
- connect(m_cameraLocksControl, SIGNAL(lockStatusChanged(QCamera::LockType,QCamera::LockStatus,QCamera::LockChangeReason)),
- m_cameraFocusControl, SLOT(_q_updateLockStatus(QCamera::LockType,QCamera::LockStatus,QCamera::LockChangeReason)));
}
CameraBinSession::~CameraBinSession()
@@ -383,8 +382,20 @@ GstElement *CameraBinSession::buildVideoSrc()
if (!videoSrc)
gst_element_factory_make("autovideosrc", "camera_source");
- if (videoSrc && !m_inputDevice.isEmpty() )
+ if (videoSrc && !m_inputDevice.isEmpty()) {
+#if CAMERABIN_DEBUG
+ qDebug() << "set camera device" << m_inputDevice;
+#endif
+
+#ifdef Q_WS_MAEMO_6
+ if (m_inputDevice == QLatin1String("secondary"))
+ g_object_set(G_OBJECT(videoSrc), "camera-device", 1, NULL);
+ else
+ g_object_set(G_OBJECT(videoSrc), "camera-device", 0, NULL);
+#else
g_object_set(G_OBJECT(videoSrc), "device", m_inputDevice.toLocal8Bit().constData(), NULL);
+#endif
+ }
}
return videoSrc;
@@ -567,22 +578,17 @@ void CameraBinSession::setState(QCamera::State newState)
switch (newState) {
case QCamera::UnloadedState:
- //focus is lost at least on n900 when the state is changed from Active to Idle
- if (m_state == QCamera::ActiveState)
- emit focusStatusChanged(QCamera::Unlocked, QCamera::LockLost);
-
if (m_recordingActive)
stopVideoRecording();
gst_element_set_state(m_pipeline, GST_STATE_NULL);
m_state = newState;
+ if (m_busy)
+ emit busyChanged(m_busy = false);
+
emit stateChanged(m_state);
break;
case QCamera::LoadedState:
- //focus is lost at least on n900 when the state is changed from Active to Idle
- if (m_state == QCamera::ActiveState)
- emit focusStatusChanged(QCamera::Unlocked, QCamera::LockLost);
-
if (m_recordingActive)
stopVideoRecording();
@@ -619,6 +625,28 @@ void CameraBinSession::setState(QCamera::State newState)
}
}
+bool CameraBinSession::isBusy() const
+{
+ return m_busy;
+}
+
+void CameraBinSession::updateBusyStatus(GObject *o, GParamSpec *p, gpointer d)
+{
+ Q_UNUSED(p);
+ CameraBinSession *session = reinterpret_cast<CameraBinSession *>(d);
+
+ bool idle = false;
+ g_object_get(o, "idle", &idle, NULL);
+ bool busy = !idle;
+
+ if (session->m_busy != busy) {
+ session->m_busy = busy;
+ QMetaObject::invokeMethod(session, "busyChanged",
+ Qt::QueuedConnection,
+ Q_ARG(bool, busy));
+ }
+}
+
qint64 CameraBinSession::duration() const
{
GstFormat format = GST_FORMAT_TIME;
@@ -766,26 +794,8 @@ bool CameraBinSession::processSyncMessage(const QGstreamerMessage &message)
return true;
}
- if (gst_structure_has_name(gm->structure, GST_PHOTOGRAPHY_AUTOFOCUS_DONE)) {
- gint status = GST_PHOTOGRAPHY_FOCUS_STATUS_NONE;
- gst_structure_get_int (gm->structure, "status", &status);
- switch (status) {
- case GST_PHOTOGRAPHY_FOCUS_STATUS_FAIL:
- emit focusStatusChanged(QCamera::Unlocked, QCamera::LockFailed);
- break;
- case GST_PHOTOGRAPHY_FOCUS_STATUS_SUCCESS:
- emit focusStatusChanged(QCamera::Locked, QCamera::UserRequest);
- break;
- case GST_PHOTOGRAPHY_FOCUS_STATUS_NONE:
- emit focusStatusChanged(QCamera::Unlocked, QCamera::UserRequest);
- break;
- case GST_PHOTOGRAPHY_FOCUS_STATUS_RUNNING:
- emit focusStatusChanged(QCamera::Searching, QCamera::UserRequest);
- break;
- default:
- break;
- }
- }
+ if (gst_structure_has_name(gm->structure, GST_PHOTOGRAPHY_AUTOFOCUS_DONE))
+ m_cameraFocusControl->handleFocusMessage(gm);
if (GST_MESSAGE_SRC(gm) == GST_OBJECT_CAST(m_viewfinderElement))
m_viewfinderInterface->handleSyncMessage(gm);
@@ -903,8 +913,6 @@ void CameraBinSession::processSavedImage(const QString &filename)
Qt::QueuedConnection,
Q_ARG(int,m_requestId),
Q_ARG(QString,filename));
-
- emit focusStatusChanged(QCamera::Unlocked, QCamera::LockLost);
}
static gboolean imgCaptured(GstElement *camera,
diff --git a/plugins/multimedia/gstreamer/camerabin/camerabinsession.h b/plugins/multimedia/gstreamer/camerabin/camerabinsession.h
index d3b6cc3452..98e431780e 100644
--- a/plugins/multimedia/gstreamer/camerabin/camerabinsession.h
+++ b/plugins/multimedia/gstreamer/camerabin/camerabinsession.h
@@ -129,6 +129,8 @@ public:
void captureImage(int requestId, const QString &fileName);
QCamera::State state() const;
+ bool isBusy() const;
+
qint64 duration() const;
void recordVideo();
@@ -148,10 +150,10 @@ signals:
void imageExposed(int requestId);
void imageCaptured(int requestId, const QImage &img);
void imageSaved(int requestId, const QString &fileName);
- void focusStatusChanged(QCamera::LockStatus status, QCamera::LockChangeReason reason);
void mutedChanged(bool);
void viewfinderChanged();
void readyChanged(bool);
+ void busyChanged(bool);
public slots:
void setDevice(const QString &device);
@@ -170,6 +172,7 @@ private:
void setupCaptureResolution();
void updateVideoSourceCaps();
GstElement *buildVideoSrc();
+ static void updateBusyStatus(GObject *o, GParamSpec *p, gpointer d);
QUrl m_sink;
QUrl m_actualSink;
@@ -179,8 +182,9 @@ private:
QCamera::State m_pendingState;
QString m_inputDevice;
bool m_pendingResolutionUpdate;
+ bool m_muted;
+ bool m_busy;
- bool m_muted;
QCamera::CaptureMode m_captureMode;
QMap<QByteArray, QVariant> m_metaData;
diff --git a/plugins/multimedia/gstreamer/gstvideoconnector.c b/plugins/multimedia/gstreamer/gstvideoconnector.c
index 33a23fb747..4f8a75b75a 100644
--- a/plugins/multimedia/gstreamer/gstvideoconnector.c
+++ b/plugins/multimedia/gstreamer/gstvideoconnector.c
@@ -41,6 +41,16 @@
#include "gstvideoconnector.h"
+/* signals */
+enum
+{
+ SIGNAL_RESEND_NEW_SEGMENT,
+ SIGNAL_CONNECTION_FAILED,
+ LAST_SIGNAL
+};
+static guint gst_video_connector_signals[LAST_SIGNAL] = { 0 };
+
+
GST_DEBUG_CATEGORY_STATIC (video_connector_debug);
#define GST_CAT_DEFAULT video_connector_debug
@@ -72,6 +82,8 @@ static GstStateChangeReturn gst_video_connector_change_state (GstElement *
static gboolean gst_video_connector_handle_sink_event (GstPad * pad,
GstEvent * event);
static gboolean gst_video_connector_new_buffer_probe(GstObject *pad, GstBuffer *buffer, guint * object);
+static void gst_video_connector_resend_new_segment(GstElement * element);
+static gboolean gst_video_connector_setcaps (GstPad *pad, GstCaps *caps);
static void
gst_video_connector_base_init (gpointer g_class)
@@ -98,6 +110,19 @@ gst_video_connector_class_init (GstVideoConnectorClass * klass)
gobject_class->dispose = gst_video_connector_dispose;
gstelement_class->change_state = gst_video_connector_change_state;
+ klass->resend_new_segment = gst_video_connector_resend_new_segment;
+
+ gst_video_connector_signals[SIGNAL_RESEND_NEW_SEGMENT] =
+ g_signal_new ("resend-new-segment", G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (GstVideoConnectorClass, resend_new_segment), NULL, NULL,
+ g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+
+ gst_video_connector_signals[SIGNAL_CONNECTION_FAILED] =
+ g_signal_new ("connection-failed", G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL,
+ g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}
static void
@@ -113,6 +138,8 @@ gst_video_connector_init (GstVideoConnector *element,
GST_DEBUG_FUNCPTR (gst_video_connector_handle_sink_event));
gst_pad_set_bufferalloc_function(element->sinkpad,
GST_DEBUG_FUNCPTR (gst_video_connector_buffer_alloc));
+ gst_pad_set_setcaps_function(element->sinkpad,
+ GST_DEBUG_FUNCPTR (gst_video_connector_setcaps));
gst_element_add_pad (GST_ELEMENT (element), element->sinkpad);
@@ -149,7 +176,6 @@ gst_video_connector_dispose (GObject * object)
G_OBJECT_CLASS (parent_class)->dispose (object);
}
-
static GstFlowReturn
gst_video_connector_buffer_alloc (GstPad * pad, guint64 offset, guint size,
GstCaps * caps, GstBuffer ** buf)
@@ -170,6 +196,35 @@ gst_video_connector_buffer_alloc (GstPad * pad, guint64 offset, guint size,
return res;
}
+static gboolean
+gst_video_connector_setcaps (GstPad *pad, GstCaps *caps)
+{
+ GstVideoConnector *element;
+ element = GST_VIDEO_CONNECTOR (GST_PAD_PARENT (pad));
+
+ /* forward-negotiate */
+ gboolean res = gst_pad_set_caps(element->srcpad, caps);
+
+ GST_DEBUG_OBJECT(element, "gst_video_connector_setcaps %s %i", gst_caps_to_string(caps), res);
+
+ if (!res) {
+ //if set_caps failed, emit "connection-failed" signal
+ //so colorspace transformation elemnt can be inserted
+ GST_INFO_OBJECT(element, "gst_video_connector_setcaps failed, emit connection-failed signal");
+ g_signal_emit(G_OBJECT(element), gst_video_connector_signals[SIGNAL_CONNECTION_FAILED], 0);
+
+ return gst_pad_set_caps(element->srcpad, caps);
+ }
+
+ return TRUE;
+}
+
+static void
+gst_video_connector_resend_new_segment(GstElement * element)
+{
+ GST_VIDEO_CONNECTOR(element)->relinked = TRUE;
+}
+
static gboolean gst_video_connector_new_buffer_probe(GstObject *pad, GstBuffer *buffer, guint * object)
{
@@ -194,6 +249,7 @@ gst_video_connector_chain (GstPad * pad, GstBuffer * buf)
GstVideoConnector *element;
element = GST_VIDEO_CONNECTOR (gst_pad_get_parent (pad));
+ gboolean failedSigtnalEmited = FALSE;
do {
/*
@@ -207,7 +263,7 @@ gst_video_connector_chain (GstPad * pad, GstBuffer * buf)
gint64 pos = element->segment.last_stop;
- if (GST_BUFFER_TIMESTAMP_IS_VALID(element->latest_buffer)) {
+ if (element->latest_buffer && GST_BUFFER_TIMESTAMP_IS_VALID(element->latest_buffer)) {
pos = GST_BUFFER_TIMESTAMP (element->latest_buffer);
}
@@ -244,6 +300,14 @@ gst_video_connector_chain (GstPad * pad, GstBuffer * buf)
res = gst_pad_push (element->srcpad, buf);
GST_LOG_OBJECT (element, "Pushed buffer: %s", gst_flow_get_name (res));
+ //if gst_pad_push failed give the service another chance,
+ //it may still work with the colorspace element added
+ if (!failedSigtnalEmited && res == GST_FLOW_NOT_NEGOTIATED) {
+ failedSigtnalEmited = TRUE;
+ GST_INFO_OBJECT(element, "gst_pad_push failed, emit connection-failed signal");
+ g_signal_emit(G_OBJECT(element), gst_video_connector_signals[SIGNAL_CONNECTION_FAILED], 0);
+ }
+
} while (element->relinked);
@@ -298,7 +362,7 @@ gst_video_connector_handle_sink_event (GstPad * pad, GstEvent * event)
gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format,
&start, &stop, &time);
- GST_DEBUG_OBJECT (element,
+ GST_LOG_OBJECT (element,
"NEWSEGMENT update %d, rate %lf, applied rate %lf, "
"format %d, " "%" G_GINT64_FORMAT " -- %" G_GINT64_FORMAT ", time %"
G_GINT64_FORMAT, update, rate, arate, format, start, stop, time);
diff --git a/plugins/multimedia/gstreamer/gstvideoconnector.h b/plugins/multimedia/gstreamer/gstvideoconnector.h
index e08450cb31..f417c71fb7 100644
--- a/plugins/multimedia/gstreamer/gstvideoconnector.h
+++ b/plugins/multimedia/gstreamer/gstvideoconnector.h
@@ -73,6 +73,9 @@ struct _GstVideoConnector {
struct _GstVideoConnectorClass {
GstElementClass parent_class;
+
+ /* action signal to resend new segment */
+ void (*resend_new_segment) (GstElement * element);
};
GType gst_video_connector_get_type (void);
diff --git a/plugins/multimedia/gstreamer/mediaplayer/mediaplayer.pri b/plugins/multimedia/gstreamer/mediaplayer/mediaplayer.pri
index fcfbd063b9..92cd790866 100644
--- a/plugins/multimedia/gstreamer/mediaplayer/mediaplayer.pri
+++ b/plugins/multimedia/gstreamer/mediaplayer/mediaplayer.pri
@@ -7,13 +7,15 @@ HEADERS += \
$$PWD/qgstreamerplayerservice.h \
$$PWD/qgstreamerplayersession.h \
$$PWD/qgstreamerstreamscontrol.h \
- $$PWD/qgstreamermetadataprovider.h
+ $$PWD/qgstreamermetadataprovider.h \
+ $$PWD/playerresourcepolicy.h
SOURCES += \
$$PWD/qgstreamerplayercontrol.cpp \
$$PWD/qgstreamerplayerservice.cpp \
$$PWD/qgstreamerplayersession.cpp \
$$PWD/qgstreamerstreamscontrol.cpp \
- $$PWD/qgstreamermetadataprovider.cpp
+ $$PWD/qgstreamermetadataprovider.cpp \
+ $$PWD/playerresourcepolicy.cpp
diff --git a/plugins/multimedia/gstreamer/mediaplayer/playerresourcepolicy.cpp b/plugins/multimedia/gstreamer/mediaplayer/playerresourcepolicy.cpp
new file mode 100644
index 0000000000..29cdb61aa3
--- /dev/null
+++ b/plugins/multimedia/gstreamer/mediaplayer/playerresourcepolicy.cpp
@@ -0,0 +1,166 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "playerresourcepolicy.h"
+
+#ifdef Q_WS_MAEMO_6
+#define HAVE_RESOURCE_POLICY
+#endif
+
+//#define DEBUG_RESOURCE_POLICY
+#include <QtCore/qdebug.h>
+
+#ifdef HAVE_RESOURCE_POLICY
+#include <policy/resource.h>
+#include <policy/resources.h>
+#include <policy/resource-set.h>
+#endif
+
+PlayerResourcePolicy::PlayerResourcePolicy(QObject *parent) :
+ QObject(parent),
+ m_videoEnabled(true),
+ m_resourceSet(0),
+ m_status(PlayerResourcePolicy::Initial)
+{
+#ifdef HAVE_RESOURCE_POLICY
+ m_resourceSet = new ResourcePolicy::ResourceSet("player", this);
+
+ ResourcePolicy::AudioResource *audioResource = new ResourcePolicy::AudioResource("player");
+ audioResource->setProcessID(QCoreApplication::applicationPid());
+ audioResource->setStreamTag("media.name", "*");
+ m_resourceSet->addResourceObject(audioResource);
+
+ m_resourceSet->addResource(ResourcePolicy::VideoPlaybackType);
+ m_resourceSet->update();
+
+ connect(m_resourceSet, SIGNAL(resourcesGranted(const QList<ResourcePolicy::ResourceType>)),
+ this, SLOT(handleResourcesGranted()));
+ connect(m_resourceSet, SIGNAL(resourcesDenied()),
+ this, SLOT(handleResourcesDenied()));
+ connect(m_resourceSet, SIGNAL(lostResources()),
+ this, SLOT(handleResourcesLost()));
+#endif
+}
+
+PlayerResourcePolicy::~PlayerResourcePolicy()
+{
+}
+
+bool PlayerResourcePolicy::isVideoEnabled() const
+{
+ return m_videoEnabled;
+}
+
+void PlayerResourcePolicy::setVideoEnabled(bool enabled)
+{
+ if (m_videoEnabled != enabled) {
+ m_videoEnabled = enabled;
+
+#ifdef HAVE_RESOURCE_POLICY
+ if (enabled)
+ m_resourceSet->addResource(ResourcePolicy::VideoPlaybackType);
+ else
+ m_resourceSet->deleteResource(ResourcePolicy::VideoPlaybackType);
+
+ m_resourceSet->update();
+#endif
+ }
+}
+
+void PlayerResourcePolicy::acquire()
+{
+#ifdef HAVE_RESOURCE_POLICY
+
+#ifdef DEBUG_RESOURCE_POLICY
+ qDebug() << Q_FUNC_INFO << "Acquire resource";
+#endif
+
+ m_resourceSet->acquire();
+#else
+ m_status = GrantedResource;
+#endif
+}
+
+void PlayerResourcePolicy::release()
+{
+#ifdef HAVE_RESOURCE_POLICY
+
+#ifdef DEBUG_RESOURCE_POLICY
+ qDebug() << Q_FUNC_INFO << "Release resource";
+#endif
+
+ m_resourceSet->release();
+#else
+ m_status = Initial;
+#endif
+}
+
+bool PlayerResourcePolicy::isGranted() const
+{
+ return m_status == GrantedResource;
+}
+
+void PlayerResourcePolicy::handleResourcesGranted()
+{
+ m_status = GrantedResource;
+#ifdef DEBUG_RESOURCE_POLICY
+ qDebug() << Q_FUNC_INFO << "Resource granted";
+#endif
+ emit resourcesGranted();
+}
+
+void PlayerResourcePolicy::handleResourcesDenied()
+{
+ m_status = RequestedResource;
+#ifdef DEBUG_RESOURCE_POLICY
+ qDebug() << Q_FUNC_INFO << "Resource denied";
+#endif
+ emit resourcesDenied();
+}
+
+void PlayerResourcePolicy::handleResourcesLost()
+{
+ m_status = RequestedResource;
+#ifdef DEBUG_RESOURCE_POLICY
+ qDebug() << Q_FUNC_INFO << "Resource lost";
+#endif
+ emit resourcesLost();
+}
diff --git a/plugins/multimedia/gstreamer/mediaplayer/playerresourcepolicy.h b/plugins/multimedia/gstreamer/mediaplayer/playerresourcepolicy.h
new file mode 100644
index 0000000000..eaf4f71fcc
--- /dev/null
+++ b/plugins/multimedia/gstreamer/mediaplayer/playerresourcepolicy.h
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef PLAYERRESOURCEPOLICY_H
+#define PLAYERRESOURCEPOLICY_H
+
+#include <QtCore/qobject.h>
+
+namespace ResourcePolicy {
+class ResourceSet;
+};
+
+class PlayerResourcePolicy : public QObject
+{
+ Q_OBJECT
+public:
+ PlayerResourcePolicy(QObject *parent = 0);
+ ~PlayerResourcePolicy();
+
+ bool isVideoEnabled() const;
+ bool isGranted() const;
+
+Q_SIGNALS:
+ void resourcesDenied();
+ void resourcesGranted();
+ void resourcesLost();
+
+public Q_SLOTS:
+ void acquire();
+ void release();
+
+ void setVideoEnabled(bool enabled);
+
+private Q_SLOTS:
+ void handleResourcesGranted();
+ void handleResourcesDenied();
+ void handleResourcesLost();
+
+private:
+ enum ResourceStatus {
+ Initial = 0,
+ RequestedResource,
+ GrantedResource
+ };
+
+ bool m_videoEnabled;
+ ResourcePolicy::ResourceSet *m_resourceSet;
+ ResourceStatus m_status;
+};
+
+#endif
diff --git a/plugins/multimedia/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp b/plugins/multimedia/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp
index 17d734ff5c..5cda47891e 100644
--- a/plugins/multimedia/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp
+++ b/plugins/multimedia/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp
@@ -41,9 +41,11 @@
#include "qgstreamerplayercontrol.h"
#include "qgstreamerplayersession.h"
+#include "playerresourcepolicy.h"
#include <qmediaplaylistnavigator.h>
+
#include <QtCore/qdir.h>
#include <QtCore/qsocketnotifier.h>
#include <QtCore/qurl.h>
@@ -71,6 +73,8 @@ QGstreamerPlayerControl::QGstreamerPlayerControl(QGstreamerPlayerSession *sessio
m_fifoFd[0] = -1;
m_fifoFd[1] = -1;
+ m_resources = new PlayerResourcePolicy(this);
+
connect(m_session, SIGNAL(positionChanged(qint64)),
this, SIGNAL(positionChanged(qint64)));
connect(m_session, SIGNAL(durationChanged(qint64)),
@@ -81,10 +85,6 @@ QGstreamerPlayerControl::QGstreamerPlayerControl(QGstreamerPlayerSession *sessio
this, SIGNAL(volumeChanged(int)));
connect(m_session, SIGNAL(stateChanged(QMediaPlayer::State)),
this, SLOT(updateState(QMediaPlayer::State)));
-#ifdef Q_WS_MAEMO_6
- connect(m_session, SIGNAL(resourceLost()),
- this, SLOT(resourceLost()));
-#endif // Q_WS_MAEMO_6
connect(m_session,SIGNAL(bufferingProgressChanged(int)),
this, SLOT(setBufferProgress(int)));
connect(m_session, SIGNAL(playbackFinished()),
@@ -102,6 +102,9 @@ QGstreamerPlayerControl::QGstreamerPlayerControl(QGstreamerPlayerSession *sessio
connect(m_session, SIGNAL(playbackRateChanged(qreal)),
this, SIGNAL(playbackRateChanged(qreal)));
+ connect(m_resources, SIGNAL(resourcesGranted()), SLOT(handleResourcesGranted()));
+ connect(m_resources, SIGNAL(resourcesDenied()), SLOT(handleResourcesLost()));
+ connect(m_resources, SIGNAL(resourcesLost()), SLOT(handleResourcesLost()));
}
QGstreamerPlayerControl::~QGstreamerPlayerControl()
@@ -220,10 +223,16 @@ void QGstreamerPlayerControl::playOrPause(QMediaPlayer::State newState)
}
bool ok = false;
- if (newState == QMediaPlayer::PlayingState)
- ok = m_session->play();
- else
+ if (newState == QMediaPlayer::PlayingState) {
+ m_resources->acquire();
+ if (m_resources->isGranted())
+ ok = m_session->play();
+ else
+ ok = true;
+ } else {
+ m_resources->release();
ok = m_session->pause();
+ }
if (!ok)
return;
@@ -256,6 +265,11 @@ void QGstreamerPlayerControl::stop()
updateState(m_session->state());
emit positionChanged(0);
emit stateChanged(m_state);
+
+ //do not release the resource if player
+ //state was chaged to playing from slots connected to stateChanged
+ if (m_state != QMediaPlayer::PlayingState)
+ m_resources->release();
}
}
@@ -307,8 +321,14 @@ void QGstreamerPlayerControl::setMedia(const QMediaContent &content, QIODevice *
if (!stream->open(QIODevice::ReadOnly)) {
delete stream;
m_mediaStatus = QMediaPlayer::InvalidMedia;
+ m_currentResource = content;
+ emit mediaChanged(m_currentResource);
emit error(QMediaPlayer::FormatError, tr("Attempting to play invalid Qt resource"));
emit mediaStatusChanged(m_mediaStatus);
+ if (m_state != oldState)
+ emit stateChanged(m_state);
+ if (m_state != QMediaPlayer::PlayingState)
+ m_resources->release();
return;
}
m_ownStream = true;
@@ -349,6 +369,9 @@ void QGstreamerPlayerControl::setMedia(const QMediaContent &content, QIODevice *
emit mediaChanged(m_currentResource);
if (m_state != oldState)
emit stateChanged(m_state);
+
+ if (m_state != QMediaPlayer::PlayingState)
+ m_resources->release();
}
void QGstreamerPlayerControl::setVideoOutput(QObject *output)
@@ -391,6 +414,9 @@ void QGstreamerPlayerControl::updateState(QMediaPlayer::State state)
break;
}
+ if (m_state == QMediaPlayer::PlayingState && !m_resources->isGranted())
+ m_mediaStatus = QMediaPlayer::StalledMedia;
+
//EndOfMedia status should be kept, until reset by pause, play or setMedia
if (oldStatus == QMediaPlayer::EndOfMedia)
m_mediaStatus = QMediaPlayer::EndOfMedia;
@@ -401,14 +427,6 @@ void QGstreamerPlayerControl::updateState(QMediaPlayer::State state)
emit mediaStatusChanged(m_mediaStatus);
}
-#ifdef Q_WS_MAEMO_6
-void QGstreamerPlayerControl::resourceLost()
-{
- if (m_mediaStatus != QMediaPlayer::EndOfMedia)
- m_mediaStatus = QMediaPlayer::StalledMedia;
-}
-#endif // Q_WS_MAEMO_6
-
void QGstreamerPlayerControl::processEOS()
{
m_mediaStatus = QMediaPlayer::EndOfMedia;
@@ -433,7 +451,7 @@ void QGstreamerPlayerControl::setBufferProgress(int progress)
m_session->pause();
} else {
m_mediaStatus = QMediaPlayer::BufferedMedia;
- if (m_state == QMediaPlayer::PlayingState)
+ if (m_state == QMediaPlayer::PlayingState && m_resources->isGranted())
m_session->play();
}
}
@@ -550,3 +568,17 @@ void QGstreamerPlayerControl::handleInvalidMedia()
if (emitMediaStateChanged)
emit mediaStatusChanged(m_mediaStatus);
}
+
+void QGstreamerPlayerControl::handleResourcesGranted()
+{
+ if (m_state == QMediaPlayer::PlayingState)
+ m_session->play();
+}
+
+void QGstreamerPlayerControl::handleResourcesLost()
+{
+ if (m_state == QMediaPlayer::PlayingState)
+ m_session->pause();
+
+ updateState(m_session->state());
+}
diff --git a/plugins/multimedia/gstreamer/mediaplayer/qgstreamerplayercontrol.h b/plugins/multimedia/gstreamer/mediaplayer/qgstreamerplayercontrol.h
index 035a99b30f..ca701b80a6 100644
--- a/plugins/multimedia/gstreamer/mediaplayer/qgstreamerplayercontrol.h
+++ b/plugins/multimedia/gstreamer/mediaplayer/qgstreamerplayercontrol.h
@@ -59,6 +59,7 @@ QT_USE_NAMESPACE
class QGstreamerPlayerSession;
class QGstreamerPlayerService;
+class PlayerResourcePolicy;
class QGstreamerPlayerControl : public QMediaPlayerControl
{
@@ -108,14 +109,14 @@ private Q_SLOTS:
void fifoReadyWrite(int socket);
void updateState(QMediaPlayer::State);
-#ifdef Q_WS_MAEMO_6
- void resourceLost();
-#endif // Q_WS_MAEMO_6
void processEOS();
void setBufferProgress(int progress);
void handleInvalidMedia();
+ void handleResourcesGranted();
+ void handleResourcesLost();
+
private:
bool openFifo();
void closeFifo();
@@ -135,6 +136,8 @@ private:
int m_bufferSize;
int m_bufferOffset;
char m_buffer[PIPE_BUF];
+
+ PlayerResourcePolicy *m_resources;
};
#endif
diff --git a/plugins/multimedia/gstreamer/mediaplayer/qgstreamerplayersession.cpp b/plugins/multimedia/gstreamer/mediaplayer/qgstreamerplayersession.cpp
index b5ff547685..0f10f58d34 100644
--- a/plugins/multimedia/gstreamer/mediaplayer/qgstreamerplayersession.cpp
+++ b/plugins/multimedia/gstreamer/mediaplayer/qgstreamerplayersession.cpp
@@ -93,12 +93,6 @@ QGstreamerPlayerSession::QGstreamerPlayerSession(QObject *parent)
m_seekable(false),
m_lastPosition(0),
m_duration(-1)
-#ifdef Q_WS_MAEMO_6
- ,
- m_resourceSet(0),
- m_audioResource(0),
- m_resourceState(NoResourceState)
-#endif // Q_WS_MAEMO_6
{
#ifdef USE_PLAYBIN2
m_playbin = gst_element_factory_make("playbin2", NULL);
@@ -122,6 +116,7 @@ QGstreamerPlayerSession::QGstreamerPlayerSession(QObject *parent)
gst_object_ref(GST_OBJECT(m_videoOutputBin));
m_videoIdentity = GST_ELEMENT(g_object_new(gst_video_connector_get_type(), 0));
+ g_signal_connect(G_OBJECT(m_videoIdentity), "connection-failed", G_CALLBACK(insertColorSpaceElement), (gpointer)this);
m_colorSpace = gst_element_factory_make("ffmpegcolorspace", "ffmpegcolorspace-vo");
gst_object_ref(GST_OBJECT(m_colorSpace));
@@ -153,23 +148,11 @@ QGstreamerPlayerSession::QGstreamerPlayerSession(QObject *parent)
double volume = 1.0;
g_object_get(G_OBJECT(m_playbin), "volume", &volume, NULL);
m_volume = int(volume*100);
- }
-#ifdef Q_WS_MAEMO_6
- // resource policy awareness
- m_resourceSet = new ResourcePolicy::ResourceSet("player", this);
- m_resourceSet->setAlwaysReply();
-
- m_audioResource = new ResourcePolicy::AudioResource("player");
- m_audioResource->setProcessID(QCoreApplication::applicationPid());
- m_audioResource->setStreamTag("media.name", "*");
- m_resourceSet->addResourceObject(m_audioResource);
-
- connect(m_resourceSet, SIGNAL(resourcesGranted(const QList<ResourcePolicy::ResourceType>&)),
- this, SLOT(resourceAcquiredHandler(const QList<ResourcePolicy::ResourceType>&)));
- connect(m_resourceSet, SIGNAL(lostResources()), this, SLOT(resourceLostHandler()));
- connect(m_resourceSet, SIGNAL(resourcesReleased()), this, SLOT(resourceReleasedHandler()));
-#endif // Q_WS_MAEMO_6
+ g_signal_connect(G_OBJECT(m_playbin), "notify::volume", G_CALLBACK(handleVolumeChange), this);
+ if (m_usePlaybin2)
+ g_signal_connect(G_OBJECT(m_playbin), "notify::mute", G_CALLBACK(handleVolumeChange), this);
+ }
}
QGstreamerPlayerSession::~QGstreamerPlayerSession()
@@ -327,10 +310,6 @@ static void block_pad_cb(GstPad *pad, gboolean blocked, gpointer user_data)
}
}
-#ifdef DEBUG_VO_BIN_DUMP
- static int dumpNum = 0;
-#endif
-
void QGstreamerPlayerSession::updateVideoRenderer()
{
#ifdef DEBUG_PLAYBIN
@@ -366,11 +345,9 @@ void QGstreamerPlayerSession::setVideoRenderer(QObject *videoOutput)
m_renderer = renderer;
#ifdef DEBUG_VO_BIN_DUMP
- dumpNum++;
-
- _gst_debug_bin_to_dot_file(GST_BIN(m_playbin),
+ _gst_debug_bin_to_dot_file_with_ts(GST_BIN(m_playbin),
GstDebugGraphDetails(GST_DEBUG_GRAPH_SHOW_ALL /* GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE | GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS | GST_DEBUG_GRAPH_SHOW_STATES*/),
- QString("playbin_%1_set").arg(dumpNum).toAscii().constData());
+ "playbin_set");
#endif
GstElement *videoSink = 0;
@@ -421,14 +398,15 @@ void QGstreamerPlayerSession::setVideoRenderer(QObject *videoOutput)
gst_bin_add(GST_BIN(m_videoOutputBin), m_videoSink);
- m_usingColorspaceElement = (m_videoSink != m_nullVideoSink) &&
- m_renderer->isColorSpaceElementRequired();
-
- if (m_usingColorspaceElement) {
+ m_usingColorspaceElement = false;
+ bool linked = gst_element_link(m_videoIdentity, m_videoSink);
+ if (!linked) {
+ m_usingColorspaceElement = true;
+#ifdef DEBUG_PLAYBIN
+ qDebug() << "Failed to connect video output, inserting the colorspace element.";
+#endif
gst_bin_add(GST_BIN(m_videoOutputBin), m_colorSpace);
- gst_element_link_many(m_videoIdentity, m_colorSpace, m_videoSink, NULL);
- } else {
- gst_element_link(m_videoIdentity, m_videoSink);
+ linked = gst_element_link_many(m_videoIdentity, m_colorSpace, m_videoSink, NULL);
}
switch (m_pendingState) {
@@ -524,21 +502,23 @@ void QGstreamerPlayerSession::finishVideoOutputChange()
gst_bin_add(GST_BIN(m_videoOutputBin), m_videoSink);
- m_usingColorspaceElement = (m_videoSink != m_nullVideoSink) &&
- m_renderer->isColorSpaceElementRequired();
-
- bool linked = false;
- if (m_usingColorspaceElement) {
+ m_usingColorspaceElement = false;
+ bool linked = gst_element_link(m_videoIdentity, m_videoSink);
+ if (!linked) {
+ m_usingColorspaceElement = true;
+#ifdef DEBUG_PLAYBIN
+ qDebug() << "Failed to connect video output, inserting the colorspace element.";
+#endif
gst_bin_add(GST_BIN(m_videoOutputBin), m_colorSpace);
linked = gst_element_link_many(m_videoIdentity, m_colorSpace, m_videoSink, NULL);
- } else {
- linked = gst_element_link(m_videoIdentity, m_videoSink);
}
if (!linked)
qWarning() << "Linking video output element failed";
+#ifdef DEBUG_PLAYBIN
qDebug() << "notify the video connector it has to emit a new segment message...";
+#endif
//it's necessary to send a new segment event just before
//the first buffer pushed to the new sink
GST_VIDEO_CONNECTOR(m_videoIdentity)->relinked = true;
@@ -572,13 +552,50 @@ void QGstreamerPlayerSession::finishVideoOutputChange()
gst_object_unref(GST_OBJECT(srcPad));
#ifdef DEBUG_VO_BIN_DUMP
- dumpNum++;
- _gst_debug_bin_to_dot_file(GST_BIN(m_playbin),
- GstDebugGraphDetails(/*GST_DEBUG_GRAPH_SHOW_ALL */ GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE | GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS | GST_DEBUG_GRAPH_SHOW_STATES),
- QString("playbin_%1_finish").arg(dumpNum).toAscii().constData());
+ _gst_debug_bin_to_dot_file_with_ts(GST_BIN(m_playbin),
+ GstDebugGraphDetails(GST_DEBUG_GRAPH_SHOW_ALL /* GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE | GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS | GST_DEBUG_GRAPH_SHOW_STATES*/),
+ "playbin_finish");
#endif
}
+void QGstreamerPlayerSession::insertColorSpaceElement(GstElement *element, gpointer data)
+{
+ Q_UNUSED(element);
+ QGstreamerPlayerSession* session = reinterpret_cast<QGstreamerPlayerSession*>(data);
+
+ if (session->m_usingColorspaceElement)
+ return;
+ session->m_usingColorspaceElement = true;
+
+#ifdef DEBUG_PLAYBIN
+ qDebug() << "Failed to connect video output, inserting the colorspace elemnt.";
+ qDebug() << "notify the video connector it has to emit a new segment message...";
+#endif
+ //it's necessary to send a new segment event just before
+ //the first buffer pushed to the new sink
+ GST_VIDEO_CONNECTOR(session->m_videoIdentity)->relinked = true;
+
+ gst_element_unlink(session->m_videoIdentity, session->m_videoSink);
+ gst_bin_add(GST_BIN(session->m_videoOutputBin), session->m_colorSpace);
+ gst_element_link_many(session->m_videoIdentity, session->m_colorSpace, session->m_videoSink, NULL);
+
+ GstState state;
+
+ switch (session->m_pendingState) {
+ case QMediaPlayer::StoppedState:
+ state = GST_STATE_NULL;
+ break;
+ case QMediaPlayer::PausedState:
+ state = GST_STATE_PAUSED;
+ break;
+ case QMediaPlayer::PlayingState:
+ state = GST_STATE_PLAYING;
+ break;
+ }
+
+ gst_element_set_state(session->m_colorSpace, state);
+}
+
bool QGstreamerPlayerSession::isVideoAvailable() const
{
@@ -592,35 +609,26 @@ bool QGstreamerPlayerSession::isSeekable() const
bool QGstreamerPlayerSession::play()
{
-#ifdef Q_WS_MAEMO_6
if (m_playbin) {
- if (m_resourceState == NoResourceState) {
- m_resourceState = PendingResourceState;
- acquireResources();
+ m_pendingState = QMediaPlayer::PlayingState;
+ if (gst_element_set_state(m_playbin, GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) {
+ qWarning() << "GStreamer; Unable to play -" << m_request.url().toString();
+ m_pendingState = m_state = QMediaPlayer::StoppedState;
+
+ emit stateChanged(m_state);
+ } else
return true;
- }
- else if (m_resourceState == HasResourceState) {
- return doPlay();
- }
}
return false;
-#else
- return doPlay();
-#endif // Q_WS_MAEMO_6
}
bool QGstreamerPlayerSession::pause()
{
if (m_playbin) {
m_pendingState = QMediaPlayer::PausedState;
- if (m_pendingVideoSink != 0) {
-#ifdef Q_WS_MAEMO_6
- if (m_resourceState == HasResourceState)
- m_resourceSet->release();
-#endif // Q_WS_MAEMO_6
+ if (m_pendingVideoSink != 0)
return true;
- }
if (gst_element_set_state(m_playbin, GST_STATE_PAUSED) == GST_STATE_CHANGE_FAILURE) {
qWarning() << "GStreamer; Unable to pause -" << m_request.url().toString();
@@ -628,10 +636,6 @@ bool QGstreamerPlayerSession::pause()
emit stateChanged(m_state);
} else {
-#ifdef Q_WS_MAEMO_6
- if (m_resourceState == HasResourceState)
- m_resourceSet->release();
-#endif // Q_WS_MAEMO_6
return true;
}
}
@@ -652,12 +656,6 @@ void QGstreamerPlayerSession::stop()
//we have to do it here, since gstreamer will not emit bus messages any more
if (oldState != m_state)
emit stateChanged(m_state);
-
-#ifdef Q_WS_MAEMO_6
- // release the resource
- if (m_resourceState != NoResourceState)
- m_resourceSet->release();
-#endif // Q_WS_MAEMO_6
}
}
@@ -809,14 +807,6 @@ void QGstreamerPlayerSession::busMessage(const QGstreamerMessage &message)
m_lastPosition = newPos/1000;
emit positionChanged(newPos);
}
-
- double volume = 1.0;
- g_object_get(G_OBJECT(m_playbin), "volume", &volume, NULL);
- if (m_volume != int(volume*100)) {
- m_volume = int(volume*100);
- emit volumeChanged(m_volume);
- }
-
} else {
//tag message comes from elements inside playbin, not from playbin itself
if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_TAG) {
@@ -830,6 +820,7 @@ void QGstreamerPlayerSession::busMessage(const QGstreamerMessage &message)
emit tagsChanged();
}
+ bool handlePlaybin2 = false;
if (GST_MESSAGE_SRC(gm) == GST_OBJECT_CAST(m_playbin)) {
switch (GST_MESSAGE_TYPE(gm)) {
case GST_MESSAGE_STATE_CHANGED:
@@ -895,16 +886,8 @@ void QGstreamerPlayerSession::busMessage(const QGstreamerMessage &message)
}
}
- if (m_state != prevState) {
-#ifdef Q_WS_MAEMO_6
- if (m_resourceState == PendingResourceState)
- emit resourceLost();
- else
- emit stateChanged(m_state);
-#else
+ if (m_state != prevState)
emit stateChanged(m_state);
-#endif //Q_WS_MAEMO_6
- }
break;
}
@@ -1030,18 +1013,32 @@ void QGstreamerPlayerSession::busMessage(const QGstreamerMessage &message)
if (oldState == GST_STATE_READY && newState == GST_STATE_PAUSED)
m_renderer->precessNewStream();
}
- } else if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ERROR && qstrcmp(GST_OBJECT_NAME(GST_MESSAGE_SRC(gm)), "source") == 0) {
- // If the source has given up, so do we.
+ } else if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ERROR) {
+ GError *err;
+ gchar *debug;
+ gst_message_parse_error(gm, &err, &debug);
+ // If the source has given up, so do we.
+ if (qstrcmp(GST_OBJECT_NAME(GST_MESSAGE_SRC(gm)), "source") == 0) {
emit invalidMedia();
stop();
- GError *err;
- gchar *debug;
- gst_message_parse_error(gm, &err, &debug);
emit error(int(QMediaPlayer::ResourceError), QString::fromUtf8(err->message));
+ } else if (err->domain == GST_STREAM_ERROR
+ && (err->code == GST_STREAM_ERROR_DECRYPT || err->code == GST_STREAM_ERROR_DECRYPT_NOKEY)) {
+ emit invalidMedia();
+ stop();
+ emit error(int(QMediaPlayer::AccessDeniedError), QString::fromUtf8(err->message));
+ } else {
+ handlePlaybin2 = m_usePlaybin2;
+ }
+ if (!handlePlaybin2)
qWarning() << "Error:" << QString::fromUtf8(err->message);
- g_error_free(err);
- g_free(debug);
- } else if (m_usePlaybin2) {
+ g_error_free(err);
+ g_free(debug);
+ } else {
+ handlePlaybin2 = m_usePlaybin2;
+ }
+
+ if (handlePlaybin2) {
if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_WARNING) {
GError *err;
gchar *debug;
@@ -1051,15 +1048,21 @@ void QGstreamerPlayerSession::busMessage(const QGstreamerMessage &message)
qWarning() << "Warning:" << QString::fromUtf8(err->message);
g_error_free(err);
g_free(debug);
- } else if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ERROR
- && (QString::fromLatin1(GST_OBJECT_NAME(GST_MESSAGE_SRC(gm))).startsWith(QString::fromLatin1("decodebin2"))
- || QString::fromLatin1(GST_OBJECT_NAME(GST_MESSAGE_SRC(gm))).startsWith(QString::fromLatin1("uridecodebin")))) {
- emit invalidMedia();
- stop();
+ } else if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ERROR) {
GError *err;
gchar *debug;
gst_message_parse_error(gm, &err, &debug);
- emit error(int(QMediaPlayer::ResourceError), QString::fromUtf8(err->message));
+ if (qstrncmp(GST_OBJECT_NAME(GST_MESSAGE_SRC(gm)), "decodebin2", 10) == 0
+ || qstrncmp(GST_OBJECT_NAME(GST_MESSAGE_SRC(gm)), "uridecodebin", 12) == 0) {
+ emit invalidMedia();
+ stop();
+ emit error(int(QMediaPlayer::ResourceError), QString::fromUtf8(err->message));
+ } else if (err->domain == GST_STREAM_ERROR
+ && (err->code == GST_STREAM_ERROR_DECRYPT || err->code == GST_STREAM_ERROR_DECRYPT_NOKEY)) {
+ emit invalidMedia();
+ stop();
+ emit error(int(QMediaPlayer::AccessDeniedError), QString::fromUtf8(err->message));
+ }
qWarning() << "Error:" << QString::fromUtf8(err->message);
g_error_free(err);
g_free(debug);
@@ -1261,58 +1264,6 @@ void QGstreamerPlayerSession::updateVideoResolutionTag()
}
}
-bool QGstreamerPlayerSession::doPlay()
-{
-#ifdef Q_WS_MAEMO_6
- if (m_playbin && m_resourceState == HasResourceState) {
-#else
- if (m_playbin) {
-#endif // Q_WS_MAEMO_6
- m_pendingState = QMediaPlayer::PlayingState;
- if (gst_element_set_state(m_playbin, GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) {
- qWarning() << "GStreamer; Unable to play -" << m_request.url().toString();
- m_pendingState = m_state = QMediaPlayer::StoppedState;
-
- emit stateChanged(m_state);
- } else
- return true;
- }
-
- return false;
-}
-
-#ifdef Q_WS_MAEMO_6
-void QGstreamerPlayerSession::acquireResources()
-{
- m_resourceSet->addResource(ResourcePolicy::VideoPlaybackType);
- // TODO: The video resource should be acquired only when necessary. We might play only audio...
- m_resourceSet->update();
- m_resourceSet->acquire();
-}
-
-void QGstreamerPlayerSession::resourceAcquiredHandler(const QList<ResourcePolicy::ResourceType>&
- /*grantedOptionalResList*/)
-{
- if (m_resourceState == PendingResourceState) {
- m_resourceState = HasResourceState;
- doPlay();
- }
-}
-
-void QGstreamerPlayerSession::resourceReleasedHandler()
-{
- m_resourceState = NoResourceState;
-}
-
-void QGstreamerPlayerSession::resourceLostHandler()
-{
- if (m_resourceState == HasResourceState) {
- m_resourceState = PendingResourceState;
- pause();
- }
-}
-#endif // Q_WS_MAEMO_6
-
void QGstreamerPlayerSession::playbinNotifySource(GObject *o, GParamSpec *p, gpointer d)
{
Q_UNUSED(p);
@@ -1373,3 +1324,29 @@ void QGstreamerPlayerSession::playbinNotifySource(GObject *o, GParamSpec *p, gpo
// should be functional.
}
+void QGstreamerPlayerSession::handleVolumeChange(GObject *o, GParamSpec *p, gpointer d)
+{
+ Q_UNUSED(o);
+ Q_UNUSED(p);
+ QGstreamerPlayerSession *session = reinterpret_cast<QGstreamerPlayerSession *>(d);
+ QMetaObject::invokeMethod(session, "updateVolume", Qt::QueuedConnection);
+}
+
+void QGstreamerPlayerSession::updateVolume()
+{
+ double volume = 1.0;
+ g_object_get(m_playbin, "volume", &volume, NULL);
+ if (m_volume != int(volume*100)) {
+ m_volume = int(volume*100);
+ emit volumeChanged(m_volume);
+ }
+
+ if (m_usePlaybin2) {
+ bool muted = false;
+ g_object_get(G_OBJECT(m_playbin), "mute", &muted, NULL);
+ if (m_muted != muted) {
+ m_muted = muted;
+ emit mutedStateChanged(muted);
+ }
+ }
+}
diff --git a/plugins/multimedia/gstreamer/mediaplayer/qgstreamerplayersession.h b/plugins/multimedia/gstreamer/mediaplayer/qgstreamerplayersession.h
index fbde2380f0..6f44554b18 100644
--- a/plugins/multimedia/gstreamer/mediaplayer/qgstreamerplayersession.h
+++ b/plugins/multimedia/gstreamer/mediaplayer/qgstreamerplayersession.h
@@ -50,9 +50,6 @@
#include <qmediastreamscontrol.h>
#include <gst/gst.h>
-#ifdef Q_WS_MAEMO_6
-#include <policy/resource-set.h>
-#endif // Q_WS_MAEMO_6
class QGstreamerBusHelper;
class QGstreamerMessage;
@@ -119,9 +116,6 @@ signals:
void durationChanged(qint64 duration);
void positionChanged(qint64 position);
void stateChanged(QMediaPlayer::State state);
-#ifdef Q_WS_MAEMO_6
- void resourceLost();
-#endif // Q_WS_MAEMO_6
void volumeChanged(int volume);
void mutedStateChanged(bool muted);
void audioAvailableChanged(bool audioAvailable);
@@ -143,19 +137,12 @@ private slots:
void finishVideoOutputChange();
void updateVideoRenderer();
void updateVideoResolutionTag();
-
- bool doPlay();
-
-#ifdef Q_WS_MAEMO_6
- // resource policy awareness
- void acquireResources();
- void resourceAcquiredHandler(const QList<ResourcePolicy::ResourceType>& /*grantedOptionalResList*/);
- void resourceReleasedHandler();
- void resourceLostHandler();
-#endif // Q_WS_MAEMO_6
+ void updateVolume();
private:
static void playbinNotifySource(GObject *o, GParamSpec *p, gpointer d);
+ static void handleVolumeChange(GObject *o, GParamSpec *p, gpointer d);
+ static void insertColorSpaceElement(GstElement *element, gpointer data);
QNetworkRequest m_request;
QMediaPlayer::State m_state;
@@ -191,19 +178,6 @@ private:
qint64 m_lastPosition;
qint64 m_duration;
-
-#ifdef Q_WS_MAEMO_6
- // resource policy awareness
- ResourcePolicy::ResourceSet *m_resourceSet;
- ResourcePolicy::AudioResource *m_audioResource;
-
- enum ResourceState {
- NoResourceState = 0,
- PendingResourceState,
- HasResourceState
- };
- ResourceState m_resourceState;
-#endif // Q_WS_MAEMO_6
};
#endif // QGSTREAMERPLAYERSESSION_H
diff --git a/plugins/multimedia/gstreamer/qgstreamerserviceplugin.cpp b/plugins/multimedia/gstreamer/qgstreamerserviceplugin.cpp
index 744a9c1165..7bb4696d7a 100644
--- a/plugins/multimedia/gstreamer/qgstreamerserviceplugin.cpp
+++ b/plugins/multimedia/gstreamer/qgstreamerserviceplugin.cpp
@@ -126,6 +126,15 @@ void QGstreamerServicePlugin::release(QMediaService *service)
delete service;
}
+QMediaServiceProviderHint::Features QGstreamerServicePlugin::supportedFeatures(
+ const QByteArray &service) const
+{
+ if (service == Q_MEDIASERVICE_MEDIAPLAYER)
+ return QMediaServiceProviderHint::StreamPlayback;
+ else
+ return QMediaServiceProviderHint::Features();
+}
+
QList<QByteArray> QGstreamerServicePlugin::devices(const QByteArray &service) const
{
if (service == Q_MEDIASERVICE_CAMERA) {
@@ -171,6 +180,12 @@ void QGstreamerServicePlugin::updateDevices() const
return;
#endif
+#ifdef Q_WS_MAEMO_6
+ m_cameraDevices << "primary" << "secondary";
+ m_cameraDescriptions << tr("Main camera") << tr("Front camera");
+ return;
+#endif
+
QDir devDir("/dev");
devDir.setFilter(QDir::System);
diff --git a/plugins/multimedia/gstreamer/qgstreamerserviceplugin.h b/plugins/multimedia/gstreamer/qgstreamerserviceplugin.h
index 55e18b6eb6..cc61af42ac 100644
--- a/plugins/multimedia/gstreamer/qgstreamerserviceplugin.h
+++ b/plugins/multimedia/gstreamer/qgstreamerserviceplugin.h
@@ -48,15 +48,21 @@
QT_USE_NAMESPACE
-class QGstreamerServicePlugin : public QMediaServiceProviderPlugin, public QMediaServiceSupportedDevicesInterface
+class QGstreamerServicePlugin
+ : public QMediaServiceProviderPlugin
+ , public QMediaServiceSupportedDevicesInterface
+ , public QMediaServiceFeaturesInterface
{
Q_OBJECT
Q_INTERFACES(QMediaServiceSupportedDevicesInterface)
+ Q_INTERFACES(QMediaServiceFeaturesInterface)
public:
QStringList keys() const;
QMediaService* create(QString const& key);
void release(QMediaService *service);
+ QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const;
+
QList<QByteArray> devices(const QByteArray &service) const;
QString deviceDescription(const QByteArray &service, const QByteArray &device);
QVariant deviceProperty(const QByteArray &service, const QByteArray &device, const QByteArray &property);
diff --git a/plugins/multimedia/gstreamer/qgstreamervideoinputdevicecontrol.cpp b/plugins/multimedia/gstreamer/qgstreamervideoinputdevicecontrol.cpp
index 16bb5afae0..d53497d308 100644
--- a/plugins/multimedia/gstreamer/qgstreamervideoinputdevicecontrol.cpp
+++ b/plugins/multimedia/gstreamer/qgstreamervideoinputdevicecontrol.cpp
@@ -114,6 +114,10 @@ void QGstreamerVideoInputDeviceControl::update()
m_names.clear();
m_descriptions.clear();
+#ifdef Q_WS_MAEMO_6
+ m_names << QLatin1String("primary") << QLatin1String("secondary");
+ m_descriptions << tr("Main camera") << tr("Front camera");
+#else
QDir devDir("/dev");
devDir.setFilter(QDir::System);
@@ -154,4 +158,5 @@ void QGstreamerVideoInputDeviceControl::update()
}
::close(fd);
}
+#endif
}
diff --git a/plugins/multimedia/gstreamer/qgstreamervideorendererinterface.h b/plugins/multimedia/gstreamer/qgstreamervideorendererinterface.h
index 620992ed20..cbd0010d55 100644
--- a/plugins/multimedia/gstreamer/qgstreamervideorendererinterface.h
+++ b/plugins/multimedia/gstreamer/qgstreamervideorendererinterface.h
@@ -57,10 +57,6 @@ public:
//(winId is known,
virtual bool isReady() const { return true; }
- //video renderer can declare it's confident it can play
- //video frames without colorspace converter inserted before.
- virtual bool isColorSpaceElementRequired() const { return true; }
-
//video renderer may handle video sink specific gstreamer messages.
virtual void handleBusMessage(GstMessage*) {};
virtual void handleSyncMessage(GstMessage*) {};
diff --git a/plugins/multimedia/symbian/ecam/camera_s60.pri b/plugins/multimedia/symbian/ecam/camera_s60.pri
index 8704cd78c3..ac648020c0 100644
--- a/plugins/multimedia/symbian/ecam/camera_s60.pri
+++ b/plugins/multimedia/symbian/ecam/camera_s60.pri
@@ -57,7 +57,6 @@ contains(symbian_camera_ecamadvsettings_enabled, yes) {
}
}
-
# DevVideo API Check (Requires both, DevVideoPlay and DevVideoRecord plugins):
# DevVideoConstants has been problematic since not being included in SDK plugins
# For S60 5.0 this has changed with plugin extension 1.1
@@ -124,7 +123,7 @@ HEADERS += $$PWD/s60cameraconstants.h \
$$PWD/s60imageencodercontrol.h \
$$PWD/s60videowidgetcontrol.h \
$$PWD/s60camerasettings.h \
- $$PWD/s60cameraengine.h \
+ $$PWD/s60cameraengine.h \
$$PWD/s60cameraviewfinderengine.h \
$$PWD/s60cameraengineobserver.h \
$$PWD/s60videorenderercontrol.h
diff --git a/plugins/multimedia/symbian/ecam/s60audioencodercontrol.cpp b/plugins/multimedia/symbian/ecam/s60audioencodercontrol.cpp
index 907b707278..e82136a296 100644
--- a/plugins/multimedia/symbian/ecam/s60audioencodercontrol.cpp
+++ b/plugins/multimedia/symbian/ecam/s60audioencodercontrol.cpp
@@ -70,9 +70,9 @@ QString S60AudioEncoderControl::codecDescription(const QString &codecName) const
{
// According to ForumNokia MMF camcorder plugin supports AAC, AMR and QCELP
// QCELP is speech codec and can be discarded
- if(qstrcmp(codecName.toLocal8Bit().constData(), "audio/aac") == 0)
+ if (qstrcmp(codecName.toLocal8Bit().constData(), "audio/aac") == 0)
return QString("Advanced Audio Coding");
- else if(qstrcmp(codecName.toLocal8Bit().constData(), "audio/amr") == 0)
+ else if (qstrcmp(codecName.toLocal8Bit().constData(), "audio/amr") == 0)
return QString("Adaptive Multi-Rate Audio Codec");
return QString();
@@ -122,6 +122,10 @@ QAudioEncoderSettings S60AudioEncoderControl::audioSettings() const
void S60AudioEncoderControl::setAudioSettings(const QAudioEncoderSettings &settings)
{
+ // Notify that settings have been implicitly set and there's no need to
+ // initialize them in case camera is changed
+ m_session->notifySettingsSet();
+
// Quality defines SampleRate/BitRate combination if either or both are missing
if (settings.codec().isEmpty()) { // Empty settings
m_session->setAudioCaptureQuality(settings.quality(), S60VideoCaptureSession::EOnlyAudioQuality);
@@ -140,6 +144,12 @@ void S60AudioEncoderControl::setAudioSettings(const QAudioEncoderSettings &setti
m_session->setAudioEncodingMode(settings.encodingMode());
m_session->setAudioCaptureQuality(settings.quality(), S60VideoCaptureSession::EAudioQualityAndBitRate);
+ } else if (settings.bitRate() == -1 && settings.sampleRate() == -1) { // No BitRate or SampleRate set
+ m_session->setAudioCaptureCodec(settings.codec());
+ m_session->setAudioChannelCount(settings.channelCount());
+ m_session->setAudioEncodingMode(settings.encodingMode());
+ m_session->setAudioCaptureQuality(settings.quality(), S60VideoCaptureSession::EOnlyAudioQuality);
+
} else { // Both SampleRate and BitRate set
m_session->setAudioCaptureCodec(settings.codec());
m_session->setAudioChannelCount(settings.channelCount());
diff --git a/plugins/multimedia/symbian/ecam/s60cameraconstants.h b/plugins/multimedia/symbian/ecam/s60cameraconstants.h
index 60e899037b..6471d7642d 100644
--- a/plugins/multimedia/symbian/ecam/s60cameraconstants.h
+++ b/plugins/multimedia/symbian/ecam/s60cameraconstants.h
@@ -48,7 +48,7 @@
#define KDefaultCameraDevice 0
#define KECamCameraPriority 0
-#define KInactivityTimerTimeout 20000 // msec
+#define KInactivityTimerTimeout 30000 // msec
#define KSymbianFineResolutionFactor 100.0
#define KDefaultOpticalZoom 1.0
#define KDefaultDigitalZoom 1.0
@@ -67,7 +67,13 @@
#define KDefaultImageFileName QString("image.jpg")
#define KDefaultImageCodec QString("image/jpg")
#define KDefaultImageFormatPrimaryCam CCamera::EFormatExif
+#ifdef SYMBIAN_3_PLATFORM
+#define KDefaultImageFormatSecondaryCam CCamera::EFormatExif
+#define KDefaultImageResolution QSize(3264, 2448)
+#else // Pre-Symbian3 Platforms
#define KDefaultImageFormatSecondaryCam CCamera::EFormatFbsBitmapColor64K
+#define KDefaultImageResolution QSize(2048, 1536)
+#endif // SYMBIAN_3_PLATFORM
#define KSymbianImageQualityCoefficient 25
// This must be divisible by 4 and creater or equal to 8
#define KSnapshotDownScaleFactor 8
@@ -97,6 +103,7 @@ _LIT(KDummyVideoFile, "c:\\data\\temp");
#define KMimeTypeDefaultContainer QString("video/mp4")
#define KDefaultVideoPath QString("c:\\Data\\Videos")
#define KDefaultVideoFileName QString("video.mp4")
+#define KDurationChangedInterval 1000 // 1 second
// ==============
// Audio Settings
@@ -106,9 +113,9 @@ _LIT(KDummyVideoFile, "c:\\data\\temp");
#define KMimeTypeDefaultAudioCodec QString("audio/aac")
// Default audio settings for video recording
-#define KDefaultChannelCount 2
+#define KDefaultChannelCount -1 // Not Supported on Symbian
#define KDefaultBitRate 32000 // 32kbps
-#define KDefaultSampleRate 16000 // 16000 Hz
+#define KDefaultSampleRate -1 // Not Supported on Symbian
// ==============
// Video Settings
@@ -216,7 +223,12 @@ _LIT(KDummyVideoFile, "c:\\data\\temp");
#define KBiR_MPEG4_PLID_1 int(64000);
#define KBiR_MPEG4_PLID_2 int(128000);
#define KBiR_MPEG4_PLID_3 int(384000);
+// This is a workaround for a known platform bug
+#if (defined(S60_31_PLATFORM) | defined(S60_32_PLATFORM))
+#define KBiR_MPEG4_PLID_4 int(2000000);
+#else // All other platforms
#define KBiR_MPEG4_PLID_4 int(4000000);
+#endif // S60 3.1 or 3.2
#define KBiR_MPEG4_PLID_5 int(8000000);
#define KBiR_MPEG4_PLID_6 int(12000000);
#define KBiR_MPEG4_PLID_8 int(64000);
diff --git a/plugins/multimedia/symbian/ecam/s60cameracontrol.cpp b/plugins/multimedia/symbian/ecam/s60cameracontrol.cpp
index 6bed8b87e9..3c04231077 100644
--- a/plugins/multimedia/symbian/ecam/s60cameracontrol.cpp
+++ b/plugins/multimedia/symbian/ecam/s60cameracontrol.cpp
@@ -68,6 +68,7 @@ S60CameraControl::S60CameraControl(S60VideoCaptureSession *videosession,
m_inactivityTimer(NULL),
m_captureMode(QCamera::CaptureStillImage), // Default CaptureMode
m_requestedCaptureMode(QCamera::CaptureStillImage),
+ m_settingCaptureModeInternally(false),
m_internalState(QCamera::UnloadedStatus), // Default Status
m_requestedState(QCamera::UnloadedState), // Default State
m_deviceIndex(KDefaultCameraDevice),
@@ -92,14 +93,12 @@ S60CameraControl::S60CameraControl(S60VideoCaptureSession *videosession,
m_inactivityTimer->setSingleShot(true);
TRAPD(err, m_cameraEngine = CCameraEngine::NewL(m_deviceIndex, KECamCameraPriority, this));
- if (err) {
+ if (err)
m_error = err;
- }
m_viewfinderEngine = new S60CameraViewfinderEngine(this, m_cameraEngine);
- if (m_viewfinderEngine == NULL) {
+ if (m_viewfinderEngine == NULL)
m_error = KErrNoMemory;
- }
// Connect signals
connect(m_inactivityTimer, SIGNAL(timeout()), this, SLOT(toStandByStatus()));
@@ -147,13 +146,16 @@ void S60CameraControl::setState(QCamera::State state)
return;
}
- if (m_requestedState == state) {
+ if (m_requestedState == state)
return;
- }
if (m_inactivityTimer->isActive())
m_inactivityTimer->stop();
+ // Save the target state
+ m_requestedState = state;
+ emit stateChanged(m_requestedState);
+
switch (state) {
case QCamera::UnloadedState: // To UnloadedState - Release resources
switch (m_internalState) {
@@ -180,7 +182,6 @@ void S60CameraControl::setState(QCamera::State state)
setError(KErrGeneral, QString("Unexpected camera error."));
return;
}
- m_requestedState = QCamera::UnloadedState;
break;
case QCamera::LoadedState: // To LoadedState - Reserve resources OR Stop ViewFinder and Cancel Capture
@@ -209,7 +210,6 @@ void S60CameraControl::setState(QCamera::State state)
setError(KErrGeneral, QString("Unexpected camera error."));
return;
}
- m_requestedState = QCamera::LoadedState;
break;
case QCamera::ActiveState: // To ActiveState - (Reserve Resources and) Start ViewFinder
@@ -238,15 +238,12 @@ void S60CameraControl::setState(QCamera::State state)
setError(KErrGeneral, QString("Unexpected camera error."));
return;
}
- m_requestedState = QCamera::ActiveState;
break;
default:
setError(KErrNotSupported, QString("Requested state is not supported."));
return;
}
-
- emit stateChanged(m_requestedState);
}
QCamera::State S60CameraControl::state() const
@@ -271,12 +268,21 @@ void S60CameraControl::setCaptureMode(QCamera::CaptureMode mode)
return;
}
- // If capturemode change was requested earlier, but was postponed due
- // to backend being busy, m_changeCaptureModeWhenReady flag is set when
- // trying to set the capturemode again internally.
- if (m_requestedCaptureMode == mode && !m_changeCaptureModeWhenReady) {
+ if (m_captureMode == mode)
return;
+
+ // Setting CaptureMode Internally or Externally (Client)
+ if (!m_settingCaptureModeInternally) {
+ // Save the requested mode
+ m_requestedCaptureMode = mode;
+
+ // CaptureMode change pending (backend busy), wait
+ if (m_changeCaptureModeWhenReady)
+ return;
+ } else {
+ m_changeCaptureModeWhenReady = false; // Reset
}
+ m_settingCaptureModeInternally = false; // Reset
if (!isCaptureModeSupported(mode)) {
setError(KErrNotSupported, QString("Requested capture mode is not supported."));
@@ -293,18 +299,20 @@ void S60CameraControl::setCaptureMode(QCamera::CaptureMode mode)
switch (mode) {
case QCamera::CaptureStillImage:
m_videoSession->releaseVideoRecording();
- m_requestedCaptureMode = QCamera::CaptureStillImage;
m_captureMode = QCamera::CaptureStillImage;
- if (m_internalState == QCamera::LoadedStatus) {
+ if (m_internalState == QCamera::LoadedStatus)
m_inactivityTimer->start(KInactivityTimerTimeout);
- }
else if (m_internalState == QCamera::StandbyStatus)
loadCamera();
break;
case QCamera::CaptureVideo:
- m_requestedCaptureMode = QCamera::CaptureVideo;
+ m_imageSession->releaseImageCapture();
m_captureMode = QCamera::CaptureVideo;
if (m_internalState == QCamera::LoadedStatus) {
+ // Revet InternalState as we need to wait for the video
+ // side initialization to complete
+ m_internalState = QCamera::LoadingStatus;
+ emit statusChanged(m_internalState);
int prepareSuccess = m_videoSession->initializeVideoRecording();
setError(prepareSuccess, QString("Loading video capture failed."));
} else if (m_internalState == QCamera::StandbyStatus)
@@ -314,7 +322,6 @@ void S60CameraControl::setCaptureMode(QCamera::CaptureMode mode)
break;
case QCamera::LoadingStatus:
case QCamera::StartingStatus:
- m_requestedCaptureMode = mode;
m_changeCaptureModeWhenReady = true;
return;
case QCamera::ActiveStatus:
@@ -323,15 +330,18 @@ void S60CameraControl::setCaptureMode(QCamera::CaptureMode mode)
switch (mode) {
case QCamera::CaptureStillImage:
m_videoSession->releaseVideoRecording();
- m_requestedCaptureMode = QCamera::CaptureStillImage;
m_captureMode = QCamera::CaptureStillImage;
startCamera();
break;
case QCamera::CaptureVideo:
- m_requestedCaptureMode = QCamera::CaptureVideo;
+ m_imageSession->releaseImageCapture();
m_captureMode = QCamera::CaptureVideo;
+ // Revet InternalState as we need to wait for the video
+ // side initialization to complete
+ m_internalState = QCamera::LoadingStatus;
+ emit statusChanged(m_internalState);
int prepareSuccess = m_videoSession->initializeVideoRecording();
- setError(prepareSuccess, QString("Loading video capture failed."));
+ setError(prepareSuccess, QString("Loading video recorder failed."));
break;
}
break;
@@ -380,6 +390,7 @@ bool S60CameraControl::canChangeProperty(QCameraControl::PropertyChangeType chan
returnValue = false;
break;
}
+
return returnValue;
}
@@ -403,8 +414,15 @@ void S60CameraControl::setVideoOutput(QObject *output, ViewfinderOutputType type
void S60CameraControl::loadCamera()
{
- m_internalState = QCamera::LoadingStatus;
- emit statusChanged(m_internalState);
+ if (m_internalState < QCamera::LoadingStatus) {
+ m_internalState = QCamera::LoadingStatus;
+ emit statusChanged(m_internalState);
+ } else if (m_internalState == QCamera::LoadedStatus
+ || m_internalState >= QCamera::StartingStatus) {
+ // Nothing to load (already loaded)
+ return;
+ }
+ // Status = Loading or Standby
m_cameraEngine->ReserveAndPowerOn();
@@ -413,8 +431,17 @@ void S60CameraControl::loadCamera()
void S60CameraControl::unloadCamera()
{
- m_internalState = QCamera::LoadingStatus;
- emit statusChanged(m_internalState);
+ if (m_internalState > QCamera::LoadingStatus) {
+ m_internalState = QCamera::LoadingStatus;
+ emit statusChanged(m_internalState);
+ } else if (m_internalState < QCamera::LoadingStatus) {
+ // Nothing to unload
+ return;
+ }
+ // Status = Loading
+
+ if (m_inactivityTimer->isActive())
+ m_inactivityTimer->stop();
m_cameraEngine->ReleaseAndPowerOff();
@@ -424,10 +451,18 @@ void S60CameraControl::unloadCamera()
void S60CameraControl::startCamera()
{
- m_internalState = QCamera::StartingStatus;
- emit statusChanged(m_internalState);
+ if (m_internalState < QCamera::StartingStatus) {
+ m_internalState = QCamera::StartingStatus;
+ emit statusChanged(m_internalState);
+ } else if (m_internalState > QCamera::StartingStatus) {
+ // Nothing to start (already started)
+ return;
+ }
+ // Status = Starting
+
+ if (m_inactivityTimer->isActive())
+ m_inactivityTimer->stop();
- emit cameraReadyChanged(true);
if (m_viewfinderEngine)
m_viewfinderEngine->startViewfinder();
else
@@ -436,6 +471,8 @@ void S60CameraControl::startCamera()
m_internalState = QCamera::ActiveStatus;
emit statusChanged(m_internalState);
+ emit cameraReadyChanged(true);
+
#ifdef Q_CC_NOKIAX86 // Emulator
MceoCameraReady(); // Signal that we are ready
#endif
@@ -443,8 +480,14 @@ void S60CameraControl::startCamera()
void S60CameraControl::stopCamera()
{
- m_internalState = QCamera::StartingStatus;
- emit statusChanged(m_internalState);
+ if (m_internalState > QCamera::StartingStatus) {
+ m_internalState = QCamera::StartingStatus;
+ emit statusChanged(m_internalState);
+ } else if (m_internalState < QCamera::StartingStatus) {
+ // Nothing to stop
+ return;
+ }
+ // Status = Starting
// Cancel ongoing operations if any
m_imageSession->cancelCapture();
@@ -469,23 +512,32 @@ void S60CameraControl::videoStateChanged(const S60VideoCaptureSession::TVideoCap
if (m_rotateCameraWhenReady) {
if (m_videoCaptureState != S60VideoCaptureSession::ERecording &&
- m_videoCaptureState != S60VideoCaptureSession::EPaused) {
+ m_videoCaptureState != S60VideoCaptureSession::EPaused)
resetCameraOrientation();
- }
}
- if (state == S60VideoCaptureSession::EInitialized) {
- // Don't downgrade state
- if (m_internalState == QCamera::StartingStatus || m_internalState == QCamera::ActiveStatus) {
- m_internalState = QCamera::ActiveStatus;
- if (m_internalState == QCamera::StartingStatus)
- emit statusChanged(m_internalState);
+ // If video recording was stopped, video state reverts back to
+ // Initializing. In that case revert also Camera status to notify that
+ // video initialization needs to be completed.
+ if (state == S60VideoCaptureSession::EInitializing) {
+ if (m_internalState > QCamera::LoadingStatus) {
+ m_internalState = QCamera::LoadingStatus;
+ emit statusChanged(m_internalState);
}
- else {
- if (m_internalState != QCamera::LoadedStatus) {
- m_internalState = QCamera::LoadedStatus;
- emit statusChanged(m_internalState);
- }
+
+ // Handle video initialization completion
+ } else if (state == S60VideoCaptureSession::EInitialized) {
+
+ // Make sure state is not downgraded
+ if (m_internalState == QCamera::LoadedStatus
+ || m_internalState == QCamera::ActiveStatus) {
+ // Do nothing (already in target state)
+ } else if (m_internalState == QCamera::StartingStatus) {
+ m_internalState = QCamera::ActiveStatus;
+ emit statusChanged(m_internalState);
+ } else {
+ m_internalState = QCamera::LoadedStatus;
+ emit statusChanged(m_internalState);
}
switch (m_requestedState) {
@@ -493,22 +545,22 @@ void S60CameraControl::videoStateChanged(const S60VideoCaptureSession::TVideoCap
stopCamera();
unloadCamera();
if (m_changeCaptureModeWhenReady) {
+ m_settingCaptureModeInternally = true;
setCaptureMode(m_requestedCaptureMode);
- m_changeCaptureModeWhenReady = false; // Reset
}
break;
case QCamera::LoadedState:
stopCamera();
if (m_changeCaptureModeWhenReady) {
+ m_settingCaptureModeInternally = true;
setCaptureMode(m_requestedCaptureMode);
- m_changeCaptureModeWhenReady = false; // Reset
}
m_inactivityTimer->start(KInactivityTimerTimeout);
break;
case QCamera::ActiveState:
if (m_changeCaptureModeWhenReady) {
+ m_settingCaptureModeInternally = true;
setCaptureMode(m_requestedCaptureMode);
- m_changeCaptureModeWhenReady = false; // Reset
}
startCamera();
break;
@@ -517,8 +569,6 @@ void S60CameraControl::videoStateChanged(const S60VideoCaptureSession::TVideoCap
setError(KErrGeneral, QString("Unexpected camera error."));
return;
}
-
- emit statusChanged(m_internalState);
}
}
@@ -545,6 +595,12 @@ void S60CameraControl::advancedSettingsCreated()
void S60CameraControl::MceoCameraReady()
{
+ // Rotate camera if requested
+ if (m_rotateCameraWhenReady) {
+ resetCameraOrientation();
+ return;
+ }
+
if (m_internalState != QCamera::LoadedStatus) {
switch (m_requestedState) {
@@ -556,8 +612,8 @@ void S60CameraControl::MceoCameraReady()
unloadCamera();
if (m_changeCaptureModeWhenReady) {
+ m_settingCaptureModeInternally = true;
setCaptureMode(m_requestedCaptureMode);
- m_changeCaptureModeWhenReady = false; // Reset
}
break;
@@ -628,7 +684,7 @@ void S60CameraControl::setError(const TInt error, const QString &description)
m_error = error;
QCamera::Error cameraError = fromSymbianErrorToQtMultimediaError(m_error);
- emit this->error(cameraError, description);
+ emit this->error(int(cameraError), description);
// Reset everything, if other than not supported error or resource loss
if (error != KErrNotSupported && error != KErrHardwareNotAvailable)
@@ -680,8 +736,12 @@ int S60CameraControl::selectedDevice() const
void S60CameraControl::setSelectedDevice(const int index)
{
if (m_deviceIndex != index) {
- m_deviceIndex = index;
- resetCamera();
+ if (index >= 0 && index < deviceCount()) {
+ m_deviceIndex = index;
+ resetCamera();
+ } else {
+ setError(KErrNotSupported, QString("Requested camera is not available."));
+ }
}
}
@@ -767,9 +827,8 @@ void S60CameraControl::resetCamera()
emit devicesChanged();
m_viewfinderEngine = new S60CameraViewfinderEngine(this, m_cameraEngine);
- if (m_viewfinderEngine == NULL) {
+ if (m_viewfinderEngine == NULL)
setError(KErrNoMemory, QString("Viewfinder device creation failed."));
- }
connect(m_viewfinderEngine, SIGNAL(error(int, const QString&)), this, SIGNAL(error(int,const QString&)));
setCameraHandles();
@@ -794,9 +853,12 @@ void S60CameraControl::resetCamera()
*/
void S60CameraControl::resetCameraOrientation()
{
+ // If camera has not been created, it will be created automatically to correct orientation
+ if (!m_cameraEngine)
+ return;
+
// Check Image/VideoCapture allow rotation
- if (!m_cameraEngine ||
- (!m_cameraEngine->IsCameraReady() && m_internalState != QCamera::UnloadedStatus) ||
+ if ((!m_cameraEngine->IsCameraReady() && m_internalState != QCamera::UnloadedStatus) ||
m_videoCaptureState == S60VideoCaptureSession::ERecording ||
m_videoCaptureState == S60VideoCaptureSession::EPaused) {
@@ -806,7 +868,8 @@ void S60CameraControl::resetCameraOrientation()
// Obs! If preview creation is changed to be synchnonously done during
// the image capture this implementation needs to be changed)
if (m_videoCaptureState != S60VideoCaptureSession::ERecording &&
- m_videoCaptureState != S60VideoCaptureSession::EPaused)
+ m_videoCaptureState != S60VideoCaptureSession::EPaused &&
+ m_internalState == QCamera::ActiveStatus)
connect(m_imageSession, SIGNAL(imageCaptured(const int, const QImage&)),
this, SLOT(imageCaptured(const int, const QImage&)));
diff --git a/plugins/multimedia/symbian/ecam/s60cameracontrol.h b/plugins/multimedia/symbian/ecam/s60cameracontrol.h
index 94bad38a72..9de75eda2b 100644
--- a/plugins/multimedia/symbian/ecam/s60cameracontrol.h
+++ b/plugins/multimedia/symbian/ecam/s60cameracontrol.h
@@ -170,6 +170,7 @@ private: // Data
QTimer *m_inactivityTimer;
QCamera::CaptureMode m_captureMode;
QCamera::CaptureMode m_requestedCaptureMode;
+ bool m_settingCaptureModeInternally;
QCamera::Status m_internalState;
QCamera::State m_requestedState;
int m_deviceIndex;
diff --git a/plugins/multimedia/symbian/ecam/s60cameraengine.cpp b/plugins/multimedia/symbian/ecam/s60cameraengine.cpp
index c46a31913e..d539d4645b 100644
--- a/plugins/multimedia/symbian/ecam/s60cameraengine.cpp
+++ b/plugins/multimedia/symbian/ecam/s60cameraengine.cpp
@@ -149,9 +149,8 @@ void CCameraEngine::SetViewfinderObserver(MCameraViewfinderObserver* aViewfinder
void CCameraEngine::ReserveAndPowerOn()
{
- if (!iCamera || iEngineState > EEngineNotReady) {
+ if (!iCamera || iEngineState > EEngineNotReady)
iObserver->MceoHandleError(EErrReserve, KErrNotReady);
- }
iCamera->Reserve();
}
@@ -170,27 +169,23 @@ void CCameraEngine::ReleaseAndPowerOff()
void CCameraEngine::StartViewFinderL(TSize& aSize)
{
- if (iEngineState < EEngineIdle) {
+ if (iEngineState < EEngineIdle)
User::Leave(KErrNotReady);
- }
- if (0 == (iCameraInfo.iOptionsSupported & TCameraInfo::EViewFinderBitmapsSupported)) {
+ if (0 == (iCameraInfo.iOptionsSupported & TCameraInfo::EViewFinderBitmapsSupported))
User::Leave(KErrNotSupported);
- }
if (!iCamera->ViewFinderActive()) {
- if (iCameraIndex != 0) {
+ if (iCameraIndex != 0)
iCamera->SetViewFinderMirrorL(true);
- }
iCamera->StartViewFinderBitmapsL(aSize);
}
}
void CCameraEngine::StopViewFinder()
{
- if (iCamera && iCamera->ViewFinderActive()) {
+ if (iCamera && iCamera->ViewFinderActive())
iCamera->StopViewFinder();
- }
}
void CCameraEngine::StartDirectViewFinderL(RWsSession& aSession,
@@ -198,18 +193,16 @@ void CCameraEngine::StartDirectViewFinderL(RWsSession& aSession,
RWindowBase& aWindow,
TRect& aSize)
{
- if (iEngineState < EEngineIdle) {
+ if (iEngineState < EEngineIdle)
User::Leave(KErrNotReady);
- }
- if (0 == (iCameraInfo.iOptionsSupported & TCameraInfo::EViewFinderDirectSupported)) {
+ if (0 == (iCameraInfo.iOptionsSupported & TCameraInfo::EViewFinderDirectSupported))
User::Leave(KErrNotSupported);
- }
if (!iCamera->ViewFinderActive()) {
- if (iCameraIndex != 0) {
+
+ if (iCameraIndex != 0)
iCamera->SetViewFinderMirrorL(true);
- }
iCamera->StartViewFinderDirectL(aSession, aScreenDevice, aWindow, aSize);
}
}
@@ -285,7 +278,6 @@ void CCameraEngine::HandleEvent(const TECAMEvent &aEvent)
if (iImageCaptureObserver)
iImageCaptureObserver->MceoHandleOtherEvent(aEvent);
#endif // !Q_CC_NOKIAX86
-
}
void CCameraEngine::ReserveComplete(TInt aError)
@@ -423,7 +415,6 @@ void CCameraEngine::ReleaseImageBuffer()
*/
void CCameraEngine::ImageBufferReady(MCameraBuffer &aCameraBuffer, TInt aError)
{
-
// Use the buffer that is available
if (!iImageBuffer1) {
iLatestImageBufferIndex = 0;
@@ -625,9 +616,8 @@ TBool CCameraEngine::IsAutoFocusSupported() const
*/
void CCameraEngine::StartFocusL()
{
- if (iEngineState != EEngineIdle) {
+ if (iEngineState != EEngineIdle)
return;
- }
#ifndef Q_CC_NOKIAX86 // Not Emulator
#ifdef S60_CAM_AUTOFOCUS_SUPPORT // S60 3.1
@@ -686,9 +676,8 @@ void CCameraEngine::SetFocusRange(TInt aFocusRange)
#ifdef S60_CAM_AUTOFOCUS_SUPPORT
if (iAutoFocus) {
TRAPD(focusErr, iAutoFocus->SetFocusRangeL((CCamAutoFocus::TAutoFocusRange)aFocusRange));
- if (focusErr) {
+ if (focusErr)
iObserver->MceoHandleError(EErrAutoFocusRange, focusErr);
- }
}
#endif // S60_CAM_AUTOFOCUS_SUPPORT
diff --git a/plugins/multimedia/symbian/ecam/s60cameraengineobserver.h b/plugins/multimedia/symbian/ecam/s60cameraengineobserver.h
index e8e1aec55e..c17496cd2b 100644
--- a/plugins/multimedia/symbian/ecam/s60cameraengineobserver.h
+++ b/plugins/multimedia/symbian/ecam/s60cameraengineobserver.h
@@ -64,7 +64,6 @@ enum TCameraEngineError
*/
class MAdvancedSettingsObserver
{
-
public:
virtual void HandleAdvancedEvent( const TECAMEvent &aEvent ) = 0;
diff --git a/plugins/multimedia/symbian/ecam/s60cameraexposurecontrol.cpp b/plugins/multimedia/symbian/ecam/s60cameraexposurecontrol.cpp
index 48ada857b1..a39036ba6a 100644
--- a/plugins/multimedia/symbian/ecam/s60cameraexposurecontrol.cpp
+++ b/plugins/multimedia/symbian/ecam/s60cameraexposurecontrol.cpp
@@ -129,18 +129,16 @@ void S60CameraExposureControl::setExposureMode(QCameraExposure::ExposureMode mod
bool S60CameraExposureControl::isExposureModeSupported(QCameraExposure::ExposureMode mode) const
{
- if (m_session->isExposureModeSupported(mode)) {
+ if (m_session->isExposureModeSupported(mode))
return true;
- }
return false;
}
QCameraExposure::MeteringMode S60CameraExposureControl::meteringMode() const
{
- if (m_advancedSettings) {
+ if (m_advancedSettings)
return m_advancedSettings->meteringMode();
- }
return QCameraExposure::MeteringMode();
}
@@ -160,9 +158,8 @@ void S60CameraExposureControl::setMeteringMode(QCameraExposure::MeteringMode mod
bool S60CameraExposureControl::isMeteringModeSupported(QCameraExposure::MeteringMode mode) const
{
- if (m_advancedSettings) {
+ if (m_advancedSettings)
return m_advancedSettings->isMeteringModeSupported(mode);
- }
return false;
}
@@ -260,30 +257,26 @@ QVariantList S60CameraExposureControl::supportedParameterRange(ExposureParameter
switch (parameter) {
case QCameraExposureControl::ISO: {
QList<int> exposureValues = m_advancedSettings->supportedIsoSensitivities();
- for (int i = 0; i < exposureValues.count(); ++i) {
+ for (int i = 0; i < exposureValues.count(); ++i)
valueList.append(QVariant(exposureValues[i]));
- }
break;
}
case QCameraExposureControl::Aperture: {
QList<qreal> apertureValues = m_advancedSettings->supportedApertures();
- for (int i = 0; i < apertureValues.count(); ++i) {
+ for (int i = 0; i < apertureValues.count(); ++i)
valueList.append(QVariant(apertureValues[i]));
- }
break;
}
case QCameraExposureControl::ShutterSpeed: {
QList<qreal> shutterSpeedValues = m_advancedSettings->supportedShutterSpeeds();
- for (int i = 0; i < shutterSpeedValues.count(); ++i) {
+ for (int i = 0; i < shutterSpeedValues.count(); ++i)
valueList.append(QVariant(shutterSpeedValues[i]));
- }
break;
}
case QCameraExposureControl::ExposureCompensation: {
QList<qreal> evValues = m_advancedSettings->supportedExposureCompensationValues();
- for (int i = 0; i < evValues.count(); ++i) {
+ for (int i = 0; i < evValues.count(); ++i)
valueList.append(QVariant(evValues[i]));
- }
break;
}
case QCameraExposureControl::FlashPower:
@@ -429,7 +422,6 @@ void S60CameraExposureControl::setAutoIsoSensitivity()
m_advancedSettings->setAutoIsoSensitivity();
}
-
qreal S60CameraExposureControl::aperture() const
{
if (m_advancedSettings)
diff --git a/plugins/multimedia/symbian/ecam/s60cameraflashcontrol.cpp b/plugins/multimedia/symbian/ecam/s60cameraflashcontrol.cpp
index e3a60e4710..46ce2ae6ab 100644
--- a/plugins/multimedia/symbian/ecam/s60cameraflashcontrol.cpp
+++ b/plugins/multimedia/symbian/ecam/s60cameraflashcontrol.cpp
@@ -104,9 +104,8 @@ bool S60CameraFlashControl::isFlashModeSupported(QCameraExposure::FlashModes mod
bool S60CameraFlashControl::isFlashReady() const
{
- if (m_advancedSettings) {
+ if (m_advancedSettings)
return m_advancedSettings->isFlashReady();
- }
return false;
}
diff --git a/plugins/multimedia/symbian/ecam/s60camerafocuscontrol.cpp b/plugins/multimedia/symbian/ecam/s60camerafocuscontrol.cpp
index e7c17d8ac5..1e6255a843 100644
--- a/plugins/multimedia/symbian/ecam/s60camerafocuscontrol.cpp
+++ b/plugins/multimedia/symbian/ecam/s60camerafocuscontrol.cpp
@@ -71,10 +71,8 @@ S60CameraFocusControl::S60CameraFocusControl(S60ImageCaptureSession *session, QO
m_advancedSettings = m_session->advancedSettings();
TRAPD(err, m_session->doSetZoomFactorL(m_opticalZoomValue, m_digitalZoomValue));
- if (err) {
+ if (err)
m_session->setError(KErrNotSupported, QString("Setting default zoom factors failed."));
- }
-
}
S60CameraFocusControl::~S60CameraFocusControl()
@@ -102,9 +100,8 @@ bool S60CameraFocusControl::isFocusModeSupported(QCameraFocus::FocusMode mode) c
if (m_advancedSettings) {
return m_advancedSettings->supportedFocusModes() & mode;
} else {
- if (mode == QCameraFocus::AutoFocus) {
+ if (mode == QCameraFocus::AutoFocus)
return m_session->isFocusSupported();
- }
}
return false;
@@ -133,9 +130,8 @@ qreal S60CameraFocusControl::digitalZoom() const
void S60CameraFocusControl::zoomTo(qreal optical, qreal digital)
{
TRAPD(err, m_session->doSetZoomFactorL(optical, digital));
- if (err) {
+ if (err)
m_session->setError(KErrNotSupported, QString("Requested zoom factor is not supported."));
- }
// Query new values
if (m_opticalZoomValue != m_session->opticalZoomFactor()) {
diff --git a/plugins/multimedia/symbian/ecam/s60cameraimagecapturecontrol.cpp b/plugins/multimedia/symbian/ecam/s60cameraimagecapturecontrol.cpp
index 313e8bba2b..0e6eb7f9af 100644
--- a/plugins/multimedia/symbian/ecam/s60cameraimagecapturecontrol.cpp
+++ b/plugins/multimedia/symbian/ecam/s60cameraimagecapturecontrol.cpp
@@ -93,9 +93,8 @@ S60CameraImageCaptureControl::~S60CameraImageCaptureControl()
bool S60CameraImageCaptureControl::isReadyForCapture() const
{
- if (m_cameraControl && m_cameraControl->captureMode() != QCamera::CaptureStillImage) {
+ if (m_cameraControl && m_cameraControl->captureMode() != QCamera::CaptureStillImage)
return false;
- }
return m_session->isDeviceReady();
}
diff --git a/plugins/multimedia/symbian/ecam/s60cameraservice.cpp b/plugins/multimedia/symbian/ecam/s60cameraservice.cpp
index 9d2db54d30..03f55a49a9 100644
--- a/plugins/multimedia/symbian/ecam/s60cameraservice.cpp
+++ b/plugins/multimedia/symbian/ecam/s60cameraservice.cpp
@@ -86,7 +86,6 @@ S60CameraService::S60CameraService(QObject *parent) :
m_imageEncoderControl = new S60ImageEncoderControl(m_imagesession, this);
m_locksControl = new S60CameraLocksControl(m_imagesession, this);
m_rendererControl = new S60VideoRendererControl(this);
-
}
}
diff --git a/plugins/multimedia/symbian/ecam/s60camerasettings.cpp b/plugins/multimedia/symbian/ecam/s60camerasettings.cpp
index a4db1c2ea0..63fa381525 100644
--- a/plugins/multimedia/symbian/ecam/s60camerasettings.cpp
+++ b/plugins/multimedia/symbian/ecam/s60camerasettings.cpp
@@ -208,9 +208,8 @@ void S60CameraSettings::setFocusMode(QCameraFocus::FocusMode mode)
void S60CameraSettings::cancelFocusing()
{
#ifdef POST_31_PLATFORM
- if (m_advancedSettings) {
+ if (m_advancedSettings)
m_advancedSettings->SetAutoFocusType(CCamera::CCameraAdvancedSettings::EAutoFocusTypeOff);
- }
else
emit error(QCamera::CameraError, QString("Unexpected camera error."));
#endif // POST_31_PLATFORM
@@ -303,9 +302,8 @@ qreal S60CameraSettings::opticalZoomFactorL() const
else
User::Leave(KErrNotSupported);
- if (symbianFactor != 0) {
+ if (symbianFactor != 0)
factor = symbianFactor; factor /= KSymbianFineResolutionFactor;
- }
#endif // POST_31_PLATFORM
return factor;
@@ -344,9 +342,8 @@ qreal S60CameraSettings::digitalZoomFactorL() const
else
User::Leave(KErrNotSupported);
- if (symbianFactor != 0) {
+ if (symbianFactor != 0)
factor = symbianFactor; factor /= KSymbianFineResolutionFactor;
- }
#endif // POST_31_PLATFORM
return factor;
@@ -373,6 +370,7 @@ void S60CameraSettings::setDigitalZoomFactorL(const qreal zoomFactor)
void S60CameraSettings::HandleAdvancedEvent(const TECAMEvent& aEvent)
{
#ifdef POST_31_PLATFORM
+
if (aEvent.iErrorCode != KErrNone) {
switch (aEvent.iErrorCode) {
case KErrECamCameraDisabled:
@@ -646,9 +644,8 @@ void S60CameraSettings::setAutoIsoSensitivity()
#ifdef POST_31_PLATFORM
if (m_advancedSettings) {
TRAPD(err, m_advancedSettings->SetISORateL(CCamera::CCameraAdvancedSettings::EISOAutoUnPrioritised, 0));
- if (err) {
+ if (err)
emit error(QCamera::CameraError, QString("Setting auto iso sensitivity failed."));
- }
return;
}
else
diff --git a/plugins/multimedia/symbian/ecam/s60cameraviewfinderengine.cpp b/plugins/multimedia/symbian/ecam/s60cameraviewfinderengine.cpp
index 2df5426d56..db68bbe47c 100644
--- a/plugins/multimedia/symbian/ecam/s60cameraviewfinderengine.cpp
+++ b/plugins/multimedia/symbian/ecam/s60cameraviewfinderengine.cpp
@@ -141,9 +141,8 @@ void S60CameraViewfinderEngine::handleDesktopResize(int screen)
// only for the QVideoRendererControl
if (m_viewfinderType == OutputTypeRenderer) {
QSize newResolution(-1,-1);
- if (m_viewfinderSurface) {
+ if (m_viewfinderSurface)
newResolution = m_viewfinderSurface->nativeResolution();
- }
if (newResolution.width() == -1 || newResolution.height() == -1) {
QDesktopWidget* desktopWidget = QApplication::desktop();
@@ -151,18 +150,18 @@ void S60CameraViewfinderEngine::handleDesktopResize(int screen)
newResolution = QSize(screenRect.width(), screenRect.height());
}
- resetViewfinderSize(newResolution); // This handles also Camera rotation if needed
+ resetViewfinderSize(newResolution);
}
+
+ // Rotate Camera if UI has rotated
+ checkAndRotateCamera();
}
void S60CameraViewfinderEngine::setVideoWidgetControl(QObject *viewfinderOutput)
{
- if (m_viewfinderOutput) {
- if (m_viewfinderType == OutputTypeRenderer) {
- disconnect(this, SIGNAL(viewFinderFrameReady(const QPixmap &)),
- this, SLOT(viewFinderBitmapReady(const QPixmap &)));
- }
- }
+ // Release old control if it has not already been done
+ if (m_viewfinderOutput)
+ releaseCurrentControl();
// Rotate Camera if UI has rotated
checkAndRotateCamera();
@@ -226,12 +225,9 @@ void S60CameraViewfinderEngine::setVideoWidgetControl(QObject *viewfinderOutput)
void S60CameraViewfinderEngine::setVideoRendererControl(QObject *viewfinderOutput)
{
- if (m_viewfinderOutput) {
- if (m_viewfinderType == OutputTypeVideoWidget) {
- QWidget *widget = qobject_cast<QVideoWidgetControl*>(m_viewfinderOutput)->videoWidget();
- disconnect(this, SIGNAL(viewFinderFrameReady(const QPixmap &)), widget, SLOT(setPixmap(const QPixmap &)));
- }
- }
+ // Release old control if it has not already been done
+ if (m_viewfinderOutput)
+ releaseCurrentControl();
// Rotate Camera if UI has rotated
checkAndRotateCamera();
@@ -332,6 +328,61 @@ void S60CameraViewfinderEngine::setVideoWindowControl(QObject *viewfinderOutput)
emit error(QCamera::NotSupportedFeatureError, tr("Viewfinder output not supported."));
}
+void S60CameraViewfinderEngine::releaseCurrentControl()
+{
+ if (m_viewfinderOutput) {
+ switch (m_viewfinderType) {
+ case OutputTypeNotSet:
+ {
+ return;
+ }
+ case OutputTypeVideoWidget:
+ {
+ QVideoWidgetControl *widgetControl = qobject_cast<QVideoWidgetControl*>(m_viewfinderOutput);
+ if (m_viewfinderNativeType == EDirectScreenViewFinder)
+ disconnect(widgetControl, SIGNAL(widgetUpdated()), this, SLOT(resetViewfinderDisplay()));
+ else
+ disconnect(this, SIGNAL(viewFinderFrameReady(const QPixmap &)), widgetControl->videoWidget(), SLOT(setPixmap(const QPixmap &)));
+ disconnect(widgetControl, SIGNAL(widgetVisible(bool)), this, SLOT(handleVisibilityChange(bool)));
+ disconnect(widgetControl, SIGNAL(widgetResized(QSize)), this, SLOT(resetViewfinderSize(QSize)));
+ break;
+ }
+ case OutputTypeRenderer:
+ {
+ QVideoRendererControl *rendererControl = qobject_cast<QVideoRendererControl*>(m_viewfinderOutput);
+ disconnect(rendererControl, SIGNAL(viewFinderSurfaceSet()), this, SLOT(resetViewfinderDisplay()));
+ disconnect(this, SIGNAL(viewFinderFrameReady(const QPixmap &)), this, SLOT(viewFinderBitmapReady(const QPixmap &)));
+ if (m_viewfinderSurface)
+ disconnect(m_viewfinderSurface, SIGNAL(nativeResolutionChanged(const QSize&)), this, SLOT(resetViewfinderSize(QSize)));
+ break;
+ }
+ case OutputTypeVideoWindow:
+ {
+ break;
+ }
+ default:
+ emit error(QCamera::CameraError, tr("Unexpected viewfinder error."));
+ return;
+ }
+ } else {
+ return;
+ }
+
+ m_viewfinderOutput = NULL;
+ m_viewfinderType = OutputTypeNotSet;
+
+
+ if (m_viewfinderType == OutputTypeVideoWidget) {
+ QWidget *widget = qobject_cast<QVideoWidgetControl*>(m_viewfinderOutput)->videoWidget();
+ disconnect(this, SIGNAL(viewFinderFrameReady(const QPixmap &)), widget, SLOT(setPixmap(const QPixmap &)));
+ }
+ if (m_viewfinderType == OutputTypeRenderer) {
+ disconnect(this, SIGNAL(viewFinderFrameReady(const QPixmap &)),
+ this, SLOT(viewFinderBitmapReady(const QPixmap &)));
+ }
+
+}
+
void S60CameraViewfinderEngine::startViewfinder(const bool internalStart)
{
if (!internalStart) {
@@ -398,6 +449,7 @@ void S60CameraViewfinderEngine::startViewfinder(const bool internalStart)
qRect.setBottomRight(QPoint(screenRect.bottomRight().x(), qRect.bottomRight().y()));
if (screenRect.bottomRight().y() < qRect.bottomRight().y())
qRect.setBottomRight(QPoint(qRect.bottomRight().x(), screenRect.bottomRight().y()));
+
TRect viewfinderRect(TPoint(qRect.x(),qRect.y()), TSize(qRect.width(),qRect.height()));
#endif // USING_NGA
@@ -414,9 +466,8 @@ void S60CameraViewfinderEngine::startViewfinder(const bool internalStart)
QSize actualSize((viewfinderRect.iBr.iX - viewfinderRect.iTl.iX),
(viewfinderRect.iBr.iY - viewfinderRect.iTl.iY));
- if (actualSize.width() != m_viewfinderSize.width() || actualSize.width() != m_viewfinderSize.height()) {
+ if (actualSize.width() != m_viewfinderSize.width() || actualSize.width() != m_viewfinderSize.height())
m_actualViewFinderSize = actualSize;
- }
} else {
emit error(QCamera::CameraError, tr("Requesting window for viewfinder failed."));
return;
@@ -445,9 +496,8 @@ void S60CameraViewfinderEngine::startViewfinder(const bool internalStart)
return;
}
- if (size.iWidth != m_viewfinderSize.width() || size.iHeight != m_viewfinderSize.height()) {
+ if (size.iWidth != m_viewfinderSize.width() || size.iHeight != m_viewfinderSize.height())
m_actualViewFinderSize = QSize(size.iWidth, size.iHeight);
- }
}
}
}
@@ -456,12 +506,11 @@ void S60CameraViewfinderEngine::stopViewfinder(const bool internalStop)
{
// Stop if viewfinder is started
if (m_vfState == EVFIsConnectedIsStartedIsVisible) {
- if(m_viewfinderType == OutputTypeRenderer) {
+ if (m_viewfinderType == OutputTypeRenderer) {
// Stop surface if one still exists
if (m_viewfinderOutput) {
- if (m_viewfinderSurface) {
+ if (m_viewfinderSurface)
m_viewfinderSurface->stop();
- }
}
}
@@ -501,18 +550,13 @@ void S60CameraViewfinderEngine::MceoViewFinderFrameReady(CFbsBitmap& aFrame)
void S60CameraViewfinderEngine::resetViewfinderSize(QSize size)
{
- // Rotate Camera if UI has rotated
- checkAndRotateCamera();
-
- if (m_viewfinderSize == size) {
+ if (m_viewfinderSize == size)
return;
- }
m_viewfinderSize = size;
- if(m_vfState != EVFIsConnectedIsStartedIsVisible) {
+ if(m_vfState != EVFIsConnectedIsStartedIsVisible)
return;
- }
stopViewfinder(true);
@@ -522,6 +566,7 @@ void S60CameraViewfinderEngine::resetViewfinderSize(QSize size)
void S60CameraViewfinderEngine::resetViewfinderDisplay()
{
if (m_viewfinderNativeType == EDirectScreenViewFinder) {
+
switch (m_viewfinderType) {
case OutputTypeVideoWidget: {
if (!m_viewfinderOutput)
@@ -534,9 +579,8 @@ void S60CameraViewfinderEngine::resetViewfinderDisplay()
qobject_cast<S60VideoWidgetControl*>(m_viewfinderOutput);
WId widgetWId = viewFinderWidgetControl->windowId();
- if (!widgetWId) {
+ if (!widgetWId)
return;
- }
// Then start it with the new WindowID
startViewfinder(true);
@@ -586,8 +630,8 @@ void S60CameraViewfinderEngine::resetViewfinderDisplay()
this, SLOT(viewFinderBitmapReady(const QPixmap &)));
break;
}
- case OutputTypevideoWindow:
- // Not supported in Symbian
+ case OutputTypeVideoWindow:
+ // Not currently supported in Symbian
break;
default:
@@ -609,9 +653,8 @@ void S60CameraViewfinderEngine::viewFinderBitmapReady(const QPixmap &pixmap)
QImage newImage = pixmap.toImage();
if (newImage.format() != QImage::Format_ARGB32 &&
- newImage.format() != QImage::Format_RGB32) {
+ newImage.format() != QImage::Format_RGB32)
newImage = newImage.convertToFormat(QImage::Format_RGB32);
- }
if (!newImage.isNull()) {
QVideoFrame newFrame(newImage);
diff --git a/plugins/multimedia/symbian/ecam/s60cameraviewfinderengine.h b/plugins/multimedia/symbian/ecam/s60cameraviewfinderengine.h
index 9eaeb1251a..a407243f6f 100644
--- a/plugins/multimedia/symbian/ecam/s60cameraviewfinderengine.h
+++ b/plugins/multimedia/symbian/ecam/s60cameraviewfinderengine.h
@@ -77,6 +77,7 @@ public: // Methods
void setVideoWidgetControl(QObject *viewfinderOutput);
void setVideoRendererControl(QObject *viewfinderOutput);
void setVideoWindowControl(QObject *viewfinderOutput);
+ void releaseCurrentControl();
// Controls
void startViewfinder(const bool internalStart = false);
@@ -85,7 +86,7 @@ public: // Methods
// Start using new CameraEngine
void setNewCameraEngine(CCameraEngine *engine);
-protected: // MCameraViewfinderObserver (Bitmap ViewFinder)
+protected: // MCameraViewfinderObserver
void MceoViewFinderFrameReady(CFbsBitmap& aFrame);
@@ -116,7 +117,7 @@ private: // Enums
OutputTypeNotSet = 0, // No viewfinder output connected
OutputTypeVideoWidget, // Using QVideoWidget
OutputTypeRenderer, // Using QGraphicsVideoItem
- OutputTypevideoWindow // Using QVideoWindow
+ OutputTypeVideoWindow // Using QVideoWindow
};
/*
diff --git a/plugins/multimedia/symbian/ecam/s60imagecapturesession.cpp b/plugins/multimedia/symbian/ecam/s60imagecapturesession.cpp
index 26ae5b7e7c..9f0312d8bb 100644
--- a/plugins/multimedia/symbian/ecam/s60imagecapturesession.cpp
+++ b/plugins/multimedia/symbian/ecam/s60imagecapturesession.cpp
@@ -267,6 +267,7 @@ S60ImageCaptureSession::S60ImageCaptureSession(QObject *parent) :
m_currentCodec(QString()),
m_captureSize(QSize()),
m_symbianImageQuality(QtMultimediaKit::HighQuality * KSymbianImageQualityCoefficient),
+ m_captureSettingsSet(false),
m_stillCaptureFileName(QString()),
m_requestedStillCaptureFileName(QString()),
m_currentImageId(0),
@@ -275,14 +276,15 @@ S60ImageCaptureSession::S60ImageCaptureSession(QObject *parent) :
m_previewInWaitLoop(false)
{
// Define supported image codecs
- m_supportedImageCodecs << "image/jpg";
+ m_supportedImageCodecs << "image/jpg";
+
+ initializeImageCaptureSettings();
// Install ActiveScheduler if needed
if (!CActiveScheduler::Current()) {
m_activeScheduler = new CActiveScheduler;
CActiveScheduler::Install(m_activeScheduler);
}
-
}
S60ImageCaptureSession::~S60ImageCaptureSession()
@@ -365,6 +367,11 @@ void S60ImageCaptureSession::setCurrentDevice(TInt deviceindex)
m_activeDeviceIndex = deviceindex;
}
+void S60ImageCaptureSession::notifySettingsSet()
+{
+ m_captureSettingsSet = true;
+}
+
void S60ImageCaptureSession::resetSession()
{
// Delete old AdvancedSettings
@@ -466,12 +473,23 @@ int S60ImageCaptureSession::currentImageId() const
void S60ImageCaptureSession::initializeImageCaptureSettings()
{
+ if (m_captureSettingsSet)
+ return;
+
m_currentCodec = KDefaultImageCodec;
+ m_captureSize = QSize(-1, -1);
m_currentFormat = defaultImageFormat();
- QList<QSize> resolutions = supportedCaptureSizesForCodec(imageCaptureCodec());
- if (resolutions.size() > 0)
- m_captureSize = resolutions[0]; // First is the maximum
+ // Resolution
+ if (m_cameraEngine) {
+ QList<QSize> resolutions = supportedCaptureSizesForCodec(imageCaptureCodec());
+ foreach (QSize reso, resolutions) {
+ if ((reso.width() * reso.height()) > (m_captureSize.width() * m_captureSize.height()))
+ m_captureSize = reso;
+ }
+ } else {
+ m_captureSize = KDefaultImageResolution;
+ }
m_symbianImageQuality = KDefaultImageQuality;
}
@@ -523,15 +541,21 @@ int S60ImageCaptureSession::prepareImageCapture()
m_icState = EImageCapturePrepared;
// Check if CaptureSize was modified
- if (captureSize.iWidth != m_captureSize.width() || captureSize.iHeight != m_captureSize.height()) {
+ if (captureSize.iWidth != m_captureSize.width() || captureSize.iHeight != m_captureSize.height())
m_captureSize = QSize(captureSize.iWidth, captureSize.iHeight);
- }
+
return symbianError;
}
return KErrGeneral;
}
+void S60ImageCaptureSession::releaseImageCapture()
+{
+ // Make sure ImageCapture is prepared the next time it is being activated
+ m_icState = EImageCaptureNotPrepared;
+}
+
int S60ImageCaptureSession::capture(const QString &fileName)
{
if (!m_cameraStarted) {
@@ -579,9 +603,8 @@ int S60ImageCaptureSession::capture(const QString &fileName)
void S60ImageCaptureSession::cancelCapture()
{
- if (m_icState != EImageCaptureCapturing) {
+ if (m_icState != EImageCaptureCapturing)
return;
- }
if (m_cameraEngine)
m_cameraEngine->cancelCapture();
@@ -595,9 +618,8 @@ void S60ImageCaptureSession::processFileName(const QString &fileName)
if (fileName.isEmpty()) {
// Make sure default directory exists
QDir videoDir(QDir::rootPath());
- if (!videoDir.exists(KDefaultImagePath)) {
+ if (!videoDir.exists(KDefaultImagePath))
videoDir.mkpath(KDefaultImagePath);
- }
QString defaultFile = KDefaultImagePath;
defaultFile.append("\\");
defaultFile.append(KDefaultImageFileName);
@@ -637,9 +659,8 @@ void S60ImageCaptureSession::processFileName(const QString &fileName)
// Make sure absolute directory exists
QDir imageDir(QDir::rootPath());
- if (!imageDir.exists(directory)) {
+ if (!imageDir.exists(directory))
imageDir.mkpath(directory);
- }
QString resolvedFileName = directory;
resolvedFileName.append("\\");
@@ -674,7 +695,6 @@ void S60ImageCaptureSession::MceoCapturedDataReady(TDesC8* aData)
m_icState = EImageCapturePrepared;
-
}
void S60ImageCaptureSession::MceoCapturedBitmapReady(CFbsBitmap* aBitmap)
@@ -728,9 +748,8 @@ void S60ImageCaptureSession::MceoCapturedBitmapReady(CFbsBitmap* aBitmap)
m_fileSystemAccess,
&path,
m_symbianImageQuality));
- if (saveError) {
+ if (saveError)
setError(saveError, QString("Saving captured image failed."), true);
- }
m_previewDecodingOngoing = true;
m_imageEncoder->encode(aBitmap);
@@ -767,9 +786,8 @@ TFileName S60ImageCaptureSession::convertImagePath()
*/
void S60ImageCaptureSession::saveImageL(TDesC8 *aData, TFileName &aPath)
{
- if (aData == NULL) {
+ if (aData == NULL)
setError(KErrGeneral, QString("Captured image data is not available."), true);
- }
if (aPath.Size() > 0) {
if (m_previewDecodingOngoing) {
@@ -828,15 +846,13 @@ void S60ImageCaptureSession::saveImageL(TDesC8 *aData, TFileName &aPath)
RFile file;
TInt fileWriteErr = KErrNone;
fileWriteErr = file.Replace(*fileSystemAccess, aPath, EFileWrite);
- if (fileWriteErr) {
+ if (fileWriteErr)
User::Leave(fileWriteErr);
- }
CleanupClosePushL(file); // Close if Leaves
fileWriteErr = file.Write(*aData);
- if (fileWriteErr) {
+ if (fileWriteErr)
User::Leave(fileWriteErr);
- }
CleanupStack::PopAndDestroy(&file);
// Delete when Image is decoded
@@ -892,9 +908,8 @@ void S60ImageCaptureSession::cameraStatusChanged(QCamera::Status status)
{
if (status == QCamera::ActiveStatus) {
m_cameraStarted = true;
- if (m_captureWhenReady) {
+ if (m_captureWhenReady)
capture(m_requestedStillCaptureFileName);
- }
}else if (status == QCamera::UnloadedStatus) {
m_cameraStarted = false;
m_icState = EImageCaptureNotPrepared;
@@ -919,11 +934,12 @@ QSize S60ImageCaptureSession::maximumCaptureSize()
void S60ImageCaptureSession::setCaptureSize(const QSize &size)
{
- if (m_captureSize.isNull() || size.isEmpty()) {
+ if (size.isNull() ||
+ size.isEmpty() ||
+ size == QSize(-1,-1)) {
// An empty QSize indicates the encoder should make an optimal choice based on what is
// available from the image source and the limitations of the codec.
m_captureSize = supportedCaptureSizesForCodec(formatMap().key(m_currentFormat)).last();
-
}
else
m_captureSize = size;
@@ -1001,6 +1017,7 @@ QStringList S60ImageCaptureSession::supportedImageCaptureCodecs()
#ifdef Q_CC_NOKIAX86 // Emulator
return formatMap().keys();
#endif
+
return m_supportedImageCodecs;
}
@@ -1033,10 +1050,13 @@ void S60ImageCaptureSession::setImageCaptureCodec(const QString &codecName)
if (supportedImageCaptureCodecs().contains(codecName, Qt::CaseInsensitive)) {
m_currentCodec = codecName;
m_currentFormat = selectFormatForCodec(m_currentCodec);
- return;
+ } else {
+ setError(KErrNotSupported, QString("Requested image codec is not supported"));
}
+ } else {
+ m_currentCodec = KDefaultImageCodec;
+ m_currentFormat = selectFormatForCodec(m_currentCodec);
}
- setError(KErrNotSupported, QString("Requested image codec is not supported"));
}
QString S60ImageCaptureSession::imageCaptureCodecDescription(const QString &codecName)
@@ -1150,9 +1170,8 @@ void S60ImageCaptureSession::doSetZoomFactorL(qreal optical, qreal digital)
digitalSymbian = 1; // Make sure zooming out to initial value if requested
#endif // !USE_S60_32_ECAM_ADVANCED_SETTINGS_HEADER & !USE_S60_50_ECAM_ADVANCED_SETTINGS_HEADER
- if (m_cameraEngine && !m_cameraEngine->IsCameraReady()) {
+ if (m_cameraEngine && !m_cameraEngine->IsCameraReady())
return;
- }
if (m_cameraEngine && queryCurrentCameraInfo()) {
CCamera *camera = m_cameraEngine->Camera();
@@ -1249,7 +1268,6 @@ void S60ImageCaptureSession::doSetZoomFactorL(qreal optical, qreal digital)
return;
}
}
-
}
} else {
setError(KErrGeneral, QString("Unexpected camera error."));
@@ -1274,7 +1292,7 @@ qreal S60ImageCaptureSession::opticalZoomFactor()
else
factor = 1.0;
}
- }
+ }
#endif // USE_S60_32_ECAM_ADVANCED_SETTINGS_HEADER | USE_S60_50_ECAM_ADVANCED_SETTINGS_HEADER
if (factor == 0.0) // If not supported
@@ -1301,7 +1319,7 @@ qreal S60ImageCaptureSession::digitalZoomFactor()
else
factor = 1.0;
}
- }
+ }
#endif // USE_S60_32_ECAM_ADVANCED_SETTINGS_HEADER | USE_S60_50_ECAM_ADVANCED_SETTINGS_HEADER
if (factor == 0.0)
@@ -1382,21 +1400,16 @@ QCameraExposure::FlashModes S60ImageCaptureSession::supportedFlashModes()
if (supportedModes == 0)
return modes;
- if (supportedModes & CCamera::EFlashManual) {
+ if (supportedModes & CCamera::EFlashManual)
modes |= QCameraExposure::FlashOff;
- }
- if (supportedModes & CCamera::EFlashForced) {
+ if (supportedModes & CCamera::EFlashForced)
modes |= QCameraExposure::FlashOn;
- }
- if (supportedModes & CCamera::EFlashAuto) {
+ if (supportedModes & CCamera::EFlashAuto)
modes |= QCameraExposure::FlashAuto;
- }
- if (supportedModes & CCamera::EFlashFillIn) {
+ if (supportedModes & CCamera::EFlashFillIn)
modes |= QCameraExposure::FlashFill;
- }
- if (supportedModes & CCamera::EFlashRedEyeReduce) {
+ if (supportedModes & CCamera::EFlashRedEyeReduce)
modes |= QCameraExposure::FlashRedEyeReduction;
- }
}
return modes;
@@ -1699,7 +1712,6 @@ bool S60ImageCaptureSession::isWhiteBalanceModeSupported(QCameraImageProcessing:
default:
return false;
}
-
}
return false;
diff --git a/plugins/multimedia/symbian/ecam/s60imagecapturesession.h b/plugins/multimedia/symbian/ecam/s60imagecapturesession.h
index 972c499780..ed1f4df43e 100644
--- a/plugins/multimedia/symbian/ecam/s60imagecapturesession.h
+++ b/plugins/multimedia/symbian/ecam/s60imagecapturesession.h
@@ -74,7 +74,6 @@ class S60ImageCaptureSession;
*/
class S60ImageCaptureDecoder : public CActive
{
-
public: // Static Contructor & Destructor
static S60ImageCaptureDecoder* FileNewL(S60ImageCaptureSession *imageSession = 0,
@@ -124,7 +123,6 @@ private: // Data
*/
class S60ImageCaptureEncoder : public CActive
{
-
public: // Static Contructor & Destructor
static S60ImageCaptureEncoder* NewL(S60ImageCaptureSession *imageSession = 0,
@@ -194,6 +192,7 @@ public: // Methods
bool isDeviceReady();
void setCameraHandle(CCameraEngine* camerahandle);
void setCurrentDevice(TInt deviceindex);
+ void notifySettingsSet();
// Ecam Advanced Settings
S60CameraSettings* advancedSettings();
@@ -201,6 +200,7 @@ public: // Methods
// Controls
int prepareImageCapture();
+ void releaseImageCapture();
int capture(const QString &fileName);
void cancelCapture();
void releaseImageBuffer();
@@ -334,6 +334,7 @@ private: // Data
CCamera::TFormat m_currentFormat;
QSize m_captureSize;
int m_symbianImageQuality;
+ bool m_captureSettingsSet;
QString m_stillCaptureFileName;
QString m_requestedStillCaptureFileName;
mutable int m_currentImageId;
diff --git a/plugins/multimedia/symbian/ecam/s60imageencodercontrol.cpp b/plugins/multimedia/symbian/ecam/s60imageencodercontrol.cpp
index 499281cbc2..bf2853c535 100644
--- a/plugins/multimedia/symbian/ecam/s60imageencodercontrol.cpp
+++ b/plugins/multimedia/symbian/ecam/s60imageencodercontrol.cpp
@@ -96,9 +96,13 @@ QImageEncoderSettings S60ImageEncoderControl::imageSettings() const
}
void S60ImageEncoderControl::setImageSettings(const QImageEncoderSettings &settings)
{
+ // Notify that settings have been implicitly set and there's no need to
+ // initialize them in case camera is changed
+ m_session->notifySettingsSet();
+
if (!settings.isNull()) {
if (!settings.codec().isEmpty()) {
- if (settings.resolution() != QSize()) { // Codec, Resolution & Quality
+ if (settings.resolution() != QSize(-1,-1)) { // Codec, Resolution & Quality
m_session->setImageCaptureCodec(settings.codec());
m_session->setCaptureSize(settings.resolution());
m_session->setCaptureQuality(settings.quality());
@@ -107,7 +111,7 @@ void S60ImageEncoderControl::setImageSettings(const QImageEncoderSettings &setti
m_session->setCaptureQuality(settings.quality());
}
} else {
- if (settings.resolution() != QSize()) { // Resolution & Quality
+ if (settings.resolution() != QSize(-1,-1)) { // Resolution & Quality
m_session->setCaptureSize(settings.resolution());
m_session->setCaptureQuality(settings.quality());
}
@@ -119,7 +123,7 @@ void S60ImageEncoderControl::setImageSettings(const QImageEncoderSettings &setti
int prepareSuccess = m_session->prepareImageCapture();
// Preparation fails with KErrNotReady if camera has not been started.
- // That can be ignored since settings are set internally in that case.
+ // That can be ignored since settings are set internally in that case.
if (prepareSuccess != KErrNotReady && prepareSuccess != KErrNone)
m_session->setError(prepareSuccess, QString("Failure in preparation of image capture."));
}
diff --git a/plugins/multimedia/symbian/ecam/s60mediarecordercontrol.cpp b/plugins/multimedia/symbian/ecam/s60mediarecordercontrol.cpp
index 32114987d9..9be83a39a9 100644
--- a/plugins/multimedia/symbian/ecam/s60mediarecordercontrol.cpp
+++ b/plugins/multimedia/symbian/ecam/s60mediarecordercontrol.cpp
@@ -49,7 +49,7 @@ S60MediaRecorderControl::S60MediaRecorderControl(QObject *parent) :
{
}
-S60MediaRecorderControl::S60MediaRecorderControl(S60VideoCaptureSession *session, QObject *parent) :
+S60MediaRecorderControl::S60MediaRecorderControl(S60VideoCaptureSession *session, QObject *parent):
QMediaRecorderControl(parent),
m_state(QMediaRecorder::StoppedState) // Default RecorderState
{
@@ -154,9 +154,8 @@ void S60MediaRecorderControl::applySettings()
void S60MediaRecorderControl::record()
{
- if (m_state == QMediaRecorder::RecordingState) {
+ if (m_state == QMediaRecorder::RecordingState)
return;
- }
if (m_cameraControl && m_cameraControl->captureMode() != QCamera::CaptureVideo) {
emit error(QCamera::CameraError, tr("Video capture mode is not selected."));
diff --git a/plugins/multimedia/symbian/ecam/s60videocapturesession.cpp b/plugins/multimedia/symbian/ecam/s60videocapturesession.cpp
index 94ace3239a..fd5c346064 100644
--- a/plugins/multimedia/symbian/ecam/s60videocapturesession.cpp
+++ b/plugins/multimedia/symbian/ecam/s60videocapturesession.cpp
@@ -41,6 +41,7 @@
#include <QtCore/qstring.h>
#include <QtCore/qdir.h>
+#include <QtCore/qtimer.h>
#include "s60videocapturesession.h"
#include "s60cameraconstants.h"
@@ -56,12 +57,13 @@ S60VideoCaptureSession::S60VideoCaptureSession(QObject *parent) :
QObject(parent),
m_cameraEngine(NULL),
m_videoRecorder(NULL),
+ m_position(0),
m_error(KErrNone),
m_cameraStarted(false),
m_captureState(ENotInitialized), // Default state
m_sink(QUrl()),
m_requestedSink(QUrl()),
- m_videoQuality(QtMultimediaKit::VeryHighQuality * KSymbianImageQualityCoefficient), // Default video quality
+ m_captureSettingsSet(false),
m_container(QString()),
m_requestedContainer(QString()),
m_muted(false),
@@ -79,23 +81,32 @@ S60VideoCaptureSession::S60VideoCaptureSession(QObject *parent) :
TRAPD(err, doPopulateVideoCodecsDataL());
setError(err, QString("Failed to gather video codec information."));
#endif // S60_DEVVIDEO_RECORDING_SUPPORTED
+
+ initializeVideoCaptureSettings();
+
+ m_durationTimer = new QTimer;
+ m_durationTimer->setInterval(KDurationChangedInterval);
+ connect(m_durationTimer, SIGNAL(timeout()), this, SLOT(durationTimerTriggered()));
}
S60VideoCaptureSession::~S60VideoCaptureSession()
{
- if (m_captureState >= ERecording) {
+ if (m_captureState >= ERecording)
m_videoRecorder->Stop();
- }
- if (m_captureState >= EInitialized) {
+ if (m_captureState >= EInitialized)
m_videoRecorder->Close();
- }
if (m_videoRecorder) {
delete m_videoRecorder;
m_videoRecorder = NULL;
}
+ if (m_durationTimer) {
+ delete m_durationTimer;
+ m_durationTimer = NULL;
+ }
+
// Clear all data structures
foreach (MaxResolutionRatesAndTypes structure, m_videoParametersForEncoder) {
structure.frameRatePictureSizePair.clear();
@@ -103,8 +114,8 @@ S60VideoCaptureSession::~S60VideoCaptureSession()
}
m_videoParametersForEncoder.clear();
- m_videoCodeclist.clear();
- m_audioCodeclist.clear();
+ m_videoCodecList.clear();
+ m_audioCodecList.clear();
QList<TInt> controllers = m_videoControllerMap.keys();
for (int i = 0; i < controllers.size(); ++i) {
@@ -133,12 +144,13 @@ void S60VideoCaptureSession::setError(const TInt error, const QString &descripti
if (m_captureState >= ERecording)
m_videoRecorder->Stop();
- if (m_captureState >= EInitialized) {
+ if (m_captureState >= EInitialized)
m_videoRecorder->Close();
- }
// Reset state
if (m_captureState != ENotInitialized) {
+ if (m_durationTimer->isActive())
+ m_durationTimer->stop();
m_captureState = ENotInitialized;
emit stateChanged(m_captureState);
}
@@ -179,69 +191,75 @@ QMediaRecorder::Error S60VideoCaptureSession::fromSymbianErrorToQtMultimediaErro
void S60VideoCaptureSession::applyAllSettings()
{
switch (m_captureState) {
- case ENotInitialized:
- setError(KErrNotReady, QString("Cannot apply settings before camera is started."));
- return;
- case EInitializing:
- m_commitSettingsWhenReady = true;
- return;
- case EInitialized:
- setOutputLocation(QUrl());
- m_prepareAfterOpenComplete = true;
- return;
- case EOpening:
- m_prepareAfterOpenComplete = true;
- return;
- case EOpenComplete:
- // Do nothing, ready to commit
- break;
- case EPreparing:
- m_commitSettingsWhenReady = true;
- return;
- case EPrepared:
- // Revert state internally, since logically applying settings means going
- // from OpenComplete ==> Preparing ==> Prepared.
- m_captureState = EOpenComplete;
- break;
- case ERecording:
- case EPaused:
- setError(KErrNotReady, QString("Cannot apply settings while recording."));
- return;
+ case ENotInitialized:
+ case EInitializing:
+ m_commitSettingsWhenReady = true;
+ return;
+ case EInitialized:
+ setOutputLocation(QUrl());
+ m_prepareAfterOpenComplete = true;
+ return;
+ case EOpening:
+ m_prepareAfterOpenComplete = true;
+ return;
+ case EOpenComplete:
+ // Do nothing, ready to commit
+ break;
+ case EPreparing:
+ m_commitSettingsWhenReady = true;
+ return;
+ case EPrepared:
+ // Revert state internally, since logically applying settings means going
+ // from OpenComplete ==> Preparing ==> Prepared.
+ m_captureState = EOpenComplete;
+ break;
+ case ERecording:
+ case EPaused:
+ setError(KErrNotReady, QString("Cannot apply settings while recording."));
+ return;
- default:
- setError(KErrGeneral, QString("Unexpected camera error."));
- return;
+ default:
+ setError(KErrGeneral, QString("Unexpected camera error."));
+ return;
}
- // Commit settings - State is now either OpenComplete or Prepared
+ // Commit settings - State is now OpenComplete (possibly reverted from Prepared)
commitVideoEncoderSettings();
- // If capture state has been reset, a different container was requested
- if (m_captureState == EOpening) {
+ // If capture state has been changed to:
+ // * Opening: A different media container has been requested
+ // * Other: Failure during the setting committing
+ // ==> Return
+ if (m_captureState != EOpenComplete)
return;
- }
// Start preparing
m_captureState = EPreparing;
emit stateChanged(m_captureState);
- if (m_cameraEngine->IsCameraReady()) {
+ if (m_cameraEngine->IsCameraReady())
m_videoRecorder->Prepare();
- }
}
void S60VideoCaptureSession::setCameraHandle(CCameraEngine* cameraHandle)
{
m_cameraEngine = cameraHandle;
+ // Initialize settings for the new camera
+ initializeVideoCaptureSettings();
+
resetSession();
}
+void S60VideoCaptureSession::notifySettingsSet()
+{
+ m_captureSettingsSet = true;
+}
+
void S60VideoCaptureSession::doInitializeVideoRecorderL()
{
- if (m_captureState > ENotInitialized) {
+ if (m_captureState > ENotInitialized)
resetSession();
- }
m_captureState = EInitializing;
emit stateChanged(m_captureState);
@@ -271,6 +289,8 @@ void S60VideoCaptureSession::resetSession()
}
if (m_captureState != ENotInitialized) {
+ if (m_durationTimer->isActive())
+ m_durationTimer->stop();
m_captureState = ENotInitialized;
emit stateChanged(m_captureState);
}
@@ -293,63 +313,111 @@ void S60VideoCaptureSession::resetSession()
QList<QSize> S60VideoCaptureSession::supportedVideoResolutions(bool *continuous)
{
- QList<QSize> list;
+ QList<QSize> resolutions;
- if (m_videoParametersForEncoder.count() > 0) {
+ // Secondary Camera
+ if (m_cameraEngine->currentCameraIndex() != 0) {
+ TCameraInfo *info = m_cameraEngine->cameraInfo();
+ if (info) {
+ TInt videoResolutionCount = info->iNumVideoFrameSizesSupported;
+ CCamera *camera = m_cameraEngine->Camera();
+ if (camera) {
+ for (TInt i = 0; i < videoResolutionCount; ++i) {
+ TSize checkedResolution;
+ camera->EnumerateVideoFrameSizes(checkedResolution, i, CCamera::EFormatYUV420Planar);
+ QSize qtResolution(checkedResolution.iWidth, checkedResolution.iHeight);
+ if (!resolutions.contains(qtResolution))
+ resolutions.append(qtResolution);
+ }
+ } else {
+ setError(KErrGeneral, QString("Could not query supported video resolutions."));
+ }
+ } else {
+ setError(KErrGeneral, QString("Could not query supported video resolutions."));
+ }
- // Also arbitrary resolutions are supported
- if (continuous)
- *continuous = true;
+ // Primary Camera
+ } else {
- // Append all supported resolutions to the list
- foreach (MaxResolutionRatesAndTypes parameters, m_videoParametersForEncoder)
- for (int i = 0; i < parameters.frameRatePictureSizePair.count(); ++i)
- if (!list.contains(parameters.frameRatePictureSizePair[i].frameSize))
- list.append(parameters.frameRatePictureSizePair[i].frameSize);
+ if (m_videoParametersForEncoder.count() > 0) {
+
+ // Also arbitrary resolutions are supported
+ if (continuous)
+ *continuous = true;
+
+ // Append all supported resolutions to the list
+ foreach (MaxResolutionRatesAndTypes parameters, m_videoParametersForEncoder)
+ for (int i = 0; i < parameters.frameRatePictureSizePair.count(); ++i)
+ if (!resolutions.contains(parameters.frameRatePictureSizePair[i].frameSize))
+ resolutions.append(parameters.frameRatePictureSizePair[i].frameSize);
+ }
}
#ifdef Q_CC_NOKIAX86 // Emulator
- list << QSize(160, 120);
- list << QSize(352, 288);
- list << QSize(640,480);
-#endif
+ resolutions << QSize(160, 120);
+ resolutions << QSize(352, 288);
+ resolutions << QSize(640,480);
+#endif // Q_CC_NOKIAX86
- return list;
+ return resolutions;
}
QList<QSize> S60VideoCaptureSession::supportedVideoResolutions(const QVideoEncoderSettings &settings, bool *continuous)
{
QList<QSize> supportedFrameSizes;
- if (settings.codec().isEmpty())
- return supportedFrameSizes;
+ // Secondary Camera
+ if (m_cameraEngine->currentCameraIndex() != 0) {
+ TCameraInfo *info = m_cameraEngine->cameraInfo();
+ if (info) {
+ TInt videoResolutionCount = info->iNumVideoFrameSizesSupported;
+ CCamera *camera = m_cameraEngine->Camera();
+ if (camera) {
+ for (TInt i = 0; i < videoResolutionCount; ++i) {
+ TSize checkedResolution;
+ camera->EnumerateVideoFrameSizes(checkedResolution, i, CCamera::EFormatYUV420Planar);
+ QSize qtResolution(checkedResolution.iWidth, checkedResolution.iHeight);
+ if (!supportedFrameSizes.contains(qtResolution))
+ supportedFrameSizes.append(qtResolution);
+ }
+ } else {
+ setError(KErrGeneral, QString("Could not query supported video resolutions."));
+ }
+ } else {
+ setError(KErrGeneral, QString("Could not query supported video resolutions."));
+ }
- if (!m_videoCodeclist.contains(settings.codec(), Qt::CaseInsensitive)) {
- return supportedFrameSizes;
- }
+ // Primary Camera
+ } else {
- // Also arbitrary resolutions are supported
- if (continuous)
- *continuous = true;
+ if (settings.codec().isEmpty())
+ return supportedFrameSizes;
- // Find maximum resolution (using defined framerate if set)
- for (int i = 0; i < m_videoParametersForEncoder.count(); ++i) {
- // Check if encoder supports the requested codec
- if (!m_videoParametersForEncoder[i].mimeTypes.contains(settings.codec(), Qt::CaseInsensitive)) {
- continue;
- }
+ if (!m_videoCodecList.contains(settings.codec(), Qt::CaseInsensitive))
+ return supportedFrameSizes;
- foreach (SupportedFrameRatePictureSize pair, m_videoParametersForEncoder[i].frameRatePictureSizePair) {
- if (!supportedFrameSizes.contains(pair.frameSize)) {
- QSize maxForMime = maximumResolutionForMimeType(settings.codec());
- if (settings.frameRate() != 0) {
- if(settings.frameRate() <= pair.frameRate) {
+ // Also arbitrary resolutions are supported
+ if (continuous)
+ *continuous = true;
+
+ // Find maximum resolution (using defined framerate if set)
+ for (int i = 0; i < m_videoParametersForEncoder.count(); ++i) {
+ // Check if encoder supports the requested codec
+ if (!m_videoParametersForEncoder[i].mimeTypes.contains(settings.codec(), Qt::CaseInsensitive))
+ continue;
+
+ foreach (SupportedFrameRatePictureSize pair, m_videoParametersForEncoder[i].frameRatePictureSizePair) {
+ if (!supportedFrameSizes.contains(pair.frameSize)) {
+ QSize maxForMime = maximumResolutionForMimeType(settings.codec());
+ if (settings.frameRate() != 0) {
+ if (settings.frameRate() <= pair.frameRate) {
+ if ((pair.frameSize.width() * pair.frameSize.height()) <= (maxForMime.width() * maxForMime.height()))
+ supportedFrameSizes.append(pair.frameSize);
+ }
+ } else {
if ((pair.frameSize.width() * pair.frameSize.height()) <= (maxForMime.width() * maxForMime.height()))
supportedFrameSizes.append(pair.frameSize);
}
- } else {
- if ((pair.frameSize.width() * pair.frameSize.height()) <= (maxForMime.width() * maxForMime.height()))
- supportedFrameSizes.append(pair.frameSize);
}
}
}
@@ -366,11 +434,11 @@ QList<QSize> S60VideoCaptureSession::supportedVideoResolutions(const QVideoEncod
QList<qreal> S60VideoCaptureSession::supportedVideoFrameRates(bool *continuous)
{
- QList<qreal> list;
+ QList<qreal> supportedRatesList;
if (m_videoParametersForEncoder.count() > 0) {
// Insert min and max to the list
- list.append(1.0); // Use 1fps as sensible minimum
+ supportedRatesList.append(1.0); // Use 1fps as sensible minimum
qreal foundMaxFrameRate(0.0);
// Also arbitrary framerates are supported
@@ -386,26 +454,34 @@ QList<qreal> S60VideoCaptureSession::supportedVideoFrameRates(bool *continuous)
}
}
- list.append(foundMaxFrameRate);
+ supportedRatesList.append(foundMaxFrameRate);
}
// Add also other standard framerates to the list
- if (!list.isEmpty()) {
- if (list.last() > 30)
- list.insert(1, 30);
- if (list.last() > 20)
- list.insert(1, 20);
- if (list.last() > 15)
- list.insert(1, 15);
- if (list.last() > 10)
- list.insert(1, 10);
+ if (!supportedRatesList.isEmpty()) {
+ if (supportedRatesList.last() > 30.0) {
+ if (!supportedRatesList.contains(30.0))
+ supportedRatesList.insert(1, 30.0);
+ }
+ if (supportedRatesList.last() > 25.0) {
+ if (!supportedRatesList.contains(25.0))
+ supportedRatesList.insert(1, 25.0);
+ }
+ if (supportedRatesList.last() > 15.0) {
+ if (!supportedRatesList.contains(15.0))
+ supportedRatesList.insert(1, 15.0);
+ }
+ if (supportedRatesList.last() > 10.0) {
+ if (!supportedRatesList.contains(10))
+ supportedRatesList.insert(1, 10.0);
+ }
}
#ifdef Q_CC_NOKIAX86 // Emulator
- list << 30.0 << 25.0 << 15.0 << 10.0 << 5.0;
+ supportedRatesList << 30.0 << 25.0 << 15.0 << 10.0 << 5.0;
#endif
- return list;
+ return supportedRatesList;
}
QList<qreal> S60VideoCaptureSession::supportedVideoFrameRates(const QVideoEncoderSettings &settings, bool *continuous)
@@ -414,7 +490,7 @@ QList<qreal> S60VideoCaptureSession::supportedVideoFrameRates(const QVideoEncode
if (settings.codec().isEmpty())
return supportedFrameRates;
- if (!m_videoCodeclist.contains(settings.codec(), Qt::CaseInsensitive))
+ if (!m_videoCodecList.contains(settings.codec(), Qt::CaseInsensitive))
return supportedFrameRates;
// Also arbitrary framerates are supported
@@ -443,21 +519,30 @@ QList<qreal> S60VideoCaptureSession::supportedVideoFrameRates(const QVideoEncode
}
}
- // Add also other standard framerates to the list if max is higher
+ // Add also other standard framerates to the list
if (!supportedFrameRates.isEmpty()) {
- if (supportedFrameRates.last() > 30)
- supportedFrameRates.insert(1, 30);
- if (supportedFrameRates.last() > 25)
- supportedFrameRates.insert(1, 25);
- if (supportedFrameRates.last() > 15)
- supportedFrameRates.insert(1, 15);
- if (supportedFrameRates.last() > 10)
- supportedFrameRates.insert(1, 10);
+ if (supportedFrameRates.last() > 30.0) {
+ if (!supportedFrameRates.contains(30.0))
+ supportedFrameRates.insert(1, 30.0);
+ }
+ if (supportedFrameRates.last() > 25.0) {
+ if (!supportedFrameRates.contains(25.0))
+ supportedFrameRates.insert(1, 25.0);
+ }
+ if (supportedFrameRates.last() > 15.0) {
+ if (!supportedFrameRates.contains(15.0))
+ supportedFrameRates.insert(1, 15.0);
+ }
+ if (supportedFrameRates.last() > 10.0) {
+ if (!supportedFrameRates.contains(10))
+ supportedFrameRates.insert(1, 10.0);
+ }
}
#ifdef Q_CC_NOKIAX86 // Emulator
supportedFrameRates << 30.0 << 25.0 << 15.0 << 10.0 << 5.0;
#endif
+
return supportedFrameRates;
}
@@ -494,11 +579,11 @@ bool S60VideoCaptureSession::setOutputLocation(const QUrl &sink)
// Empty URL - Use default file name and path (C:\Data\Videos\video.mp4)
if (sink.isEmpty()) {
+
// Make sure default directory exists
QDir videoDir(QDir::rootPath());
- if (!videoDir.exists(KDefaultVideoPath)) {
+ if (!videoDir.exists(KDefaultVideoPath))
videoDir.mkpath(KDefaultVideoPath);
- }
QString defaultFile = KDefaultVideoPath;
defaultFile.append("\\");
defaultFile.append(KDefaultVideoFileName);
@@ -516,9 +601,9 @@ bool S60VideoCaptureSession::setOutputLocation(const QUrl &sink)
fullUrl.append("\\");
fullUrl.append(QDir::toNativeSeparators(sink.path()));
-
// Absolute URL
} else {
+
// Extract file name and path from the URL
if (fullUrl == "file") {
fullUrl = QDir::toNativeSeparators(sink.path().right(sink.path().length() - 1));
@@ -544,9 +629,8 @@ bool S60VideoCaptureSession::setOutputLocation(const QUrl &sink)
// Make sure absolute directory exists
QDir videoDir(QDir::rootPath());
- if (!videoDir.exists(directory)) {
+ if (!videoDir.exists(directory))
videoDir.mkpath(directory);
- }
QString resolvedURL = directory;
resolvedURL.append("\\");
@@ -554,15 +638,14 @@ bool S60VideoCaptureSession::setOutputLocation(const QUrl &sink)
m_sink = QUrl(resolvedURL);
}
-
// State is either Initialized, OpenComplete or Prepared, Close previously opened file
- if (m_videoRecorder) {
+ if (m_videoRecorder)
m_videoRecorder->Close();
- }
else
setError(KErrNotReady, QString("Unexpected camera error."));
// Open file
+
QString fileName = QDir::toNativeSeparators(m_sink.toString());
TPtrC16 fileSink(reinterpret_cast<const TUint16*>(fileName.utf16()));
@@ -594,14 +677,14 @@ QUrl S60VideoCaptureSession::outputLocation() const
qint64 S60VideoCaptureSession::position()
{
- qint64 position = 0;
// Update position only if recording is ongoing
if ((m_captureState == ERecording) && m_videoRecorder) {
- TRAPD(err, position = m_videoRecorder->DurationL().Int64() / 1000);
+ // Signal will be automatically emitted of position changes
+ TRAPD(err, m_position = m_videoRecorder->DurationL().Int64() / 1000);
setError(err, QString("Cannot retrieve video position."));
}
- return position;
+ return m_position;
}
S60VideoCaptureSession::TVideoCaptureState S60VideoCaptureSession::state() const
@@ -617,8 +700,13 @@ bool S60VideoCaptureSession::isMuted() const
void S60VideoCaptureSession::setMuted(const bool muted)
{
// CVideoRecorderUtility can mute/unmute only if not recording
- if (m_captureState > EPrepared)
+ if (m_captureState > EPrepared) {
+ if (muted)
+ setError(KErrNotSupported, QString("Muting audio is not supported during recording."));
+ else
+ setError(KErrNotSupported, QString("Unmuting audio is not supported during recording."));
return;
+ }
// Check if request is already active
if (muted == isMuted())
@@ -632,51 +720,75 @@ void S60VideoCaptureSession::setMuted(const bool muted)
void S60VideoCaptureSession::commitVideoEncoderSettings()
{
if (m_captureState == EOpenComplete) {
+
if (m_container != m_requestedContainer) {
setOutputLocation(m_requestedSink);
return;
}
TRAPD(err, doSetCodecsL(m_audioSettings.codec(), m_videoSettings.codec()));
- setError(err, QString("Failed to set audio/video codec."));
+ if (err) {
+ setError(err, QString("Failed to set audio or video codec."));
+ m_audioSettings.setCodec(KMimeTypeDefaultAudioCodec);
+ m_videoSettings.setCodec(KMimeTypeDefaultVideoCodec);
+ }
+
doSetVideoResolution(m_videoSettings.resolution());
doSetFrameRate(m_videoSettings.frameRate());
doSetBitrate(m_videoSettings.bitRate());
-#ifndef S60_3X_PLATFORM
- TRAP(err, m_videoRecorder->SetVideoQualityL(m_videoQuality));
- if (err != KErrNotSupported) {
- setError(err, QString("Setting video quality failed."));
- }
-#endif // S60_3X_PLATFORM
-
// Audio/Video EncodingMode are not supported in Symbian
- TRAP(err, m_videoRecorder->SetAudioBitRateL((TInt)m_audioSettings.bitRate()));
- if (err != KErrNotSupported)
- setError(err, QString("Setting audio bitrate failed."));
-
#ifndef S60_31_PLATFORM
- if (m_audioSettings.sampleRate() != -1) {
+ if (m_audioSettings.sampleRate() != -1 && m_audioSettings.sampleRate() != 0) {
TRAP(err, m_videoRecorder->SetAudioSampleRateL((TInt)m_audioSettings.sampleRate()));
- if (err != KErrNotSupported)
+ if (err != KErrNotSupported) {
setError(err, QString("Setting audio sample rate failed."));
+ } else {
+ setError(err, QString("Setting audio sample rate is not supported."));
+ m_audioSettings.setSampleRate(KDefaultSampleRate); // Reset
+ }
}
+#endif // S60_31_PLATFORM
- TRAP(err, m_videoRecorder->SetAudioChannelsL((TUint)m_audioSettings.channelCount()));
- if (err != KErrNotSupported)
- setError(err, QString("Setting audio channel count failed."));
+ TRAP(err, m_videoRecorder->SetAudioBitRateL((TInt)m_audioSettings.bitRate()));
+ if (err != KErrNotSupported) {
+ if (err == KErrArgument) {
+ setError(KErrNotSupported, QString("Requested audio bitrate is not supported or previously set codec is not supported with requested bitrate."));
+ int fallback = 16000;
+ TRAP(err, m_videoRecorder->SetAudioBitRateL(TInt(fallback)));
+ if (err == KErrNone)
+ m_audioSettings.setBitRate(fallback);
+ } else {
+ setError(err, QString("Setting audio bitrate failed."));
+ }
+ }
+
+#ifndef S60_31_PLATFORM
+ if (m_audioSettings.channelCount() != -1) {
+ TRAP(err, m_videoRecorder->SetAudioChannelsL(TUint(m_audioSettings.channelCount())));
+ if (err != KErrNotSupported) {
+ setError(err, QString("Setting audio channel count failed."));
+ } else {
+ setError(err, QString("Setting audio channel count is not supported."));
+ m_audioSettings.setChannelCount(KDefaultChannelCount); // Reset
+ }
+ }
#endif // S60_31_PLATFORM
- // Note difference between muted and isEnabled (true for the other means false for the other)
- TBool isAudioEnabled = EFalse;
- TRAP(err, isAudioEnabled = m_videoRecorder->AudioEnabledL());
- setError(err, QString("Failure when checking if audio is enabled."));
- if (m_muted == (bool)isAudioEnabled) {
- TRAP(err, m_videoRecorder->SetAudioEnabledL((TBool)!m_muted));
+ TBool isAudioMuted = EFalse;
+ TRAP(err, isAudioMuted = !m_videoRecorder->AudioEnabledL());
+ if (err != KErrNotSupported && err != KErrNone)
+ setError(err, QString("Failure when checking if audio is enabled."));
+
+ if (m_muted != (bool)isAudioMuted) {
+ TRAP(err, m_videoRecorder->SetAudioEnabledL(TBool(!m_muted)));
if (err) {
- if (err != KErrNotSupported)
+ if (err != KErrNotSupported) {
setError(err, QString("Failed to mute/unmute audio."));
+ } else {
+ setError(err, QString("Muting/unmuting audio is not supported."));
+ }
}
else
emit mutedChanged(m_muted);
@@ -686,25 +798,238 @@ void S60VideoCaptureSession::commitVideoEncoderSettings()
}
}
-void S60VideoCaptureSession::videoEncoderSettings(QVideoEncoderSettings &videoSettings) const
+void S60VideoCaptureSession::queryAudioEncoderSettings()
+{
+ if (!m_videoRecorder)
+ return;
+
+ switch (m_captureState) {
+ case ENotInitialized:
+ case EInitializing:
+ case EOpening:
+ case EPreparing:
+ return;
+
+ // Possible to query settings from CVideoRecorderUtility
+ case EInitialized:
+ case EOpenComplete:
+ case EPrepared:
+ case ERecording:
+ case EPaused:
+ break;
+
+ default:
+ return;
+ }
+
+ TInt err = KErrNone;
+
+ // Codec
+ TFourCC audioCodec;
+ TRAP(err, audioCodec = m_videoRecorder->AudioTypeL());
+ if (err) {
+ if (err != KErrNotSupported)
+ setError(err, QString("Querying audio codec failed."));
+ }
+ QString codec = "";
+ foreach (TFourCC aCodec, m_audioCodecList) {
+ if (audioCodec == aCodec)
+ codec = m_audioCodecList.key(aCodec);
+ }
+ m_audioSettings.setCodec(codec);
+
+#ifndef S60_31_PLATFORM
+ // Samplerate
+ TInt sampleRate = -1;
+ TRAP(err, sampleRate = m_videoRecorder->AudioSampleRateL());
+ if (err) {
+ if (err != KErrNotSupported)
+ setError(err, QString("Querying audio sample rate failed."));
+ }
+ m_audioSettings.setSampleRate(int(sampleRate));
+#endif // S60_31_PLATFORM
+
+ // BitRate
+ TInt bitRate = -1;
+ TRAP(err, bitRate = m_videoRecorder->AudioBitRateL());
+ if (err) {
+ if (err != KErrNotSupported)
+ setError(err, QString("Querying audio bitrate failed."));
+ }
+ m_audioSettings.setBitRate(int(bitRate));
+
+#ifndef S60_31_PLATFORM
+ // ChannelCount
+ TUint channelCount = 0;
+ TRAP(err, channelCount = m_videoRecorder->AudioChannelsL());
+ if (err) {
+ if (err != KErrNotSupported)
+ setError(err, QString("Querying audio channel count failed."));
+ }
+ if (channelCount != 0)
+ m_audioSettings.setChannelCount(int(channelCount));
+ else
+ m_audioSettings.setChannelCount(-1);
+#endif // S60_31_PLATFORM
+
+ // EncodingMode
+ m_audioSettings.setEncodingMode(QtMultimediaKit::ConstantQualityEncoding);
+
+ // IsMuted
+ TBool isEnabled = ETrue;
+ TRAP(err, isEnabled = m_videoRecorder->AudioEnabledL());
+ if (err) {
+ if (err != KErrNotSupported)
+ setError(err, QString("Querying whether audio is muted failed."));
+ }
+ m_muted = bool(!isEnabled);
+}
+
+void S60VideoCaptureSession::queryVideoEncoderSettings()
+{
+ if (!m_videoRecorder)
+ return;
+
+ switch (m_captureState) {
+ case ENotInitialized:
+ case EInitializing:
+ case EOpening:
+ case EPreparing:
+ return;
+
+ // Possible to query settings from CVideoRecorderUtility
+ case EInitialized:
+ case EOpenComplete:
+ case EPrepared:
+ case ERecording:
+ case EPaused:
+ break;
+
+ default:
+ return;
+ }
+
+ TInt err = KErrNone;
+
+ // Codec
+ const TDesC8 &videoMimeType = m_videoRecorder->VideoFormatMimeType();
+ QString videoMimeTypeString = "";
+ if (videoMimeType.Length() > 0) {
+ // First convert the 8-bit descriptor to Unicode
+ HBufC16* videoCodec;
+ videoCodec = CnvUtfConverter::ConvertToUnicodeFromUtf8L(videoMimeType);
+ CleanupStack::PushL(videoCodec);
+
+ // Then deep copy QString from that
+ videoMimeTypeString = QString::fromUtf16(videoCodec->Ptr(), videoCodec->Length());
+ m_videoSettings.setCodec(videoMimeTypeString);
+
+ CleanupStack::PopAndDestroy(videoCodec);
+ }
+
+ // Resolution
+ TSize symbianResolution;
+ TRAP(err, m_videoRecorder->GetVideoFrameSizeL(symbianResolution));
+ if (err) {
+ if (err != KErrNotSupported)
+ setError(err, QString("Querying video resolution failed."));
+ }
+ QSize resolution = QSize(symbianResolution.iWidth, symbianResolution.iHeight);
+ m_videoSettings.setResolution(resolution);
+
+ // FrameRate
+ TReal32 frameRate = 0;
+ TRAP(err, frameRate = m_videoRecorder->VideoFrameRateL());
+ if (err) {
+ if (err != KErrNotSupported)
+ setError(err, QString("Querying video framerate failed."));
+ }
+ m_videoSettings.setFrameRate(qreal(frameRate));
+
+ // BitRate
+ TInt bitRate = -1;
+ TRAP(err, bitRate = m_videoRecorder->VideoBitRateL());
+ if (err) {
+ if (err != KErrNotSupported)
+ setError(err, QString("Querying video bitrate failed."));
+ }
+ m_videoSettings.setBitRate(int(bitRate));
+
+ // EncodingMode
+ m_audioSettings.setEncodingMode(QtMultimediaKit::ConstantQualityEncoding);
+}
+
+void S60VideoCaptureSession::videoEncoderSettings(QVideoEncoderSettings &videoSettings)
{
+ switch (m_captureState) {
+ // CVideoRecorderUtility, return requested settings
+ case ENotInitialized:
+ case EInitializing:
+ case EInitialized:
+ case EOpening:
+ case EOpenComplete:
+ case EPreparing:
+ break;
+
+ // Possible to query settings from CVideoRecorderUtility
+ case EPrepared:
+ case ERecording:
+ case EPaused:
+ queryVideoEncoderSettings();
+ break;
+
+ default:
+ videoSettings = QVideoEncoderSettings();
+ setError(KErrGeneral, QString("Unexpected video error."));
+ return;
+ }
+
videoSettings = m_videoSettings;
}
-void S60VideoCaptureSession::audioEncoderSettings(QAudioEncoderSettings &audioSettings) const
+void S60VideoCaptureSession::audioEncoderSettings(QAudioEncoderSettings &audioSettings)
{
+ switch (m_captureState) {
+ // CVideoRecorderUtility, return requested settings
+ case ENotInitialized:
+ case EInitializing:
+ case EInitialized:
+ case EOpening:
+ case EOpenComplete:
+ case EPreparing:
+ break;
+
+ // Possible to query settings from CVideoRecorderUtility
+ case EPrepared:
+ case ERecording:
+ case EPaused:
+ queryAudioEncoderSettings();
+ break;
+
+ default:
+ audioSettings = QAudioEncoderSettings();
+ setError(KErrGeneral, QString("Unexpected video error."));
+ return;
+ }
+
audioSettings = m_audioSettings;
}
+void S60VideoCaptureSession::validateRequestedCodecs()
+{
+ if (!m_audioCodecList.contains(m_audioSettings.codec())) {
+ m_audioSettings.setCodec(KMimeTypeDefaultAudioCodec);
+ setError(KErrNotSupported, QString("Currently selected audio codec is not supported by the platform."));
+ }
+ if (!m_videoCodecList.contains(m_videoSettings.codec())) {
+ m_videoSettings.setCodec(KMimeTypeDefaultVideoCodec);
+ setError(KErrNotSupported, QString("Currently selected video codec is not supported by the platform."));
+ }
+}
+
void S60VideoCaptureSession::setVideoCaptureQuality(const QtMultimediaKit::EncodingQuality quality,
const VideoQualityDefinition mode)
{
-#ifndef S60_3X_PLATFORM // S60 5.0 or later
- Q_UNUSED(mode);
- m_videoQuality = quality * KSymbianImageQualityCoefficient;
- if (m_videoQuality == 0)
- m_videoQuality = 25;
-#else // S60 3.1 or 3.2
// Sensible presets
switch (mode) {
case ENoVideoQuality:
@@ -720,7 +1045,7 @@ void S60VideoCaptureSession::setVideoCaptureQuality(const QtMultimediaKit::Encod
m_videoSettings.setFrameRate(15);
m_videoSettings.setBitRate(64000);
} else if (quality == QtMultimediaKit::NormalQuality) {
- m_videoSettings.setResolution(QSize(160,120));
+ m_videoSettings.setResolution(QSize(176,144));
m_videoSettings.setFrameRate(15);
m_videoSettings.setBitRate(128000);
} else if (quality == QtMultimediaKit::HighQuality) {
@@ -728,9 +1053,16 @@ void S60VideoCaptureSession::setVideoCaptureQuality(const QtMultimediaKit::Encod
m_videoSettings.setFrameRate(15);
m_videoSettings.setBitRate(384000);
} else if (quality == QtMultimediaKit::VeryHighQuality) {
- m_videoSettings.setResolution(QSize(640,480));
+ if (m_cameraEngine && m_cameraEngine->currentCameraIndex() == 0)
+ m_videoSettings.setResolution(QSize(640,480)); // Primary camera
+ else
+ m_videoSettings.setResolution(QSize(352,288)); // Other cameras
m_videoSettings.setFrameRate(15);
m_videoSettings.setBitRate(2000000);
+ } else {
+ m_videoSettings.setQuality(QtMultimediaKit::NormalQuality);
+ setError(KErrNotSupported, QString("Unsupported video quality."));
+ return;
}
break;
case EVideoQualityAndResolution:
@@ -749,6 +1081,10 @@ void S60VideoCaptureSession::setVideoCaptureQuality(const QtMultimediaKit::Encod
} else if (quality == QtMultimediaKit::VeryHighQuality) {
m_videoSettings.setFrameRate(15);
m_videoSettings.setBitRate(2000000);
+ } else {
+ m_videoSettings.setQuality(QtMultimediaKit::NormalQuality);
+ setError(KErrNotSupported, QString("Unsupported video quality."));
+ return;
}
break;
case EVideoQualityAndFrameRate:
@@ -759,14 +1095,21 @@ void S60VideoCaptureSession::setVideoCaptureQuality(const QtMultimediaKit::Encod
m_videoSettings.setResolution(QSize(176,144));
m_videoSettings.setBitRate(64000);
} else if (quality == QtMultimediaKit::NormalQuality) {
- m_videoSettings.setResolution(QSize(160,120));
+ m_videoSettings.setResolution(QSize(176,144));
m_videoSettings.setBitRate(128000);
} else if (quality == QtMultimediaKit::HighQuality) {
m_videoSettings.setResolution(QSize(352,288));
m_videoSettings.setBitRate(384000);
} else if (quality == QtMultimediaKit::VeryHighQuality) {
- m_videoSettings.setResolution(QSize(640,480));
+ if (m_cameraEngine && m_cameraEngine->currentCameraIndex() == 0)
+ m_videoSettings.setResolution(QSize(640,480)); // Primary camera
+ else
+ m_videoSettings.setResolution(QSize(352,288)); // Other cameras
m_videoSettings.setBitRate(2000000);
+ } else {
+ m_videoSettings.setQuality(QtMultimediaKit::NormalQuality);
+ setError(KErrNotSupported, QString("Unsupported video quality."));
+ return;
}
break;
case EVideoQualityAndBitRate:
@@ -777,57 +1120,80 @@ void S60VideoCaptureSession::setVideoCaptureQuality(const QtMultimediaKit::Encod
m_videoSettings.setResolution(QSize(176,144));
m_videoSettings.setFrameRate(15);
} else if (quality == QtMultimediaKit::NormalQuality) {
- m_videoSettings.setResolution(QSize(160,120));
+ m_videoSettings.setResolution(QSize(176,144));
m_videoSettings.setFrameRate(15);
} else if (quality == QtMultimediaKit::HighQuality) {
m_videoSettings.setResolution(QSize(352,288));
m_videoSettings.setFrameRate(15);
} else if (quality == QtMultimediaKit::VeryHighQuality) {
- m_videoSettings.setResolution(QSize(640,480));
+ if (m_cameraEngine && m_cameraEngine->currentCameraIndex() == 0)
+ m_videoSettings.setResolution(QSize(640,480)); // Primary camera
+ else
+ m_videoSettings.setResolution(QSize(352,288)); // Other cameras
m_videoSettings.setFrameRate(15);
+ } else {
+ m_videoSettings.setQuality(QtMultimediaKit::NormalQuality);
+ setError(KErrNotSupported, QString("Unsupported video quality."));
+ return;
}
break;
case EVideoQualityAndResolutionAndBitRate:
- if (quality == QtMultimediaKit::VeryLowQuality)
+ if (quality == QtMultimediaKit::VeryLowQuality) {
m_videoSettings.setFrameRate(10);
- else if (quality == QtMultimediaKit::LowQuality)
+ } else if (quality == QtMultimediaKit::LowQuality) {
m_videoSettings.setFrameRate(15);
- else if (quality == QtMultimediaKit::NormalQuality)
+ } else if (quality == QtMultimediaKit::NormalQuality) {
m_videoSettings.setFrameRate(15);
- else if (quality == QtMultimediaKit::HighQuality)
+ } else if (quality == QtMultimediaKit::HighQuality) {
m_videoSettings.setFrameRate(15);
- else if (quality == QtMultimediaKit::VeryHighQuality)
+ } else if (quality == QtMultimediaKit::VeryHighQuality) {
m_videoSettings.setFrameRate(15);
+ } else {
+ m_videoSettings.setQuality(QtMultimediaKit::NormalQuality);
+ setError(KErrNotSupported, QString("Unsupported video quality."));
+ return;
+ }
break;
case EVideoQualityAndResolutionAndFrameRate:
- if (quality == QtMultimediaKit::VeryLowQuality)
+ if (quality == QtMultimediaKit::VeryLowQuality) {
m_videoSettings.setBitRate(64000);
- else if (quality == QtMultimediaKit::LowQuality)
+ } else if (quality == QtMultimediaKit::LowQuality) {
m_videoSettings.setBitRate(64000);
- else if (quality == QtMultimediaKit::NormalQuality)
+ } else if (quality == QtMultimediaKit::NormalQuality) {
m_videoSettings.setBitRate(128000);
- else if (quality == QtMultimediaKit::HighQuality)
+ } else if (quality == QtMultimediaKit::HighQuality) {
m_videoSettings.setBitRate(384000);
- else if (quality == QtMultimediaKit::VeryHighQuality)
+ } else if (quality == QtMultimediaKit::VeryHighQuality) {
m_videoSettings.setBitRate(2000000);
+ } else {
+ m_videoSettings.setQuality(QtMultimediaKit::NormalQuality);
+ setError(KErrNotSupported, QString("Unsupported video quality."));
+ return;
+ }
break;
case EVideoQualityAndFrameRateAndBitRate:
- if (quality == QtMultimediaKit::VeryLowQuality)
+ if (quality == QtMultimediaKit::VeryLowQuality) {
m_videoSettings.setResolution(QSize(128,96));
- else if (quality == QtMultimediaKit::LowQuality)
+ } else if (quality == QtMultimediaKit::LowQuality) {
m_videoSettings.setResolution(QSize(176,144));
- else if (quality == QtMultimediaKit::NormalQuality)
- m_videoSettings.setResolution(QSize(160,120));
- else if (quality == QtMultimediaKit::HighQuality)
+ } else if (quality == QtMultimediaKit::NormalQuality) {
+ m_videoSettings.setResolution(QSize(176,144));
+ } else if (quality == QtMultimediaKit::HighQuality) {
m_videoSettings.setResolution(QSize(352,288));
- else if (quality == QtMultimediaKit::VeryHighQuality)
- m_videoSettings.setResolution(QSize(640,480));
+ } else if (quality == QtMultimediaKit::VeryHighQuality) {
+ if (m_cameraEngine && m_cameraEngine->currentCameraIndex() == 0)
+ m_videoSettings.setResolution(QSize(640,480)); // Primary camera
+ else
+ m_videoSettings.setResolution(QSize(352,288)); // Other cameras
+ } else {
+ m_videoSettings.setQuality(QtMultimediaKit::NormalQuality);
+ setError(KErrNotSupported, QString("Unsupported video quality."));
+ return;
+ }
break;
}
-#endif // S60_3X_PLATFORM
m_videoSettings.setQuality(quality);
-
m_uncommittedSettings = true;
}
@@ -840,47 +1206,51 @@ void S60VideoCaptureSession::setAudioCaptureQuality(const QtMultimediaKit::Encod
switch (quality) {
case QtMultimediaKit::VeryLowQuality:
m_audioSettings.setBitRate(16000);
- m_audioSettings.setSampleRate(8000);
+ m_audioSettings.setSampleRate(-1);
break;
case QtMultimediaKit::LowQuality:
- m_audioSettings.setBitRate(32000);
- m_audioSettings.setSampleRate(16000);
+ m_audioSettings.setBitRate(16000);
+ m_audioSettings.setSampleRate(-1);
break;
case QtMultimediaKit::NormalQuality:
- m_audioSettings.setBitRate(64000);
- m_audioSettings.setSampleRate(22050);
+ m_audioSettings.setBitRate(32000);
+ m_audioSettings.setSampleRate(-1);
break;
case QtMultimediaKit::HighQuality:
- m_audioSettings.setBitRate(128000);
- m_audioSettings.setSampleRate(44100);
+ m_audioSettings.setBitRate(64000);
+ m_audioSettings.setSampleRate(-1);
break;
case QtMultimediaKit::VeryHighQuality:
- m_audioSettings.setBitRate(256000);
- m_audioSettings.setSampleRate(48000);
+ m_audioSettings.setBitRate(64000);
+ m_audioSettings.setSampleRate(-1);
break;
default:
- setError(KErrGeneral, QString("Unsupported quality."));
+ m_audioSettings.setQuality(QtMultimediaKit::NormalQuality);
+ setError(KErrNotSupported, QString("Unsupported audio quality."));
+ return;
}
break;
case EAudioQualityAndBitRate:
switch (quality) {
case QtMultimediaKit::VeryLowQuality:
- m_audioSettings.setSampleRate(8000);
+ m_audioSettings.setSampleRate(-1);
break;
case QtMultimediaKit::LowQuality:
- m_audioSettings.setSampleRate(16000);
+ m_audioSettings.setSampleRate(-1);
break;
case QtMultimediaKit::NormalQuality:
- m_audioSettings.setSampleRate(22050);
+ m_audioSettings.setSampleRate(-1);
break;
case QtMultimediaKit::HighQuality:
- m_audioSettings.setSampleRate(44100);
+ m_audioSettings.setSampleRate(-1);
break;
case QtMultimediaKit::VeryHighQuality:
- m_audioSettings.setSampleRate(48000);
+ m_audioSettings.setSampleRate(-1);
break;
default:
- setError(KErrGeneral, QString("Unsupported quality."));
+ m_audioSettings.setQuality(QtMultimediaKit::NormalQuality);
+ setError(KErrNotSupported, QString("Unsupported audio quality."));
+ return;
}
break;
case EAudioQualityAndSampleRate:
@@ -889,19 +1259,21 @@ void S60VideoCaptureSession::setAudioCaptureQuality(const QtMultimediaKit::Encod
m_audioSettings.setBitRate(16000);
break;
case QtMultimediaKit::LowQuality:
- m_audioSettings.setBitRate(32000);
+ m_audioSettings.setBitRate(16000);
break;
case QtMultimediaKit::NormalQuality:
- m_audioSettings.setBitRate(64000);
+ m_audioSettings.setBitRate(32000);
break;
case QtMultimediaKit::HighQuality:
- m_audioSettings.setBitRate(128000);
+ m_audioSettings.setBitRate(64000);
break;
case QtMultimediaKit::VeryHighQuality:
- m_audioSettings.setBitRate(256000);
+ m_audioSettings.setBitRate(64000);
break;
default:
- setError(KErrGeneral, QString("Unsupported quality."));
+ m_audioSettings.setQuality(QtMultimediaKit::NormalQuality);
+ setError(KErrNotSupported, QString("Unsupported audio quality."));
+ return;
}
break;
case ENoAudioQuality:
@@ -910,6 +1282,7 @@ void S60VideoCaptureSession::setAudioCaptureQuality(const QtMultimediaKit::Encod
default:
setError(KErrGeneral, QString("Unexpected camera error."));
+ return;
}
m_audioSettings.setQuality(quality);
@@ -918,9 +1291,8 @@ void S60VideoCaptureSession::setAudioCaptureQuality(const QtMultimediaKit::Encod
int S60VideoCaptureSession::initializeVideoRecording()
{
- if (m_error) {
+ if (m_error)
return m_error;
- }
TRAPD(symbianError, doInitializeVideoRecorderL());
setError(symbianError, QString("Failed to initialize video recorder."));
@@ -932,11 +1304,12 @@ void S60VideoCaptureSession::releaseVideoRecording()
{
if (m_captureState >= ERecording) {
m_videoRecorder->Stop();
+ if (m_durationTimer->isActive())
+ m_durationTimer->stop();
}
- if (m_captureState >= EInitialized) {
+ if (m_captureState >= EInitialized)
m_videoRecorder->Close();
- }
// Reset state
m_captureState = ENotInitialized;
@@ -959,18 +1332,12 @@ void S60VideoCaptureSession::startRecording()
return;
}
- if (!m_cameraStarted) {
- setError(KErrNotReady, QString("Camera is not started."));
- return;
- }
-
switch (m_captureState) {
case ENotInitialized:
case EInitializing:
case EInitialized:
- if (m_captureState == EInitialized) {
+ if (m_captureState == EInitialized)
setOutputLocation(m_requestedSink);
- }
m_startAfterPrepareComplete = true;
return;
@@ -981,23 +1348,16 @@ void S60VideoCaptureSession::startRecording()
return;
case EOpenComplete:
case EPrepared:
- if (m_captureState == EPrepared && !m_uncommittedSettings) {
+ if (m_captureState == EPrepared && !m_uncommittedSettings)
break;
- }
// Revert state internally, since logically applying settings means going
// from OpenComplete ==> Preparing ==> Prepared.
m_captureState = EOpenComplete;
- commitVideoEncoderSettings();
-
- // Start preparing
- m_captureState = EPreparing;
- emit stateChanged(m_captureState);
+ m_startAfterPrepareComplete = true;
- if (m_cameraEngine->IsCameraReady()) {
- m_startAfterPrepareComplete = true;
- m_videoRecorder->Prepare();
- }
+ // Commit settings and prepare with them
+ applyAllSettings();
return;
case ERecording:
// Discard
@@ -1013,6 +1373,11 @@ void S60VideoCaptureSession::startRecording()
// State should now be either Prepared with no Uncommitted Settings or Paused
+ if (!m_cameraStarted) {
+ m_startAfterPrepareComplete = true;
+ return;
+ }
+
if (m_cameraEngine && !m_cameraEngine->IsCameraReady()) {
setError(KErrNotReady, QString("Camera not ready to start video recording."));
return;
@@ -1022,9 +1387,15 @@ void S60VideoCaptureSession::startRecording()
m_videoRecorder->Record();
m_captureState = ERecording;
emit stateChanged(m_captureState);
- }
- else
+ m_durationTimer->start();
+
+ // Reset all flags
+ m_openWhenReady = false;
+ m_prepareAfterOpenComplete = false;
+ m_startAfterPrepareComplete = false;
+ } else {
setError(KErrNotReady, QString("Unexpected camera error."));
+ }
}
void S60VideoCaptureSession::pauseRecording()
@@ -1035,10 +1406,11 @@ void S60VideoCaptureSession::pauseRecording()
setError(err, QString("Pausing video recording failed."));
m_captureState = EPaused;
emit stateChanged(m_captureState);
+ if (m_durationTimer->isActive())
+ m_durationTimer->stop();
}
else
setError(KErrNotReady, QString("Unexpected camera error."));
-
}
}
@@ -1051,14 +1423,20 @@ void S60VideoCaptureSession::stopRecording(const bool reInitialize)
m_videoRecorder->Stop();
m_videoRecorder->Close();
+ // Notify muting is disabled if needed
+ if (m_muted)
+ emit mutedChanged(false);
+
m_captureState = ENotInitialized;
emit stateChanged(m_captureState);
+ if (m_durationTimer->isActive())
+ m_durationTimer->stop();
+
// VideoRecording will be re-initialized unless explicitly requested not to do so
if (reInitialize) {
- if (m_cameraEngine->IsCameraReady()) {
+ if (m_cameraEngine->IsCameraReady())
initializeVideoRecording();
- }
}
}
else
@@ -1113,6 +1491,7 @@ void S60VideoCaptureSession::doUpdateVideoCaptureContainersL()
// Find the first controller with at least one record format available
for (TInt index = 0; index < controllers.Count(); ++index) {
+
m_videoControllerMap.insert(controllers[index]->Uid().iUid, QHash<TInt,VideoFormatData>());
const RMMFFormatImplInfoArray& recordFormats = controllers[index]->RecordFormats();
@@ -1132,7 +1511,6 @@ void S60VideoCaptureSession::doUpdateVideoCaptureContainersL()
m_videoControllerMap[controllers[index]->Uid().iUid].insert(recordFormats[j]->Uid().iUid, formatData);
}
-
}
CleanupStack::PopAndDestroy(&controllers);
@@ -1166,12 +1544,12 @@ void S60VideoCaptureSession::selectController(const QString &format,
QStringList S60VideoCaptureSession::supportedVideoCaptureCodecs()
{
- return m_videoCodeclist;
+ return m_videoCodecList;
}
QStringList S60VideoCaptureSession::supportedAudioCaptureCodecs()
{
- QStringList keys = m_audioCodeclist.keys();
+ QStringList keys = m_audioCodecList.keys();
keys.sort();
return keys;
}
@@ -1196,6 +1574,7 @@ QList<int> S60VideoCaptureSession::doGetSupportedSampleRatesL(const QAudioEncode
CleanupClosePushL(supportedSampleRates);
if (!settings.codec().isEmpty()) {
+
TFourCC currentAudioCodec;
currentAudioCodec = m_videoRecorder->AudioTypeL();
@@ -1213,9 +1592,8 @@ QList<int> S60VideoCaptureSession::doGetSupportedSampleRatesL(const QAudioEncode
else
m_videoRecorder->GetSupportedAudioSampleRatesL(supportedSampleRates);
- for (int i = 0; i < supportedSampleRates.Count(); ++i) {
- sampleRates.append((int)supportedSampleRates[i]);
- }
+ for (int i = 0; i < supportedSampleRates.Count(); ++i)
+ sampleRates.append(int(supportedSampleRates[i]));
CleanupStack::PopAndDestroy(); // RArray<TUint> supportedSampleRates
#else // S60 3.1 Platform
@@ -1254,22 +1632,39 @@ void S60VideoCaptureSession::setAudioChannelCount(const int channelCount)
void S60VideoCaptureSession::setVideoCaptureCodec(const QString &codecName)
{
- if (codecName.isEmpty() || codecName == m_videoSettings.codec())
+ if (codecName == m_videoSettings.codec())
return;
- m_videoSettings.setCodec(codecName);
+ if (codecName.isEmpty())
+ m_videoSettings.setCodec(KMimeTypeDefaultVideoCodec); // Use default
+ else
+ m_videoSettings.setCodec(codecName);
m_uncommittedSettings = true;
}
void S60VideoCaptureSession::setAudioCaptureCodec(const QString &codecName)
{
- if (codecName.isEmpty() || codecName == m_audioSettings.codec())
+ if (codecName == m_audioSettings.codec())
return;
- m_audioSettings.setCodec(codecName);
-
- m_uncommittedSettings = true;
+ if (codecName.isEmpty()) {
+ m_audioSettings.setCodec(KMimeTypeDefaultAudioCodec); // Use default
+ } else {
+ // If information of supported codecs is already available check that
+ // given codec is supported
+ if (m_captureState >= EOpenComplete) {
+ if (m_audioCodecList.contains(codecName)) {
+ m_audioSettings.setCodec(codecName);
+ m_uncommittedSettings = true;
+ } else {
+ setError(KErrNotSupported, QString("Requested audio codec is not supported"));
+ }
+ } else {
+ m_audioSettings.setCodec(codecName);
+ m_uncommittedSettings = true;
+ }
+ }
}
QString S60VideoCaptureSession::videoCaptureCodecDescription(const QString &codecName)
@@ -1295,11 +1690,15 @@ void S60VideoCaptureSession::doSetCodecsL(const QString &aCodec, const QString &
videoCodec = CnvUtfConverter::ConvertFromUnicodeToUtf8L(str);
CleanupStack::PushL(videoCodec);
- TFourCC audioCodec = m_audioCodeclist[m_audioSettings.codec()];
+ TFourCC audioCodec = m_audioCodecList[m_audioSettings.codec()];
- m_videoRecorder->SetVideoTypeL(*videoCodec);
+ TInt vErr = KErrNone;
+ TInt aErr = KErrNone;
+ TRAP(vErr, m_videoRecorder->SetVideoTypeL(*videoCodec));
+ TRAP(aErr, m_videoRecorder->SetAudioTypeL(audioCodec));
- m_videoRecorder->SetAudioTypeL(audioCodec);
+ User::LeaveIfError(vErr);
+ User::LeaveIfError(aErr);
CleanupStack::PopAndDestroy(videoCodec);
}
@@ -1320,7 +1719,12 @@ void S60VideoCaptureSession::doSetBitrate(const int &bitrate)
if (m_videoRecorder) {
TRAPD(err, m_videoRecorder->SetVideoBitRateL(bitrate));
if (err) {
- setError(err, QString("Failed to set video bitrate."));
+ if (err == KErrNotSupported || err == KErrArgument) {
+ setError(KErrNotSupported, QString("Requested video bitrate is not supported."));
+ m_videoSettings.setBitRate(64000); // Reset
+ } else {
+ setError(err, QString("Failed to set video bitrate."));
+ }
}
} else {
setError(KErrNotReady, QString("Unexpected camera error."));
@@ -1358,33 +1762,35 @@ void S60VideoCaptureSession::doSetVideoResolution(const QSize &resolution)
maxCameraVideoResolution = checkedResolution;
}
if ((maxCameraVideoResolution.iWidth * maxCameraVideoResolution.iHeight) <
- (size.iWidth * size.iHeight))
+ (size.iWidth * size.iHeight)) {
size = maxCameraVideoResolution;
+ setError(KErrNotSupported, QString("Requested resolution is not supported for this camera."));
+ }
}
else
setError(KErrGeneral, QString("Could not query supported video resolutions."));
}else
setError(KErrGeneral, QString("Could not query supported video resolutions."));
}
+
if (resolution.width() != -1 && resolution.height() != -1) {
if (m_videoRecorder) {
TRAPD(err, m_videoRecorder->SetVideoFrameSizeL((TSize)size));
- if (err == KErrNotSupported) {
+ if (err == KErrNotSupported || err == KErrArgument) {
+ setError(KErrNotSupported, QString("Requested video resolution is not supported."));
TSize fallBack(640,480);
TRAPD(err, m_videoRecorder->SetVideoFrameSizeL(fallBack));
- if (err == KErrNone)
+ if (err == KErrNone) {
m_videoSettings.setResolution(QSize(fallBack.iWidth,fallBack.iHeight));
- else {
+ } else {
fallBack = TSize(176,144);
TRAPD(err, m_videoRecorder->SetVideoFrameSizeL(fallBack));
if (err == KErrNone)
m_videoSettings.setResolution(QSize(fallBack.iWidth,fallBack.iHeight));
- else
- setError(err, QString("Failed to set fallback resolution 176x144."));
}
- }
- else
+ } else {
setError(err, QString("Failed to set video resolution."));
+ }
} else {
setError(KErrNotReady, QString("Unexpected camera error."));
}
@@ -1408,20 +1814,25 @@ void S60VideoCaptureSession::doSetFrameRate(qreal rate)
foreach (qreal fRate, list)
if (fRate > maxRate)
maxRate = fRate;
- if (maxRate >= rate) {
+ if (maxRate >= rate && rate > 0) {
TRAPD(err, m_videoRecorder->SetVideoFrameRateL((TReal32)rate));
if (err == KErrNotSupported) {
+ setError(KErrNotSupported, QString("Requested framerate is not supported."));
TReal32 fallBack = 15.0;
TRAPD(err, m_videoRecorder->SetVideoFrameRateL(fallBack));
if (err == KErrNone)
m_videoSettings.setFrameRate((qreal)fallBack);
- else
- setError(err, QString("Failed to set fallback framerate 15 fps."));
+ } else {
+ if (err == KErrArgument) {
+ setError(KErrNotSupported, QString("Requested framerate is not supported."));
+ m_videoSettings.setFrameRate(15.0); // Reset
+ } else {
+ setError(err, QString("Failed to set video framerate."));
+ }
}
- else
- setError(err, QString("Failed to set video framerate."));
} else {
- setError(KErrNotSupported, QString("Framerate is not supported."));
+ setError(KErrNotSupported, QString("Requested framerate is not supported."));
+ m_videoSettings.setFrameRate(15.0); // Reset
}
} else {
setError(KErrNotReady, QString("Unexpected camera error."));
@@ -1432,7 +1843,13 @@ void S60VideoCaptureSession::doSetFrameRate(qreal rate)
void S60VideoCaptureSession::setVideoEncodingMode(const QtMultimediaKit::EncodingMode mode)
{
// This has no effect as it has no support in Symbian
- m_videoSettings.setEncodingMode(mode);
+
+ if (mode == QtMultimediaKit::ConstantQualityEncoding) {
+ m_videoSettings.setEncodingMode(mode);
+ return;
+ }
+
+ setError(KErrNotSupported, QString("Requested video encoding mode is not supported"));
// m_uncommittedSettings = true;
}
@@ -1440,70 +1857,118 @@ void S60VideoCaptureSession::setVideoEncodingMode(const QtMultimediaKit::Encodin
void S60VideoCaptureSession::setAudioEncodingMode(const QtMultimediaKit::EncodingMode mode)
{
// This has no effect as it has no support in Symbian
- m_audioSettings.setEncodingMode(mode);
+
+ if (mode == QtMultimediaKit::ConstantQualityEncoding) {
+ m_audioSettings.setEncodingMode(mode);
+ return;
+ }
+
+ setError(KErrNotSupported, QString("Requested audio encoding mode is not supported"));
// m_uncommittedSettings = true;
}
void S60VideoCaptureSession::initializeVideoCaptureSettings()
{
- // Codecs - Use ones defined in constants if supported
- if (m_videoCodeclist.count() > 0) {
- if (m_videoCodeclist.contains(KMimeTypeDefaultVideoCodec, Qt::CaseInsensitive)) {
+ // Check if user has already requested some settings
+ if (m_captureSettingsSet)
+ return;
+
+ QSize resolution(-1, -1);
+ qreal frameRate(0);
+ int bitRate(-1);
+
+ if (m_cameraEngine) {
+
+ if (m_videoRecorder && m_captureState >= EInitialized) {
+
+ // Resolution
+ QList<QSize> resos = supportedVideoResolutions(NULL);
+ foreach (QSize reso, resos) {
+ if ((reso.width() * reso.height()) > (resolution.width() * resolution.height()))
+ resolution = reso;
+ }
+
+ // Needed to query supported framerates for this codec/resolution pair
m_videoSettings.setCodec(KMimeTypeDefaultVideoCodec);
- } else {
- if (m_videoCodeclist.size() > 0)
- m_videoSettings.setCodec(m_videoCodeclist[m_videoCodeclist.size()-1]);
- }
- }
+ m_videoSettings.setResolution(resolution);
+
+ // FrameRate
+ QList<qreal> fRates = supportedVideoFrameRates(m_videoSettings, NULL);
+ foreach (qreal rate, fRates) {
+ if (rate > frameRate)
+ frameRate = rate;
+ }
+
+ // BitRate
+#ifdef SYMBIAN_3_PLATFORM
+ if (m_cameraEngine->currentCameraIndex() == 0)
+ bitRate = KBiR_H264_PLID_42801F // 14Mbps
+ else
+ bitRate = KBiR_H264_PLID_428016 // 4Mbps
+#else // Other platforms
+ if (m_cameraEngine->currentCameraIndex() == 0)
+ bitRate = KBiR_MPEG4_PLID_4 // 2/4Mbps
+ else
+ bitRate = KBiR_MPEG4_PLID_3 // 384kbps
+#endif // SYMBIAN_3_PLATFORM
- QStringList aCodecs = m_audioCodeclist.keys();
- if (aCodecs.count() > 0) {
- if (aCodecs.contains(KMimeTypeDefaultAudioCodec, Qt::CaseInsensitive)) {
- m_audioSettings.setCodec(KMimeTypeDefaultAudioCodec);
} else {
- if (aCodecs.size() > 0)
- m_audioSettings.setCodec(aCodecs[0]);
+#ifdef SYMBIAN_3_PLATFORM
+ if (m_cameraEngine->currentCameraIndex() == 0) {
+ // Primary camera
+ resolution = KResH264_PLID_42801F; // 1280x720
+ frameRate = KFrR_H264_PLID_42801F; // 30fps
+ bitRate = KBiR_H264_PLID_42801F; // 14Mbps
+ } else {
+ // Other cameras
+ resolution = KResH264_PLID_42801E; // 640x480
+ frameRate = KFrR_H264_PLID_428014; // 30fps
+ bitRate = KBiR_H264_PLID_428016; // 4Mbps
+ }
+#else // Other platforms
+ if (m_cameraEngine->currentCameraIndex() == 0) {
+ // Primary camera
+ resolution = KResMPEG4_PLID_4; // 640x480
+ frameRate = KFrR_MPEG4_PLID_4; // 15/30fps
+ bitRate = KBiR_MPEG4_PLID_4; // 2/4Mbps
+ } else {
+ // Other cameras
+ resolution = KResMPEG4_PLID_3; // 352x288
+ frameRate = KFrR_MPEG4; // 15fps
+ bitRate = KBiR_MPEG4_PLID_3; // 384kbps
+ }
+#endif // SYMBIAN_3_PLATFORM
}
- }
+ } else {
+#ifdef SYMBIAN_3_PLATFORM
+ resolution = KResH264_PLID_42801F;
+ frameRate = KFrR_H264_PLID_42801F;
+ bitRate = KBiR_H264_PLID_42801F;
+#else // Pre-Symbian3 Platforms
+ resolution = KResMPEG4_PLID_4;
+ frameRate = KFrR_MPEG4_PLID_4;
+ bitRate = KBiR_MPEG4_PLID_4;
+#endif // SYMBIAN_3_PLATFORM
+ }
+
+ // Set specified settings (Resolution, FrameRate and BitRate)
+ m_videoSettings.setResolution(resolution);
+ m_videoSettings.setFrameRate(frameRate);
+ m_videoSettings.setBitRate(bitRate);
- // Video Settings
- m_videoSettings.setBitRate(maximumBitRateForMimeType(m_videoSettings.codec())); // Use max supported
- m_videoSettings.setEncodingMode(QtMultimediaKit::AverageBitRateEncoding);
+ // Video Settings: Codec, EncodingMode and Quality
+ m_videoSettings.setCodec(KMimeTypeDefaultVideoCodec);
+ m_videoSettings.setEncodingMode(QtMultimediaKit::ConstantQualityEncoding);
m_videoSettings.setQuality(QtMultimediaKit::VeryHighQuality);
- // Use maximum resolution and framerate supported
- bool continuous = false;
- QList<QSize> sizes = supportedVideoResolutions(m_videoSettings, &continuous);
- QSize maxSize = QSize();
- foreach (QSize size, sizes) {
- if ((size.width() * size.height()) > (maxSize.width() * maxSize.height()))
- maxSize = size;
- }
- m_videoSettings.setResolution(maxSize);
-
- QList<qreal> rates = supportedVideoFrameRates(m_videoSettings, &continuous);
- qreal maxRate = 0.0;
- foreach (qreal rate, rates)
- maxRate = qMax(maxRate, rate);
- m_videoSettings.setFrameRate(maxRate);
-
// Audio Settings
- m_audioSettings.setEncodingMode(QtMultimediaKit::AverageBitRateEncoding);
+ m_audioSettings.setCodec(KMimeTypeDefaultAudioCodec);
m_audioSettings.setBitRate(KDefaultBitRate);
+ m_audioSettings.setSampleRate(KDefaultSampleRate);
m_audioSettings.setChannelCount(KDefaultChannelCount);
+ m_audioSettings.setEncodingMode(QtMultimediaKit::ConstantQualityEncoding);
m_audioSettings.setQuality(QtMultimediaKit::VeryHighQuality);
-
- QList<int> sampleRates = supportedSampleRates(m_audioSettings, &continuous);
- if (sampleRates.count() > 0) {
- if (sampleRates.indexOf(KDefaultSampleRate) != -1)
- m_audioSettings.setSampleRate(KDefaultSampleRate);
- else
- m_audioSettings.setSampleRate(sampleRates[0]);
- }
- else
- m_audioSettings.setSampleRate(-1); // Setting SampleRate is not supported
-
}
QSize S60VideoCaptureSession::pixelAspectRatio()
@@ -1511,9 +1976,8 @@ QSize S60VideoCaptureSession::pixelAspectRatio()
#ifndef S60_31_PLATFORM
TVideoAspectRatio par;
TRAPD(err, m_videoRecorder->GetPixelAspectRatioL(par));
- if (err) {
+ if (err)
setError(err, QString("Failed to query current pixel aspect ratio."));
- }
return QSize(par.iNumerator, par.iDenominator);
#else // S60_31_PLATFORM
return QSize();
@@ -1523,11 +1987,11 @@ QSize S60VideoCaptureSession::pixelAspectRatio()
void S60VideoCaptureSession::setPixelAspectRatio(const QSize par)
{
#ifndef S60_31_PLATFORM
+
const TVideoAspectRatio videoPar(par.width(), par.height());
TRAPD(err, m_videoRecorder->SetPixelAspectRatioL(videoPar));
- if (err) {
+ if (err)
setError(err, QString("Failed to set pixel aspect ratio."));
- }
#else // S60_31_PLATFORM
Q_UNUSED(par);
#endif // !S60_31_PLATFORM
@@ -1539,18 +2003,16 @@ int S60VideoCaptureSession::gain()
{
TInt gain = 0;
TRAPD(err, gain = m_videoRecorder->GainL());
- if (err) {
+ if (err)
setError(err, QString("Failed to query video gain."));
- }
return (int)gain;
}
void S60VideoCaptureSession::setGain(const int gain)
{
TRAPD(err, m_videoRecorder->SetGainL(gain));
- if (err) {
+ if (err)
setError(err, QString("Failed to set video gain."));
- }
m_uncommittedSettings = true;
}
@@ -1590,14 +2052,18 @@ void S60VideoCaptureSession::MvruoOpenComplete(TInt aError)
// Max parameters needed to be populated, if not using DevVideoRecord
// Otherwise done already in constructor
doPopulateMaxVideoParameters();
-#endif
-
- initializeVideoCaptureSettings();
+#endif // S60_DEVVIDEO_RECORDING_SUPPORTED
m_captureState = EInitialized;
emit stateChanged(m_captureState);
- if (m_openWhenReady == true) {
+ // Initialize settings if not already done
+ initializeVideoCaptureSettings();
+
+ // Validate codecs to be used
+ validateRequestedCodecs();
+
+ if (m_openWhenReady || m_prepareAfterOpenComplete || m_startAfterPrepareComplete) {
setOutputLocation(m_requestedSink);
m_openWhenReady = false; // Reset
}
@@ -1605,7 +2071,6 @@ void S60VideoCaptureSession::MvruoOpenComplete(TInt aError)
applyAllSettings();
m_commitSettingsWhenReady = false; // Reset
}
-
return;
} else if (m_captureState == EOpening) {
@@ -1616,10 +2081,9 @@ void S60VideoCaptureSession::MvruoOpenComplete(TInt aError)
// Prepare right away
if (m_startAfterPrepareComplete || m_prepareAfterOpenComplete) {
m_prepareAfterOpenComplete = false; // Reset
- commitVideoEncoderSettings();
- if (m_cameraEngine->IsCameraReady()) {
- m_videoRecorder->Prepare();
- }
+
+ // Commit settings and prepare with them
+ applyAllSettings();
}
return;
@@ -1635,7 +2099,10 @@ void S60VideoCaptureSession::MvruoOpenComplete(TInt aError)
}
m_videoRecorder->Close();
- setError(aError, QString("Failure during video recorder initialization."));
+ if (aError == KErrNotFound || aError == KErrNotSupported || aError == KErrArgument)
+ setError(KErrGeneral, QString("Requested video container or controller is not supported."));
+ else
+ setError(KErrGeneral, QString("Failure during video recorder initialization."));
}
void S60VideoCaptureSession::MvruoPrepareComplete(TInt aError)
@@ -1653,6 +2120,10 @@ void S60VideoCaptureSession::MvruoPrepareComplete(TInt aError)
m_captureState = EPrepared;
emit stateChanged(EPrepared);
+ // Check the actual active settings
+ queryAudioEncoderSettings();
+ queryVideoEncoderSettings();
+
if (m_openWhenReady == true) {
setOutputLocation(m_requestedSink);
m_openWhenReady = false; // Reset
@@ -1669,7 +2140,10 @@ void S60VideoCaptureSession::MvruoPrepareComplete(TInt aError)
}
} else {
m_videoRecorder->Close();
- setError(aError, QString("Failed to prepare camera for video recording."));
+ if (aError == KErrNotSupported)
+ setError(aError, QString("Camera preparation for video recording failed because of unsupported setting."));
+ else
+ setError(aError, QString("Failed to prepare camera for video recording."));
}
}
@@ -1687,14 +2161,19 @@ void S60VideoCaptureSession::MvruoRecordComplete(TInt aError)
if (m_captureState != ENotInitialized) {
m_captureState = ENotInitialized;
emit stateChanged(m_captureState);
+ if (m_durationTimer->isActive())
+ m_durationTimer->stop();
}
- if (m_cameraEngine->IsCameraReady()) {
+ if (m_cameraEngine->IsCameraReady())
initializeVideoRecording();
- }
}
m_videoRecorder->Close();
+ // Notify muting is disabled if needed
+ if (m_muted)
+ emit mutedChanged(false);
+
if (aError == KErrDiskFull)
setError(aError, QString("Not enough space for video, recording stopped."));
else
@@ -1755,6 +2234,7 @@ void S60VideoCaptureSession::doPopulateVideoCodecsDataL()
mDevVideoRecord->GetEncoderListL(encoders);
for (int i = 0; i < encoders.Count(); ++i ) {
+
CVideoEncoderInfo *encoderInfo = mDevVideoRecord->VideoEncoderInfoLC(encoders[i]);
// Discard encoders that are not HW accelerated and do not support direct capture
@@ -1774,7 +2254,6 @@ void S60VideoCaptureSession::doPopulateVideoCodecsDataL()
for(int x = 0; x < videoFormats.Count(); ++x) {
QString codecMimeType = QString::fromUtf8((char *)videoFormats[x]->MimeType().Ptr(),videoFormats[x]->MimeType().Length());
- //m_videoCodeclist.append(codecMimeType);
m_videoParametersForEncoder[newIndex].mimeTypes.append(codecMimeType);
}
@@ -1807,9 +2286,8 @@ QStringList S60VideoCaptureSession::supportedVideoContainers()
for (int i = 0; i < controllers.count(); ++i) {
foreach (VideoFormatData formatData, m_videoControllerMap[controllers[i]]) {
for (int j = 0; j < formatData.supportedMimeTypes.count(); ++j) {
- if (containers.contains(formatData.supportedMimeTypes[j], Qt::CaseInsensitive) == false) {
+ if (containers.contains(formatData.supportedMimeTypes[j], Qt::CaseInsensitive) == false)
containers.append(formatData.supportedMimeTypes[j]);
- }
}
}
}
@@ -1832,7 +2310,17 @@ void S60VideoCaptureSession::setVideoContainer(const QString &containerName)
if (containerName == m_requestedContainer)
return;
- m_requestedContainer = containerName;
+ if (containerName.isEmpty()) {
+ m_requestedContainer = KMimeTypeDefaultContainer; // Use default
+ } else {
+ if (supportedVideoContainers().contains(containerName)) {
+ m_requestedContainer = containerName;
+ } else {
+ setError(KErrNotSupported, QString("Requested video container is not supported."));
+ m_requestedContainer = KMimeTypeDefaultContainer; // Reset to default
+ }
+ }
+
m_uncommittedSettings = true;
}
@@ -1843,32 +2331,54 @@ QString S60VideoCaptureSession::videoContainerDescription(const QString &contain
for (int i = 0; i < encoders.count(); ++i) {
formats = m_videoControllerMap[encoders[i]].keys();
for (int j = 0; j < formats.count(); ++j) {
- if (m_videoControllerMap[encoders[i]][formats[j]].supportedMimeTypes.contains(containerName, Qt::CaseInsensitive)) {
+ if (m_videoControllerMap[encoders[i]][formats[j]].supportedMimeTypes.contains(containerName, Qt::CaseInsensitive))
return m_videoControllerMap[encoders[i]][formats[j]].description;
- }
}
}
return QString();
}
-
void S60VideoCaptureSession::cameraStatusChanged(QCamera::Status status)
{
if (status == QCamera::ActiveStatus) {
m_cameraStarted = true;
- return;
- }
- else if (status == QCamera::UnloadedStatus)
+
+ // Continue preparation or start recording if previously requested
+ if (m_captureState == EInitialized
+ && (m_openWhenReady || m_prepareAfterOpenComplete || m_startAfterPrepareComplete)) {
+ setOutputLocation(m_requestedSink);
+ m_openWhenReady = false; // Reset
+ } else if ((m_captureState == EOpenComplete || m_captureState == EPrepared)
+ && (m_prepareAfterOpenComplete || m_startAfterPrepareComplete)) {
+ startRecording();
+ m_prepareAfterOpenComplete = false; // Reset
+ }
+
+ } else if (status == QCamera::UnloadedStatus) {
+ m_cameraStarted = false;
releaseVideoRecording();
+ } else {
+ m_cameraStarted = false;
+ }
+}
- m_cameraStarted = false;
+void S60VideoCaptureSession::durationTimerTriggered()
+{
+ // Update position only if recording is ongoing
+ if ((m_captureState == ERecording) && m_videoRecorder) {
+ // Signal will be automatically emitted of position changes
+ TRAPD(err, m_position = m_videoRecorder->DurationL().Int64() / 1000);
+ setError(err, QString("Cannot retrieve video position."));
+
+ emit positionChanged(m_position);
+ }
}
void S60VideoCaptureSession::doPopulateAudioCodecsL()
{
if (m_captureState == EInitializing) {
- m_audioCodeclist.clear();
+ m_audioCodecList.clear();
RArray<TFourCC> audioTypes;
CleanupClosePushL(audioTypes);
@@ -1880,10 +2390,11 @@ void S60VideoCaptureSession::doPopulateAudioCodecsL()
for (TInt i = 0; i < audioTypes.Count(); i++) {
TUint32 codec = audioTypes[i].FourCC();
+
if (codec == KMMFFourCCCodeAMR)
- m_audioCodeclist.insert(QString("audio/amr"), KMMFFourCCCodeAMR);
+ m_audioCodecList.insert(QString("audio/amr"), KMMFFourCCCodeAMR);
if (codec == KMMFFourCCCodeAAC)
- m_audioCodeclist.insert(QString("audio/aac"), KMMFFourCCCodeAAC);
+ m_audioCodecList.insert(QString("audio/aac"), KMMFFourCCCodeAAC);
}
CleanupStack::PopAndDestroy(&audioTypes);
}
@@ -1892,7 +2403,7 @@ void S60VideoCaptureSession::doPopulateAudioCodecsL()
void S60VideoCaptureSession::doPopulateVideoCodecsL()
{
if (m_captureState == EInitializing) {
- m_videoCodeclist.clear();
+ m_videoCodecList.clear();
CDesC8ArrayFlat* videoTypes = new (ELeave) CDesC8ArrayFlat(10);
CleanupStack::PushL(videoTypes);
@@ -1908,12 +2419,12 @@ void S60VideoCaptureSession::doPopulateVideoCodecsL()
#ifdef S60_DEVVIDEO_RECORDING_SUPPORTED
for (int j = 0; j < m_videoParametersForEncoder.size(); ++j) {
if (m_videoParametersForEncoder[j].mimeTypes.contains(codecMimeType, Qt::CaseInsensitive)) {
- m_videoCodeclist << codecMimeType;
+ m_videoCodecList << codecMimeType;
break;
}
}
#else // CVideoRecorderUtility
- m_videoCodeclist << codecMimeType;
+ m_videoCodecList << codecMimeType;
#endif // S60_DEVVIDEO_RECORDING_SUPPORTED
}
CleanupStack::PopAndDestroy(videoTypes);
@@ -1933,10 +2444,10 @@ void S60VideoCaptureSession::doPopulateMaxVideoParameters()
m_videoParametersForEncoder.append(MaxResolutionRatesAndTypes()); // For MPEG-4
m_videoParametersForEncoder.append(MaxResolutionRatesAndTypes()); // For H.264
- for (int i = 0; i < m_videoCodeclist.count(); ++i) {
+ for (int i = 0; i < m_videoCodecList.count(); ++i) {
// Use all lower case for comparisons
- QString codec = m_videoCodeclist[i].toLower();
+ QString codec = m_videoCodecList[i].toLower();
if (codec.contains("video/h263-2000", Qt::CaseInsensitive)) {
// H.263
diff --git a/plugins/multimedia/symbian/ecam/s60videocapturesession.h b/plugins/multimedia/symbian/ecam/s60videocapturesession.h
index 4144b1af74..86ad28c253 100644
--- a/plugins/multimedia/symbian/ecam/s60videocapturesession.h
+++ b/plugins/multimedia/symbian/ecam/s60videocapturesession.h
@@ -59,6 +59,8 @@
QT_USE_NAMESPACE
+class QTimer;
+
/*
* VideoSession is the main class handling all video recording related
* operations. It uses mainly CVideoRecorderUtility to do it's tasks, but if
@@ -72,7 +74,6 @@ class S60VideoCaptureSession : public QObject,
#endif // S60_DEVVIDEO_RECORDING_SUPPORTED
{
Q_OBJECT
- Q_PROPERTY(qint64 position READ position NOTIFY positionChanged)
Q_ENUMS(Error)
Q_ENUMS(EcamErrors)
Q_ENUMS(TVideoCaptureState)
@@ -138,6 +139,7 @@ public: // Methods
void setError(const TInt error, const QString &description);
void setCameraHandle(CCameraEngine* cameraHandle);
+ void notifySettingsSet();
qint64 position();
TVideoCaptureState state() const;
@@ -181,8 +183,8 @@ public: // Methods
QStringList supportedAudioCaptureCodecs();
// Encoder Settings
- void videoEncoderSettings(QVideoEncoderSettings &videoSettings) const;
- void audioEncoderSettings(QAudioEncoderSettings &audioSettings) const;
+ void videoEncoderSettings(QVideoEncoderSettings &videoSettings);
+ void audioEncoderSettings(QAudioEncoderSettings &audioSettings);
// Quality
void setVideoCaptureQuality(const QtMultimediaKit::EncodingQuality quality,
@@ -219,6 +221,9 @@ private: // Internal
void initializeVideoCaptureSettings();
void doInitializeVideoRecorderL();
void commitVideoEncoderSettings();
+ void queryAudioEncoderSettings();
+ void queryVideoEncoderSettings();
+ void validateRequestedCodecs();
void resetSession();
void doSetCodecsL(const QString &aCodec, const QString &vCodec);
@@ -235,15 +240,15 @@ private: // Internal
void doPopulateVideoCodecsDataL();
void doPopulateVideoCodecsL();
#ifndef S60_DEVVIDEO_RECORDING_SUPPORTED
- void doPopulateMaxVideoParameters();
+ void doPopulateMaxVideoParameters();
#endif // S60_DEVVIDEO_RECORDING_SUPPORTED
- void doPopulateAudioCodecsL();
+ void doPopulateAudioCodecsL();
- QList<int> doGetSupportedSampleRatesL(const QAudioEncoderSettings &settings,
+ QList<int> doGetSupportedSampleRatesL(const QAudioEncoderSettings &settings,
bool *continuous);
- QSize maximumResolutionForMimeType(const QString &mimeType) const;
- qreal maximumFrameRateForMimeType(const QString &mimeType) const;
- int maximumBitRateForMimeType(const QString &mimeType) const;
+ QSize maximumResolutionForMimeType(const QString &mimeType) const;
+ qreal maximumFrameRateForMimeType(const QString &mimeType) const;
+ int maximumBitRateForMimeType(const QString &mimeType) const;
Q_SIGNALS: // Notification Signals
@@ -255,6 +260,7 @@ Q_SIGNALS: // Notification Signals
private Q_SLOTS: // Internal Slots
void cameraStatusChanged(QCamera::Status);
+ void durationTimerTriggered();
private: // Structs
@@ -325,6 +331,8 @@ private: // Data
CCameraEngine *m_cameraEngine;
CVideoRecorderUtility *m_videoRecorder;
+ QTimer *m_durationTimer;
+ qint64 m_position;
// Symbian ErrorCode
mutable int m_error;
// This defines whether Camera is in ActiveStatus or not
@@ -343,8 +351,8 @@ private: // Data
// Requested audioSettings. The may not be active settings before those are
// committed (with commitVideoEncoderSettings())
QAudioEncoderSettings m_audioSettings;
- // Symbian Video Quality
- int m_videoQuality;
+ // Tells whether settings should be initialized when changing the camera
+ bool m_captureSettingsSet;
// Active container
QString m_container;
// Requested container, this may be different from m_container if
@@ -357,9 +365,9 @@ private: // Data
// Maximum ClipSize in Bytes
int m_maxClipSize;
// List of supported video codec mime types
- QStringList m_videoCodeclist;
+ QStringList m_videoCodecList;
// Hash of supported video codec mime types and corresponding FourCC codes
- QHash<QString, TFourCC> m_audioCodeclist;
+ QHash<QString, TFourCC> m_audioCodecList;
// Map of video capture controllers information. It is populated during
// doUpdateVideoCaptureContainersL().
//
diff --git a/plugins/multimedia/symbian/ecam/s60videoencodercontrol.cpp b/plugins/multimedia/symbian/ecam/s60videoencodercontrol.cpp
index 25e67249aa..c0d1ec73b5 100644
--- a/plugins/multimedia/symbian/ecam/s60videoencodercontrol.cpp
+++ b/plugins/multimedia/symbian/ecam/s60videoencodercontrol.cpp
@@ -103,20 +103,19 @@ QStringList S60VideoEncoderControl::supportedEncodingOptions(const QString &code
QVariant S60VideoEncoderControl::encodingOption(const QString &codec, const QString &name) const
{
+ Q_UNUSED(codec);
+
// Possible settings: EncodingMode, Codec, Resolution, FrameRate, BitRate, Quality
// Possible (codec specific) options: PixelAspectRatio, Gain, MaxClipSizeInBytes
QVariant returnValue;
- if(qstrcmp(name.toLocal8Bit().constData(), "pixelAspectRatio") == 0) {
+ if (qstrcmp(name.toLocal8Bit().constData(), "pixelAspectRatio") == 0)
returnValue.setValue(m_session->pixelAspectRatio());
- }
- else if(qstrcmp(name.toLocal8Bit().constData(), "gain") == 0) {
+ else if (qstrcmp(name.toLocal8Bit().constData(), "gain") == 0)
returnValue.setValue((int)m_session->gain());
- }
- else if(qstrcmp(name.toLocal8Bit().constData(), "maxClipSizeInBytes") == 0) {
+ else if (qstrcmp(name.toLocal8Bit().constData(), "maxClipSizeInBytes") == 0)
returnValue.setValue(m_session->maxClipSizeInBytes());
- }
return returnValue;
}
@@ -127,18 +126,14 @@ void S60VideoEncoderControl::setEncodingOption(
// Set the codec first if not already set
m_session->setVideoCaptureCodec(codec);
- if(qstrcmp(name.toLocal8Bit().constData(), "pixelAspectRatio") == 0) {
+ if (qstrcmp(name.toLocal8Bit().constData(), "pixelAspectRatio") == 0)
m_session->setPixelAspectRatio(value.toSize());
- }
- else if(qstrcmp(name.toLocal8Bit().constData(), "gain") == 0) {
+ else if (qstrcmp(name.toLocal8Bit().constData(), "gain") == 0)
m_session->setGain(value.toInt());
- }
- else if(qstrcmp(name.toLocal8Bit().constData(), "maxClipSizeInBytes") == 0) {
+ else if (qstrcmp(name.toLocal8Bit().constData(), "maxClipSizeInBytes") == 0)
m_session->setMaxClipSizeInBytes(value.toInt());
- }
- else {
+ else
m_session->setError(KErrNotSupported, QString("Requested encoding option is not supported"));
- }
}
QVideoEncoderSettings S60VideoEncoderControl::videoSettings() const
@@ -151,41 +146,55 @@ QVideoEncoderSettings S60VideoEncoderControl::videoSettings() const
void S60VideoEncoderControl::setVideoSettings(const QVideoEncoderSettings &settings)
{
- if (settings.codec().isEmpty()) {
+ // Notify that settings have been implicitly set and there's no need to
+ // initialize them in case camera is changed
+ m_session->notifySettingsSet();
+
+ if (settings.codec().isEmpty()
+ || (settings.resolution() == QSize(-1,-1) && settings.frameRate() == 0 && settings.bitRate() == -1)) {
+ if (!settings.codec().isEmpty())
+ m_session->setVideoCaptureCodec(settings.codec());
+ m_session->setVideoEncodingMode(settings.encodingMode());
m_session->setVideoCaptureQuality(settings.quality(), S60VideoCaptureSession::EOnlyVideoQuality);
- } else if (settings.resolution() != QSize() && settings.frameRate() == 0 && settings.bitRate() == -1) { // Only Resolution
+ } else if (settings.resolution() != QSize(-1,-1) && settings.frameRate() == 0 && settings.bitRate() == -1) { // Only Resolution
m_session->setVideoCaptureCodec(settings.codec());
m_session->setVideoEncodingMode(settings.encodingMode());
m_session->setVideoResolution(settings.resolution());
m_session->setVideoCaptureQuality(settings.quality(), S60VideoCaptureSession::EVideoQualityAndResolution);
- } else if (settings.resolution() != QSize() && settings.frameRate() == 0 && settings.bitRate() == -1) { // Only Framerate
+
+ } else if (settings.resolution() == QSize(-1,-1) && settings.frameRate() != 0 && settings.bitRate() == -1) { // Only Framerate
m_session->setVideoCaptureCodec(settings.codec());
m_session->setVideoEncodingMode(settings.encodingMode());
m_session->setFrameRate(settings.frameRate());
m_session->setVideoCaptureQuality(settings.quality(), S60VideoCaptureSession::EVideoQualityAndFrameRate);
- } else if (settings.resolution() != QSize() && settings.frameRate() == 0 && settings.bitRate() == -1) { // Only BitRate
+
+ } else if (settings.resolution() == QSize(-1,-1) && settings.frameRate() == 0 && settings.bitRate() != -1) { // Only BitRate
m_session->setVideoCaptureCodec(settings.codec());
m_session->setVideoEncodingMode(settings.encodingMode());
m_session->setBitrate(settings.bitRate());
m_session->setVideoCaptureQuality(settings.quality(), S60VideoCaptureSession::EVideoQualityAndBitRate);
- } else if (settings.resolution() != QSize() && settings.frameRate() == 0 && settings.bitRate() == -1) { // Resolution and FrameRate
+
+ } else if (settings.resolution() != QSize(-1,-1) && settings.frameRate() != 0 && settings.bitRate() == -1) { // Resolution and FrameRate
m_session->setVideoCaptureCodec(settings.codec());
m_session->setVideoEncodingMode(settings.encodingMode());
m_session->setVideoResolution(settings.resolution());
m_session->setFrameRate(settings.frameRate());
m_session->setVideoCaptureQuality(settings.quality(), S60VideoCaptureSession::EVideoQualityAndResolutionAndFrameRate);
- } else if (settings.resolution() != QSize() && settings.frameRate() == 0 && settings.bitRate() == -1) { // Resolution and BitRate
+
+ } else if (settings.resolution() != QSize(-1,-1) && settings.frameRate() == 0 && settings.bitRate() != -1) { // Resolution and BitRate
m_session->setVideoCaptureCodec(settings.codec());
m_session->setVideoEncodingMode(settings.encodingMode());
m_session->setVideoResolution(settings.resolution());
m_session->setBitrate(settings.bitRate());
m_session->setVideoCaptureQuality(settings.quality(), S60VideoCaptureSession::EVideoQualityAndResolutionAndBitRate);
- } else if (settings.resolution() != QSize() && settings.frameRate() == 0 && settings.bitRate() == -1) { // FrameRate and BitRate
+
+ } else if (settings.resolution() == QSize(-1,-1) && settings.frameRate() != 0 && settings.bitRate() != -1) { // FrameRate and BitRate
m_session->setVideoCaptureCodec(settings.codec());
m_session->setVideoEncodingMode(settings.encodingMode());
m_session->setFrameRate(settings.frameRate());
m_session->setBitrate(settings.bitRate());
m_session->setVideoCaptureQuality(settings.quality(), S60VideoCaptureSession::EVideoQualityAndFrameRateAndBitRate);
+
} else { // All: Resolution, BitRate and FrameRate
m_session->setVideoCaptureCodec(settings.codec());
m_session->setVideoEncodingMode(settings.encodingMode());
diff --git a/plugins/multimedia/symbian/ecam/s60videowidgetcontrol.cpp b/plugins/multimedia/symbian/ecam/s60videowidgetcontrol.cpp
index d3141d4819..30a859e7cd 100644
--- a/plugins/multimedia/symbian/ecam/s60videowidgetcontrol.cpp
+++ b/plugins/multimedia/symbian/ecam/s60videowidgetcontrol.cpp
@@ -49,7 +49,6 @@
#include <coecntrl.h> // CCoeControl
#include <w32std.h>
-
S60ViewFinderWidget::S60ViewFinderWidget(QWidget *parent):
QLabel(parent),
m_isDirect(false) // Bitmap as default
@@ -208,9 +207,8 @@ Qt::AspectRatioMode S60VideoWidgetControl::aspectRatioMode() const
void S60VideoWidgetControl::setAspectRatioMode(Qt::AspectRatioMode ratio)
{
- if (m_aspectRatioMode == ratio) {
+ if (m_aspectRatioMode == ratio)
return;
- }
m_aspectRatioMode = ratio;
if (!m_isViewFinderDirect) {
diff --git a/plugins/multimedia/symbian/mmf/mediaplayer/mediaplayer_s60.pri b/plugins/multimedia/symbian/mmf/mediaplayer/mediaplayer_s60.pri
index eea69f95d1..3fcf8981b2 100644
--- a/plugins/multimedia/symbian/mmf/mediaplayer/mediaplayer_s60.pri
+++ b/plugins/multimedia/symbian/mmf/mediaplayer/mediaplayer_s60.pri
@@ -88,3 +88,12 @@ exists($$[QT_INSTALL_HEADERS]/QtGui/private/qwidget_p.h) {
DEFINES += USE_PRIVATE_QWIDGET_METHODS
message("Enabling use of private QWidget methods")
}
+
+contains(S60_VERSION, 3.1) {
+ DEFINES += PLAY_RATE_NOT_SUPPORTED
+ message("S60 version 3.1 does not support setplaybackrate")
+}
+contains(S60_VERSION, 3.2) {
+ DEFINES += PLAY_RATE_NOT_SUPPORTED
+ message("S60 version 3.2 does not support setplaybackrate")
+}
diff --git a/plugins/multimedia/symbian/mmf/mediaplayer/s60audioplayersession.cpp b/plugins/multimedia/symbian/mmf/mediaplayer/s60audioplayersession.cpp
index 2034ba08d6..938810a55d 100644
--- a/plugins/multimedia/symbian/mmf/mediaplayer/s60audioplayersession.cpp
+++ b/plugins/multimedia/symbian/mmf/mediaplayer/s60audioplayersession.cpp
@@ -111,15 +111,16 @@ void S60AudioPlayerSession::MaloLoadingComplete()
void S60AudioPlayerSession::doPlay()
{
-// For some reason loading progress callbalck are not called on emulator
-#ifdef __WINSCW__
- buffering();
-#endif
- m_player->Play();
-#ifdef __WINSCW__
- buffered();
-#endif
-
+ // For some reason loading progress callback are not called on emulator
+ // Same is the case with hardware. Will be fixed as part of QTMOBILITY-782.
+
+ //#ifdef __WINSCW__
+ buffering();
+ //#endif
+ m_player->Play();
+ //#ifdef __WINSCW__
+ buffered();
+ //#endif
}
void S60AudioPlayerSession::doPauseL()
@@ -163,6 +164,16 @@ void S60AudioPlayerSession::updateMetaDataEntriesL()
emit metaDataChanged();
}
+
+void S60AudioPlayerSession::setPlaybackRate(qreal rate)
+{
+ /*set playback rate is not supported so returning
+ not supported error.*/
+ Q_UNUSED(rate);
+ int err = KErrNotSupported;
+ setError(err);
+}
+
int S60AudioPlayerSession::doGetBufferStatusL() const
{
int progress = 0;
diff --git a/plugins/multimedia/symbian/mmf/mediaplayer/s60audioplayersession.h b/plugins/multimedia/symbian/mmf/mediaplayer/s60audioplayersession.h
index 4fe020f591..9655809d91 100644
--- a/plugins/multimedia/symbian/mmf/mediaplayer/s60audioplayersession.h
+++ b/plugins/multimedia/symbian/mmf/mediaplayer/s60audioplayersession.h
@@ -90,6 +90,7 @@ public:
// From S60MediaPlayerAudioEndpointSelector
QString activeEndpoint() const;
QString defaultEndpoint() const;
+ void setPlaybackRate(qreal rate);
public Q_SLOTS:
void setActiveEndpoint(const QString& name);
diff --git a/plugins/multimedia/symbian/mmf/mediaplayer/s60mediaplayercontrol.cpp b/plugins/multimedia/symbian/mmf/mediaplayer/s60mediaplayercontrol.cpp
index 7568417576..6af9d9992c 100644
--- a/plugins/multimedia/symbian/mmf/mediaplayer/s60mediaplayercontrol.cpp
+++ b/plugins/multimedia/symbian/mmf/mediaplayer/s60mediaplayercontrol.cpp
@@ -127,15 +127,24 @@ QMediaTimeRange S60MediaPlayerControl::availablePlaybackRanges() const
qreal S60MediaPlayerControl::playbackRate() const
{
- // Playback rate retrieving is not supported in Symbian
return m_mediaSettings.playbackRate();
}
void S60MediaPlayerControl::setPlaybackRate(qreal rate)
{
- // Playback rate setting is not supported in Symbian
- m_mediaSettings.setPlaybackRate(rate);
- emit playbackRateChanged(playbackRate());
+ //getting the current playbackrate
+ qreal currentPBrate = m_mediaSettings.playbackRate();
+ //checking if we need to change the Playback rate
+ if (!qFuzzyCompare(currentPBrate,rate))
+ {
+ if(m_session)
+ m_session->setPlaybackRate(rate);
+
+ m_mediaSettings.setPlaybackRate(rate);
+
+ emit playbackRateChanged(playbackRate());
+ }
+
}
diff --git a/plugins/multimedia/symbian/mmf/mediaplayer/s60mediaplayercontrol.h b/plugins/multimedia/symbian/mmf/mediaplayer/s60mediaplayercontrol.h
index b392957cad..e86fab82dc 100644
--- a/plugins/multimedia/symbian/mmf/mediaplayer/s60mediaplayercontrol.h
+++ b/plugins/multimedia/symbian/mmf/mediaplayer/s60mediaplayercontrol.h
@@ -77,7 +77,7 @@ public:
void setVolume(int volume) { m_volume = volume; }
void setMuted(bool muted) { m_muted = muted; }
- void setPlaybackRate(int rate) { m_playbackRate = rate; }
+ void setPlaybackRate(qreal rate) { m_playbackRate = rate; }
void setMediaStatus(QMediaPlayer::MediaStatus status) {m_mediaStatus=status;}
void setAudioEndpoint(const QString& audioEndpoint) { m_audioEndpoint = audioEndpoint; }
void setMediaType(S60MediaSettings::TMediaType type) { m_mediaType = type; }
diff --git a/plugins/multimedia/symbian/mmf/mediaplayer/s60mediaplayersession.cpp b/plugins/multimedia/symbian/mmf/mediaplayer/s60mediaplayersession.cpp
index c0b3d6c05a..208bb8c144 100644
--- a/plugins/multimedia/symbian/mmf/mediaplayer/s60mediaplayersession.cpp
+++ b/plugins/multimedia/symbian/mmf/mediaplayer/s60mediaplayersession.cpp
@@ -414,8 +414,12 @@ void S60MediaPlayerSession::loaded()
void S60MediaPlayerSession::endOfMedia()
{
+ m_state = QMediaPlayer::StoppedState;
setMediaStatus(QMediaPlayer::EndOfMedia);
- setState(QMediaPlayer::StoppedState);
+ //there is a chance that user might have called play from EOF callback
+ //if we are already in playing state, do not send state change callback
+ if(m_state == QMediaPlayer::StoppedState)
+ emit stateChanged(QMediaPlayer::StoppedState);
emit positionChanged(0);
}
diff --git a/plugins/multimedia/symbian/mmf/mediaplayer/s60mediaplayersession.h b/plugins/multimedia/symbian/mmf/mediaplayer/s60mediaplayersession.h
index fadab0b119..cf9d2825f2 100644
--- a/plugins/multimedia/symbian/mmf/mediaplayer/s60mediaplayersession.h
+++ b/plugins/multimedia/symbian/mmf/mediaplayer/s60mediaplayersession.h
@@ -93,6 +93,7 @@ public:
void setMediaStatus(QMediaPlayer::MediaStatus);
void setState(QMediaPlayer::State state);
void setAudioEndpoint(const QString& audioEndpoint);
+ virtual void setPlaybackRate(qreal rate) = 0;
protected:
virtual void doLoadL(const TDesC &path) = 0;
diff --git a/plugins/multimedia/symbian/mmf/mediaplayer/s60videoplayersession.cpp b/plugins/multimedia/symbian/mmf/mediaplayer/s60videoplayersession.cpp
index 251e47c871..54912d4547 100644
--- a/plugins/multimedia/symbian/mmf/mediaplayer/s60videoplayersession.cpp
+++ b/plugins/multimedia/symbian/mmf/mediaplayer/s60videoplayersession.cpp
@@ -79,6 +79,7 @@ S60VideoPlayerSession::S60VideoPlayerSession(QMediaService *service)
0,
EMdaPriorityPreferenceNone
));
+ m_player->RegisterForVideoLoadingNotification(*this);
#else
RWindow *window = 0;
QRect rect;
@@ -133,6 +134,22 @@ void S60VideoPlayerSession::doLoadL(const TDesC &path)
m_player->OpenFileL(path);
}
+void S60VideoPlayerSession::setPlaybackRate(qreal rate)
+{
+ /*
+ * setPlaybackRate is not supported in S60 3.1 and 3.2
+ * This flag will be defined for 3.1 and 3.2
+ */
+#ifndef PLAY_RATE_NOT_SUPPORTED
+ //setPlayVelocity requires rate in the form of
+ //50 = 0.5x ;100 = 1.x ; 200 = 2.x ; 300 = 3.x
+ //so multiplying rate with 100
+ TRAPD(err, m_player->SetPlayVelocityL((TInt)(rate*100)));
+ setError(err);
+#endif
+
+}
+
void S60VideoPlayerSession::doLoadUrlL(const TDesC &path)
{
#ifdef HAS_AUDIOROUTING_IN_VIDEOPLAYER
@@ -289,7 +306,13 @@ bool S60VideoPlayerSession::isAudioAvailable()
void S60VideoPlayerSession::doPlay()
{
+ //temporary hack for bufferring.. To be removed when register for notification is enabled
+ buffering();
+
m_player->Play();
+
+ //temporary.. To be removed when register for notification is enabled
+ buffered();
}
void S60VideoPlayerSession::doPauseL()
diff --git a/plugins/multimedia/symbian/mmf/mediaplayer/s60videoplayersession.h b/plugins/multimedia/symbian/mmf/mediaplayer/s60videoplayersession.h
index c8d3f0c25e..0dbea26669 100644
--- a/plugins/multimedia/symbian/mmf/mediaplayer/s60videoplayersession.h
+++ b/plugins/multimedia/symbian/mmf/mediaplayer/s60videoplayersession.h
@@ -82,7 +82,7 @@ public:
// From MVideoLoadingObserver
void MvloLoadingStarted();
void MvloLoadingComplete();
-
+ void setPlaybackRate(qreal rate);
#ifdef HAS_AUDIOROUTING_IN_VIDEOPLAYER
// From MAudioOutputObserver
void DefaultAudioOutputChanged(CAudioOutput& aAudioOutput,
diff --git a/plugins/multimedia/symbian/mmf/radio/s60radiotunercontrol_since32.cpp b/plugins/multimedia/symbian/mmf/radio/s60radiotunercontrol_since32.cpp
index 976d0ccd20..9eb5c06ed3 100644
--- a/plugins/multimedia/symbian/mmf/radio/s60radiotunercontrol_since32.cpp
+++ b/plugins/multimedia/symbian/mmf/radio/s60radiotunercontrol_since32.cpp
@@ -341,6 +341,9 @@ void S60RadioTunerControl::MrpoStateChange(TPlayerState aState, TInt aError)
m_apiTunerState = QRadioTuner::ActiveState;
}
}
+ else {
+ m_apiTunerState = QRadioTuner::StoppedState;
+ }
emit stateChanged(m_apiTunerState);
}
diff --git a/plugins/organizer/maemo5/maemo5.pro b/plugins/organizer/maemo5/maemo5.pro
index b084112dee..6bdf9d4ca6 100644
--- a/plugins/organizer/maemo5/maemo5.pro
+++ b/plugins/organizer/maemo5/maemo5.pro
@@ -22,14 +22,14 @@ HEADERS += qorganizermaemo5_p.h \
qorganizermaemo5ids_p.h \
qorganizerrecurrencetransform.h \
qorganizeritemtransform.h \
- qorganizerasynchprocess.h \
+ ../mkcal/qorganizerasynchmanager.h \
qorganizercaldbaccess.h \
qorganizerdbcache.h \
qorganizerdbcachewrappers.h
SOURCES += qorganizermaemo5.cpp \
qorganizerrecurrencetransform.cpp \
qorganizeritemtransform.cpp \
- qorganizerasynchprocess.cpp \
+ ../mkcal/qorganizerasynchmanager.cpp \
qorganizercaldbaccess.cpp \
qorganizerdbcache.cpp \
qorganizerdbcachewrappers.cpp
diff --git a/plugins/organizer/maemo5/qorganizerasynchprocess.cpp b/plugins/organizer/maemo5/qorganizerasynchprocess.cpp
deleted file mode 100644
index 9d1cc8be04..0000000000
--- a/plugins/organizer/maemo5/qorganizerasynchprocess.cpp
+++ /dev/null
@@ -1,410 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qorganizerasynchprocess.h"
-#include "qtorganizer.h"
-#include "qorganizermaemo5_p.h"
-#include "qorganizermaemo5ids_p.h"
-#include <QtCore/qtimer.h>
-#include <QtCore/qcoreapplication.h>
-
-QTM_USE_NAMESPACE
-
-OrganizerRequestTimeoutTimer::OrganizerRequestTimeoutTimer(QOrganizerAbstractRequest *req, int msecs)
- : m_req(req)
-{
- m_timeoutTimer = new QTimer();
- connect(m_timeoutTimer, SIGNAL(timeout()), this, SLOT(internalTimeout()));
- m_timeoutTimer->setSingleShot(true);
- m_timeoutTimer->start(msecs);
-}
-
-OrganizerRequestTimeoutTimer::~OrganizerRequestTimeoutTimer()
-{
- delete m_timeoutTimer;
-}
-
-QOrganizerAbstractRequest* OrganizerRequestTimeoutTimer::request() const
-{
- return m_req;
-}
-
-void OrganizerRequestTimeoutTimer::internalTimeout()
-{
- emit timeout(this);
-}
-
-OrganizerAsynchProcess::OrganizerAsynchProcess(QOrganizerItemMaemo5Engine* engine)
- : m_engine(engine), m_quitNow(false)
-{
- start();
- QObject::moveToThread(this);
-}
-
-void OrganizerAsynchProcess::run()
-{
- while(!m_quitNow) {
- yieldCurrentThread();
- processRequest();
- }
-
- // Inform that the thread quits now
- m_quitNow = false;
-}
-
-OrganizerAsynchProcess::~OrganizerAsynchProcess()
-{
- // Tell thread to quit
- m_quitNow = true;
-
- // Wait for run() to exit
- while(m_quitNow)
- yieldCurrentThread();
-}
-
-void OrganizerAsynchProcess::requestDestroyed(QOrganizerAbstractRequest *req)
-{
- bool requestRemoved = false;
-
- m_mainMutex.lock();
- if (m_requestQueue.contains(req)) {
- m_requestQueue.removeOne(req);
- requestRemoved = true;
- }
- m_mainMutex.unlock();
-
- if (!requestRemoved && req->state() != QOrganizerAbstractRequest::FinishedState)
- waitForRequestFinished(req);
-}
-
-bool OrganizerAsynchProcess::addRequest(QOrganizerAbstractRequest *req)
-{
- m_mainMutex.lock();
- m_requestQueue.enqueue(req);
- m_mainMutex.unlock();
- QOrganizerManagerEngine::updateRequestState(req, QOrganizerAbstractRequest::ActiveState);
- return true;
-}
-
-bool OrganizerAsynchProcess::cancelRequest(QOrganizerAbstractRequest *req)
-{
- m_mainMutex.lock();
-
- if (m_requestQueue.contains(req)) {
- QOrganizerManagerEngine::updateRequestState(req, QOrganizerAbstractRequest::CanceledState);
- m_requestQueue.removeOne(req);
- m_mainMutex.unlock();
- return true;
- }
- else {
- // cannot cancel request when processing has already begun
- m_mainMutex.unlock();
- return false;
- }
-}
-
-bool OrganizerAsynchProcess::waitForRequestFinished(QOrganizerAbstractRequest *req, int msecs)
-{
- if (req->state() == QOrganizerAbstractRequest::FinishedState) {
- return true;
- }
- else if (req->state() == QOrganizerAbstractRequest::CanceledState
- || req->state() == req->state() == QOrganizerAbstractRequest::InactiveState) {
- return false;
- }
-
- // Multiple timers are created to make this method thread safe.
- // There's a timer for each calling thread.
- OrganizerRequestTimeoutTimer* newTimer = new OrganizerRequestTimeoutTimer(req, msecs);
- connect(newTimer, SIGNAL(timeout(OrganizerRequestTimeoutTimer*)), this, SLOT(timeout(OrganizerRequestTimeoutTimer*)));
- m_timers << newTimer;
- return waitForRequestFinished(req);
-}
-
-bool OrganizerAsynchProcess::waitForRequestFinished(QOrganizerAbstractRequest *req)
-{
- m_activeRequests.insert(req);
-
- do {
- yieldCurrentThread();
- // Process events to allow the timeout timers to work
- QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers);
- } while(m_activeRequests.contains(req) && req->state() == QOrganizerAbstractRequest::ActiveState);
-
- m_timeoutMutex.lock();
- if (!m_activeRequests.contains(req)) {
- // timeout occurred
- m_timeoutMutex.unlock();
- return false;
- }
- else {
- // timeout not occurred
- m_activeRequests.remove(req);
-
- // cancel and remove timer
- QList<OrganizerRequestTimeoutTimer *>::iterator timer;
- for (timer = m_timers.begin(); timer != m_timers.end(); ++timer)
- if ((*timer)->request() == req)
- break;
- if (timer != m_timers.end()) {
- m_timers.removeOne(*timer);
- delete *timer;
- }
- m_timeoutMutex.unlock();
- return true;
- }
-}
-
-void OrganizerAsynchProcess::timeout(OrganizerRequestTimeoutTimer *timer)
-{
- m_timeoutMutex.lock();
- if (m_activeRequests.contains(timer->request())) {
- m_activeRequests.remove(timer->request());
- m_timers.removeOne(timer);
- delete timer;
- }
- m_timeoutMutex.unlock();
-}
-
-void OrganizerAsynchProcess::processRequest()
-{
- m_mainMutex.lock();
-
- if (m_requestQueue.isEmpty()) {
- m_mainMutex.unlock();
- return;
- }
-
- QOrganizerAbstractRequest *req = m_requestQueue.dequeue();
- if (req->state() != QOrganizerAbstractRequest::ActiveState) {
- m_mainMutex.unlock();
- return;
- }
-
- switch(req->type()) {
- case QOrganizerAbstractRequest::ItemFetchRequest:
- handleItemFetchRequest(static_cast<QOrganizerItemFetchRequest *>(req));
- break;
- case QOrganizerAbstractRequest::ItemFetchForExportRequest:
- handleItemFetchForExportRequest(static_cast<QOrganizerItemFetchForExportRequest *>(req));
- break;
- case QOrganizerAbstractRequest::ItemOccurrenceFetchRequest:
- handleItemOccurrenceFetchRequest(static_cast<QOrganizerItemOccurrenceFetchRequest *>(req));
- break;
- case QOrganizerAbstractRequest::ItemIdFetchRequest:
- handleIdFetchRequest(static_cast<QOrganizerItemIdFetchRequest *>(req));
- break;
- case QOrganizerAbstractRequest::ItemRemoveRequest:
- handleItemRemoveRequest(static_cast<QOrganizerItemRemoveRequest *>(req));
- break;
- case QOrganizerAbstractRequest::ItemSaveRequest:
- handleSaveRequest(static_cast<QOrganizerItemSaveRequest *>(req));
- break;
- case QOrganizerAbstractRequest::DetailDefinitionFetchRequest:
- handleDefinitionFetchRequest(static_cast<QOrganizerItemDetailDefinitionFetchRequest *>(req));
- break;
- case QOrganizerAbstractRequest::DetailDefinitionRemoveRequest:
- handleDefinitionRemoveRequest(static_cast<QOrganizerItemDetailDefinitionRemoveRequest *>(req));
- break;
- case QOrganizerAbstractRequest::DetailDefinitionSaveRequest:
- handleDefinitionSaveRequest(static_cast<QOrganizerItemDetailDefinitionSaveRequest *>(req));
- break;
- case QOrganizerAbstractRequest::CollectionFetchRequest:
- handleCollectionFetchRequest(static_cast<QOrganizerCollectionFetchRequest *>(req));
- break;
- case QOrganizerAbstractRequest::CollectionRemoveRequest:
- handleCollectionRemoveRequest(static_cast<QOrganizerCollectionRemoveRequest *>(req));
- break;
- case QOrganizerAbstractRequest::CollectionSaveRequest:
- handleCollectionSaveRequest(static_cast<QOrganizerCollectionSaveRequest *>(req));
- break;
-
- default:
- // invalid request
- break;
- }
-
- m_mainMutex.unlock();
-}
-
-void OrganizerAsynchProcess::handleItemFetchRequest(QOrganizerItemFetchRequest *req)
-{
- QOrganizerManager::Error err = QOrganizerManager::NoError;
- QList<QOrganizerItem> items = m_engine->items(req->startDate(), req->endDate(), req->filter(), req->sorting(), req->fetchHint(), &err);
- QOrganizerManagerEngine::updateItemFetchRequest(req, items, err, QOrganizerAbstractRequest::FinishedState);
-}
-
-void OrganizerAsynchProcess::handleItemFetchForExportRequest(QOrganizerItemFetchForExportRequest *req)
-{
- QOrganizerManager::Error err = QOrganizerManager::NoError;
- QList<QOrganizerItem> items = m_engine->itemsForExport(req->startDate(), req->endDate(), req->filter(), req->sorting(), req->fetchHint(), &err);
- QOrganizerManagerEngine::updateItemFetchForExportRequest(req, items, err, QOrganizerAbstractRequest::FinishedState);
-}
-
-void OrganizerAsynchProcess::handleItemOccurrenceFetchRequest(QOrganizerItemOccurrenceFetchRequest *req)
-{
- QOrganizerManager::Error err = QOrganizerManager::NoError;
- QList<QOrganizerItem> items = m_engine->itemOccurrences(req->parentItem(), req->startDate(), req->endDate(), req->maxOccurrences(), req->fetchHint(), &err);
- QOrganizerManagerEngine::updateItemOccurrenceFetchRequest(req, items, err, QOrganizerAbstractRequest::FinishedState);
-}
-
-void OrganizerAsynchProcess::handleIdFetchRequest(QOrganizerItemIdFetchRequest *req)
-{
- QOrganizerManager::Error err = QOrganizerManager::NoError;
- QList<QOrganizerItemId> ids = m_engine->itemIds(req->startDate(), req->endDate(), req->filter(), req->sorting(), &err);
- QOrganizerManagerEngine::updateItemIdFetchRequest(req, ids, err, QOrganizerAbstractRequest::FinishedState);
-}
-
-void OrganizerAsynchProcess::handleItemRemoveRequest(QOrganizerItemRemoveRequest *req)
-{
- QOrganizerManager::Error err = QOrganizerManager::NoError;
- QMap<int, QOrganizerManager::Error> errorMap;
- m_engine->removeItems(req->itemIds(), &errorMap, &err);
- QOrganizerManagerEngine::updateItemRemoveRequest(req, err, errorMap, QOrganizerAbstractRequest::FinishedState);
-}
-
-void OrganizerAsynchProcess::handleSaveRequest(QOrganizerItemSaveRequest *req)
-{
- QOrganizerManager::Error err = QOrganizerManager::NoError;
- QMap<int, QOrganizerManager::Error> errorMap;
- QList<QOrganizerItem> items = req->items();
- m_engine->saveItems(&items, &errorMap, &err);
- QOrganizerManagerEngine::updateItemSaveRequest(req, items, err, errorMap, QOrganizerAbstractRequest::FinishedState);
-}
-
-void OrganizerAsynchProcess::handleDefinitionFetchRequest(QOrganizerItemDetailDefinitionFetchRequest *req)
-{
- QOrganizerManager::Error err = QOrganizerManager::NoError;
- QMap<QString, QOrganizerItemDetailDefinition> definitions = m_engine->detailDefinitions(req->itemType(), &err);
- QMap<QString, QOrganizerItemDetailDefinition> retn;
- QMap<int, QOrganizerManager::Error> errorMap;
- QStringList keys = req->definitionNames();
- if (keys.isEmpty())
- keys = definitions.keys();
- int definitionsCount = keys.count();
- for (int i = 0; i < definitionsCount; ++i) {
- if (definitions.contains(keys.at(i)))
- retn.insert(keys.at(i), definitions[keys.at(i)]);
- else
- errorMap.insert(i, QOrganizerManager::DoesNotExistError);
- }
- QOrganizerManagerEngine::updateDefinitionFetchRequest(req, retn, err, errorMap, QOrganizerAbstractRequest::FinishedState);
-}
-
-void OrganizerAsynchProcess::handleDefinitionRemoveRequest(QOrganizerItemDetailDefinitionRemoveRequest *req)
-{
- QOrganizerManager::Error tempError = QOrganizerManager::NoError;
- QOrganizerManager::Error operationError = QOrganizerManager::NoError;
- QMap<int, QOrganizerManager::Error> errorMap;
- QStringList definitionNames = req->definitionNames();
- int nameCount = definitionNames.count();
- for(int i = 0; i < nameCount; ++i) {
- m_engine->removeDetailDefinition(definitionNames.at(i), req->itemType(), &tempError);
- if (tempError != QOrganizerManager::NoError) {
- errorMap.insert(i, tempError);
- operationError = tempError;
- }
- }
- QOrganizerManagerEngine::updateDefinitionRemoveRequest(req, operationError, errorMap, QOrganizerAbstractRequest::FinishedState);
-}
-
-void OrganizerAsynchProcess::handleDefinitionSaveRequest(QOrganizerItemDetailDefinitionSaveRequest *req)
-{
- QOrganizerManager::Error tempError = QOrganizerManager::NoError;
- QOrganizerManager::Error operationError = QOrganizerManager::NoError;
- QMap<int, QOrganizerManager::Error> errorMap;
- QList<QOrganizerItemDetailDefinition> definitions = req->definitions();
- int definitionCount = definitions.count();
- for (int i = 0; i < definitionCount; ++i) {
- m_engine->saveDetailDefinition(definitions.at(i), req->itemType(), &tempError);
- if (tempError != QOrganizerManager::NoError) {
- errorMap.insert(i, tempError);
- operationError = tempError;
- }
- }
- QOrganizerManagerEngine::updateDefinitionSaveRequest(req, definitions, operationError, errorMap, QOrganizerAbstractRequest::FinishedState);
-}
-
-void OrganizerAsynchProcess::handleCollectionFetchRequest(QOrganizerCollectionFetchRequest *req)
-{
- QOrganizerManager::Error err = QOrganizerManager::NoError;
- QList<QOrganizerCollection> collections = m_engine->collections(&err);
- QOrganizerManagerEngine::updateCollectionFetchRequest(req, collections, err, QOrganizerAbstractRequest::FinishedState);
-}
-
-void OrganizerAsynchProcess::handleCollectionRemoveRequest(QOrganizerCollectionRemoveRequest *req)
-{
- QOrganizerManager::Error tempError = QOrganizerManager::NoError;
- QOrganizerManager::Error operationError = QOrganizerManager::NoError;
- QMap<int, QOrganizerManager::Error> errorMap;
- QOrganizerCollectionId currentId;
- QList<QOrganizerCollectionId> colsToRemove = req->collectionIds();
- int collectionsCount = colsToRemove.count();
- for (int i = 0; i < collectionsCount; ++i) {
- currentId = colsToRemove.at(i);
- m_engine->removeCollection(currentId, &tempError);
- if (tempError != QOrganizerManager::NoError) {
- errorMap.insert(i, tempError);
- operationError = tempError;
- }
- }
- QOrganizerManagerEngine::updateCollectionRemoveRequest(req, operationError, errorMap, QOrganizerAbstractRequest::FinishedState);
-}
-
-void OrganizerAsynchProcess::handleCollectionSaveRequest(QOrganizerCollectionSaveRequest *req)
-{
- QOrganizerManager::Error tempError = QOrganizerManager::NoError;
- QOrganizerManager::Error operationError = QOrganizerManager::NoError;
- QMap<int, QOrganizerManager::Error> errorMap;
- QList<QOrganizerCollection> collections = req->collections();
- QList<QOrganizerCollection> retn;
- int collectionsCount = collections.count();
- for (int i = 0; i < collectionsCount; ++i) {
- QOrganizerCollection collection = collections.at(i);
- m_engine->saveCollection(&collection, &tempError);
- retn << collection;
- if (tempError != QOrganizerManager::NoError) {
- errorMap.insert(i, tempError);
- operationError = tempError;
- }
- }
- QOrganizerManagerEngine::updateCollectionSaveRequest(req, retn, operationError, errorMap, QOrganizerAbstractRequest::FinishedState);
-}
diff --git a/plugins/organizer/maemo5/qorganizerasynchprocess.h b/plugins/organizer/maemo5/qorganizerasynchprocess.h
deleted file mode 100644
index 1904140d7d..0000000000
--- a/plugins/organizer/maemo5/qorganizerasynchprocess.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QORGANIZERASYNCHPROCESS_H
-#define QORGANIZERASYNCHPROCESS_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qtorganizer.h"
-#include <QtCore/qthread.h>
-#include <QtCore/qqueue.h>
-#include <QtCore/qmutex.h>
-#include <QtCore/qmap.h>
-#include <QtCore/qtimer.h>
-
-QTM_USE_NAMESPACE
-
-class QOrganizerItemMaemo5Engine;
-
-class OrganizerRequestTimeoutTimer : public QObject
-{
- Q_OBJECT
-
-public:
- OrganizerRequestTimeoutTimer(QOrganizerAbstractRequest *req, int msecs);
- ~OrganizerRequestTimeoutTimer();
-
- QOrganizerAbstractRequest *request() const;
-
-private Q_SLOTS:
- void internalTimeout();
-
-Q_SIGNALS:
- void timeout(OrganizerRequestTimeoutTimer* timer);
-
-private:
- QTimer* m_timeoutTimer;
- QOrganizerAbstractRequest *m_req;
-};
-
-
-class OrganizerAsynchProcess : public QThread
-{
- Q_OBJECT
-
-public:
- OrganizerAsynchProcess(QOrganizerItemMaemo5Engine *engine);
- ~OrganizerAsynchProcess();
-
- void requestDestroyed(QOrganizerAbstractRequest *req);
- bool addRequest(QOrganizerAbstractRequest *req);
- bool cancelRequest(QOrganizerAbstractRequest *req);
- bool waitForRequestFinished(QOrganizerAbstractRequest *req, int msecs);
-
-protected:
- void processRequest();
- void run();
-
-private:
- bool waitForRequestFinished(QOrganizerAbstractRequest *req);
-
- void handleItemFetchRequest(QOrganizerItemFetchRequest *req);
- void handleItemFetchForExportRequest(QOrganizerItemFetchForExportRequest *req);
- void handleItemOccurrenceFetchRequest(QOrganizerItemOccurrenceFetchRequest *req);
- void handleIdFetchRequest(QOrganizerItemIdFetchRequest *req);
- void handleItemRemoveRequest(QOrganizerItemRemoveRequest *req);
- void handleSaveRequest(QOrganizerItemSaveRequest *req);
- void handleDefinitionFetchRequest(QOrganizerItemDetailDefinitionFetchRequest *req);
- void handleDefinitionRemoveRequest(QOrganizerItemDetailDefinitionRemoveRequest *req);
- void handleDefinitionSaveRequest(QOrganizerItemDetailDefinitionSaveRequest *req);
- void handleCollectionFetchRequest(QOrganizerCollectionFetchRequest *req);
- void handleCollectionRemoveRequest(QOrganizerCollectionRemoveRequest *req);
- void handleCollectionSaveRequest(QOrganizerCollectionSaveRequest *req);
-
-private Q_SLOTS:
- void timeout(OrganizerRequestTimeoutTimer* timer);
-
-private:
- QOrganizerItemMaemo5Engine* m_engine;
- QQueue<QOrganizerAbstractRequest *> m_requestQueue;
- QList<OrganizerRequestTimeoutTimer *> m_timers;
- QSet<QOrganizerAbstractRequest *> m_activeRequests;
- QMutex m_mainMutex;
- QMutex m_timeoutMutex;
- bool m_quitNow;
-};
-
-#endif // QORGANIZERASYNCHPROCESS_H
diff --git a/plugins/organizer/maemo5/qorganizermaemo5.cpp b/plugins/organizer/maemo5/qorganizermaemo5.cpp
index bd0aea7f3b..2cacdebd06 100644
--- a/plugins/organizer/maemo5/qorganizermaemo5.cpp
+++ b/plugins/organizer/maemo5/qorganizermaemo5.cpp
@@ -255,7 +255,7 @@ QOrganizerItemMaemo5Engine::QOrganizerItemMaemo5Engine()
connect(&m_waitTimer, SIGNAL(timeout()), this, SIGNAL(dataChanged()));
d->m_itemTransformer.setManagerUri(managerUri());
- d->m_asynchProcess = new OrganizerAsynchProcess(this);
+ d->m_asynchManager = new OrganizerAsynchManager(this);
d->m_dbCache = new OrganizerDbCache();
connect(databaseMonitor, SIGNAL(fileChanged(const QString &)), d->m_dbCache, SLOT(invalidate()));
@@ -283,7 +283,7 @@ void QOrganizerItemMaemo5Engine::databaseChanged()
QOrganizerItemMaemo5Engine::~QOrganizerItemMaemo5Engine()
{
- delete d->m_asynchProcess;
+ delete d->m_asynchManager;
}
QString QOrganizerItemMaemo5Engine::managerName() const
@@ -1085,23 +1085,23 @@ bool QOrganizerItemMaemo5Engine::internalRemoveCollection(const QOrganizerCollec
bool QOrganizerItemMaemo5Engine::startRequest(QOrganizerAbstractRequest* req)
{
- d->m_asynchProcess->addRequest(req);
+ d->m_asynchManager->startRequest(req);
return true;
}
bool QOrganizerItemMaemo5Engine::cancelRequest(QOrganizerAbstractRequest* req)
{
- return d->m_asynchProcess->cancelRequest(req);
+ return d->m_asynchManager->cancelRequest(req);
}
bool QOrganizerItemMaemo5Engine::waitForRequestFinished(QOrganizerAbstractRequest* req, int msecs)
{
- return d->m_asynchProcess->waitForRequestFinished(req, msecs);
+ return d->m_asynchManager->waitForRequestFinished(req, msecs);
}
void QOrganizerItemMaemo5Engine::requestDestroyed(QOrganizerAbstractRequest* req)
{
- return d->m_asynchProcess->requestDestroyed(req);
+ return d->m_asynchManager->requestDestroyed(req);
}
bool QOrganizerItemMaemo5Engine::hasFeature(QOrganizerManager::ManagerFeature feature, const QString &itemType) const
diff --git a/plugins/organizer/maemo5/qorganizermaemo5_p.h b/plugins/organizer/maemo5/qorganizermaemo5_p.h
index ca5f91bf3d..02c527829d 100644
--- a/plugins/organizer/maemo5/qorganizermaemo5_p.h
+++ b/plugins/organizer/maemo5/qorganizermaemo5_p.h
@@ -76,7 +76,7 @@
#include "qorganizeritemchangeset.h"
#include "qorganizeritemtransform.h"
-#include "qorganizerasynchprocess.h"
+#include "../mkcal/qorganizerasynchmanager.h"
#include "qorganizercaldbaccess.h"
#include "qorganizerjournal.h"
@@ -129,7 +129,7 @@ public:
OrganizerItemTransform m_itemTransformer;
// asynchronous request handler instance
- OrganizerAsynchProcess *m_asynchProcess;
+ OrganizerAsynchManager *m_asynchManager;
// calendar database accessor instance
OrganizerCalendarDatabaseAccess* m_dbAccess;
diff --git a/plugins/organizer/maemo5/qorganizermaemo5ids_p.h b/plugins/organizer/maemo5/qorganizermaemo5ids_p.h
index 77863b20d3..ab9a270c3d 100644
--- a/plugins/organizer/maemo5/qorganizermaemo5ids_p.h
+++ b/plugins/organizer/maemo5/qorganizermaemo5ids_p.h
@@ -51,7 +51,7 @@ QTM_USE_NAMESPACE
class OrganizerCalendarDatabaseAccess;
class OrganizerItemTransform; // forward declare maemo5 transform.
class QOrganizerItemMaemo5Engine; // forward declare maemo5 engine.
-class OrganizerAsynchProcess; // forward declare maemo5 asynchronous process.
+class OrganizerAsynchManager; // forward declare maemo5 asynchronous process.
class QOrganizerCollectionMaemo5EngineId : public QOrganizerCollectionEngineId
{
@@ -76,7 +76,6 @@ public:
public:
quint32 m_localCollectionId;
- friend class OrganizerAsynchProcess;
};
class QOrganizerItemMaemo5EngineId : public QOrganizerItemEngineId
@@ -102,7 +101,6 @@ public:
public:
quint32 m_localItemId; // the maemo5 backend can use a single quint32 to uniquely identify an item in it.
- friend class OrganizerAsynchProcess;
};
inline QOrganizerItemId makeItemLocalId(quint32 id) {
diff --git a/plugins/organizer/mkcal/qorganizerasynchmanager.cpp b/plugins/organizer/mkcal/qorganizerasynchmanager.cpp
index fb693c6800..09d9c3700d 100644
--- a/plugins/organizer/mkcal/qorganizerasynchmanager.cpp
+++ b/plugins/organizer/mkcal/qorganizerasynchmanager.cpp
@@ -41,8 +41,6 @@
#include "qorganizerasynchmanager.h"
#include "qtorganizer.h"
-#include "mkcalengine.h"
-#include "mkcalid.h"
QTM_USE_NAMESPACE
diff --git a/plugins/sensors/simulator/simulator.pro b/plugins/sensors/simulator/simulator.pro
index f359651bf0..c424dcb52d 100644
--- a/plugins/sensors/simulator/simulator.pro
+++ b/plugins/sensors/simulator/simulator.pro
@@ -6,8 +6,8 @@ include(version.pri)
include(simulator.pri)
TEMPLATE = lib
-TARGET = $$qtLibraryTarget(qtsensors_simulator)
CONFIG += plugin
+TARGET = $$qtLibraryTarget(qtsensors_simulator)
include(../../../common.pri)
qtAddLibrary(QtMobilitySimulator)
symbian:TARGET.EPOCALLOWDLLDATA = 1
diff --git a/qtmobility.pro b/qtmobility.pro
index 1dff098117..3f8ce2b0dc 100644
--- a/qtmobility.pro
+++ b/qtmobility.pro
@@ -218,7 +218,7 @@ contains(build_demos, yes):SUBDIRS+=demos
qtmAppHeaders = include/QtContacts/* \
include/QtVersit/* \
include/QtVersitOrganizer/* \
- include/Organizer/*
+ include/QtOrganizer/*
qtmMwHeaders = include/QtBearer/* \
include/QtLocation/* \
diff --git a/src/contacts/qcontactmanager.cpp b/src/contacts/qcontactmanager.cpp
index 61bbf2a233..dce4a22435 100644
--- a/src/contacts/qcontactmanager.cpp
+++ b/src/contacts/qcontactmanager.cpp
@@ -261,7 +261,8 @@ QContactManager* QContactManager::fromUri(const QString& managerUri, QObject* pa
The default implementation for the platform will be created.
*/
QContactManager::QContactManager(QObject* parent)
- : QObject(parent)
+ : QObject(parent),
+ d(new QContactManagerData)
{
createEngine(QString(), QMap<QString, QString>());
}
diff --git a/src/gallery/qgalleryfilter.cpp b/src/gallery/qgalleryfilter.cpp
index 62781a0a60..1bfd238dff 100644
--- a/src/gallery/qgalleryfilter.cpp
+++ b/src/gallery/qgalleryfilter.cpp
@@ -404,7 +404,7 @@ void QGalleryIntersectionFilter::prepend(const QGalleryUnionFilter &filter)
void QGalleryIntersectionFilter::prepend(const QGalleryIntersectionFilter &filter)
{
- d->filters += filter.d->filters;
+ d->filters = filter.d->filters + d->filters;
}
/*!
@@ -691,7 +691,7 @@ void QGalleryUnionFilter::prepend(const QGalleryIntersectionFilter &filter)
void QGalleryUnionFilter::prepend(const QGalleryUnionFilter &filter)
{
- d->filters += filter.d->filters;
+ d->filters = filter.d->filters + d->filters;
}
/*!
diff --git a/src/global/qmobilitypluginsearch.h b/src/global/qmobilitypluginsearch.h
index 2f18571821..42242bee2c 100644
--- a/src/global/qmobilitypluginsearch.h
+++ b/src/global/qmobilitypluginsearch.h
@@ -144,6 +144,23 @@ inline QStringList mobilityPlugins(const QString& plugintype)
}
}
}
+
+ /* Add application path + plugintype */
+ QDir appldir(QCoreApplication::applicationDirPath());
+ if(appldir.cd(plugintype)){
+ if (!processed.contains(appldir.absolutePath())){
+ processed.insert(appldir.absolutePath());
+ QStringList files = appldir.entryList(QDir::Files);
+#if !defined QT_NO_DEBUG
+ if (showDebug)
+ qDebug() << "Looking for " << plugintype << " plugins in" << appldir.path() << files;
+#endif
+ for (int j=0; j < files.count(); j++) {
+ plugins << appldir.absoluteFilePath(files.at(j));
+ }
+ }
+ }
+
#if defined(Q_OS_SYMBIAN)
rfs.Close();
#endif
diff --git a/src/location/landmarks/qlandmark.h b/src/location/landmarks/qlandmark.h
index c63d5a7fdf..a66898e91c 100644
--- a/src/location/landmarks/qlandmark.h
+++ b/src/location/landmarks/qlandmark.h
@@ -106,7 +106,7 @@ private:
QTM_END_NAMESPACE
-Q_DECLARE_METATYPE(QTM_PREPEND_NAMESPACE(QLandmark));
+Q_DECLARE_METATYPE(QTM_PREPEND_NAMESPACE(QLandmark))
Q_DECLARE_TYPEINFO(QTM_PREPEND_NAMESPACE(QLandmark), Q_MOVABLE_TYPE);
diff --git a/src/location/landmarks/qlandmarkabstractrequest.cpp b/src/location/landmarks/qlandmarkabstractrequest.cpp
index 1f25badb3f..d40ab4e17a 100644
--- a/src/location/landmarks/qlandmarkabstractrequest.cpp
+++ b/src/location/landmarks/qlandmarkabstractrequest.cpp
@@ -369,9 +369,10 @@ bool QLandmarkAbstractRequest::cancel()
Returns true if the request was canceled or completed
within the given period, otherwise returns false. Some backends may be unable
to support this operation safely and will return false immediately.
- The sqlite and sparql managers currently do not support waitForFinished(),
- while the symbian manager does. (with the exception of an import request,
- which will always return false on symbian when waitForFinished() is called).
+
+ (Note: This function is not supported for an import request
+ with the symbian manager which always returns false. As of
+ Qt Mobility 1.1.1 waitForFinished() is supported using the sqlite manager).
Note that any signals generated while waiting for the request to be complete
may be queued and delivered sometime after this function has returned, when
diff --git a/src/location/landmarks/qlandmarkcategory.h b/src/location/landmarks/qlandmarkcategory.h
index 3d3abc7cf1..c694e0c890 100644
--- a/src/location/landmarks/qlandmarkcategory.h
+++ b/src/location/landmarks/qlandmarkcategory.h
@@ -84,7 +84,7 @@ private:
QTM_END_NAMESPACE
-Q_DECLARE_METATYPE(QTM_PREPEND_NAMESPACE(QLandmarkCategory));
+Q_DECLARE_METATYPE(QTM_PREPEND_NAMESPACE(QLandmarkCategory))
Q_DECLARE_TYPEINFO(QTM_PREPEND_NAMESPACE(QLandmarkCategory), Q_MOVABLE_TYPE);
diff --git a/src/location/landmarks/qlandmarkcategoryfetchrequest.cpp b/src/location/landmarks/qlandmarkcategoryfetchrequest.cpp
index 3cc28619fc..98d0f84457 100644
--- a/src/location/landmarks/qlandmarkcategoryfetchrequest.cpp
+++ b/src/location/landmarks/qlandmarkcategoryfetchrequest.cpp
@@ -137,6 +137,10 @@ void QLandmarkCategoryFetchRequest::setLimit(int limit)
/*!
Returns the index offset for the request. By default the offset is 0.
+ The offset determines the first index which is retrieved. For example,
+ if there are 10 categories in the landmark store, setting the offset
+ to 2 will retrieve the 3rd to 10th categories inclusively. (The order of categories
+ is specified by the sorting field).
*/
int QLandmarkCategoryFetchRequest::offset() const
{
diff --git a/src/location/landmarks/qlandmarkcategoryid.h b/src/location/landmarks/qlandmarkcategoryid.h
index 9cb5904b61..90e811d9d5 100644
--- a/src/location/landmarks/qlandmarkcategoryid.h
+++ b/src/location/landmarks/qlandmarkcategoryid.h
@@ -77,7 +77,7 @@ QTM_END_NAMESPACE
QT_END_HEADER
-Q_DECLARE_METATYPE(QTM_PREPEND_NAMESPACE(QLandmarkCategoryId));
+Q_DECLARE_METATYPE(QTM_PREPEND_NAMESPACE(QLandmarkCategoryId))
Q_DECLARE_TYPEINFO(QTM_PREPEND_NAMESPACE(QLandmarkCategoryId), Q_MOVABLE_TYPE);
#endif
diff --git a/src/location/landmarks/qlandmarkcategoryidfetchrequest.cpp b/src/location/landmarks/qlandmarkcategoryidfetchrequest.cpp
index 55b3942941..0b2cf603c0 100644
--- a/src/location/landmarks/qlandmarkcategoryidfetchrequest.cpp
+++ b/src/location/landmarks/qlandmarkcategoryidfetchrequest.cpp
@@ -139,6 +139,10 @@ void QLandmarkCategoryIdFetchRequest::setLimit(int limit)
/*!
Returns the index offset for the request. By default the offset is set to 0.
+ The offset determines the first index which is retrieved. For example,
+ if there are 10 categories in the landmark store, setting the offset
+ to 2 will retrieve the 3rd to 10th category ids inclusively. (The order
+ of category ids is specified by the sorting field).
*/
int QLandmarkCategoryIdFetchRequest::offset() const
{
diff --git a/src/location/landmarks/qlandmarkfetchrequest.cpp b/src/location/landmarks/qlandmarkfetchrequest.cpp
index ff580cc742..1199db54ed 100644
--- a/src/location/landmarks/qlandmarkfetchrequest.cpp
+++ b/src/location/landmarks/qlandmarkfetchrequest.cpp
@@ -166,6 +166,10 @@ void QLandmarkFetchRequest::setLimit(int limit)
/*!
Returns the index offset for the request. By default the offset is set to 0.
+ The offset determines the first index which is retrieved. For example,
+ if there are 10 landmarks in the landmark store, setting the offset
+ to 2 will retrieve the 3rd to 10th landmarks inclusively. (The order
+ of the landmarks is specified by the sorting field).
*/
int QLandmarkFetchRequest::offset() const
{
diff --git a/src/location/landmarks/qlandmarkfilter.cpp b/src/location/landmarks/qlandmarkfilter.cpp
index 6483402dc8..465db82a88 100644
--- a/src/location/landmarks/qlandmarkfilter.cpp
+++ b/src/location/landmarks/qlandmarkfilter.cpp
@@ -115,7 +115,7 @@ QLandmarkFilterPrivate::~QLandmarkFilterPrivate()
\enum QLandmarkFilter::MatchFlag
Describes the semantics of matching followed by the filter.
\value MatchExactly Performs QVariant-based matching. (For the Symbian and S60 platforms MatchExactly has the same semantics as MatchFixedString)
- \value MatchContains The search term is contained in the item.
+ \value MatchContains The search term is contained in the item. (For the Symbian and S60 platforms, MatchContains is not supported)
\value MatchStartsWith The search term matches the start of the item.
\value MatchEndsWith The search term matches the end of the item.
\value MatchFixedString Performs string-based matching. String-based comparisons are case-insensitive unless the MatchCaseSensitive flag is also specified.
diff --git a/src/location/landmarks/qlandmarkid.h b/src/location/landmarks/qlandmarkid.h
index d8235fcb39..248bec23c1 100644
--- a/src/location/landmarks/qlandmarkid.h
+++ b/src/location/landmarks/qlandmarkid.h
@@ -76,7 +76,7 @@ QTM_END_NAMESPACE
QT_END_HEADER
-Q_DECLARE_METATYPE(QTM_PREPEND_NAMESPACE(QLandmarkId));
+Q_DECLARE_METATYPE(QTM_PREPEND_NAMESPACE(QLandmarkId))
Q_DECLARE_TYPEINFO(QTM_PREPEND_NAMESPACE(QLandmarkId), Q_MOVABLE_TYPE);
diff --git a/src/location/landmarks/qlandmarkidfetchrequest.cpp b/src/location/landmarks/qlandmarkidfetchrequest.cpp
index e7a916268e..9e6b7a8931 100644
--- a/src/location/landmarks/qlandmarkidfetchrequest.cpp
+++ b/src/location/landmarks/qlandmarkidfetchrequest.cpp
@@ -167,6 +167,10 @@ void QLandmarkIdFetchRequest::setLimit(int limit)
/*!
Returns the index offset for the request. By default the offset is set to 0.
+ The offset determines the first index which is retrieved. For example,
+ if there are 10 landmarks in the landmark store, setting the offset
+ to 2 will retrieve the 3rd and 10th landmark ids inclusively. (The order
+ of the landmark ids is sepecified by the sorting field).
*/
int QLandmarkIdFetchRequest::offset() const
{
diff --git a/src/location/landmarks/qlandmarkmanager_p.cpp b/src/location/landmarks/qlandmarkmanager_p.cpp
index 4d4f9859a9..fd8e011644 100644
--- a/src/location/landmarks/qlandmarkmanager_p.cpp
+++ b/src/location/landmarks/qlandmarkmanager_p.cpp
@@ -158,7 +158,6 @@ void QLandmarkManagerPrivate::loadStaticFactories(QHash<QString, QLandmarkManage
QString name = f->managerName();
#if !defined QT_NO_DEBUG
- const bool showDebug = qgetenv("QT_DEBUG_PLUGINS").toInt() > 0;
if (showDebug)
qDebug() << "Static: found an engine plugin with name" << name;
#endif
diff --git a/src/location/landmarks/qlandmarkmanagerengine.cpp b/src/location/landmarks/qlandmarkmanagerengine.cpp
index 8527162237..8ec38fb5e7 100644
--- a/src/location/landmarks/qlandmarkmanagerengine.cpp
+++ b/src/location/landmarks/qlandmarkmanagerengine.cpp
@@ -211,7 +211,7 @@ int QLandmarkManagerEngine::managerVersion() const
*/
QList<QLandmarkId> QLandmarkManagerEngine::landmarkIds(const QLandmarkFilter& /*filter*/,
int /*limit*/, int /*offset*/, const QList<QLandmarkSortOrder>& /*sortOrders*/, QLandmarkManager::Error* /*error*/,
- QString *errorString) const
+ QString */* errorString */) const
{
return QList<QLandmarkId>();
}
diff --git a/src/location/maps/qgeomapdata.cpp b/src/location/maps/qgeomapdata.cpp
index b0ab85a524..e01e9acdd7 100644
--- a/src/location/maps/qgeomapdata.cpp
+++ b/src/location/maps/qgeomapdata.cpp
@@ -631,11 +631,11 @@ void QGeoMapData::setBlockPropertyChangeSignals(bool block)
*******************************************************************************/
QGeoMapDataPrivate::QGeoMapDataPrivate(QGeoMapData *parent, QGeoMappingManagerEngine *engine)
- : q_ptr(parent),
- engine(engine),
+ : engine(engine),
containerObject(0),
zoomLevel(-1.0),
- blockPropertyChangeSignals(false) {}
+ blockPropertyChangeSignals(false),
+ q_ptr(parent) {}
QGeoMapDataPrivate::~QGeoMapDataPrivate()
{
diff --git a/src/location/maps/tiled/qgeotiledmapcircleobjectinfo_p.cpp b/src/location/maps/tiled/qgeotiledmapcircleobjectinfo_p.cpp
index 1ca73f4c26..f287532a05 100644
--- a/src/location/maps/tiled/qgeotiledmapcircleobjectinfo_p.cpp
+++ b/src/location/maps/tiled/qgeotiledmapcircleobjectinfo_p.cpp
@@ -108,7 +108,7 @@ void QGeoTiledMapCircleObjectInfo::updateValidity()
setValid((circle->center().isValid() && (circle->radius() >= 0.0)));
}
-void QGeoTiledMapCircleObjectInfo::centerChanged(const QGeoCoordinate &center)
+void QGeoTiledMapCircleObjectInfo::centerChanged(const QGeoCoordinate &/*center*/)
{
updateValidity();
if (valid())
@@ -116,7 +116,7 @@ void QGeoTiledMapCircleObjectInfo::centerChanged(const QGeoCoordinate &center)
}
-void QGeoTiledMapCircleObjectInfo::radiusChanged(qreal radius)
+void QGeoTiledMapCircleObjectInfo::radiusChanged(qreal /*radius*/)
{
updateValidity();
if (valid())
diff --git a/src/location/maps/tiled/qgeotiledmapobjectinfo_p.cpp b/src/location/maps/tiled/qgeotiledmapobjectinfo_p.cpp
index 471f23af41..e8d154f7a6 100644
--- a/src/location/maps/tiled/qgeotiledmapobjectinfo_p.cpp
+++ b/src/location/maps/tiled/qgeotiledmapobjectinfo_p.cpp
@@ -101,7 +101,7 @@ void QGeoTiledMapObjectInfo::visibleChanged(bool visible)
}
}
-void QGeoTiledMapObjectInfo::selectedChanged(bool selected)
+void QGeoTiledMapObjectInfo::selectedChanged(bool /*selected*/)
{
// don't want to draw the selection box
// if (graphicsItem) {
diff --git a/src/location/maps/tiled/qgeotiledmappixmapobjectinfo_p.cpp b/src/location/maps/tiled/qgeotiledmappixmapobjectinfo_p.cpp
index f4ce2e78af..98becd0dce 100644
--- a/src/location/maps/tiled/qgeotiledmappixmapobjectinfo_p.cpp
+++ b/src/location/maps/tiled/qgeotiledmappixmapobjectinfo_p.cpp
@@ -86,14 +86,14 @@ void QGeoTiledMapPixmapObjectInfo::updateValidity()
setValid((pixmap->coordinate().isValid() && !pixmap->pixmap().isNull()));
}
-void QGeoTiledMapPixmapObjectInfo::coordinateChanged(const QGeoCoordinate &coordinate)
+void QGeoTiledMapPixmapObjectInfo::coordinateChanged(const QGeoCoordinate &/*coordinate*/)
{
updateValidity();
if (valid())
update();
}
-void QGeoTiledMapPixmapObjectInfo::pixmapChanged(const QPixmap &pixmap)
+void QGeoTiledMapPixmapObjectInfo::pixmapChanged(const QPixmap &/*pixmap*/)
{
updateValidity();
if (!this->pixmap->pixmap().isNull()) {
@@ -105,13 +105,13 @@ void QGeoTiledMapPixmapObjectInfo::pixmapChanged(const QPixmap &pixmap)
updateItem();
}
-void QGeoTiledMapPixmapObjectInfo::offsetChanged(const QPoint &offset)
+void QGeoTiledMapPixmapObjectInfo::offsetChanged(const QPoint &/*offset*/)
{
if (valid())
update();
}
-void QGeoTiledMapPixmapObjectInfo::zoomLevelChanged(qreal zoomLevel)
+void QGeoTiledMapPixmapObjectInfo::zoomLevelChanged(qreal /*zoomLevel*/)
{
if (valid())
update();
diff --git a/src/location/maps/tiled/qgeotiledmappolygonobjectinfo_p.cpp b/src/location/maps/tiled/qgeotiledmappolygonobjectinfo_p.cpp
index 9a0dc6bd60..632dc44b30 100644
--- a/src/location/maps/tiled/qgeotiledmappolygonobjectinfo_p.cpp
+++ b/src/location/maps/tiled/qgeotiledmappolygonobjectinfo_p.cpp
@@ -77,7 +77,7 @@ QGeoTiledMapPolygonObjectInfo::QGeoTiledMapPolygonObjectInfo(QGeoTiledMapData *m
QGeoTiledMapPolygonObjectInfo::~QGeoTiledMapPolygonObjectInfo() {}
-void QGeoTiledMapPolygonObjectInfo::pathChanged(const QList<QGeoCoordinate> &path)
+void QGeoTiledMapPolygonObjectInfo::pathChanged(const QList<QGeoCoordinate> &/*path*/)
{
points = createPolygon(polygon->path(), tiledMapData, true);
if (points.size() >= 3) {
@@ -89,13 +89,13 @@ void QGeoTiledMapPolygonObjectInfo::pathChanged(const QList<QGeoCoordinate> &pat
updateItem();
}
-void QGeoTiledMapPolygonObjectInfo::penChanged(const QPen &pen)
+void QGeoTiledMapPolygonObjectInfo::penChanged(const QPen &/*pen*/)
{
polygonItem->setPen(polygon->pen());
updateItem();
}
-void QGeoTiledMapPolygonObjectInfo::brushChanged(const QBrush &brush)
+void QGeoTiledMapPolygonObjectInfo::brushChanged(const QBrush &/*brush*/)
{
polygonItem->setBrush(polygon->brush());
updateItem();
diff --git a/src/location/maps/tiled/qgeotiledmappolylineobjectinfo_p.cpp b/src/location/maps/tiled/qgeotiledmappolylineobjectinfo_p.cpp
index 4b08d31d75..73f07bb077 100644
--- a/src/location/maps/tiled/qgeotiledmappolylineobjectinfo_p.cpp
+++ b/src/location/maps/tiled/qgeotiledmappolylineobjectinfo_p.cpp
@@ -74,7 +74,7 @@ QGeoTiledMapPolylineObjectInfo::QGeoTiledMapPolylineObjectInfo(QGeoTiledMapData
QGeoTiledMapPolylineObjectInfo::~QGeoTiledMapPolylineObjectInfo() {}
-void QGeoTiledMapPolylineObjectInfo::pathChanged(const QList<QGeoCoordinate> &path)
+void QGeoTiledMapPolylineObjectInfo::pathChanged(const QList<QGeoCoordinate> &/*path*/)
{
points = createPolygon(polyline->path(), tiledMapData, false);
if (points.size() >= 2) {
@@ -88,7 +88,7 @@ void QGeoTiledMapPolylineObjectInfo::pathChanged(const QList<QGeoCoordinate> &pa
updateItem();
}
-void QGeoTiledMapPolylineObjectInfo::zoomLevelChanged(qreal zoomLevel)
+void QGeoTiledMapPolylineObjectInfo::zoomLevelChanged(qreal /*zoomLevel*/)
{
QPen p = polyline->pen();
p.setWidth(p.width() * tiledMapData->zoomFactor());
@@ -96,7 +96,7 @@ void QGeoTiledMapPolylineObjectInfo::zoomLevelChanged(qreal zoomLevel)
updateItem();
}
-void QGeoTiledMapPolylineObjectInfo::penChanged(const QPen &pen)
+void QGeoTiledMapPolylineObjectInfo::penChanged(const QPen &/*pen*/)
{
QPen p = polyline->pen();
p.setWidth(p.width() * tiledMapData->zoomFactor());
diff --git a/src/location/maps/tiled/qgeotiledmaprectangleobjectinfo_p.cpp b/src/location/maps/tiled/qgeotiledmaprectangleobjectinfo_p.cpp
index 18bacef5bd..820d87e4c7 100644
--- a/src/location/maps/tiled/qgeotiledmaprectangleobjectinfo_p.cpp
+++ b/src/location/maps/tiled/qgeotiledmaprectangleobjectinfo_p.cpp
@@ -91,14 +91,14 @@ void QGeoTiledMapRectangleObjectInfo::updateValidity()
setValid((rectangle->topLeft().isValid() && rectangle->bottomRight().isValid()));
}
-void QGeoTiledMapRectangleObjectInfo::topLeftChanged(const QGeoCoordinate &topLeft)
+void QGeoTiledMapRectangleObjectInfo::topLeftChanged(const QGeoCoordinate &/*topLeft*/)
{
updateValidity();
if (valid())
update();
}
-void QGeoTiledMapRectangleObjectInfo::bottomRightChanged(const QGeoCoordinate &bottomRight)
+void QGeoTiledMapRectangleObjectInfo::bottomRightChanged(const QGeoCoordinate &/*bottomRight*/)
{
updateValidity();
if (valid())
diff --git a/src/location/maps/tiled/qgeotiledmaprouteobjectinfo_p.cpp b/src/location/maps/tiled/qgeotiledmaprouteobjectinfo_p.cpp
index 1537ee3325..7a68b58103 100644
--- a/src/location/maps/tiled/qgeotiledmaprouteobjectinfo_p.cpp
+++ b/src/location/maps/tiled/qgeotiledmaprouteobjectinfo_p.cpp
@@ -79,7 +79,7 @@ QGeoTiledMapRouteObjectInfo::QGeoTiledMapRouteObjectInfo(QGeoTiledMapData *mapDa
QGeoTiledMapRouteObjectInfo::~QGeoTiledMapRouteObjectInfo() {}
-void QGeoTiledMapRouteObjectInfo::routeChanged(const QGeoRoute &route)
+void QGeoTiledMapRouteObjectInfo::routeChanged(const QGeoRoute &/*route*/)
{
//QListIterator<QGeoRouteSegment> segIt(this->route->route().routeSegments());
//while (segIt.hasNext()) {
@@ -101,7 +101,7 @@ void QGeoTiledMapRouteObjectInfo::routeChanged(const QGeoRoute &route)
updateData();
}
-void QGeoTiledMapRouteObjectInfo::penChanged(const QPen &pen)
+void QGeoTiledMapRouteObjectInfo::penChanged(const QPen &/*pen*/)
{
QPen p = route->pen();
p.setWidth(p.width() * tiledMapData->zoomFactor());
@@ -109,12 +109,12 @@ void QGeoTiledMapRouteObjectInfo::penChanged(const QPen &pen)
updateItem();
}
-void QGeoTiledMapRouteObjectInfo::detailLevelChanged(quint32 detailLevel)
+void QGeoTiledMapRouteObjectInfo::detailLevelChanged(quint32 /*detailLevel*/)
{
updateData();
}
-void QGeoTiledMapRouteObjectInfo::zoomLevelChanged(qreal zoomLevel)
+void QGeoTiledMapRouteObjectInfo::zoomLevelChanged(qreal /*zoomLevel*/)
{
QPen p = route->pen();
p.setWidth(p.width() * tiledMapData->zoomFactor());
@@ -144,13 +144,13 @@ void QGeoTiledMapRouteObjectInfo::updateData()
updateVisible();
}
-void QGeoTiledMapRouteObjectInfo::windowSizeChanged(const QSizeF &windowSize)
+void QGeoTiledMapRouteObjectInfo::windowSizeChanged(const QSizeF &/*windowSize*/)
{
if (valid())
updateVisible();
}
-void QGeoTiledMapRouteObjectInfo::centerChanged(const QGeoCoordinate &coordinate)
+void QGeoTiledMapRouteObjectInfo::centerChanged(const QGeoCoordinate &/*coordinate*/)
{
if (valid())
updateVisible();
diff --git a/src/location/maps/tiled/qgeotiledmaptextobjectinfo_p.cpp b/src/location/maps/tiled/qgeotiledmaptextobjectinfo_p.cpp
index fbef32955b..b90abbbfe4 100644
--- a/src/location/maps/tiled/qgeotiledmaptextobjectinfo_p.cpp
+++ b/src/location/maps/tiled/qgeotiledmaptextobjectinfo_p.cpp
@@ -107,14 +107,14 @@ void QGeoTiledMapTextObjectInfo::updateValidity()
setValid((text->coordinate().isValid() && !text->text().isEmpty()));
}
-void QGeoTiledMapTextObjectInfo::coordinateChanged(const QGeoCoordinate &coordinate)
+void QGeoTiledMapTextObjectInfo::coordinateChanged(const QGeoCoordinate &/*coordinate*/)
{
updateValidity();
if (valid())
update();
}
-void QGeoTiledMapTextObjectInfo::textChanged(const QString &text)
+void QGeoTiledMapTextObjectInfo::textChanged(const QString &/*text*/)
{
updateValidity();
if (!this->text->text().isEmpty()) {
@@ -126,7 +126,7 @@ void QGeoTiledMapTextObjectInfo::textChanged(const QString &text)
update();
}
-void QGeoTiledMapTextObjectInfo::fontChanged(const QFont &font)
+void QGeoTiledMapTextObjectInfo::fontChanged(const QFont &/*font*/)
{
textItem1->setFont(text->font());
if (textItem2)
@@ -135,19 +135,19 @@ void QGeoTiledMapTextObjectInfo::fontChanged(const QFont &font)
update();
}
-void QGeoTiledMapTextObjectInfo::offsetChanged(const QPoint &offset)
+void QGeoTiledMapTextObjectInfo::offsetChanged(const QPoint &/*offset*/)
{
if (valid())
update();
}
-void QGeoTiledMapTextObjectInfo::alignmentChanged(Qt::Alignment alignment)
+void QGeoTiledMapTextObjectInfo::alignmentChanged(Qt::Alignment /*alignment*/)
{
if (valid())
update();
}
-void QGeoTiledMapTextObjectInfo::penChanged(const QPen &pen)
+void QGeoTiledMapTextObjectInfo::penChanged(const QPen &/*pen*/)
{
textItem1->setPen(text->pen());
if (textItem2)
@@ -155,7 +155,7 @@ void QGeoTiledMapTextObjectInfo::penChanged(const QPen &pen)
updateItem();
}
-void QGeoTiledMapTextObjectInfo::brushChanged(const QBrush &brush)
+void QGeoTiledMapTextObjectInfo::brushChanged(const QBrush &/*brush*/)
{
textItem1->setBrush(text->brush());
if (textItem2)
@@ -163,7 +163,7 @@ void QGeoTiledMapTextObjectInfo::brushChanged(const QBrush &brush)
updateItem();
}
-void QGeoTiledMapTextObjectInfo::zoomLevelChanged(qreal zoomLevel)
+void QGeoTiledMapTextObjectInfo::zoomLevelChanged(qreal /*zoomLevel*/)
{
if (valid())
update();
diff --git a/src/location/qgeoaddress.cpp b/src/location/qgeoaddress.cpp
index 27e0558890..7c6e85bcee 100644
--- a/src/location/qgeoaddress.cpp
+++ b/src/location/qgeoaddress.cpp
@@ -182,7 +182,7 @@ void QGeoAddress::setCountryCode(const QString &countryCode)
}
/*!
- Returns the state.
+ Returns the state. The state is considered the first subdivision below country.
*/
QString QGeoAddress::state() const
{
@@ -198,7 +198,7 @@ void QGeoAddress::setState(const QString &state)
}
/*!
- Returns the county.
+ Returns the county. The county is considered the second subdivision below country.
*/
QString QGeoAddress::county() const
{
@@ -230,7 +230,7 @@ void QGeoAddress::setCity(const QString &city)
}
/*!
- Returns the district.
+ Returns the district. The district is considered the subdivison below city.
*/
QString QGeoAddress::district() const
{
diff --git a/src/messaging/modestengine_maemo.cpp b/src/messaging/modestengine_maemo.cpp
index cba373d76b..30bfd4abb6 100644
--- a/src/messaging/modestengine_maemo.cpp
+++ b/src/messaging/modestengine_maemo.cpp
@@ -658,39 +658,42 @@ QString ModestEngine::accountRootFolder(QMessageAccountId& accountId) const
gchar* store_account_key = g_strconcat(MODESTENGINE_ACCOUNT_NAMESPACE, "/", modestAccountId.toUtf8().data(), "/", MODESTENGINE_ACCOUNT_STORE_ACCOUNT, NULL);
gchar* store_account_name = gconf_client_get_string(m_gconfclient, store_account_key, NULL);
g_free(store_account_key);
- gchar* escaped_store_account_name = gconf_escape_key(store_account_name, strlen(store_account_name));
- g_free(store_account_name);
-
- gchar* username_key = g_strconcat(MODESTENGINE_SERVER_ACCOUNT_NAMESPACE, "/", escaped_store_account_name, "/", MODESTENGINE_ACCOUNT_USERNAME, NULL);
- gchar* account_username = gconf_client_get_string(m_gconfclient, username_key, NULL);
- userName = QString::fromUtf8(account_username);
- g_free(account_username);
- g_free(username_key);
-
- gchar* hostname_key = g_strconcat(MODESTENGINE_SERVER_ACCOUNT_NAMESPACE, "/", escaped_store_account_name, "/", MODESTENGINE_ACCOUNT_HOSTNAME, NULL);
- gchar* account_hostname = gconf_client_get_string(m_gconfclient, hostname_key, NULL);
- hostName = QString::fromUtf8(account_hostname);
- g_free(account_hostname);
- g_free(hostname_key);
-
- gchar* port_key = g_strconcat(MODESTENGINE_SERVER_ACCOUNT_NAMESPACE, "/", escaped_store_account_name, "/", MODESTENGINE_ACCOUNT_PORT, NULL);
- gint account_port = gconf_client_get_int(m_gconfclient, port_key, NULL);
- port = QString::number(account_port);
- g_free(port_key);
-
- gchar* protocol_key = g_strconcat(MODESTENGINE_SERVER_ACCOUNT_NAMESPACE, "/", escaped_store_account_name, "/", MODESTENGINE_ACCOUNT_PROTOCOL, NULL);
- gchar* account_protocol = gconf_client_get_string(m_gconfclient, protocol_key, NULL);
- protocol = QString::fromUtf8(account_protocol);
- g_free(account_protocol);
- g_free(protocol_key);
-
- g_free(escaped_store_account_name);
+ if (store_account_name) {
+ gchar* escaped_store_account_name = gconf_escape_key(store_account_name, strlen(store_account_name));
+ g_free(store_account_name);
- if (protocol == "pop") {
- return QDir::home().absolutePath()+"/.modest/cache/mail/"+protocol+"/"+userName+"__"+hostName+"_"+port;
- } else if (protocol == "imap") {
- return QDir::home().absolutePath()+"/.modest/cache/mail/"+protocol+"/"+userName+"__"+hostName+"_"+port+"/folders";
+ gchar* username_key = g_strconcat(MODESTENGINE_SERVER_ACCOUNT_NAMESPACE, "/", escaped_store_account_name, "/", MODESTENGINE_ACCOUNT_USERNAME, NULL);
+ gchar* account_username = gconf_client_get_string(m_gconfclient, username_key, NULL);
+ userName = QString::fromUtf8(account_username);
+ g_free(account_username);
+ g_free(username_key);
+
+ gchar* hostname_key = g_strconcat(MODESTENGINE_SERVER_ACCOUNT_NAMESPACE, "/", escaped_store_account_name, "/", MODESTENGINE_ACCOUNT_HOSTNAME, NULL);
+ gchar* account_hostname = gconf_client_get_string(m_gconfclient, hostname_key, NULL);
+ hostName = QString::fromUtf8(account_hostname);
+ g_free(account_hostname);
+ g_free(hostname_key);
+
+ gchar* port_key = g_strconcat(MODESTENGINE_SERVER_ACCOUNT_NAMESPACE, "/", escaped_store_account_name, "/", MODESTENGINE_ACCOUNT_PORT, NULL);
+ gint account_port = gconf_client_get_int(m_gconfclient, port_key, NULL);
+ port = QString::number(account_port);
+ g_free(port_key);
+
+ gchar* protocol_key = g_strconcat(MODESTENGINE_SERVER_ACCOUNT_NAMESPACE, "/", escaped_store_account_name, "/", MODESTENGINE_ACCOUNT_PROTOCOL, NULL);
+ gchar* account_protocol = gconf_client_get_string(m_gconfclient, protocol_key, NULL);
+ protocol = QString::fromUtf8(account_protocol);
+ g_free(account_protocol);
+ g_free(protocol_key);
+
+ g_free(escaped_store_account_name);
+
+ if (protocol == "pop") {
+ return QDir::home().absolutePath()+"/.modest/cache/mail/"+protocol+"/"+userName+"__"+hostName+"_"+port;
+ } else if (protocol == "imap") {
+ return QDir::home().absolutePath()+"/.modest/cache/mail/"+protocol+"/"+userName+"__"+hostName+"_"+port+"/folders";
+ }
}
+
return QString();
}
@@ -722,20 +725,24 @@ ModestEngine::EmailProtocol ModestEngine::accountEmailProtocol(QMessageAccountId
gchar* store_account_key = g_strconcat(MODESTENGINE_ACCOUNT_NAMESPACE, "/", modestAccountId.toUtf8().data(), "/", MODESTENGINE_ACCOUNT_STORE_ACCOUNT, NULL);
gchar* store_account_name = gconf_client_get_string(m_gconfclient, store_account_key, NULL);
g_free(store_account_key);
- gchar* escaped_store_account_name = gconf_escape_key(store_account_name, strlen(store_account_name));
- g_free(store_account_name);
+ if (store_account_name) {
+ gchar* escaped_store_account_name = gconf_escape_key(store_account_name, strlen(store_account_name));
+ g_free(store_account_name);
+
+ gchar* protocol_key = g_strconcat(MODESTENGINE_SERVER_ACCOUNT_NAMESPACE, "/", escaped_store_account_name, "/", MODESTENGINE_ACCOUNT_PROTOCOL, NULL);
+ gchar* account_protocol = gconf_client_get_string(m_gconfclient, protocol_key, NULL);
+ if (account_protocol) {
+ if (QString("pop") == account_protocol) {
+ protocol = EmailProtocolPop3;
+ } else if (QString("imap") == account_protocol) {
+ protocol = EmailProtocolIMAP;
+ }
+ g_free(account_protocol);
+ }
+ g_free(protocol_key);
- gchar* protocol_key = g_strconcat(MODESTENGINE_SERVER_ACCOUNT_NAMESPACE, "/", escaped_store_account_name, "/", MODESTENGINE_ACCOUNT_PROTOCOL, NULL);
- gchar* account_protocol = gconf_client_get_string(m_gconfclient, protocol_key, NULL);
- if (QString("pop") == account_protocol) {
- protocol = EmailProtocolPop3;
- } else if (QString("imap") == account_protocol) {
- protocol = EmailProtocolIMAP;
+ g_free(escaped_store_account_name);
}
- g_free(account_protocol);
- g_free(protocol_key);
-
- g_free(escaped_store_account_name);
return protocol;
}
@@ -761,16 +768,20 @@ QString ModestEngine::accountEmailProtocolAsString(const QMessageAccountId& acco
gchar* store_account_key = g_strconcat(MODESTENGINE_ACCOUNT_NAMESPACE, "/", modestAccountId.toUtf8().data(), "/", MODESTENGINE_ACCOUNT_STORE_ACCOUNT, NULL);
gchar* store_account_name = gconf_client_get_string(m_gconfclient, store_account_key, NULL);
g_free(store_account_key);
- gchar* escaped_store_account_name = gconf_escape_key(store_account_name, strlen(store_account_name));
- g_free(store_account_name);
+ if (store_account_name) {
+ gchar* escaped_store_account_name = gconf_escape_key(store_account_name, strlen(store_account_name));
+ g_free(store_account_name);
- gchar* protocol_key = g_strconcat(MODESTENGINE_SERVER_ACCOUNT_NAMESPACE, "/", escaped_store_account_name, "/", MODESTENGINE_ACCOUNT_PROTOCOL, NULL);
- gchar* account_protocol = gconf_client_get_string(m_gconfclient, protocol_key, NULL);
- protocol = QString::fromUtf8(account_protocol);
- g_free(account_protocol);
- g_free(protocol_key);
+ gchar* protocol_key = g_strconcat(MODESTENGINE_SERVER_ACCOUNT_NAMESPACE, "/", escaped_store_account_name, "/", MODESTENGINE_ACCOUNT_PROTOCOL, NULL);
+ gchar* account_protocol = gconf_client_get_string(m_gconfclient, protocol_key, NULL);
+ if (account_protocol) {
+ protocol = QString::fromUtf8(account_protocol);
+ g_free(account_protocol);
+ }
+ g_free(protocol_key);
- g_free(escaped_store_account_name);
+ g_free(escaped_store_account_name);
+ }
return protocol;
}
@@ -784,16 +795,18 @@ QString ModestEngine::accountUsername(QMessageAccountId& accountId) const
gchar* store_account_key = g_strconcat(MODESTENGINE_ACCOUNT_NAMESPACE, "/", modestAccountId.toUtf8().data(), "/", MODESTENGINE_ACCOUNT_STORE_ACCOUNT, NULL);
gchar* store_account_name = gconf_client_get_string(m_gconfclient, store_account_key, NULL);
g_free(store_account_key);
- gchar* escaped_store_account_name = gconf_escape_key(store_account_name, strlen(store_account_name));
- g_free(store_account_name);
+ if (store_account_name) {
+ gchar* escaped_store_account_name = gconf_escape_key(store_account_name, strlen(store_account_name));
+ g_free(store_account_name);
- gchar* username_key = g_strconcat(MODESTENGINE_SERVER_ACCOUNT_NAMESPACE, "/", escaped_store_account_name, "/", MODESTENGINE_ACCOUNT_USERNAME, NULL);
- gchar* account_username = gconf_client_get_string(m_gconfclient, username_key, NULL);
- username = QString::fromUtf8(account_username);
- g_free(account_username);
- g_free(username_key);
+ gchar* username_key = g_strconcat(MODESTENGINE_SERVER_ACCOUNT_NAMESPACE, "/", escaped_store_account_name, "/", MODESTENGINE_ACCOUNT_USERNAME, NULL);
+ gchar* account_username = gconf_client_get_string(m_gconfclient, username_key, NULL);
+ username = QString::fromUtf8(account_username);
+ g_free(account_username);
+ g_free(username_key);
- g_free(escaped_store_account_name);
+ g_free(escaped_store_account_name);
+ }
return username;
}
@@ -807,16 +820,18 @@ QString ModestEngine::accountHostname(QMessageAccountId& accountId) const
gchar* store_account_key = g_strconcat(MODESTENGINE_ACCOUNT_NAMESPACE, "/", modestAccountId.toUtf8().data(), "/", MODESTENGINE_ACCOUNT_STORE_ACCOUNT, NULL);
gchar* store_account_name = gconf_client_get_string(m_gconfclient, store_account_key, NULL);
g_free(store_account_key);
- gchar* escaped_store_account_name = gconf_escape_key(store_account_name, strlen(store_account_name));
- g_free(store_account_name);
+ if (store_account_name) {
+ gchar* escaped_store_account_name = gconf_escape_key(store_account_name, strlen(store_account_name));
+ g_free(store_account_name);
- gchar* host_key = g_strconcat(MODESTENGINE_SERVER_ACCOUNT_NAMESPACE, "/", escaped_store_account_name, "/", MODESTENGINE_ACCOUNT_HOSTNAME, NULL);
- gchar* account_host = gconf_client_get_string(m_gconfclient, host_key, NULL);
- host = QString::fromUtf8(account_host);
- g_free(account_host);
- g_free(host_key);
+ gchar* host_key = g_strconcat(MODESTENGINE_SERVER_ACCOUNT_NAMESPACE, "/", escaped_store_account_name, "/", MODESTENGINE_ACCOUNT_HOSTNAME, NULL);
+ gchar* account_host = gconf_client_get_string(m_gconfclient, host_key, NULL);
+ host = QString::fromUtf8(account_host);
+ g_free(account_host);
+ g_free(host_key);
- g_free(escaped_store_account_name);
+ g_free(escaped_store_account_name);
+ }
return host;
}
@@ -2654,6 +2669,12 @@ void ModestEngine::folderUpdatedSlot(QDBusMessage msg)
if (modestAccountId == "local_folders") {
updatedFolderId = QMessageFolderId("MO_LOCAL&maildir&"+modestFolderId);
} else {
+ if (modestAccountId.endsWith("_store")) {
+ modestAccountId = modestAccountId.mid(0,modestAccountId.length()-6);
+ }
+ if (modestFolderId == "inbox") {
+ modestFolderId = "INBOX";
+ }
QMessageAccountId accountId = QMessageAccountId("MO_"+escapeString(modestAccountId));
QString protocol = accountEmailProtocolAsString(accountId);
if ((protocol == "pop") && (modestFolderId == "INBOX")) {
diff --git a/src/multimedia/audio/audio.pri b/src/multimedia/audio/audio.pri
index aab9b423a8..19163d4fcf 100644
--- a/src/multimedia/audio/audio.pri
+++ b/src/multimedia/audio/audio.pri
@@ -42,11 +42,12 @@ win32 {
audio/qaudioinput_win32_p.cpp
!wince*:LIBS += -lwinmm
wince*:LIBS += -lcoredll
+ LIBS += -lstrmiids -lole32 -loleaut32
}
symbian {
- INCLUDEPATH += /epoc32/include/mmf/common
- INCLUDEPATH += /epoc32/include/mmf/server
+ INCLUDEPATH += $${EPOCROOT}epoc32/include/mmf/common
+ INCLUDEPATH += $${EPOCROOT}epoc32/include/mmf/server
PRIVATE_HEADERS += audio/qaudio_symbian_p.h \
audio/qaudiodeviceinfo_symbian_p.h \
diff --git a/src/multimedia/audio/qaudiodeviceinfo.cpp b/src/multimedia/audio/qaudiodeviceinfo.cpp
index 35eaf7e3e0..fa50f0faee 100644
--- a/src/multimedia/audio/qaudiodeviceinfo.cpp
+++ b/src/multimedia/audio/qaudiodeviceinfo.cpp
@@ -54,7 +54,10 @@ public:
QAudioDeviceInfoPrivate(const QString &r, const QByteArray &h, QAudio::Mode m):
realm(r), handle(h), mode(m)
{
- info = QAudioDeviceFactory::audioDeviceInfo(realm, handle, mode);
+ if (!handle.isEmpty())
+ info = QAudioDeviceFactory::audioDeviceInfo(realm, handle, mode);
+ else
+ info = NULL;
}
QAudioDeviceInfoPrivate(const QAudioDeviceInfoPrivate &other):
diff --git a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp
index f355aef591..35165dcd08 100644
--- a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp
+++ b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp
@@ -54,6 +54,7 @@
#include <windows.h>
#include <mmsystem.h>
#include "qaudiodeviceinfo_win32_p.h"
+#include <dshow.h>
QT_BEGIN_NAMESPACE
@@ -76,7 +77,8 @@ QT_BEGIN_NAMESPACE
QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(QByteArray dev, QAudio::Mode mode)
{
- device = QLatin1String(dev);
+ QDataStream ds(&dev, QIODevice::ReadOnly);
+ ds >> devId >> device;
this->mode = mode;
updateLists();
@@ -254,54 +256,21 @@ bool QAudioDeviceInfoInternal::testSettings(const QAudioFormat& format) const
void QAudioDeviceInfoInternal::updateLists()
{
// redo all lists based on current settings
- bool base = false;
bool match = false;
DWORD fmt = NULL;
- QString tmp;
-
- if(device.compare(QLatin1String("default")) == 0)
- base = true;
if(mode == QAudio::AudioOutput) {
WAVEOUTCAPS woc;
- unsigned long iNumDevs,i;
- iNumDevs = waveOutGetNumDevs();
- for(i=0;i<iNumDevs;i++) {
- if(waveOutGetDevCaps(i, &woc, sizeof(WAVEOUTCAPS))
- == MMSYSERR_NOERROR) {
- tmp = QString::fromWCharArray(woc.szPname);
- if(tmp.compare(device) == 0) {
- match = true;
- fmt = woc.dwFormats;
- break;
- }
- if(base) {
- match = true;
- fmt = woc.dwFormats;
- break;
- }
- }
- }
+ if (waveOutGetDevCaps(devId, &woc, sizeof(WAVEOUTCAPS)) == MMSYSERR_NOERROR) {
+ match = true;
+ fmt = woc.dwFormats;
+ }
} else {
WAVEINCAPS woc;
- unsigned long iNumDevs,i;
- iNumDevs = waveInGetNumDevs();
- for(i=0;i<iNumDevs;i++) {
- if(waveInGetDevCaps(i, &woc, sizeof(WAVEINCAPS))
- == MMSYSERR_NOERROR) {
- tmp = QString::fromWCharArray(woc.szPname);
- if(tmp.compare(device) == 0) {
- match = true;
- fmt = woc.dwFormats;
- break;
- }
- if(base) {
- match = true;
- fmt = woc.dwFormats;
- break;
- }
- }
- }
+ if (waveInGetDevCaps(devId, &woc, sizeof(WAVEINCAPS)) == MMSYSERR_NOERROR) {
+ match = true;
+ fmt = woc.dwFormats;
+ }
}
sizez.clear();
freqz.clear();
@@ -397,43 +366,78 @@ QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode)
Q_UNUSED(mode)
QList<QByteArray> devices;
+ //enumerate device fullnames through directshow api
+ CoInitialize(NULL);
+ ICreateDevEnum *pDevEnum = NULL;
+ IEnumMoniker *pEnum = NULL;
+ // Create the System device enumerator
+ HRESULT hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL,
+ CLSCTX_INPROC_SERVER, IID_ICreateDevEnum,
+ reinterpret_cast<void **>(&pDevEnum));
+
+ unsigned long iNumDevs = mode == QAudio::AudioOutput ? waveOutGetNumDevs() : waveInGetNumDevs();
+ if (SUCCEEDED(hr)) {
+ // Create the enumerator for the video capture category
+ hr = pDevEnum->CreateClassEnumerator(
+ mode == QAudio::AudioOutput ? CLSID_AudioRendererCategory : CLSID_AudioInputDeviceCategory,
+ &pEnum, 0);
+ pEnum->Reset();
+ // go through and find all video capture devices
+ IMoniker *pMoniker = NULL;
+ while (pEnum->Next(1, &pMoniker, NULL) == S_OK) {
+ IPropertyBag *pPropBag;
+ hr = pMoniker->BindToStorage(0,0,IID_IPropertyBag,
+ reinterpret_cast<void **>(&pPropBag));
+ if (FAILED(hr)) {
+ pMoniker->Release();
+ continue; // skip this one
+ }
+ // Find if it is a wave device
+ VARIANT var;
+ VariantInit(&var);
+ hr = pPropBag->Read(mode == QAudio::AudioOutput ? L"WaveOutID" : L"WaveInID", &var, 0);
+ if (SUCCEEDED(hr)) {
+ LONG waveID = var.lVal;
+ if (waveID >= 0 && waveID < LONG(iNumDevs)) {
+ VariantClear(&var);
+ // Find the description
+ hr = pPropBag->Read(L"FriendlyName", &var, 0);
+ if (SUCCEEDED(hr)) {
+ WCHAR str[120];
+ StringCchCopyW(str, sizeof(str) / sizeof(str[0]), var.bstrVal);
+ QByteArray device;
+ QDataStream ds(&device, QIODevice::WriteOnly);
+ ds << quint32(waveID) << QString::fromUtf16(reinterpret_cast<unsigned short *>(str));
+ devices.append(device);
+ }
+ }
+ }
- if(mode == QAudio::AudioOutput) {
- WAVEOUTCAPS woc;
- unsigned long iNumDevs,i;
- iNumDevs = waveOutGetNumDevs();
- for(i=0;i<iNumDevs;i++) {
- if(waveOutGetDevCaps(i, &woc, sizeof(WAVEOUTCAPS))
- == MMSYSERR_NOERROR) {
- devices.append(QString::fromUtf16((const unsigned short*)woc.szPname).toLocal8Bit().constData());
- }
- }
- } else {
- WAVEINCAPS woc;
- unsigned long iNumDevs,i;
- iNumDevs = waveInGetNumDevs();
- for(i=0;i<iNumDevs;i++) {
- if(waveInGetDevCaps(i, &woc, sizeof(WAVEINCAPS))
- == MMSYSERR_NOERROR) {
- devices.append(QString::fromUtf16((const unsigned short*)woc.szPname).toLocal8Bit().constData());
- }
- }
-
+ pPropBag->Release();
+ pMoniker->Release();
+ }
}
- if(devices.count() > 0)
- devices.append("default");
+ CoUninitialize();
return devices;
}
QByteArray QAudioDeviceInfoInternal::defaultOutputDevice()
{
- return QByteArray("default");
+ QList<QByteArray> list = availableDevices(QAudio::AudioOutput);
+ if (list.size() > 0)
+ return list.at(0);
+ else
+ return QByteArray();
}
QByteArray QAudioDeviceInfoInternal::defaultInputDevice()
{
- return QByteArray("default");
+ QList<QByteArray> list = availableDevices(QAudio::AudioInput);
+ if (list.size() > 0)
+ return list.at(0);
+ else
+ return QByteArray();
}
QT_END_NAMESPACE
diff --git a/src/multimedia/audio/qaudiodeviceinfo_win32_p.h b/src/multimedia/audio/qaudiodeviceinfo_win32_p.h
index 83e35d7251..5e9956e4f7 100644
--- a/src/multimedia/audio/qaudiodeviceinfo_win32_p.h
+++ b/src/multimedia/audio/qaudiodeviceinfo_win32_p.h
@@ -97,6 +97,7 @@ public:
private:
QAudio::Mode mode;
QString device;
+ quint32 devId;
QAudioFormat nearest;
QList<int> freqz;
QList<int> channelz;
diff --git a/src/multimedia/audio/qaudioinput_win32_p.cpp b/src/multimedia/audio/qaudioinput_win32_p.cpp
index 743cee4a36..434129b47a 100644
--- a/src/multimedia/audio/qaudioinput_win32_p.cpp
+++ b/src/multimedia/audio/qaudioinput_win32_p.cpp
@@ -280,24 +280,11 @@ bool QAudioInputPrivate::open()
wfx.nBlockAlign = (wfx.wBitsPerSample >> 3) * wfx.nChannels;
wfx.nAvgBytesPerSec = wfx.nBlockAlign * wfx.nSamplesPerSec;
- UINT_PTR devId = WAVE_MAPPER;
-
- WAVEINCAPS wic;
- unsigned long iNumDevs,ii;
- iNumDevs = waveInGetNumDevs();
- for(ii=0;ii<iNumDevs;ii++) {
- if(waveInGetDevCaps(ii, &wic, sizeof(WAVEINCAPS))
- == MMSYSERR_NOERROR) {
- QString tmp;
- tmp = QString::fromWCharArray(wic.szPname);
- if(tmp.compare(QLatin1String(m_device)) == 0) {
- devId = ii;
- break;
- }
- }
- }
+ QDataStream ds(&m_device, QIODevice::ReadOnly);
+ quint32 deviceId;
+ ds >> deviceId;
- if(waveInOpen(&hWaveIn, devId, &wfx,
+ if (waveInOpen(&hWaveIn, UINT_PTR(deviceId), &wfx,
(DWORD_PTR)&waveInProc,
(DWORD_PTR) this,
CALLBACK_FUNCTION) != MMSYSERR_NOERROR) {
diff --git a/src/multimedia/audio/qaudiooutput_alsa_p.cpp b/src/multimedia/audio/qaudiooutput_alsa_p.cpp
index c2b714fdc9..dcb8f0201c 100644
--- a/src/multimedia/audio/qaudiooutput_alsa_p.cpp
+++ b/src/multimedia/audio/qaudiooutput_alsa_p.cpp
@@ -541,8 +541,20 @@ int QAudioOutputPrivate::bytesFree() const
if(deviceState != QAudio::ActiveState && deviceState != QAudio::IdleState)
return 0;
+
int frames = snd_pcm_avail_update(handle);
- if((int)frames > (int)buffer_frames)
+ if (frames == -EPIPE) {
+ // Try and handle buffer underrun
+ int err = snd_pcm_recover(handle, frames, 0);
+ if (err < 0)
+ return 0;
+ else
+ frames = snd_pcm_avail_update(handle);
+ } else if (frames < 0) {
+ return 0;
+ }
+
+ if ((int)frames > (int)buffer_frames)
frames = buffer_frames;
return snd_pcm_frames_to_bytes(handle, frames);
diff --git a/src/multimedia/audio/qaudiooutput_symbian_p.cpp b/src/multimedia/audio/qaudiooutput_symbian_p.cpp
index 6d24d73361..dea14acdfe 100644
--- a/src/multimedia/audio/qaudiooutput_symbian_p.cpp
+++ b/src/multimedia/audio/qaudiooutput_symbian_p.cpp
@@ -522,13 +522,18 @@ void QAudioOutputPrivate::pullData()
char *outputPtr = (char*)(outputBuffer.Ptr() + outputBuffer.Length());
const qint64 bytesCopied = m_source->read(outputPtr, copyBytes);
- Q_ASSERT(bytesCopied == copyBytes);
+
+ //Partial buffers can be sent to DevSound. This assert not required.
+ //Q_ASSERT(bytesCopied == copyBytes);
outputBuffer.SetLength(outputBuffer.Length() + bytesCopied);
inputBytes -= bytesCopied;
+ if(bytesCopied == 0)
+ return;
+
if (m_source->atEnd())
lastBufferFilled();
- else if (copyBytes == outputBytes)
+ else
bufferFilled();
}
}
diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp
index 82ce2d713f..26ff607077 100644
--- a/src/multimedia/audio/qaudiooutput_win32_p.cpp
+++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp
@@ -327,25 +327,12 @@ bool QAudioOutputPrivate::open()
wfx.nBlockAlign = (wfx.wBitsPerSample >> 3) * wfx.nChannels;
wfx.nAvgBytesPerSec = wfx.nBlockAlign * wfx.nSamplesPerSec;
- UINT_PTR devId = WAVE_MAPPER;
-
- WAVEOUTCAPS woc;
- unsigned long iNumDevs,ii;
- iNumDevs = waveOutGetNumDevs();
- for(ii=0;ii<iNumDevs;ii++) {
- if(waveOutGetDevCaps(ii, &woc, sizeof(WAVEOUTCAPS))
- == MMSYSERR_NOERROR) {
- QString tmp;
- tmp = QString::fromWCharArray(woc.szPname);
- if(tmp.compare(QLatin1String(m_device)) == 0) {
- devId = ii;
- break;
- }
- }
- }
+ QDataStream ds(&m_device, QIODevice::ReadOnly);
+ quint32 deviceId;
+ ds >> deviceId;
if (!surround) {
- if(waveOutOpen(&hWaveOut, devId, &wfx,
+ if (waveOutOpen(&hWaveOut, UINT_PTR(deviceId), &wfx,
(DWORD_PTR)&waveOutProc,
(DWORD_PTR) this,
CALLBACK_FUNCTION) != MMSYSERR_NOERROR) {
@@ -377,7 +364,7 @@ bool QAudioOutputPrivate::open()
if (settings.channels() == 8)
wfex.dwChannelMask |= SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT;
- if(waveOutOpen(&hWaveOut, devId, &wfex.Format,
+ if (waveOutOpen(&hWaveOut, UINT_PTR(deviceId), &wfex.Format,
(DWORD_PTR)&waveOutProc,
(DWORD_PTR) this,
CALLBACK_FUNCTION) != MMSYSERR_NOERROR) {
diff --git a/src/multimedia/effects/qsoundeffect.cpp b/src/multimedia/effects/qsoundeffect.cpp
index 5a4710134f..1d7c60bc97 100644
--- a/src/multimedia/effects/qsoundeffect.cpp
+++ b/src/multimedia/effects/qsoundeffect.cpp
@@ -96,7 +96,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \qmlproperty int SoundEffect::volume
+ \qmlproperty qreal SoundEffect::volume
This property holds the volume of the playback, from 0.0 (silent) to 1.0 (maximum volume).
*/
diff --git a/src/multimedia/effects/qwavedecoder_p.cpp b/src/multimedia/effects/qwavedecoder_p.cpp
index 4ea7a58476..a4e93a9d35 100644
--- a/src/multimedia/effects/qwavedecoder_p.cpp
+++ b/src/multimedia/effects/qwavedecoder_p.cpp
@@ -51,11 +51,12 @@ QWaveDecoder::QWaveDecoder(QIODevice *s, QObject *parent):
haveFormat(false),
dataSize(0),
remaining(0),
- source(s)
+ source(s),
+ state(QWaveDecoder::InitialState)
{
open(QIODevice::ReadOnly | QIODevice::Unbuffered);
- if (source->bytesAvailable() >= qint64(sizeof(CombinedHeader) + sizeof(DATAHeader) + sizeof(quint16)))
+ if (enoughDataAvailable())
QTimer::singleShot(0, this, SLOT(handleData()));
else
connect(source, SIGNAL(readyRead()), SLOT(handleData()));
@@ -105,55 +106,125 @@ qint64 QWaveDecoder::writeData(const char *data, qint64 len)
void QWaveDecoder::handleData()
{
- if (source->bytesAvailable() < qint64(sizeof(CombinedHeader) + sizeof(DATAHeader) + sizeof(quint16)))
- return;
+ if (state == QWaveDecoder::InitialState) {
+ if (source->bytesAvailable() < qint64(sizeof(RIFFHeader)))
+ return;
- source->disconnect(SIGNAL(readyRead()), this, SLOT(handleData()));
- source->read((char*)&header, sizeof(CombinedHeader));
+ RIFFHeader riff;
+ source->read(reinterpret_cast<char *>(&riff), sizeof(RIFFHeader));
- if (qstrncmp(header.riff.descriptor.id, "RIFF", 4) != 0 ||
- qstrncmp(header.riff.type, "WAVE", 4) != 0 ||
- qstrncmp(header.wave.descriptor.id, "fmt ", 4) != 0 ||
- (header.wave.audioFormat != 0 && header.wave.audioFormat != 1)) {
+ if (qstrncmp(riff.descriptor.id, "RIFF", 4) != 0 ||
+ qstrncmp(riff.type, "WAVE", 4) != 0) {
+ source->disconnect(SIGNAL(readyRead()), this, SLOT(handleData()));
+ emit invalidFormat();
- emit invalidFormat();
- }
- else {
- if (qFromLittleEndian<quint32>(header.wave.descriptor.size) > sizeof(WAVEHeader)) {
- // Extended data available
- quint16 extraFormatBytes;
- source->peek((char*)&extraFormatBytes, sizeof(quint16));
- extraFormatBytes = qFromLittleEndian<quint16>(extraFormatBytes);
- source->read(sizeof(quint16) + extraFormatBytes); // dump it all
+ return;
+ } else {
+ state = QWaveDecoder::WaitingForFormatState;
}
+ }
+
+ if (state == QWaveDecoder::WaitingForFormatState) {
+ if (findChunk("fmt ")) {
+ chunk descriptor;
+ source->peek(reinterpret_cast<char *>(&descriptor), sizeof(chunk));
- int bps = qFromLittleEndian<quint16>(header.wave.bitsPerSample);
+ if (source->bytesAvailable() < qint64(descriptor.size + sizeof(chunk)))
+ return;
- format.setCodec(QLatin1String("audio/pcm"));
- format.setSampleType(bps == 8 ? QAudioFormat::UnSignedInt : QAudioFormat::SignedInt);
- format.setByteOrder(QAudioFormat::LittleEndian);
- format.setFrequency(qFromLittleEndian<quint32>(header.wave.sampleRate));
- format.setSampleSize(bps);
- format.setChannels(qFromLittleEndian<quint16>(header.wave.numChannels));
+ WAVEHeader wave;
+ source->read(reinterpret_cast<char *>(&wave), sizeof(WAVEHeader));
+ if (descriptor.size > sizeof(WAVEHeader))
+ discardBytes(descriptor.size - sizeof(WAVEHeader));
- bool haveData = false;
- chunk descriptor;
- while(!haveData) {
- source->read((char*)&descriptor, sizeof(chunk));
+ if (wave.audioFormat != 0 && wave.audioFormat != 1) {
+ source->disconnect(SIGNAL(readyRead()), this, SLOT(handleData()));
+ emit invalidFormat();
- if(qstrncmp(descriptor.id, "data", 4) != 0) {
- source->read(qFromLittleEndian<quint32>(descriptor.size)); // dump chunk contents
+ return;
} else {
- haveData = true;
+ int bps = qFromLittleEndian<quint16>(wave.bitsPerSample);
+
+ format.setCodec(QLatin1String("audio/pcm"));
+ format.setSampleType(bps == 8 ? QAudioFormat::UnSignedInt : QAudioFormat::SignedInt);
+ format.setByteOrder(QAudioFormat::LittleEndian);
+ format.setFrequency(qFromLittleEndian<quint32>(wave.sampleRate));
+ format.setSampleSize(bps);
+ format.setChannels(qFromLittleEndian<quint16>(wave.numChannels));
+
+ state = QWaveDecoder::WaitingForDataState;
}
}
+ }
+
+ if (state == QWaveDecoder::WaitingForDataState) {
+ if (findChunk("data")) {
+ source->disconnect(SIGNAL(readyRead()), this, SLOT(handleData()));
+
+ chunk descriptor;
+ source->read(reinterpret_cast<char *>(&descriptor), sizeof(chunk));
+ dataSize = descriptor.size;
- dataSize = qFromLittleEndian<quint32>(descriptor.size);
+ haveFormat = true;
+ connect(source, SIGNAL(readyRead()), SIGNAL(readyRead()));
+ emit formatKnown();
- haveFormat = true;
- connect(source, SIGNAL(readyRead()), SIGNAL(readyRead()));
- emit formatKnown();
+ return;
+ }
}
+
+ if (source->atEnd()) {
+ source->disconnect(SIGNAL(readyRead()), this, SLOT(handleData()));
+ emit invalidFormat();
+
+ return;
+ }
+
+}
+
+bool QWaveDecoder::enoughDataAvailable()
+{
+ if (source->bytesAvailable() < qint64(sizeof(chunk)))
+ return false;
+
+ chunk descriptor;
+ source->peek(reinterpret_cast<char *>(&descriptor), sizeof(chunk));
+
+ if (source->bytesAvailable() < qint64(sizeof(chunk) + descriptor.size))
+ return false;
+
+ return true;
+}
+
+bool QWaveDecoder::findChunk(const char *chunkId)
+{
+ if (source->bytesAvailable() < qint64(sizeof(chunk)))
+ return false;
+
+ chunk descriptor;
+ source->peek(reinterpret_cast<char *>(&descriptor), sizeof(chunk));
+
+ if (qstrncmp(descriptor.id, chunkId, 4) == 0)
+ return true;
+
+ while (source->bytesAvailable() >= qint64(sizeof(chunk) + descriptor.size)) {
+ discardBytes(sizeof(chunk) + descriptor.size);
+
+ source->peek(reinterpret_cast<char *>(&descriptor), sizeof(chunk));
+
+ if (qstrncmp(descriptor.id, chunkId, 4) == 0)
+ return true;
+ }
+
+ return false;
+}
+
+void QWaveDecoder::discardBytes(qint64 numBytes)
+{
+ if (source->isSequential())
+ source->read(numBytes);
+ else
+ source->seek(source->pos() + numBytes);
}
QT_END_NAMESPACE
diff --git a/src/multimedia/effects/qwavedecoder_p.h b/src/multimedia/effects/qwavedecoder_p.h
index dba02ebcb2..3f0bab3179 100644
--- a/src/multimedia/effects/qwavedecoder_p.h
+++ b/src/multimedia/effects/qwavedecoder_p.h
@@ -88,6 +88,16 @@ private:
qint64 readData(char *data, qint64 maxlen);
qint64 writeData(const char *data, qint64 len);
+ bool enoughDataAvailable();
+ bool findChunk(const char *chunkId);
+ void discardBytes(qint64 numBytes);
+
+ enum State {
+ InitialState,
+ WaitingForFormatState,
+ WaitingForDataState
+ };
+
struct chunk
{
char id[4];
@@ -108,22 +118,13 @@ private:
quint16 blockAlign;
quint16 bitsPerSample;
};
- struct DATAHeader
- {
- chunk descriptor;
- };
- struct CombinedHeader
- {
- RIFFHeader riff;
- WAVEHeader wave;
- };
bool haveFormat;
qint64 dataSize;
qint64 remaining;
QAudioFormat format;
QIODevice *source;
- CombinedHeader header;
+ State state;
};
QT_END_NAMESPACE
diff --git a/src/multimedia/qcamera.cpp b/src/multimedia/qcamera.cpp
index 670a328d03..b1620b33d2 100644
--- a/src/multimedia/qcamera.cpp
+++ b/src/multimedia/qcamera.cpp
@@ -481,10 +481,7 @@ void QCamera::setViewfinder(QVideoWidget *viewfinder)
if (d->viewfinder)
unbind(d->viewfinder);
- d->viewfinder = viewfinder;
-
- if (d->viewfinder)
- bind(d->viewfinder);
+ d->viewfinder = viewfinder && bind(viewfinder) ? viewfinder : 0;
}
/*!
@@ -499,10 +496,7 @@ void QCamera::setViewfinder(QGraphicsVideoItem *viewfinder)
if (d->viewfinder)
unbind(d->viewfinder);
- d->viewfinder = viewfinder;
-
- if (d->viewfinder)
- bind(d->viewfinder);
+ d->viewfinder = viewfinder && bind(viewfinder) ? viewfinder : 0;
}
/*!
diff --git a/src/multimedia/qcamerafocus.cpp b/src/multimedia/qcamerafocus.cpp
index e054b1ec7c..dcb72f4650 100644
--- a/src/multimedia/qcamerafocus.cpp
+++ b/src/multimedia/qcamerafocus.cpp
@@ -211,6 +211,7 @@ void QCameraFocusPrivate::initControls()
q, SIGNAL(maximumOpticalZoomChanged(qreal)));
q->connect(focusControl, SIGNAL(maximumDigitalZoomChanged(qreal)),
q, SIGNAL(maximumDigitalZoomChanged(qreal)));
+ q->connect(focusControl, SIGNAL(focusZonesChanged()), q, SIGNAL(focusZonesChanged()));
}
}
diff --git a/src/multimedia/qgraphicsvideoitem_overlay.cpp b/src/multimedia/qgraphicsvideoitem_overlay.cpp
index e6d36a07c1..031dad316d 100644
--- a/src/multimedia/qgraphicsvideoitem_overlay.cpp
+++ b/src/multimedia/qgraphicsvideoitem_overlay.cpp
@@ -260,6 +260,7 @@ bool QGraphicsVideoItem::setMediaObject(QMediaObject *object)
}
}
+ d->mediaObject = 0;
return false;
}
diff --git a/src/multimedia/qmediaplayer.cpp b/src/multimedia/qmediaplayer.cpp
index ea85496ca9..4dbf4d5fb8 100644
--- a/src/multimedia/qmediaplayer.cpp
+++ b/src/multimedia/qmediaplayer.cpp
@@ -206,6 +206,8 @@ void QMediaPlayerPrivate::_q_error(int error, const QString &errorString)
void QMediaPlayerPrivate::_q_updateMedia(const QMediaContent &media)
{
+ Q_Q(QMediaPlayer);
+
if (!control)
return;
@@ -230,8 +232,14 @@ void QMediaPlayerPrivate::_q_updateMedia(const QMediaContent &media)
state = control->state();
- if (state != currentState)
- emit q_func()->stateChanged(state);
+ if (state != currentState) {
+ if (state == QMediaPlayer::PlayingState)
+ q->addPropertyWatch("position");
+ else
+ q->removePropertyWatch("position");
+
+ emit q->stateChanged(state);
+ }
}
void QMediaPlayerPrivate::_q_playlistDestroyed()
@@ -694,10 +702,7 @@ void QMediaPlayer::setVideoOutput(QVideoWidget *output)
if (d->videoOutput)
unbind(d->videoOutput);
- d->videoOutput = output;
-
- if (d->videoOutput)
- bind(d->videoOutput);
+ d->videoOutput = output && bind(output) ? output : 0;
}
/*!
@@ -715,10 +720,7 @@ void QMediaPlayer::setVideoOutput(QGraphicsVideoItem *output)
if (d->videoOutput)
unbind(d->videoOutput);
- d->videoOutput = output;
-
- if (d->videoOutput)
- bind(d->videoOutput);
+ d->videoOutput = output && bind(output) ? output : 0;
}
// Enums
diff --git a/src/multimedia/qmediastreamscontrol.cpp b/src/multimedia/qmediastreamscontrol.cpp
index b1d8d313f4..aa0efd71eb 100644
--- a/src/multimedia/qmediastreamscontrol.cpp
+++ b/src/multimedia/qmediastreamscontrol.cpp
@@ -46,7 +46,8 @@ QT_BEGIN_NAMESPACE
/*!
\class QMediaStreamsControl
-
+ \preliminary
+
\inmodule QtMultimediaKit
\ingroup multimedia
\brief The QMediaStreamsControl class provides a media stream selection control.
diff --git a/src/organizer/engines/qorganizeritemmemorybackend.cpp b/src/organizer/engines/qorganizeritemmemorybackend.cpp
index e4b5c9f597..c9d762756f 100644
--- a/src/organizer/engines/qorganizeritemmemorybackend.cpp
+++ b/src/organizer/engines/qorganizeritemmemorybackend.cpp
@@ -504,23 +504,25 @@ void QOrganizerItemMemoryEngine::inferMissingCriteria(QOrganizerRecurrenceRule*
*/
bool QOrganizerItemMemoryEngine::inMultipleOfInterval(const QDate& date, const QDate& initialDate, QOrganizerRecurrenceRule::Frequency frequency, int interval, Qt::DayOfWeek firstDayOfWeek, int maxCount) const
{
+ qulonglong maxDelta = maxCount * interval;
+ Q_ASSERT(date >= initialDate);
switch (frequency) {
case QOrganizerRecurrenceRule::Yearly: {
- int yearsDelta = date.year() - initialDate.year();
- if (maxCount && maxCount * interval <= yearsDelta)
+ uint yearsDelta = date.year() - initialDate.year();
+ if (maxCount && maxDelta <= yearsDelta)
return false;
return (yearsDelta % interval == 0);
}
case QOrganizerRecurrenceRule::Monthly: {
- int monthsDelta = date.month() - initialDate.month() + (12 * (date.year() - initialDate.year()));
- if (maxCount && maxCount * interval <= monthsDelta)
+ uint monthsDelta = date.month() - initialDate.month() + (12 * (date.year() - initialDate.year()));
+ if (maxCount && maxDelta <= monthsDelta)
return false;
return (monthsDelta % interval == 0);
}
case QOrganizerRecurrenceRule::Weekly: {
// we need to adjust for the week start specified by the client if the interval is greater than 1
// ie, every time we hit the day specified, we increment the week count.
- int weekCount = 0;
+ uint weekCount = 0;
QDate tempDate = initialDate;
while (tempDate < date) {
tempDate = tempDate.addDays(1);
@@ -528,13 +530,13 @@ bool QOrganizerItemMemoryEngine::inMultipleOfInterval(const QDate& date, const Q
weekCount += 1;
}
}
- if (maxCount && maxCount * interval <= weekCount)
+ if (maxCount && maxDelta <= weekCount)
return false;
return (weekCount % interval == 0);
}
case QOrganizerRecurrenceRule::Daily: {
- int daysDelta = initialDate.daysTo(date);
- if (maxCount && maxCount * interval <= daysDelta)
+ uint daysDelta = initialDate.daysTo(date);
+ if (maxCount && maxDelta <= daysDelta)
return false;
return (daysDelta % interval == 0);
}
@@ -890,9 +892,7 @@ QList<QOrganizerItem> QOrganizerItemMemoryEngine::internalItems(const QDateTime&
if (!parentsAdded.contains(parentId)) {
parentsAdded.insert(parentId);
QOrganizerManagerEngine::addSorted(&sorted, item(parentId), sortOrders);
-
}
-
}
}
}
diff --git a/src/serviceframework/ipc/objectendpoint.cpp b/src/serviceframework/ipc/objectendpoint.cpp
index 54145b200b..caf555278f 100644
--- a/src/serviceframework/ipc/objectendpoint.cpp
+++ b/src/serviceframework/ipc/objectendpoint.cpp
@@ -48,10 +48,8 @@
#include <QEventLoop>
#include <QEvent>
#include <QVarLengthArray>
-#ifdef Q_OS_WIN
-# include <QCoreApplication>
-# include <QTime>
-#endif
+#include <QTime>
+#include <QCoreApplication>
QTM_BEGIN_NAMESPACE
@@ -173,8 +171,8 @@ ObjectEndPoint::ObjectEndPoint(Type type, QServiceIpcEndPoint* comm, QObject* pa
d->endPointType = type;
dispatch->setParent(this);
- connect(dispatch, SIGNAL(readyRead()), this, SLOT(newPackageReady()));
- connect(dispatch, SIGNAL(disconnected()), this, SLOT(disconnected()));
+ connect(dispatch, SIGNAL(readyRead()), this, SLOT(newPackageReady()), Qt::QueuedConnection);
+ connect(dispatch, SIGNAL(disconnected()), this, SLOT(disconnected()), Qt::QueuedConnection);
if (type == Client) {
return; //we are waiting for conctructProxy() call
} else {
@@ -497,16 +495,18 @@ void ObjectEndPoint::methodCall(const QServicePackage& p)
Q_ASSERT(d->endPointType == ObjectEndPoint::Client);
Response* response = openRequests()->value(p.d->messageId);
- response->isFinished = true;
- if (p.d->responseType == QServicePackage::Failed) {
- response->result = 0;
+ if(response){
+ response->isFinished = true;
+ if (p.d->responseType == QServicePackage::Failed) {
+ response->result = 0;
+ QTimer::singleShot(0, this, SIGNAL(pendingRequestFinished()));
+ return;
+ }
+ QVariant* variant = new QVariant(p.d->payload);
+ response->result = reinterpret_cast<void *>(variant);
+
QTimer::singleShot(0, this, SIGNAL(pendingRequestFinished()));
- return;
}
- QVariant* variant = new QVariant(p.d->payload);
- response->result = reinterpret_cast<void *>(variant);
-
- QTimer::singleShot(0, this, SIGNAL(pendingRequestFinished()));
}
}
@@ -616,28 +616,25 @@ QVariant ObjectEndPoint::invokeRemote(int metaIndex, const QVariantList& args, i
void ObjectEndPoint::waitForResponse(const QUuid& requestId)
{
+ qDebug() << "start ObjectEndPoint::waitForResponse";
Q_ASSERT(d->endPointType == ObjectEndPoint::Client);
if (openRequests()->contains(requestId) ) {
Response* response = openRequests()->value(requestId);
-#ifdef Q_OS_WIN
+ QEventLoop* loop = new QEventLoop( this );
+ connect(this, SIGNAL(pendingRequestFinished()), loop, SLOT(quit()));
QTime timer;
timer.start();
+
while(!response->isFinished) {
- if(QCoreApplication::instance())
- QCoreApplication::instance()->processEvents(QEventLoop::ExcludeUserInputEvents);
+ loop->processEvents(QEventLoop::AllEvents, 30000);
if(timer.elapsed() > 30000)
break;
}
-#else
- QEventLoop* loop = new QEventLoop( this );
- connect(this, SIGNAL(pendingRequestFinished()), loop, SLOT(quit()));
-
- while(!response->isFinished) {
- loop->exec();
- }
delete loop;
-#endif
- }
+ qDebug() << "- response->isFinished: " << response->isFinished;
+
+ }
+ qDebug() << "finished ObjectEndPoint::waitForResponse";
}
#include "moc_objectendpoint_p.cpp"
diff --git a/src/serviceframework/ipc/proxyobject.cpp b/src/serviceframework/ipc/proxyobject.cpp
index 4a6573aac6..a81de66235 100644
--- a/src/serviceframework/ipc/proxyobject.cpp
+++ b/src/serviceframework/ipc/proxyobject.cpp
@@ -150,14 +150,16 @@ int QServiceProxy::qt_metacall(QMetaObject::Call c, int id, void **a)
//invokeRemote() parameter list needs review
QVariant result = d->endPoint->invokeRemote(metaIndex, args,
returnType==0 ? returnType+1: returnType);
- if (returnType != 0 && strcmp(method.typeName(),"QVariant")) {
- QByteArray buffer;
- QDataStream stream(&buffer, QIODevice::ReadWrite);
- QMetaType::save(stream, returnType, result.constData());
- stream.device()->seek(0);
- QMetaType::load(stream, returnType, a[0]);
- } else {
- if (a[0]) *reinterpret_cast< QVariant*>(a[0]) = result;
+ if(result.type() != QVariant::Invalid){
+ if (returnType != 0 && strcmp(method.typeName(),"QVariant")) {
+ QByteArray buffer;
+ QDataStream stream(&buffer, QIODevice::ReadWrite);
+ QMetaType::save(stream, returnType, result.constData());
+ stream.device()->seek(0);
+ QMetaType::load(stream, returnType, a[0]);
+ } else {
+ if (a[0]) *reinterpret_cast< QVariant*>(a[0]) = result;
+ }
}
}
id-=mcount;
diff --git a/src/serviceframework/ipc/qremoteserviceregister_s60.cpp b/src/serviceframework/ipc/qremoteserviceregister_s60.cpp
index f5b4b3bf7f..7e669c5892 100644
--- a/src/serviceframework/ipc/qremoteserviceregister_s60.cpp
+++ b/src/serviceframework/ipc/qremoteserviceregister_s60.cpp
@@ -61,6 +61,7 @@ void printServicePackage(const QServicePackage& package)
qDebug() << "QServicePackage packageType : " << package.d->packageType;
qDebug() << "QServicePackage QUuid : " << package.d->messageId;
qDebug() << "QServicePackage responseType : " << package.d->responseType;
+ qDebug() << "QServicePackage value : " << package.d->payload;
}
else {
qDebug() << "Invalid ServicePackage" << " LEAVING";
@@ -94,7 +95,8 @@ public:
void PackageReceived(QServicePackage package)
{
#ifdef QT_SFW_SYMBIAN_IPC_DEBUG
- qDebug() << "PackageReceived. Enqueueing and emiting ReadyRead()";
+ qDebug() << "SymbianClientEndPoint::PackageReceived. Enqueueing and emiting ReadyRead()";
+ printServicePackage(package);
#endif
incoming.enqueue(package);
emit readyRead();
@@ -143,7 +145,8 @@ public:
void packageReceived(QServicePackage package)
{
#ifdef QT_SFW_SYMBIAN_IPC_DEBUG
- qDebug() << "GTR SymbianServerEndPoint::packageReceived, putting to queue and emiting readyread.";
+ qDebug() << "SymbianServerEndPoint::packageReceived, putting to queue and emiting readyread.";
+ printServicePackage(package);
#endif
incoming.enqueue(package);
emit readyRead();
@@ -597,7 +600,7 @@ void CServiceProviderServerSession::ServiceL(const RMessage2 &aMessage)
switch (aMessage.Function())
{
case EServicePackage:
- User::LeaveIfError(HandleServicePackageL(aMessage));
+ HandleServicePackageL(aMessage);
aMessage.Complete(KErrNone);
break;
case EPackageRequest:
@@ -609,16 +612,16 @@ void CServiceProviderServerSession::ServiceL(const RMessage2 &aMessage)
}
}
-TInt CServiceProviderServerSession::HandleServicePackageL(const RMessage2& aMessage)
+void CServiceProviderServerSession::HandleServicePackageL(const RMessage2& aMessage)
{
- TInt ret = KErrNone;
// Reproduce the serialized data.
HBufC8* servicePackageBuf8 = HBufC8::New(aMessage.GetDesLength(0));
if (!servicePackageBuf8) {
- return KErrNoMemory;
+ User::Leave( KErrNoMemory );
}
TPtr8 ptrToBuf(servicePackageBuf8->Des());
+ TInt ret = KErrNone;
TRAP(ret, aMessage.ReadL(0, ptrToBuf));
if (ret != KErrNone) {
// TODO: is this error handleing correct
@@ -628,7 +631,7 @@ TInt CServiceProviderServerSession::HandleServicePackageL(const RMessage2& aMess
//iDb->lastError().setError(DBError::UnknownError);
//aMessage.Write(1, LastErrorCode());
delete servicePackageBuf8;
- return ret;
+ User::Leave( ret );
}
QByteArray byteArray((const char*)ptrToBuf.Ptr(), ptrToBuf.Length());
@@ -641,7 +644,7 @@ TInt CServiceProviderServerSession::HandleServicePackageL(const RMessage2& aMess
printServicePackage(results);
#endif
iOwner->packageReceived(results);
- return ret;
+ delete servicePackageBuf8;
}
void CServiceProviderServerSession::SetParent(SymbianServerEndPoint *aOwner)
diff --git a/src/serviceframework/ipc/qremoteserviceregister_s60_p.h b/src/serviceframework/ipc/qremoteserviceregister_s60_p.h
index 1178e8ebdc..0295ad2224 100644
--- a/src/serviceframework/ipc/qremoteserviceregister_s60_p.h
+++ b/src/serviceframework/ipc/qremoteserviceregister_s60_p.h
@@ -171,7 +171,7 @@ class CServiceProviderServerSession : public CSession2
void SetParent(SymbianServerEndPoint* aOwner);
void SendServicePackageL(const QServicePackage& aPackage);
- TInt HandleServicePackageL(const RMessage2& aMessage);
+ void HandleServicePackageL(const RMessage2& aMessage);
void HandlePackageRequestL(const RMessage2& aMessage);
void HandlePackageRequestCancelL(const RMessage2& aMessage);
diff --git a/src/serviceframework/qremoteserviceregister.cpp b/src/serviceframework/qremoteserviceregister.cpp
index 9256e79867..a60484c8eb 100644
--- a/src/serviceframework/qremoteserviceregister.cpp
+++ b/src/serviceframework/qremoteserviceregister.cpp
@@ -167,7 +167,7 @@ const QMetaObject * QRemoteServiceRegister::Entry::metaObject() const
Sets the QRemoteServiceRegister::InstanceType of the registration entry.
If this is not explicitly called, the default instance \a type for the registration entry
- is QRemoteServiceRegister::GlobalInstance.
+ is QRemoteServiceRegister::PrivateInstance.
*/
void QRemoteServiceRegister::Entry::setInstantiationType(QRemoteServiceRegister::InstanceType type)
{
diff --git a/src/serviceframework/serviceframework.pro b/src/serviceframework/serviceframework.pro
index fbf0d6504c..759e56ec7d 100644
--- a/src/serviceframework/serviceframework.pro
+++ b/src/serviceframework/serviceframework.pro
@@ -31,7 +31,10 @@ SOURCES += servicemetadata.cpp \
qservicefilter.cpp \
dberror.cpp \
qremoteserviceregister.cpp
-symbian {
+symbian {
+ contains(S60_VERSION, 5.2)|contains(MOBILITY_SD_MCL_BUILD, yes){
+ DEFINES += SYMBIAN_EMULATOR_SUPPORTS_PERPROCESS_WSD
+ }
INCLUDEPATH += ./databasemanagerserver_symbian
PRIVATE_HEADERS += databasemanager_symbian_p.h
SOURCES += databasemanager_symbian.cpp
diff --git a/src/systeminfo/qsysteminfo_maemo.cpp b/src/systeminfo/qsysteminfo_maemo.cpp
index 272ea94f10..2395c955ce 100644
--- a/src/systeminfo/qsysteminfo_maemo.cpp
+++ b/src/systeminfo/qsysteminfo_maemo.cpp
@@ -833,8 +833,8 @@ void QSystemNetworkInfoPrivate::registrationStatusChanged(uchar var1, ushort var
int newCellId = var3;
QString newMobileCountryCode;
QString newMobileNetworkCode;
- newMobileCountryCode.setNum(var4);
- newMobileNetworkCode.setNum(var5);
+ newMobileCountryCode.setNum(var5);
+ newMobileNetworkCode.setNum(var4);
if (currentCellNetworkStatus != newCellNetworkStatus) {
currentCellNetworkStatus = newCellNetworkStatus;
@@ -1474,7 +1474,7 @@ bool QSystemScreenSaverPrivate::screenSaverInhibited()
displayOn = ("on" == reply.value());
}
#endif
- return (displayOn && isBlankingInhibited && isInhibited);
+ return ((displayOn && isBlankingInhibited) || (displayOn && isInhibited));
}
QSystemBatteryInfoPrivate::QSystemBatteryInfoPrivate(QSystemBatteryInfoLinuxCommonPrivate *parent)
diff --git a/src/systeminfo/qsysteminfo_s60.cpp b/src/systeminfo/qsysteminfo_s60.cpp
index f8a64e11fd..d5a089c25d 100644
--- a/src/systeminfo/qsysteminfo_s60.cpp
+++ b/src/systeminfo/qsysteminfo_s60.cpp
@@ -914,6 +914,7 @@ QSystemDeviceInfoPrivate::QSystemDeviceInfoPrivate(QObject *parent)
{
DeviceInfo::instance()->batteryInfo()->addObserver(this);
DeviceInfo::instance()->chargingStatus()->addObserver(this);
+ m_previousBatteryStatus = QSystemDeviceInfo::NoBatteryLevel;
}
QSystemDeviceInfoPrivate::~QSystemDeviceInfoPrivate()
@@ -1106,14 +1107,23 @@ int QSystemDeviceInfoPrivate::batteryLevel() const
QSystemDeviceInfo::BatteryStatus QSystemDeviceInfoPrivate::batteryStatus()
{
int batteryLevel = DeviceInfo::instance()->batteryInfo()->batteryLevel();
- if(batteryLevel < 4) {
- return QSystemDeviceInfo::BatteryCritical;
- } else if (batteryLevel < 11) {
- return QSystemDeviceInfo::BatteryVeryLow;
- } else if (batteryLevel < 41) {
- return QSystemDeviceInfo::BatteryLow;
- } else if (batteryLevel > 40) {
- return QSystemDeviceInfo::BatteryNormal;
+ QSystemDeviceInfo::PowerState currentpwrstate = currentPowerState();
+ if (batteryLevel < 15 ) {
+ if ( (currentpwrstate == QSystemDeviceInfo::WallPowerChargingBattery) || (currentpwrstate == QSystemDeviceInfo::WallPower) ) {
+ return QSystemDeviceInfo::BatteryLow;
+ } else {
+ return QSystemDeviceInfo::BatteryVeryLow;
+ }
+ } else if (batteryLevel < 29) {
+ return QSystemDeviceInfo::BatteryLow;
+ } else if (batteryLevel < 43) {
+ if ( (currentpwrstate == QSystemDeviceInfo::WallPowerChargingBattery) || (currentpwrstate == QSystemDeviceInfo::WallPower) ){
+ return QSystemDeviceInfo::BatteryNormal;
+ } else {
+ return QSystemDeviceInfo::BatteryLow;
+ }
+ } else if (batteryLevel > 42) {
+ return QSystemDeviceInfo::BatteryNormal;
}
return QSystemDeviceInfo::NoBatteryLevel;
@@ -1158,20 +1168,11 @@ void QSystemDeviceInfoPrivate::batteryLevelChanged()
{
emit batteryLevelChanged(batteryLevel());
- int batteryLevel = DeviceInfo::instance()->batteryInfo()->batteryLevel();
- QSystemDeviceInfo::BatteryStatus status(batteryStatus());
-
- if(batteryLevel < 4 && status != QSystemDeviceInfo::BatteryCritical) {
- emit batteryStatusChanged(QSystemDeviceInfo::BatteryCritical);
- } else if (batteryLevel < 11 && status != QSystemDeviceInfo::BatteryVeryLow) {
- emit batteryStatusChanged(QSystemDeviceInfo::BatteryVeryLow);
- } else if (batteryLevel < 41 && status != QSystemDeviceInfo::BatteryLow) {
- emit batteryStatusChanged(QSystemDeviceInfo::BatteryLow);
- } else if (batteryLevel > 40 && status != QSystemDeviceInfo::BatteryNormal) {
- emit batteryStatusChanged(QSystemDeviceInfo::BatteryNormal);
- } else {
- emit batteryStatusChanged(QSystemDeviceInfo::NoBatteryLevel);
+ QSystemDeviceInfo::BatteryStatus currentstatus(batteryStatus());
+ if (currentstatus != m_previousBatteryStatus) {
+ emit batteryStatusChanged(currentstatus);
}
+ m_previousBatteryStatus = currentstatus;
}
void QSystemDeviceInfoPrivate::chargingStatusChanged()
diff --git a/src/systeminfo/qsysteminfo_s60_p.h b/src/systeminfo/qsysteminfo_s60_p.h
index e23d7a9800..0521166ceb 100644
--- a/src/systeminfo/qsysteminfo_s60_p.h
+++ b/src/systeminfo/qsysteminfo_s60_p.h
@@ -302,6 +302,7 @@ private:
bool hasWirelessKeyboardConnected;
+ QSystemDeviceInfo::BatteryStatus m_previousBatteryStatus;
};
//////// QSystemScreenSaver
diff --git a/src/versitorganizer/qversitorganizerexporter_p.cpp b/src/versitorganizer/qversitorganizerexporter_p.cpp
index 87d4bef4dd..e87157615b 100644
--- a/src/versitorganizer/qversitorganizerexporter_p.cpp
+++ b/src/versitorganizer/qversitorganizerexporter_p.cpp
@@ -174,16 +174,25 @@ void QVersitOrganizerExporterPrivate::encodeEventTimeRange(
QSet<QString>* processedFields)
{
QOrganizerEventTime etr = static_cast<QOrganizerEventTime>(detail);
- QVersitProperty property =
- takeProperty(document, QLatin1String("DTSTART"), removedProperties);
+ bool isAllDay = etr.isAllDay();
+ QVersitProperty property = takeProperty(document, QLatin1String("DTSTART"), removedProperties);
property.setName(QLatin1String("DTSTART"));
- property.setValue(encodeDateTime(etr.startDateTime()));
+ if (isAllDay) {
+ property.setValue(etr.startDateTime().date().toString(QLatin1String("yyyyMMdd")));
+ property.insertParameter(QLatin1String("VALUE"), QLatin1String("DATE"));
+ } else {
+ property.setValue(encodeDateTime(etr.startDateTime()));
+ }
*generatedProperties << property;
- property =
- takeProperty(document, QLatin1String("DTEND"), removedProperties);
+ property = takeProperty(document, QLatin1String("DTEND"), removedProperties);
property.setName(QLatin1String("DTEND"));
- property.setValue(encodeDateTime(etr.endDateTime()));
+ if (isAllDay) {
+ property.setValue(etr.endDateTime().date().toString(QLatin1String("yyyyMMdd")));
+ property.insertParameter(QLatin1String("VALUE"), QLatin1String("DATE"));
+ } else {
+ property.setValue(encodeDateTime(etr.endDateTime()));
+ }
*generatedProperties << property;
*processedFields << QOrganizerEventTime::FieldStartDateTime
<< QOrganizerEventTime::FieldEndDateTime;
@@ -197,16 +206,25 @@ void QVersitOrganizerExporterPrivate::encodeTodoTimeRange(
QSet<QString>* processedFields)
{
QOrganizerTodoTime ttr = static_cast<QOrganizerTodoTime>(detail);
- QVersitProperty property =
- takeProperty(document, QLatin1String("DTSTART"), removedProperties);
+ bool isAllDay = ttr.isAllDay();
+ QVersitProperty property = takeProperty(document, QLatin1String("DTSTART"), removedProperties);
property.setName(QLatin1String("DTSTART"));
- property.setValue(encodeDateTime(ttr.startDateTime()));
+ if (isAllDay) {
+ property.setValue(ttr.startDateTime().date().toString(QLatin1String("yyyyMMdd")));
+ property.insertParameter(QLatin1String("VALUE"), QLatin1String("DATE"));
+ } else {
+ property.setValue(encodeDateTime(ttr.startDateTime()));
+ }
*generatedProperties << property;
- property =
- takeProperty(document, QLatin1String("DUE"), removedProperties);
+ property = takeProperty(document, QLatin1String("DUE"), removedProperties);
property.setName(QLatin1String("DUE"));
- property.setValue(encodeDateTime(ttr.dueDateTime()));
+ if (isAllDay) {
+ property.setValue(ttr.dueDateTime().date().toString(QLatin1String("yyyyMMdd")));
+ property.insertParameter(QLatin1String("VALUE"), QLatin1String("DATE"));
+ } else {
+ property.setValue(encodeDateTime(ttr.dueDateTime()));
+ }
*generatedProperties << property;
*processedFields << QOrganizerTodoTime::FieldStartDateTime
<< QOrganizerTodoTime::FieldDueDateTime;
@@ -220,8 +238,7 @@ void QVersitOrganizerExporterPrivate::encodeJournalTimeRange(
QSet<QString>* processedFields)
{
QOrganizerJournalTime jtr = static_cast<QOrganizerJournalTime>(detail);
- QVersitProperty property =
- takeProperty(document, QLatin1String("DTSTART"), removedProperties);
+ QVersitProperty property = takeProperty(document, QLatin1String("DTSTART"), removedProperties);
property.setName(QLatin1String("DTSTART"));
property.setValue(encodeDateTime(jtr.entryDateTime()));
*generatedProperties << property;
@@ -236,14 +253,12 @@ void QVersitOrganizerExporterPrivate::encodeTimestamp(
QSet<QString>* processedFields)
{
QOrganizerItemTimestamp timestamp = static_cast<QOrganizerItemTimestamp>(detail);
- QVersitProperty property =
- takeProperty(document, QLatin1String("CREATED"), removedProperties);
+ QVersitProperty property = takeProperty(document, QLatin1String("CREATED"), removedProperties);
property.setName(QLatin1String("CREATED"));
property.setValue(encodeDateTime(timestamp.created().toUTC()));
*generatedProperties << property;
- property =
- takeProperty(document, QLatin1String("LAST-MODIFIED"), removedProperties);
+ property = takeProperty(document, QLatin1String("LAST-MODIFIED"), removedProperties);
property.setName(QLatin1String("LAST-MODIFIED"));
property.setValue(encodeDateTime(timestamp.lastModified().toUTC()));
*generatedProperties << property;
diff --git a/src/versitorganizer/qversitorganizerimporter_p.cpp b/src/versitorganizer/qversitorganizerimporter_p.cpp
index d190866b9f..235e3c71f5 100644
--- a/src/versitorganizer/qversitorganizerimporter_p.cpp
+++ b/src/versitorganizer/qversitorganizerimporter_p.cpp
@@ -289,7 +289,8 @@ bool QVersitOrganizerImporterPrivate::createStartDateTime(
QList<QOrganizerItemDetail>* updatedDetails) {
if (property.value().isEmpty())
return false;
- QDateTime newStart = parseDateTime(property);
+ bool hasTime;
+ QDateTime newStart = parseDateTime(property, &hasTime);
if (!newStart.isValid())
return false;
QOrganizerEventTime etr(item->detail<QOrganizerEventTime>());
@@ -309,6 +310,8 @@ bool QVersitOrganizerImporterPrivate::createStartDateTime(
etr.setEndDateTime(newEnd);
}
etr.setStartDateTime(newStart);
+ if (!etr.isAllDay() && !hasTime)
+ etr.setAllDay(true);
updatedDetails->append(etr);
return true;
}
@@ -321,11 +324,14 @@ bool QVersitOrganizerImporterPrivate::createEndDateTime(
QList<QOrganizerItemDetail>* updatedDetails) {
if (property.value().isEmpty())
return false;
- QDateTime newEnd = parseDateTime(property);
+ bool hasTime;
+ QDateTime newEnd = parseDateTime(property, &hasTime);
if (!newEnd.isValid())
return false;
QOrganizerEventTime etr(item->detail<QOrganizerEventTime>());
etr.setEndDateTime(newEnd);
+ if (!etr.isAllDay() && !hasTime)
+ etr.setAllDay(true);
updatedDetails->append(etr);
mDurationSpecified = false;
return true;
@@ -365,11 +371,14 @@ bool QVersitOrganizerImporterPrivate::createTodoStartDateTime(
QList<QOrganizerItemDetail>* updatedDetails) {
if (property.value().isEmpty())
return false;
- QDateTime newStart = parseDateTime(property);
+ bool hasTime;
+ QDateTime newStart = parseDateTime(property, &hasTime);
if (!newStart.isValid())
return false;
QOrganizerTodoTime ttr(item->detail<QOrganizerTodoTime>());
ttr.setStartDateTime(newStart);
+ if (!ttr.isAllDay() && !hasTime)
+ ttr.setAllDay(true);
updatedDetails->append(ttr);
return true;
}
@@ -382,11 +391,14 @@ bool QVersitOrganizerImporterPrivate::createDueDateTime(
QList<QOrganizerItemDetail>* updatedDetails) {
if (property.value().isEmpty())
return false;
- QDateTime newEnd = parseDateTime(property);
+ bool hasTime;
+ QDateTime newEnd = parseDateTime(property, &hasTime);
if (!newEnd.isValid())
return false;
QOrganizerTodoTime ttr(item->detail<QOrganizerTodoTime>());
ttr.setDueDateTime(newEnd);
+ if (!ttr.isAllDay() && !hasTime)
+ ttr.setAllDay(true);
updatedDetails->append(ttr);
mDurationSpecified = false;
return true;
@@ -413,21 +425,38 @@ bool QVersitOrganizerImporterPrivate::createJournalEntryDateTime(
* UTC time zone, floating time zone, or (if a TZID parameter exists in \a property), as a foreign
* time zone (returned as a UTC datetime). Returns an invalid QDateTime if the string cannot be
* parsed.
+ *
+ * \a hasTime is set to true if the parsed date-time has a time, or false if it is a date only.
+ * (the time portion is set to some valid but arbitrary value).
*/
-QDateTime QVersitOrganizerImporterPrivate::parseDateTime(const QVersitProperty& property) const
+QDateTime QVersitOrganizerImporterPrivate::parseDateTime(const QVersitProperty& property,
+ bool* hasTime) const
{
- QDateTime datetime(parseDateTime(property.value()));
- if (datetime.isValid() && datetime.timeSpec() == Qt::LocalTime) {
- QMultiHash<QString, QString> params = property.parameters();
- QString tzid = params.value(QLatin1String("TZID"));
- if (!tzid.isEmpty()) {
- if (tzid.at(0) == QLatin1Char('/') && mTimeZoneHandler)
- datetime = mTimeZoneHandler->convertTimeZoneToUtc(datetime, tzid);
- else
- datetime = mTimeZones.convert(datetime, tzid);
+ const QMultiHash<QString, QString> parameters = property.parameters();
+ if (parameters.find(QLatin1String("VALUE"), QLatin1String("DATE")) == parameters.constEnd()) {
+ // try parsing a datetime
+ if (hasTime)
+ *hasTime = true;
+ QDateTime datetime(parseDateTime(property.value()));
+ if (datetime.isValid() && datetime.timeSpec() == Qt::LocalTime) {
+ QMultiHash<QString, QString> params = property.parameters();
+ QString tzid = params.value(QLatin1String("TZID"));
+ if (!tzid.isEmpty()) {
+ if (tzid.at(0) == QLatin1Char('/') && mTimeZoneHandler)
+ datetime = mTimeZoneHandler->convertTimeZoneToUtc(datetime, tzid);
+ else
+ datetime = mTimeZones.convert(datetime, tzid);
+ }
}
+ return datetime;
+ } else {
+ if (hasTime)
+ *hasTime = false;
+ QDateTime retn;
+ retn.setDate(QDate::fromString(property.value(), QLatin1String("yyyyMMdd")));
+ retn.setTime(QTime(0, 0, 0));
+ return retn;
}
- return datetime;
}
/*! Parses \a str as an ISO 8601 datetime in basic format, either in UTC timezone or floating
diff --git a/src/versitorganizer/qversitorganizerimporter_p.h b/src/versitorganizer/qversitorganizerimporter_p.h
index 2e914d5515..03d0d1a7a5 100644
--- a/src/versitorganizer/qversitorganizerimporter_p.h
+++ b/src/versitorganizer/qversitorganizerimporter_p.h
@@ -171,7 +171,7 @@ private:
const QVersitProperty& property,
QOrganizerItem* item,
QList<QOrganizerItemDetail>* updatedDetails);
- QDateTime parseDateTime(const QVersitProperty& property) const;
+ QDateTime parseDateTime(const QVersitProperty& property, bool* hasTime = 0) const;
QDateTime parseDateTime(QString str) const;
bool createRecurrenceRule(
diff --git a/tests/auto/databasemanager/databasemanager.pro b/tests/auto/databasemanager/databasemanager.pro
index 2f7d1a8358..79d731328d 100644
--- a/tests/auto/databasemanager/databasemanager.pro
+++ b/tests/auto/databasemanager/databasemanager.pro
@@ -20,6 +20,9 @@ CONFIG+=testcase
include(../../../common.pri)
symbian {
+ contains(S60_VERSION, 5.2)|contains(MOBILITY_SD_MCL_BUILD, yes){
+ DEFINES += SYMBIAN_EMULATOR_SUPPORTS_PERPROCESS_WSD
+ }
SOURCES += tst_databasemanager_symbian.cpp \
../qsfwtestutil.cpp
diff --git a/tests/auto/qabstractsecuritysession/qabstractsecuritysession.pro b/tests/auto/qabstractsecuritysession/qabstractsecuritysession.pro
index cb60613217..299e9dac23 100644
--- a/tests/auto/qabstractsecuritysession/qabstractsecuritysession.pro
+++ b/tests/auto/qabstractsecuritysession/qabstractsecuritysession.pro
@@ -19,6 +19,9 @@ symbian|wince* {
symbian {
TARGET.CAPABILITY = ALL -TCB
LIBS += -lefsrv
+ contains(S60_VERSION, 5.2)|contains(MOBILITY_SD_MCL_BUILD, yes){
+ DEFINES += SYMBIAN_EMULATOR_SUPPORTS_PERPROCESS_WSD
+ }
}
wince* {
diff --git a/tests/auto/qcamera/tst_qcamera.cpp b/tests/auto/qcamera/tst_qcamera.cpp
index 9644cd0f3b..99e2c14715 100644
--- a/tests/auto/qcamera/tst_qcamera.cpp
+++ b/tests/auto/qcamera/tst_qcamera.cpp
@@ -1568,7 +1568,6 @@ void tst_QCamera::testCameraEncodingProperyChange()
camera.setCaptureMode(QCamera::CaptureStillImage);
imageCapture.setEncodingSettings(QImageEncoderSettings());
imageCapture.setEncodingSettings(QImageEncoderSettings());
- QTest::ignoreMessage(QtWarningMsg, "QMediaObject: Trying to unbind not connected helper object ");
camera.setViewfinder(new QGraphicsVideoItem());
QCOMPARE(stateChangedSignal.count(), 0);
diff --git a/tests/auto/qcontactdetails/tst_qcontactdetails.cpp b/tests/auto/qcontactdetails/tst_qcontactdetails.cpp
index ab2b664afa..4284283c1b 100644
--- a/tests/auto/qcontactdetails/tst_qcontactdetails.cpp
+++ b/tests/auto/qcontactdetails/tst_qcontactdetails.cpp
@@ -69,15 +69,19 @@ private slots:
void displayLabel();
void emailAddress();
void family();
+ void favorite();
void gender();
void geolocation();
+ void globalPresence();
void guid();
+ void hobby();
void name();
void nickname();
void note();
void onlineAccount();
void organization();
void phoneNumber();
+ void presence();
void ringtone();
void syncTarget();
void tag();
@@ -427,6 +431,48 @@ void tst_QContactDetails::family()
QCOMPARE(c.details(QContactFamily::DefinitionName).count(), 0);
}
+void tst_QContactDetails::favorite()
+{
+ QContact c;
+ QContactFavorite f1, f2;
+
+ // first, ensure that the default value is "false"
+ QCOMPARE(c.detail<QContactFavorite>().isFavorite(), false);
+ QCOMPARE(c.detail<QContactFavorite>().index(), 0); // 0 being "no index" :-/ -1 would be better, but not default...
+ QVERIFY(!f1.isFavorite());
+
+ // test property set
+ f1.setFavorite(true);
+ QCOMPARE(f1.isFavorite(), true);
+ QCOMPARE(f1.value<bool>(QContactFavorite::FieldFavorite), true);
+
+ // test property add
+ QVERIFY(c.saveDetail(&f1));
+ QCOMPARE(c.details(QContactFavorite::DefinitionName).count(), 1);
+ QCOMPARE(QContactFavorite(c.details(QContactFavorite::DefinitionName).value(0)).isFavorite(), f1.isFavorite());
+
+ // test property update
+ f1.setValue("label","label1");
+ f1.setFavorite(false);
+ f1.setIndex(5);
+ QVERIFY(c.saveDetail(&f1));
+ QCOMPARE(c.details(QContactFavorite::DefinitionName).value(0).value("label"), QString("label1"));
+ QCOMPARE(c.details(QContactFavorite::DefinitionName).value(0).value<bool>(QContactFavorite::FieldFavorite), false);
+ QCOMPARE(c.details(QContactFavorite::DefinitionName).value(0).value<int>(QContactFavorite::FieldIndex), 5);
+ QCOMPARE(c.details<QContactFavorite>().value(0).index(), 5);
+
+ // test property remove
+ f2.setFavorite(true);
+ QVERIFY(c.removeDetail(&f1));
+ QCOMPARE(c.details(QContactFavorite::DefinitionName).count(), 0);
+ QVERIFY(c.saveDetail(&f2));
+ QCOMPARE(c.details(QContactFavorite::DefinitionName).count(), 1);
+ QVERIFY(c.removeDetail(&f2));
+ QCOMPARE(c.details(QContactFavorite::DefinitionName).count(), 0);
+ QVERIFY(c.removeDetail(&f2) == false);
+ QCOMPARE(c.details(QContactFavorite::DefinitionName).count(), 0);
+}
+
void tst_QContactDetails::gender()
{
QContact c;
@@ -516,6 +562,62 @@ void tst_QContactDetails::geolocation()
QCOMPARE(c.details(QContactGeoLocation::DefinitionName).count(), 0);
}
+void tst_QContactDetails::globalPresence()
+{
+ QContact c;
+ QContactGlobalPresence p1, p2;
+
+ // test property set
+ QDateTime ts = QDateTime::currentDateTime();
+ p1.setTimestamp(ts);
+ p1.setNickname(QString("nick"));
+ p1.setPresenceState(QContactPresence::PresenceExtendedAway);
+ p1.setPresenceStateText("1234");
+ p1.setPresenceStateImageUrl(QUrl("http://example.com/someimage.png"));
+ p1.setCustomMessage("gone fishing!");
+ QCOMPARE(p1.timestamp(), ts);
+ QCOMPARE(p1.value<QDateTime>(QContactGlobalPresence::FieldTimestamp), ts);
+ QCOMPARE(p1.nickname(), QString("nick"));
+ QCOMPARE(p1.value(QContactGlobalPresence::FieldNickname), QString("nick"));
+ QCOMPARE(p1.presenceState(), QContactPresence::PresenceExtendedAway);
+ QCOMPARE(p1.value<int>(QContactGlobalPresence::FieldPresenceState), static_cast<int>(QContactPresence::PresenceExtendedAway));
+ QCOMPARE(p1.presenceStateText(), QString("1234"));
+ QCOMPARE(p1.value(QContactGlobalPresence::FieldPresenceStateText), QString("1234"));
+ QCOMPARE(p1.presenceStateImageUrl(), QUrl("http://example.com/someimage.png"));
+ QCOMPARE(p1.value<QUrl>(QContactGlobalPresence::FieldPresenceStateImageUrl), QUrl("http://example.com/someimage.png"));
+ QCOMPARE(p1.customMessage(), QString("gone fishing!"));
+ QCOMPARE(p1.value(QContactGlobalPresence::FieldCustomMessage), QString("gone fishing!"));
+
+ // test property add
+ QVERIFY(c.saveDetail(&p1));
+ QCOMPARE(c.details(QContactGlobalPresence::DefinitionName).count(), 1);
+ QCOMPARE(QContactGlobalPresence(c.details(QContactGlobalPresence::DefinitionName).value(0)).presenceStateText(), p1.presenceStateText());
+
+ // test property update
+ p1.setValue("label","label1");
+ p1.setPresenceStateText("12345");
+ QVERIFY(c.saveDetail(&p1));
+ QCOMPARE(c.details(QContactGlobalPresence::DefinitionName).value(0).value("label"), QString("label1"));
+ QCOMPARE(c.details(QContactGlobalPresence::DefinitionName).value(0).value(QContactGlobalPresence::FieldPresenceStateText), QString("12345"));
+
+ p2.setTimestamp(ts);
+ p2.setNickname(QString("test"));
+ p2.setPresenceState(QContactPresence::PresenceAvailable);
+ p2.setPresenceStateText("online");
+ p2.setPresenceStateImageUrl(QUrl("http://example.com/someimage.png"));
+ p2.setCustomMessage("C is for generic biscuit-type pastry product!");
+
+ // test property remove
+ QVERIFY(c.removeDetail(&p1));
+ QCOMPARE(c.details(QContactGlobalPresence::DefinitionName).count(), 0);
+ QVERIFY(c.saveDetail(&p2));
+ QCOMPARE(c.details(QContactGlobalPresence::DefinitionName).count(), 1);
+ QVERIFY(c.removeDetail(&p2));
+ QCOMPARE(c.details(QContactGlobalPresence::DefinitionName).count(), 0);
+ QVERIFY(c.removeDetail(&p2) == false);
+ QCOMPARE(c.details(QContactGlobalPresence::DefinitionName).count(), 0);
+}
+
void tst_QContactDetails::guid()
{
QContact c;
@@ -549,6 +651,40 @@ void tst_QContactDetails::guid()
QCOMPARE(c.details(QContactGuid::DefinitionName).count(), 0);
}
+void tst_QContactDetails::hobby()
+{
+ QContact c;
+ QContactHobby h1, h2;
+
+ // test property set
+ h1.setHobby("1234");
+ QCOMPARE(h1.hobby(), QString("1234"));
+ QCOMPARE(h1.value(QContactHobby::FieldHobby), QString("1234"));
+
+ // test property add
+ QVERIFY(c.saveDetail(&h1));
+ QCOMPARE(c.details(QContactHobby::DefinitionName).count(), 1);
+ QCOMPARE(QContactHobby(c.details(QContactHobby::DefinitionName).value(0)).hobby(), h1.hobby());
+
+ // test property update
+ h1.setValue("label","label1");
+ h1.setHobby("12345");
+ QVERIFY(c.saveDetail(&h1));
+ QCOMPARE(c.details(QContactHobby::DefinitionName).value(0).value("label"), QString("label1"));
+ QCOMPARE(c.details(QContactHobby::DefinitionName).value(0).value(QContactHobby::FieldHobby), QString("12345"));
+
+ // test property remove
+ h2.setHobby("1111");
+ QVERIFY(c.removeDetail(&h1));
+ QCOMPARE(c.details(QContactHobby::DefinitionName).count(), 0);
+ QVERIFY(c.saveDetail(&h2));
+ QCOMPARE(c.details(QContactHobby::DefinitionName).count(), 1);
+ QVERIFY(c.removeDetail(&h2));
+ QCOMPARE(c.details(QContactHobby::DefinitionName).count(), 0);
+ QVERIFY(c.removeDetail(&h2) == false);
+ QCOMPARE(c.details(QContactHobby::DefinitionName).count(), 0);
+}
+
void tst_QContactDetails::name()
{
QContact c;
@@ -711,11 +847,19 @@ void tst_QContactDetails::onlineAccount()
QCOMPARE(QContactOnlineAccount(c.details(QContactOnlineAccount::DefinitionName).value(0)).accountUri(), o1.accountUri());
// test property update
+ QStringList caps;
+ caps << "cap1" << "cap3" << "cap4";
o1.setValue("label","label1");
o1.setAccountUri("test2@nokia.com");
+ o1.setServiceProvider("some provider");
+ o1.setCapabilities(caps);
QVERIFY(c.saveDetail(&o1));
QCOMPARE(c.details(QContactOnlineAccount::DefinitionName).value(0).value("label"), QString("label1"));
QCOMPARE(c.details(QContactOnlineAccount::DefinitionName).value(0).value(QContactOnlineAccount::FieldAccountUri), QString("test2@nokia.com"));
+ QCOMPARE(c.details(QContactOnlineAccount::DefinitionName).value(0).value<QStringList>(QContactOnlineAccount::FieldCapabilities), caps);
+ QCOMPARE(c.details<QContactOnlineAccount>().value(0).capabilities(), caps);
+ QCOMPARE(c.details(QContactOnlineAccount::DefinitionName).value(0).value(QContactOnlineAccount::FieldServiceProvider), QString("some provider"));
+ QCOMPARE(c.details<QContactOnlineAccount>().value(0).serviceProvider(), QString("some provider"));
// test property remove
QVERIFY(c.removeDetail(&o1));
@@ -841,6 +985,62 @@ void tst_QContactDetails::phoneNumber()
QCOMPARE(c.details(QContactPhoneNumber::DefinitionName).count(), 0);
}
+void tst_QContactDetails::presence()
+{
+ QContact c;
+ QContactPresence p1, p2;
+
+ // test property set
+ QDateTime ts = QDateTime::currentDateTime();
+ p1.setTimestamp(ts);
+ p1.setNickname(QString("nick"));
+ p1.setPresenceState(QContactPresence::PresenceExtendedAway);
+ p1.setPresenceStateText("1234");
+ p1.setPresenceStateImageUrl(QUrl("http://example.com/someimage.png"));
+ p1.setCustomMessage("gone fishing!");
+ QCOMPARE(p1.timestamp(), ts);
+ QCOMPARE(p1.value<QDateTime>(QContactPresence::FieldTimestamp), ts);
+ QCOMPARE(p1.nickname(), QString("nick"));
+ QCOMPARE(p1.value(QContactPresence::FieldNickname), QString("nick"));
+ QCOMPARE(p1.presenceState(), QContactPresence::PresenceExtendedAway);
+ QCOMPARE(p1.value<int>(QContactPresence::FieldPresenceState), static_cast<int>(QContactPresence::PresenceExtendedAway));
+ QCOMPARE(p1.presenceStateText(), QString("1234"));
+ QCOMPARE(p1.value(QContactPresence::FieldPresenceStateText), QString("1234"));
+ QCOMPARE(p1.presenceStateImageUrl(), QUrl("http://example.com/someimage.png"));
+ QCOMPARE(p1.value<QUrl>(QContactPresence::FieldPresenceStateImageUrl), QUrl("http://example.com/someimage.png"));
+ QCOMPARE(p1.customMessage(), QString("gone fishing!"));
+ QCOMPARE(p1.value(QContactPresence::FieldCustomMessage), QString("gone fishing!"));
+
+ // test property add
+ QVERIFY(c.saveDetail(&p1));
+ QCOMPARE(c.details(QContactPresence::DefinitionName).count(), 1);
+ QCOMPARE(QContactPresence(c.details(QContactPresence::DefinitionName).value(0)).presenceStateText(), p1.presenceStateText());
+
+ // test property update
+ p1.setValue("label","label1");
+ p1.setPresenceStateText("12345");
+ QVERIFY(c.saveDetail(&p1));
+ QCOMPARE(c.details(QContactPresence::DefinitionName).value(0).value("label"), QString("label1"));
+ QCOMPARE(c.details(QContactPresence::DefinitionName).value(0).value(QContactPresence::FieldPresenceStateText), QString("12345"));
+
+ p2.setTimestamp(ts);
+ p2.setNickname(QString("test"));
+ p2.setPresenceState(QContactPresence::PresenceAvailable);
+ p2.setPresenceStateText("online");
+ p2.setPresenceStateImageUrl(QUrl("http://example.com/someimage.png"));
+ p2.setCustomMessage("C is for generic biscuit-type pastry product!");
+
+ // test property remove
+ QVERIFY(c.removeDetail(&p1));
+ QCOMPARE(c.details(QContactPresence::DefinitionName).count(), 0);
+ QVERIFY(c.saveDetail(&p2));
+ QCOMPARE(c.details(QContactPresence::DefinitionName).count(), 1);
+ QVERIFY(c.removeDetail(&p2));
+ QCOMPARE(c.details(QContactPresence::DefinitionName).count(), 0);
+ QVERIFY(c.removeDetail(&p2) == false);
+ QCOMPARE(c.details(QContactPresence::DefinitionName).count(), 0);
+}
+
void tst_QContactDetails::ringtone()
{
QContact c;
diff --git a/tests/auto/qcontactmanager/tst_qcontactmanager.cpp b/tests/auto/qcontactmanager/tst_qcontactmanager.cpp
index 2f389b86c5..a58db97cff 100644
--- a/tests/auto/qcontactmanager/tst_qcontactmanager.cpp
+++ b/tests/auto/qcontactmanager/tst_qcontactmanager.cpp
@@ -621,11 +621,17 @@ void tst_QContactManager::ctors()
QContactManager cm3(defaultStore, QMap<QString, QString>());
QContactManager cm4(cm.managerUri()); // should fail
+ QContactManager cm9b(0); // QObject* ctor, should be same as cm2 etc
+ QContactManager cm9c(&parent); // same as cm2 etc.
+
QScopedPointer<QContactManager> cm5(QContactManager::fromUri(QContactManager::buildUri(defaultStore, QMap<QString, QString>())));
QScopedPointer<QContactManager> cm6(QContactManager::fromUri(cm.managerUri())); // uri is not a name; should fail.
QScopedPointer<QContactManager> cm9(QContactManager::fromUri(QString(), &parent));
QVERIFY(cm9->parent() == &parent);
+ QVERIFY(cm9b.parent() == 0);
+ QVERIFY(cm9c.parent() == &parent);
+
/* OLD TEST WAS THIS: */
//QCOMPARE(cm.managerUri(), cm2.managerUri());
@@ -639,6 +645,8 @@ void tst_QContactManager::ctors()
QCOMPARE(cm.managerName(), cm5->managerName());
QCOMPARE(cm.managerName(), cm6->managerName());
QCOMPARE(cm.managerName(), cm9->managerName());
+ QCOMPARE(cm.managerName(), cm9b.managerName());
+ QCOMPARE(cm.managerName(), cm9c.managerName());
QVERIFY(cm.managerUri() != cm4.managerUri()); // don't pass a uri to the ctor
diff --git a/tests/auto/qgalleryfilter/tst_qgalleryfilter.cpp b/tests/auto/qgalleryfilter/tst_qgalleryfilter.cpp
index ff765779fc..c0585278bf 100644
--- a/tests/auto/qgalleryfilter/tst_qgalleryfilter.cpp
+++ b/tests/auto/qgalleryfilter/tst_qgalleryfilter.cpp
@@ -262,6 +262,19 @@ void tst_QGalleryFilter::unionFilter()
QCOMPARE(filters.at(1).type(), QGalleryFilter::Intersection);
QCOMPARE(filters.at(2).type(), QGalleryFilter::MetaData);
QCOMPARE(filters.at(3).type(), QGalleryFilter::MetaData);
+
+ unionFilter.prepend(intersectionFilter || metaDataFilter);
+ QCOMPARE(unionFilter.isEmpty(), false);
+ QCOMPARE(unionFilter.filterCount(), 6);
+
+ filters = unionFilter.filters();
+ QCOMPARE(filters.count(), 6);
+ QCOMPARE(filters.at(0).type(), QGalleryFilter::Intersection);
+ QCOMPARE(filters.at(1).type(), QGalleryFilter::MetaData);
+ QCOMPARE(filters.at(2).type(), QGalleryFilter::MetaData);
+ QCOMPARE(filters.at(3).type(), QGalleryFilter::Intersection);
+ QCOMPARE(filters.at(4).type(), QGalleryFilter::MetaData);
+ QCOMPARE(filters.at(5).type(), QGalleryFilter::MetaData);
}
void tst_QGalleryFilter::intersectionFilter()
@@ -373,6 +386,19 @@ void tst_QGalleryFilter::intersectionFilter()
QCOMPARE(filters.at(1).type(), QGalleryFilter::Union);
QCOMPARE(filters.at(2).type(), QGalleryFilter::MetaData);
QCOMPARE(filters.at(3).type(), QGalleryFilter::MetaData);
+
+ intersectionFilter.prepend(unionFilter && metaDataFilter);
+ QCOMPARE(intersectionFilter.isEmpty(), false);
+ QCOMPARE(intersectionFilter.filterCount(), 6);
+
+ filters = intersectionFilter.filters();
+ QCOMPARE(filters.count(), 6);
+ QCOMPARE(filters.at(0).type(), QGalleryFilter::Union);
+ QCOMPARE(filters.at(1).type(), QGalleryFilter::MetaData);
+ QCOMPARE(filters.at(2).type(), QGalleryFilter::MetaData);
+ QCOMPARE(filters.at(3).type(), QGalleryFilter::Union);
+ QCOMPARE(filters.at(4).type(), QGalleryFilter::MetaData);
+ QCOMPARE(filters.at(5).type(), QGalleryFilter::MetaData);
}
void tst_QGalleryFilter::assignment()
diff --git a/tests/auto/qlandmarkfilehandler_gpx/qlandmarkfilehandler_gpx.pro b/tests/auto/qlandmarkfilehandler_gpx/qlandmarkfilehandler_gpx.pro
index 2e50d8de2e..89141b7785 100644
--- a/tests/auto/qlandmarkfilehandler_gpx/qlandmarkfilehandler_gpx.pro
+++ b/tests/auto/qlandmarkfilehandler_gpx/qlandmarkfilehandler_gpx.pro
@@ -6,15 +6,17 @@ include (../../../common.pri)
QT += sql
-INCLUDEPATH += ../../../src/location
-INCLUDEPATH += ../../../src/location/landmarks
-INCLUDEPATH += ../../../plugins/landmarks/sqlite/
+INCLUDEPATH += ../../../src/location \
+ ../../../src/location/landmarks \
+ ../../../plugins/landmarks/sqlite \
+ ../
# Input
SOURCES += tst_qlandmarkfilehandler_gpx.cpp \
../../../plugins/landmarks/sqlite/qlandmarkfilehandler_gpx.cpp
-HEADERS += ../../../plugins/landmarks/sqlite/qlandmarkfilehandler_gpx_p.h
+HEADERS += ../../../plugins/landmarks/sqlite/qlandmarkfilehandler_gpx_p.h \
+ ../qlandmarkmanagerdataholder.h
RESOURCES += data.qrc
diff --git a/tests/auto/qlandmarkfilehandler_gpx/tst_qlandmarkfilehandler_gpx.cpp b/tests/auto/qlandmarkfilehandler_gpx/tst_qlandmarkfilehandler_gpx.cpp
index 725bd2ad62..b51c959905 100644
--- a/tests/auto/qlandmarkfilehandler_gpx/tst_qlandmarkfilehandler_gpx.cpp
+++ b/tests/auto/qlandmarkfilehandler_gpx/tst_qlandmarkfilehandler_gpx.cpp
@@ -49,10 +49,12 @@
#include <QBuffer>
#include <QDebug>
#include <QThread>
+#include <QScopedPointer>
#define private public
#include <qlandmarkmanager.h>
#include "qlandmarkfilehandler_gpx_p.h"
+#include "qlandmarkmanagerdataholder.h"
QTM_USE_NAMESPACE
@@ -65,7 +67,7 @@ public:
protected:
void run() {
- msleep(50);
+ msleep(10);
m_cancel = true;
}
};
@@ -81,32 +83,42 @@ private:
QLandmarkManager *m_manager;
QLandmarkFileHandlerGpx *m_handler;
QString m_exportFile;
+ QScopedPointer<QLandmarkManagerDataHolder> managerDataHolder;
+
+ void clean() {
+ QList<QLandmarkId> lmIds = m_manager->landmarkIds();
+ for(int i=0; i < lmIds.count(); ++i) {
+ QVERIFY(m_manager->removeLandmark(lmIds.at(i)));
+ }
+
+ QList<QLandmarkCategoryId> catIds = m_manager->categoryIds();
+ for (int i=0; i < catIds.count(); ++i) {
+ if (!m_manager->isReadOnly(catIds.at(i)))
+ QVERIFY(m_manager->removeCategory(catIds.at(i)));
+ }
+ QTest::qWait(20);//try ensure notifications for these
+ //deletions are made prior to each test function.
+ }
private slots:
void init() {
- QMap<QString, QString> map;
- map["filename"] = "test.db";
- m_exportFile = "exportfile";
- m_manager = new QLandmarkManager("com.nokia.qt.landmarks.engines.sqlite", map);
-
+ m_manager = new QLandmarkManager;
m_handler = new QLandmarkFileHandlerGpx;
+ clean();
}
void cleanup() {
+ clean();
delete m_handler;
delete m_manager;
- QFile file("test.db");
- file.remove();
- QFile::remove(m_exportFile);
+ if (QFile::exists(m_exportFile))
+ QFile::remove(m_exportFile);
}
- void cleanupTestCase() {
- QFile file("test.db");
- file.remove();
- QFile::remove(m_exportFile);
- }
+ void initTestCase();
+ void cleanupTestCase();
void fileImport() {
QFETCH(QString, fileIn);
@@ -185,7 +197,7 @@ private slots:
QLandmarkFileHandlerGpx handler(&(cancelThread.m_cancel));
QLandmark lm;
QList<QLandmark> lms;
- for (int i=0; i < 50000; ++i) {
+ for (int i=0; i < 100000; ++i) {
lm.setName(QString("LM%1").arg(0));
lms.append(lm);
}
@@ -193,7 +205,11 @@ private slots:
handler.setWaypoints(lms);
cancelThread.start();
QFile file(m_exportFile);
- QVERIFY(!handler.exportData(&file));
+ bool result = handler.exportData(&file);
+ if (result)
+ cancelThread.wait();
+
+ QVERIFY(!result);
QCOMPARE(handler.error(), QLandmarkManager::CancelError);
cancelThread.wait();
}
@@ -501,5 +517,16 @@ private:
}
};
+void tst_QLandmarkFileHandler_Gpx::initTestCase()
+{
+ managerDataHolder.reset(new QLandmarkManagerDataHolder());
+}
+
+void tst_QLandmarkFileHandler_Gpx::cleanupTestCase() {
+ managerDataHolder.reset(0);
+ if (QFile::exists(m_exportFile))
+ QFile::remove(m_exportFile);
+}
+
QTEST_MAIN(tst_QLandmarkFileHandler_Gpx)
#include "tst_qlandmarkfilehandler_gpx.moc"
diff --git a/tests/auto/qlandmarkfilehandler_lmx/qlandmarkfilehandler_lmx.pro b/tests/auto/qlandmarkfilehandler_lmx/qlandmarkfilehandler_lmx.pro
index ee6b26dd2c..93d729a226 100644
--- a/tests/auto/qlandmarkfilehandler_lmx/qlandmarkfilehandler_lmx.pro
+++ b/tests/auto/qlandmarkfilehandler_lmx/qlandmarkfilehandler_lmx.pro
@@ -6,15 +6,17 @@ include (../../../common.pri)
QT += sql
-INCLUDEPATH += ../../../src/location
-INCLUDEPATH += ../../../src/location/landmarks
-INCLUDEPATH+= ../../../plugins/landmarks/sqlite
+INCLUDEPATH += ../../../src/location \
+ ../../../src/location/landmarks \
+ ../../../plugins/landmarks/sqlite \
+ ../
# Input
SOURCES += tst_qlandmarkfilehandler_lmx.cpp \
../../../plugins/landmarks/sqlite/qlandmarkfilehandler_lmx.cpp
-HEADERS += ../../../plugins/landmarks/sqlite/qlandmarkfilehandler_lmx_p.h
+HEADERS += ../../../plugins/landmarks/sqlite/qlandmarkfilehandler_lmx_p.h \
+ ../qlandmarkmanagerdataholder.h
RESOURCES += data.qrc
diff --git a/tests/auto/qlandmarkfilehandler_lmx/tst_qlandmarkfilehandler_lmx.cpp b/tests/auto/qlandmarkfilehandler_lmx/tst_qlandmarkfilehandler_lmx.cpp
index 5e1d435ffc..b792b4ea9a 100644
--- a/tests/auto/qlandmarkfilehandler_lmx/tst_qlandmarkfilehandler_lmx.cpp
+++ b/tests/auto/qlandmarkfilehandler_lmx/tst_qlandmarkfilehandler_lmx.cpp
@@ -57,6 +57,7 @@
#include <qlandmarkmanager.h>
#include "qlandmarkmanager_p.h"
#include "qlandmarkfilehandler_lmx_p.h"
+#include "qlandmarkmanagerdataholder.h"
QTM_USE_NAMESPACE
@@ -86,31 +87,43 @@ private:
QLandmarkManager *m_manager;
QLandmarkFileHandlerLmx *m_handler;
QString m_exportFile;
+ QScopedPointer<QLandmarkManagerDataHolder> managerDataHolder;
private slots:
+ void clean() {
+ QList<QLandmarkId> lmIds = m_manager->landmarkIds();
+ for(int i=0; i < lmIds.count(); ++i) {
+ QVERIFY(m_manager->removeLandmark(lmIds.at(i)));
+ }
+
+ QList<QLandmarkCategoryId> catIds = m_manager->categoryIds();
+ for (int i=0; i < catIds.count(); ++i) {
+ if (!m_manager->isReadOnly(catIds.at(i)))
+ QVERIFY(m_manager->removeCategory(catIds.at(i)));
+ }
+ QTest::qWait(20);//try ensure notifications for these
+ //deletions are made prior to each test function.
+ }
+
void init() {
- QMap<QString, QString> map;
- map["filename"] = "test.db";
m_exportFile = "exportfile";
- m_manager = new QLandmarkManager("com.nokia.qt.landmarks.engines.sqlite", map);
- m_handler = new QLandmarkFileHandlerLmx();
+ m_manager = new QLandmarkManager;
+ m_handler = new QLandmarkFileHandlerLmx;
+ clean();
}
void cleanup() {
+ clean();
delete m_handler;
delete m_manager;
- QFile file("test.db");
- file.remove();
- QFile::remove(m_exportFile);
+ if (QFile::exists(m_exportFile))
+ QFile::remove(m_exportFile);
}
- void cleanupTestCase() {
- QFile file("test.db");
- file.remove();
- QFile::remove(m_exportFile);
- }
+ void initTestCase();
+ void cleanupTestCase();
void fileImport() {
QFETCH(QString, fileIn);
@@ -119,16 +132,9 @@ private slots:
QFETCH(QList<QLandmark>, landmarks);
QFETCH(QList<QLandmarkCategory>, categories);
- QLandmarkManager::Error error = QLandmarkManager::NoError;
QHash<QString,QString> categoryNameIdHash; //name to local id
for (int i = 0; i < categories.size(); ++i) {
- QLandmarkCategoryId catId;
- categories[i].setCategoryId(catId);
-
- m_manager->saveCategory(&categories[i]);
categoryNameIdHash.insert(categories[i].name(),categories[i].categoryId().localId());
- error = m_manager->error();
- QCOMPARE(error, QLandmarkManager::NoError);
}
QFile file(fileIn);
@@ -164,21 +170,11 @@ private slots:
QFETCH(QList<QLandmark>, landmarks);
QFETCH(QList<QLandmarkCategory>, categories);
- QLandmarkManager::Error error;
- for (int i = 0; i < categories.size(); ++i) {
- QLandmarkCategoryId catId;
- categories[i].setCategoryId(catId);
- m_manager->saveCategory(&categories[i]);
- error = m_manager->error();
- QCOMPARE(error, QLandmarkManager::NoError);
- }
-
QHash<QString,QString> categoryIdNameHash;//local id to name
foreach(const QLandmarkCategory &category, categories) {
categoryIdNameHash.insert(category.categoryId().localId(),category.name());
}
- m_manager->saveLandmarks(&landmarks);
m_handler->setLandmarks(landmarks);
m_handler->setCategoryIdNameHash(categoryIdNameHash);
@@ -472,9 +468,7 @@ private:
QList<QLandmarkCategory> cats;
QList<QLandmarkCategoryId> catIds;
- QMap<QString, QString> map;
- map["filename"] = "test.db";
- m_manager = new QLandmarkManager("com.nokia.qt.landmarks.engines.sqlite", map);
+ m_manager = new QLandmarkManager;
QLandmarkCategory cat0;
cat0.setName("cat0");
@@ -614,5 +608,16 @@ private:
}
};
+void tst_QLandmarkFileHandler_Lmx::initTestCase()
+{
+ managerDataHolder.reset(new QLandmarkManagerDataHolder());
+}
+
+void tst_QLandmarkFileHandler_Lmx::cleanupTestCase() {
+ managerDataHolder.reset(0);
+ if (QFile::exists(m_exportFile))
+ QFile::remove(m_exportFile);
+}
+
QTEST_MAIN(tst_QLandmarkFileHandler_Lmx)
#include "tst_qlandmarkfilehandler_lmx.moc"
diff --git a/tests/auto/qlandmarkmanager/data/AUS-PublicToilet-AustralianCapitalTerritory.gpx b/tests/auto/qlandmarkmanager/data/AUS-PublicToilet-AustralianCapitalTerritory.gpx
index 97275eb212..b99e693b0d 100644
--- a/tests/auto/qlandmarkmanager/data/AUS-PublicToilet-AustralianCapitalTerritory.gpx
+++ b/tests/auto/qlandmarkmanager/data/AUS-PublicToilet-AustralianCapitalTerritory.gpx
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><gpx xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd" version="1.1" creator="POIPlaza (http://www.poiplaza.com)"><wpt lat="-35.46146" lon="148.90686"><name>Public Toilet, AUS-Wetlands Toilets</name></wpt><wpt lat="-35.44211" lon="148.92659"><name>Public Toilet, AUS-Blewitt's Picnic Area</name></wpt><wpt lat="-35.44404" lon="148.92952"><name>Public Toilet, AUS-Sheedy's Picnic Area</name></wpt><wpt lat="-35.48193" lon="148.93326"><name>Public Toilet, AUS-Gibraltar Creek Forest - Gibraltar Falls</name></wpt><wpt lat="-35.48071" lon="148.93742"><name>Public Toilet, AUS-Gibraltar Creek Forest - Woods Reserve Day Use</name></wpt><wpt lat="-35.48059" lon="148.93786"><name>Public Toilet, AUS-Gibraltar Creek Forest - Woods Reserve Camping</name></wpt><wpt lat="-35.32616" lon="148.94381"><name>Public Toilet, AUS-Cotter Reserve</name></wpt><wpt lat="-35.32574" lon="148.94755"><name>Public Toilet, AUS-Cotter Campground</name></wpt><wpt lat="-35.24249" lon="148.95117"><name>Public Toilet, AUS-Swamp Creek</name></wpt><wpt lat="-35.24521" lon="148.95118"><name>Public Toilet, AUS-Uriarra West</name></wpt><wpt lat="-35.25006" lon="148.95222"><name>Public Toilet, AUS-Uriarra East</name></wpt><wpt lat="-35.31980" lon="148.95375"><name>Public Toilet, AUS-Casuarina Sands South</name></wpt><wpt lat="-35.77530" lon="148.95866"><name>Public Toilet, AUS-Franks Hut</name></wpt><wpt lat="-35.31933" lon="148.95974"><name>Public Toilet, AUS-Casuarina Sands North</name></wpt><wpt lat="-35.68267" lon="148.99897"><name>Public Toilet, AUS-Glendale Toilets</name></wpt><wpt lat="-35.39435" lon="149.00929"><name>Public Toilet, AUS-Kambah Pool 2</name></wpt><wpt lat="-35.39840" lon="149.01077"><name>Public Toilet, AUS-Kambah Pool 1</name></wpt><wpt lat="-35.71521" lon="149.01968"><name>Public Toilet, AUS-Brandy Flat</name></wpt><wpt lat="-35.22214" lon="149.02045"><name>Public Toilet, AUS-Hardwick Place</name></wpt><wpt lat="-35.22168" lon="149.02102"><name>Public Toilet, AUS-Park</name></wpt><wpt lat="-35.22573" lon="149.02498"><name>Public Toilet, AUS-Ormsby Place</name></wpt><wpt lat="-35.20120" lon="149.02691"><name>Public Toilet, AUS-Lhotsky Street</name></wpt><wpt lat="-35.20524" lon="149.03366"><name>Public Toilet, AUS-Charnwood Place</name></wpt><wpt lat="-35.24343" lon="149.03406"><name>Public Toilet, AUS-Delamere Street</name></wpt><wpt lat="-35.21819" lon="149.03524"><name>Public Toilet, AUS-Stretton Crescent</name></wpt><wpt lat="-35.24646" lon="149.03590"><name>Public Toilet, AUS-Murranji Street</name></wpt><wpt lat="-35.24268" lon="149.03743"><name>Public Toilet, AUS-Walhallow Street</name></wpt><wpt lat="-35.34658" lon="149.03857"><name>Public Toilet, AUS-Bangalay Court</name></wpt><wpt lat="-35.23094" lon="149.03898"><name>Public Toilet, AUS-Broadsmith Street</name></wpt><wpt lat="-35.24372" lon="149.04331"><name>Public Toilet, AUS-Hawker Place</name></wpt><wpt lat="-35.35011" lon="149.04440"><name>Public Toilet, AUS-Sherratt Place</name></wpt><wpt lat="-35.35245" lon="149.04533"><name>Public Toilet, AUS-Teesdale Place</name></wpt><wpt lat="-35.34852" lon="149.04561"><name>Public Toilet, AUS-Sherratt Place</name></wpt><wpt lat="-35.35118" lon="149.04634"><name>Public Toilet, AUS-Teesdale Close</name></wpt><wpt lat="-35.31640" lon="149.04683"><name>Public Toilet, AUS-Stromlo Forest</name></wpt><wpt lat="-35.23419" lon="149.04826"><name>Public Toilet, AUS-Halford Crescent</name></wpt><wpt lat="-35.34130" lon="149.05254"><name>Public Toilet, AUS-Cooleman Court</name></wpt><wpt lat="-35.21440" lon="149.05384"><name>Public Toilet, AUS-Brownlee Place</name></wpt><wpt lat="-35.38278" lon="149.05507"><name>Public Toilet, AUS-Park 1</name></wpt><wpt lat="-35.35624" lon="149.05685"><name>Public Toilet, AUS-Badimarra Street</name></wpt><wpt lat="-35.38018" lon="149.05841"><name>Public Toilet, AUS-Primmer Court</name></wpt><wpt lat="-35.38860" lon="149.06039"><name>Public Toilet, AUS-Springbett Street 1</name></wpt><wpt lat="-35.38237" lon="149.06066"><name>Public Toilet, AUS-Park 3</name></wpt><wpt lat="-35.39183" lon="149.06181"><name>Public Toilet, AUS-Springbett Street 2</name></wpt><wpt lat="-35.25708" lon="149.06198"><name>Public Toilet, AUS-Park</name></wpt><wpt lat="-35.42802" lon="149.06228"><name>Public Toilet, AUS-Pine Island Central</name></wpt><wpt lat="-35.38910" lon="149.06256"><name>Public Toilet, AUS-Park 2</name></wpt><wpt lat="-35.22778" lon="149.06313"><name>Public Toilet, AUS-McDermott Place</name></wpt><wpt lat="-35.19579" lon="149.06418"><name>Public Toilet, AUS-Clarey Crescent</name></wpt><wpt lat="-35.41123" lon="149.06461"><name>Public Toilet, AUS-Bartlett Place</name></wpt><wpt lat="-35.43185" lon="149.06568"><name>Public Toilet, AUS-Pine Island South</name></wpt><wpt lat="-35.24834" lon="149.06630"><name>Public Toilet, AUS-Belconnen Way</name></wpt><wpt lat="-35.50935" lon="149.06682"><name>Public Toilet, AUS-Tidbinbilla Road</name></wpt><wpt lat="-35.41616" lon="149.06683"><name>Public Toilet, AUS-Hyperdome Shopping Centre</name></wpt><wpt lat="-35.17311" lon="149.06773"><name>Public Toilet, AUS-Gladstone Street</name></wpt><wpt lat="-35.41819" lon="149.06797"><name>Public Toilet, AUS-Soward Way</name></wpt><wpt lat="-35.17199" lon="149.06934"><name>Public Toilet, AUS-Gladstone Street 2</name></wpt><wpt lat="-35.17202" lon="149.06936"><name>Public Toilet, AUS-Gladstone Street 1</name></wpt><wpt lat="-35.50922" lon="149.06947"><name>Public Toilet, AUS-Tharwa Bridge</name></wpt><wpt lat="-35.22535" lon="149.07044"><name>Public Toilet, AUS-Diddams Close 2</name></wpt><wpt lat="-35.25265" lon="149.07072"><name>Public Toilet, AUS-Bowman Street 1</name></wpt><wpt lat="-35.25272" lon="149.07111"><name>Public Toilet, AUS-Bowman Street 2</name></wpt><wpt lat="-35.23903" lon="149.07191"><name>Public Toilet, AUS-Emu Bank</name></wpt><wpt lat="-35.32122" lon="149.07209"><name>Public Toilet, AUS-Dunstan Street</name></wpt><wpt lat="-35.17147" lon="149.07254"><name>Public Toilet, AUS-Bicentennial National Trail</name></wpt><wpt lat="-35.30067" lon="149.07348"><name>Public Toilet, AUS-Scrivener Dam Lookout</name></wpt><wpt lat="-35.22871" lon="149.07433"><name>Public Toilet, AUS-Diddams Close 1</name></wpt><wpt lat="-35.23594" lon="149.07472"><name>Public Toilet, AUS-Townsend Place</name></wpt><wpt lat="-35.40043" lon="149.07545"><name>Public Toilet, AUS-Wheeler Crescent</name></wpt><wpt lat="-35.25216" lon="149.07557"><name>Public Toilet, AUS-Bindubi Street</name></wpt><wpt lat="-35.45238" lon="149.07557"><name>Public Toilet, AUS-Point Hut</name></wpt><wpt lat="-35.35244" lon="149.07648"><name>Public Toilet, AUS-Chifley Place</name></wpt><wpt lat="-35.34066" lon="149.07854"><name>Public Toilet, AUS-Park</name></wpt><wpt lat="-35.25431" lon="149.08071"><name>Public Toilet, AUS-Banambila Street</name></wpt><wpt lat="-35.32448" lon="149.08153"><name>Public Toilet, AUS-Carruthers Street</name></wpt><wpt lat="-35.32513" lon="149.08223"><name>Public Toilet, AUS-Strangways Street</name></wpt><wpt lat="-35.45548" lon="149.08486"><name>Public Toilet, AUS-Knoke Avenue</name></wpt><wpt lat="-35.36159" lon="149.08519"><name>Public Toilet, AUS-Pethebridge Street</name></wpt><wpt lat="-35.34462" lon="149.08612"><name>Public Toilet, AUS-Bowes Place</name></wpt><wpt lat="-35.28633" lon="149.08721"><name>Public Toilet, AUS-Lady Denman Drive</name></wpt><wpt lat="-35.35242" lon="149.08763"><name>Public Toilet, AUS-Colbee Court</name></wpt><wpt lat="-35.33243" lon="149.08853"><name>Public Toilet, AUS-Webster Street</name></wpt><wpt lat="-35.45996" lon="149.08905"><name>Public Toilet, AUS-Sherwood Circuit</name></wpt><wpt lat="-35.29694" lon="149.08946"><name>Public Toilet, AUS-Weston Park Road</name></wpt><wpt lat="-35.17775" lon="149.08976"><name>Public Toilet, AUS-Clarrie Hermes Drive</name></wpt><wpt lat="-35.29195" lon="149.08978"><name>Public Toilet, AUS-Prescot Lane 1</name></wpt><wpt lat="-35.32029" lon="149.09068"><name>Public Toilet, AUS-Park</name></wpt><wpt lat="-35.34033" lon="149.09129"><name>Public Toilet, AUS-Launceston Street</name></wpt><wpt lat="-35.29261" lon="149.09158"><name>Public Toilet, AUS-Prescot Lane 2</name></wpt><wpt lat="-35.34099" lon="149.09195"><name>Public Toilet, AUS-Yamba Drive 2</name></wpt><wpt lat="-35.34299" lon="149.09299"><name>Public Toilet, AUS-Justinian Street</name></wpt><wpt lat="-35.32042" lon="149.09312"><name>Public Toilet, AUS-Makin Place</name></wpt><wpt lat="-35.45749" lon="149.09316"><name>Public Toilet, AUS-Lanyon Marketplace</name></wpt><wpt lat="-35.21380" lon="149.09337"><name>Public Toilet, AUS-Gari Place</name></wpt><wpt lat="-35.33315" lon="149.09360"><name>Public Toilet, AUS-Hughes Place</name></wpt><wpt lat="-35.36581" lon="149.09439"><name>Public Toilet, AUS-Mawson Place</name></wpt><wpt lat="-35.17637" lon="149.09494"><name>Public Toilet, AUS-Clarrie Hermes Drive</name></wpt><wpt lat="-35.34289" lon="149.09509"><name>Public Toilet, AUS-Yamba Drive 1</name></wpt><wpt lat="-35.36845" lon="149.09554"><name>Public Toilet, AUS-Heard Street</name></wpt><wpt lat="-35.37073" lon="149.09618"><name>Public Toilet, AUS-Beasley Street</name></wpt><wpt lat="-35.21723" lon="149.09672"><name>Public Toilet, AUS-Coree Place</name></wpt><wpt lat="-35.30723" lon="149.09718"><name>Public Toilet, AUS-Hutchins Street</name></wpt><wpt lat="-35.34600" lon="149.09778"><name>Public Toilet, AUS-Albermarle Place</name></wpt><wpt lat="-35.27875" lon="149.09850"><name>Public Toilet, AUS-Black Mountain Drive</name></wpt><wpt lat="-35.40377" lon="149.09874"><name>Public Toilet, AUS-Erindale Shopping Centre</name></wpt><wpt lat="-35.36059" lon="149.09934"><name>Public Toilet, AUS-Ainsworth Street</name></wpt><wpt lat="-35.29229" lon="149.10014"><name>Public Toilet, AUS-Black Mountain Peninsula 2</name></wpt><wpt lat="-35.30677" lon="149.10014"><name>Public Toilet, AUS-Loftus Street</name></wpt><wpt lat="-35.28730" lon="149.10125"><name>Public Toilet, AUS-Black Mountain Peninsula 1</name></wpt><wpt lat="-35.26707" lon="149.10130"><name>Public Toilet, AUS-Australian National Botanic Gardens - Plant Use Walk</name></wpt><wpt lat="-35.26348" lon="149.10169"><name>Public Toilet, AUS-Australian National Botanic Gardens - Tasmanian Garden</name></wpt><wpt lat="-35.29928" lon="149.10298"><name>Public Toilet, AUS-Alexandrina Drive</name></wpt><wpt lat="-35.37705" lon="149.10447"><name>Public Toilet, AUS-Longerenong Street</name></wpt><wpt lat="-35.22714" lon="149.10537"><name>Public Toilet, AUS-Diamantina Crescent</name></wpt><wpt lat="-35.26956" lon="149.10563"><name>Public Toilet, AUS-Australian National Botanic Gardens - Camp</name></wpt><wpt lat="-35.22994" lon="149.10600"><name>Public Toilet, AUS-Fitzmaurice Street</name></wpt><wpt lat="-35.34329" lon="149.10768"><name>Public Toilet, AUS-Garran Place</name></wpt><wpt lat="-35.27055" lon="149.10823"><name>Public Toilet, AUS-Australian National Botanic Gardens - Top Depot</name></wpt><wpt lat="-35.27240" lon="149.10866"><name>Public Toilet, AUS-Australian National Botanic Gardens - Ducrou Pavilion</name></wpt><wpt lat="-35.27834" lon="149.10876"><name>Public Toilet, AUS-Australian National Botanic Gardens</name></wpt><wpt lat="-35.41352" lon="149.11066"><name>Public Toilet, AUS-Jefferies Street</name></wpt><wpt lat="-35.28916" lon="149.11077"><name>Public Toilet, AUS-Springbank Island</name></wpt><wpt lat="-35.27710" lon="149.11086"><name>Public Toilet, AUS-Australian National Botanic Gardens - Crosbie Morrison Building</name></wpt><wpt lat="-35.31822" lon="149.11328"><name>Public Toilet, AUS-Bedford Street</name></wpt><wpt lat="-35.22278" lon="149.11346"><name>Public Toilet, AUS-Ashburton Crescent</name></wpt><wpt lat="-35.32882" lon="149.11678"><name>Public Toilet, AUS-Red Hill Drive</name></wpt><wpt lat="-35.30032" lon="149.11709"><name>Public Toilet, AUS-Mariner Place</name></wpt><wpt lat="-35.43919" lon="149.12008"><name>Public Toilet, AUS-Calwell Shopping Centre</name></wpt><wpt lat="-35.41168" lon="149.12077"><name>Public Toilet, AUS-Bugden Avenue</name></wpt><wpt lat="-35.26432" lon="149.12258"><name>Public Toilet, AUS-MacPherson Street</name></wpt><wpt lat="-35.26054" lon="149.12373"><name>Public Toilet, AUS-Macarthur Avenue 1</name></wpt><wpt lat="-35.26230" lon="149.12380"><name>Public Toilet, AUS-Pedder Street</name></wpt><wpt lat="-35.28678" lon="149.12494"><name>Public Toilet, AUS-Barrine Drive</name></wpt><wpt lat="-35.25208" lon="149.12525"><name>Public Toilet, AUS-Hall Street</name></wpt><wpt lat="-35.41412" lon="149.12545"><name>Public Toilet, AUS-Park</name></wpt><wpt lat="-35.26085" lon="149.12570"><name>Public Toilet, AUS-Macarthur Avenue 2</name></wpt><wpt lat="-35.25079" lon="149.12791"><name>Public Toilet, AUS-Park</name></wpt><wpt lat="-35.41339" lon="149.12830"><name>Public Toilet, AUS-Halley Street</name></wpt><wpt lat="-35.24661" lon="149.12914"><name>Public Toilet, AUS-Mouat Street</name></wpt><wpt lat="-35.30040" lon="149.12941"><name>Public Toilet, AUS-King George Terrace</name></wpt><wpt lat="-35.27768" lon="149.13061"><name>Public Toilet, AUS-Mort Street</name></wpt><wpt lat="-35.17927" lon="149.13071"><name>Public Toilet, AUS-Gundaroo Drive 2</name></wpt><wpt lat="-35.28848" lon="149.13076"><name>Public Toilet, AUS-Commonwealth Park 2</name></wpt><wpt lat="-35.29023" lon="149.13076"><name>Public Toilet, AUS-Commonwealth Park 1</name></wpt><wpt lat="-35.17925" lon="149.13077"><name>Public Toilet, AUS-Gundaroo Drive 1</name></wpt><wpt lat="-35.27011" lon="149.13181"><name>Public Toilet, AUS-Girrahween Street</name></wpt><wpt lat="-35.27942" lon="149.13209"><name>Public Toilet, AUS-Canberra Centre</name></wpt><wpt lat="-35.27763" lon="149.13219"><name>Public Toilet, AUS-Bunda Street 1</name></wpt><wpt lat="-35.28249" lon="149.13271"><name>Public Toilet, AUS-London Circuit</name></wpt><wpt lat="-35.27808" lon="149.13286"><name>Public Toilet, AUS-Bunda Street 2</name></wpt><wpt lat="-35.24627" lon="149.13302"><name>Public Toilet, AUS-Northbourne Avenue</name></wpt><wpt lat="-35.28167" lon="149.13324"><name>Public Toilet, AUS-City Walk</name></wpt><wpt lat="-35.32041" lon="149.13332"><name>Public Toilet, AUS-The Terrace Manuka</name></wpt><wpt lat="-35.25554" lon="149.13350"><name>Public Toilet, AUS-Northbourne Avenue</name></wpt><wpt lat="-35.32538" lon="149.13379"><name>Public Toilet, AUS-Captain Cook Crescent</name></wpt><wpt lat="-35.32385" lon="149.13394"><name>Public Toilet, AUS-Captain Cook Crescent 2</name></wpt><wpt lat="-35.28882" lon="149.13540"><name>Public Toilet, AUS-Commonwealth Park 3</name></wpt><wpt lat="-35.28241" lon="149.13641"><name>Public Toilet, AUS-Akuna Street</name></wpt><wpt lat="-35.30067" lon="149.13668"><name>Public Toilet, AUS-National Gallery Of Australia</name></wpt><wpt lat="-35.31440" lon="149.13752"><name>Public Toilet, AUS-Telopea Park</name></wpt><wpt lat="-35.26227" lon="149.13770"><name>Public Toilet, AUS-Angas Street</name></wpt><wpt lat="-35.25998" lon="149.13775"><name>Public Toilet, AUS-Wakefield Avenue</name></wpt><wpt lat="-35.25037" lon="149.14046"><name>Public Toilet, AUS-Cowper Street</name></wpt><wpt lat="-35.21835" lon="149.14217"><name>Public Toilet, AUS-Heffernan Street 1</name></wpt><wpt lat="-35.32827" lon="149.14221"><name>Public Toilet, AUS-Barker Street</name></wpt><wpt lat="-35.21824" lon="149.14227"><name>Public Toilet, AUS-Heffernan Street 2</name></wpt><wpt lat="-35.31641" lon="149.14236"><name>Public Toilet, AUS-Eyre Street - Road Verge</name></wpt><wpt lat="-35.32009" lon="149.14250"><name>Public Toilet, AUS-Dawes Street</name></wpt><wpt lat="-35.24525" lon="149.14345"><name>Public Toilet, AUS-Park</name></wpt><wpt lat="-35.29797" lon="149.14388"><name>Public Toilet, AUS-Kings Park</name></wpt><wpt lat="-35.26209" lon="149.14461"><name>Public Toilet, AUS-Wakefield Gardens Street</name></wpt><wpt lat="-35.28100" lon="149.14499"><name>Public Toilet, AUS-Elimatta Street</name></wpt><wpt lat="-35.24537" lon="149.14516"><name>Public Toilet, AUS-Frenchman Place</name></wpt><wpt lat="-35.33246" lon="149.14619"><name>Public Toilet, AUS-Captain Cook Crescent 1</name></wpt><wpt lat="-35.33336" lon="149.14645"><name>Public Toilet, AUS-Sturt Avenue</name></wpt><wpt lat="-35.24929" lon="149.14901"><name>Public Toilet, AUS-Park</name></wpt><wpt lat="-35.31934" lon="149.14932"><name>Public Toilet, AUS-Canberra Train Station</name></wpt><wpt lat="-35.32580" lon="149.15296"><name>Public Toilet, AUS-Canberra Avenue</name></wpt><wpt lat="-35.33301" lon="149.15403"><name>Public Toilet, AUS-Iluka Street</name></wpt><wpt lat="-35.33917" lon="149.15572"><name>Public Toilet, AUS-Kayeema Street</name></wpt><wpt lat="-35.33767" lon="149.15799"><name>Public Toilet, AUS-Kayeema Street</name></wpt><wpt lat="-35.25166" lon="149.16043"><name>Public Toilet, AUS-Holtze Close</name></wpt><wpt lat="-35.30430" lon="149.16721"><name>Public Toilet, AUS-Morshead Drive</name></wpt><wpt lat="-35.30408" lon="149.17399"><name>Public Toilet, AUS-Dairy Road</name></wpt><wpt lat="-35.32697" lon="149.17658"><name>Public Toilet, AUS-Maryborough Street</name></wpt><wpt lat="-35.32361" lon="149.24713"><name>Public Toilet, AUS-Kowen Forest - Shelter Block</name></wpt><wpt lat="-35.32717" lon="149.24848"><name>Public Toilet, AUS-Kowen Forest - Playground Block</name></wpt></gpx>
+<?xml version="1.0" encoding="UTF-8"?><gpx xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd" version="1.1" creator="POIPlaza"><wpt lat="-35.46146" lon="148.90686"><name>Public Toilet, AUS-Wetlands Toilets</name></wpt><wpt lat="-35.44211" lon="148.92659"><name>Public Toilet, AUS-Blewitt's Picnic Area</name></wpt><wpt lat="-35.44404" lon="148.92952"><name>Public Toilet, AUS-Sheedy's Picnic Area</name></wpt><wpt lat="-35.48193" lon="148.93326"><name>Public Toilet, AUS-Gibraltar Creek Forest - Gibraltar Falls</name></wpt><wpt lat="-35.48071" lon="148.93742"><name>Public Toilet, AUS-Gibraltar Creek Forest - Woods Reserve Day Use</name></wpt><wpt lat="-35.48059" lon="148.93786"><name>Public Toilet, AUS-Gibraltar Creek Forest - Woods Reserve Camping</name></wpt><wpt lat="-35.32616" lon="148.94381"><name>Public Toilet, AUS-Cotter Reserve</name></wpt><wpt lat="-35.32574" lon="148.94755"><name>Public Toilet, AUS-Cotter Campground</name></wpt><wpt lat="-35.24249" lon="148.95117"><name>Public Toilet, AUS-Swamp Creek</name></wpt><wpt lat="-35.24521" lon="148.95118"><name>Public Toilet, AUS-Uriarra West</name></wpt><wpt lat="-35.25006" lon="148.95222"><name>Public Toilet, AUS-Uriarra East</name></wpt><wpt lat="-35.31980" lon="148.95375"><name>Public Toilet, AUS-Casuarina Sands South</name></wpt><wpt lat="-35.77530" lon="148.95866"><name>Public Toilet, AUS-Franks Hut</name></wpt><wpt lat="-35.31933" lon="148.95974"><name>Public Toilet, AUS-Casuarina Sands North</name></wpt><wpt lat="-35.68267" lon="148.99897"><name>Public Toilet, AUS-Glendale Toilets</name></wpt><wpt lat="-35.39435" lon="149.00929"><name>Public Toilet, AUS-Kambah Pool 2</name></wpt><wpt lat="-35.39840" lon="149.01077"><name>Public Toilet, AUS-Kambah Pool 1</name></wpt><wpt lat="-35.71521" lon="149.01968"><name>Public Toilet, AUS-Brandy Flat</name></wpt><wpt lat="-35.22214" lon="149.02045"><name>Public Toilet, AUS-Hardwick Place</name></wpt><wpt lat="-35.22168" lon="149.02102"><name>Public Toilet, AUS-Park</name></wpt><wpt lat="-35.22573" lon="149.02498"><name>Public Toilet, AUS-Ormsby Place</name></wpt><wpt lat="-35.20120" lon="149.02691"><name>Public Toilet, AUS-Lhotsky Street</name></wpt><wpt lat="-35.20524" lon="149.03366"><name>Public Toilet, AUS-Charnwood Place</name></wpt><wpt lat="-35.24343" lon="149.03406"><name>Public Toilet, AUS-Delamere Street</name></wpt><wpt lat="-35.21819" lon="149.03524"><name>Public Toilet, AUS-Stretton Crescent</name></wpt><wpt lat="-35.24646" lon="149.03590"><name>Public Toilet, AUS-Murranji Street</name></wpt><wpt lat="-35.24268" lon="149.03743"><name>Public Toilet, AUS-Walhallow Street</name></wpt><wpt lat="-35.34658" lon="149.03857"><name>Public Toilet, AUS-Bangalay Court</name></wpt><wpt lat="-35.23094" lon="149.03898"><name>Public Toilet, AUS-Broadsmith Street</name></wpt><wpt lat="-35.24372" lon="149.04331"><name>Public Toilet, AUS-Hawker Place</name></wpt><wpt lat="-35.35011" lon="149.04440"><name>Public Toilet, AUS-Sherratt Place</name></wpt><wpt lat="-35.35245" lon="149.04533"><name>Public Toilet, AUS-Teesdale Place</name></wpt><wpt lat="-35.34852" lon="149.04561"><name>Public Toilet, AUS-Sherratt Place</name></wpt><wpt lat="-35.35118" lon="149.04634"><name>Public Toilet, AUS-Teesdale Close</name></wpt><wpt lat="-35.31640" lon="149.04683"><name>Public Toilet, AUS-Stromlo Forest</name></wpt><wpt lat="-35.23419" lon="149.04826"><name>Public Toilet, AUS-Halford Crescent</name></wpt><wpt lat="-35.34130" lon="149.05254"><name>Public Toilet, AUS-Cooleman Court</name></wpt><wpt lat="-35.21440" lon="149.05384"><name>Public Toilet, AUS-Brownlee Place</name></wpt><wpt lat="-35.38278" lon="149.05507"><name>Public Toilet, AUS-Park 1</name></wpt><wpt lat="-35.35624" lon="149.05685"><name>Public Toilet, AUS-Badimarra Street</name></wpt><wpt lat="-35.38018" lon="149.05841"><name>Public Toilet, AUS-Primmer Court</name></wpt><wpt lat="-35.38860" lon="149.06039"><name>Public Toilet, AUS-Springbett Street 1</name></wpt><wpt lat="-35.38237" lon="149.06066"><name>Public Toilet, AUS-Park 3</name></wpt><wpt lat="-35.39183" lon="149.06181"><name>Public Toilet, AUS-Springbett Street 2</name></wpt><wpt lat="-35.25708" lon="149.06198"><name>Public Toilet, AUS-Park</name></wpt><wpt lat="-35.42802" lon="149.06228"><name>Public Toilet, AUS-Pine Island Central</name></wpt><wpt lat="-35.38910" lon="149.06256"><name>Public Toilet, AUS-Park 2</name></wpt><wpt lat="-35.22778" lon="149.06313"><name>Public Toilet, AUS-McDermott Place</name></wpt><wpt lat="-35.19579" lon="149.06418"><name>Public Toilet, AUS-Clarey Crescent</name></wpt><wpt lat="-35.41123" lon="149.06461"><name>Public Toilet, AUS-Bartlett Place</name></wpt><wpt lat="-35.43185" lon="149.06568"><name>Public Toilet, AUS-Pine Island South</name></wpt><wpt lat="-35.24834" lon="149.06630"><name>Public Toilet, AUS-Belconnen Way</name></wpt><wpt lat="-35.50935" lon="149.06682"><name>Public Toilet, AUS-Tidbinbilla Road</name></wpt><wpt lat="-35.41616" lon="149.06683"><name>Public Toilet, AUS-Hyperdome Shopping Centre</name></wpt><wpt lat="-35.17311" lon="149.06773"><name>Public Toilet, AUS-Gladstone Street</name></wpt><wpt lat="-35.41819" lon="149.06797"><name>Public Toilet, AUS-Soward Way</name></wpt><wpt lat="-35.17199" lon="149.06934"><name>Public Toilet, AUS-Gladstone Street 2</name></wpt><wpt lat="-35.17202" lon="149.06936"><name>Public Toilet, AUS-Gladstone Street 1</name></wpt><wpt lat="-35.50922" lon="149.06947"><name>Public Toilet, AUS-Tharwa Bridge</name></wpt><wpt lat="-35.22535" lon="149.07044"><name>Public Toilet, AUS-Diddams Close 2</name></wpt><wpt lat="-35.25265" lon="149.07072"><name>Public Toilet, AUS-Bowman Street 1</name></wpt><wpt lat="-35.25272" lon="149.07111"><name>Public Toilet, AUS-Bowman Street 2</name></wpt><wpt lat="-35.23903" lon="149.07191"><name>Public Toilet, AUS-Emu Bank</name></wpt><wpt lat="-35.32122" lon="149.07209"><name>Public Toilet, AUS-Dunstan Street</name></wpt><wpt lat="-35.17147" lon="149.07254"><name>Public Toilet, AUS-Bicentennial National Trail</name></wpt><wpt lat="-35.30067" lon="149.07348"><name>Public Toilet, AUS-Scrivener Dam Lookout</name></wpt><wpt lat="-35.22871" lon="149.07433"><name>Public Toilet, AUS-Diddams Close 1</name></wpt><wpt lat="-35.23594" lon="149.07472"><name>Public Toilet, AUS-Townsend Place</name></wpt><wpt lat="-35.40043" lon="149.07545"><name>Public Toilet, AUS-Wheeler Crescent</name></wpt><wpt lat="-35.25216" lon="149.07557"><name>Public Toilet, AUS-Bindubi Street</name></wpt><wpt lat="-35.45238" lon="149.07557"><name>Public Toilet, AUS-Point Hut</name></wpt><wpt lat="-35.35244" lon="149.07648"><name>Public Toilet, AUS-Chifley Place</name></wpt><wpt lat="-35.34066" lon="149.07854"><name>Public Toilet, AUS-Park</name></wpt><wpt lat="-35.25431" lon="149.08071"><name>Public Toilet, AUS-Banambila Street</name></wpt><wpt lat="-35.32448" lon="149.08153"><name>Public Toilet, AUS-Carruthers Street</name></wpt><wpt lat="-35.32513" lon="149.08223"><name>Public Toilet, AUS-Strangways Street</name></wpt><wpt lat="-35.45548" lon="149.08486"><name>Public Toilet, AUS-Knoke Avenue</name></wpt><wpt lat="-35.36159" lon="149.08519"><name>Public Toilet, AUS-Pethebridge Street</name></wpt><wpt lat="-35.34462" lon="149.08612"><name>Public Toilet, AUS-Bowes Place</name></wpt><wpt lat="-35.28633" lon="149.08721"><name>Public Toilet, AUS-Lady Denman Drive</name></wpt><wpt lat="-35.35242" lon="149.08763"><name>Public Toilet, AUS-Colbee Court</name></wpt><wpt lat="-35.33243" lon="149.08853"><name>Public Toilet, AUS-Webster Street</name></wpt><wpt lat="-35.45996" lon="149.08905"><name>Public Toilet, AUS-Sherwood Circuit</name></wpt><wpt lat="-35.29694" lon="149.08946"><name>Public Toilet, AUS-Weston Park Road</name></wpt><wpt lat="-35.17775" lon="149.08976"><name>Public Toilet, AUS-Clarrie Hermes Drive</name></wpt><wpt lat="-35.29195" lon="149.08978"><name>Public Toilet, AUS-Prescot Lane 1</name></wpt><wpt lat="-35.32029" lon="149.09068"><name>Public Toilet, AUS-Park</name></wpt><wpt lat="-35.34033" lon="149.09129"><name>Public Toilet, AUS-Launceston Street</name></wpt><wpt lat="-35.29261" lon="149.09158"><name>Public Toilet, AUS-Prescot Lane 2</name></wpt><wpt lat="-35.34099" lon="149.09195"><name>Public Toilet, AUS-Yamba Drive 2</name></wpt><wpt lat="-35.34299" lon="149.09299"><name>Public Toilet, AUS-Justinian Street</name></wpt><wpt lat="-35.32042" lon="149.09312"><name>Public Toilet, AUS-Makin Place</name></wpt><wpt lat="-35.45749" lon="149.09316"><name>Public Toilet, AUS-Lanyon Marketplace</name></wpt><wpt lat="-35.21380" lon="149.09337"><name>Public Toilet, AUS-Gari Place</name></wpt><wpt lat="-35.33315" lon="149.09360"><name>Public Toilet, AUS-Hughes Place</name></wpt><wpt lat="-35.36581" lon="149.09439"><name>Public Toilet, AUS-Mawson Place</name></wpt><wpt lat="-35.17637" lon="149.09494"><name>Public Toilet, AUS-Clarrie Hermes Drive</name></wpt><wpt lat="-35.34289" lon="149.09509"><name>Public Toilet, AUS-Yamba Drive 1</name></wpt><wpt lat="-35.36845" lon="149.09554"><name>Public Toilet, AUS-Heard Street</name></wpt><wpt lat="-35.37073" lon="149.09618"><name>Public Toilet, AUS-Beasley Street</name></wpt><wpt lat="-35.21723" lon="149.09672"><name>Public Toilet, AUS-Coree Place</name></wpt><wpt lat="-35.30723" lon="149.09718"><name>Public Toilet, AUS-Hutchins Street</name></wpt><wpt lat="-35.34600" lon="149.09778"><name>Public Toilet, AUS-Albermarle Place</name></wpt><wpt lat="-35.27875" lon="149.09850"><name>Public Toilet, AUS-Black Mountain Drive</name></wpt><wpt lat="-35.40377" lon="149.09874"><name>Public Toilet, AUS-Erindale Shopping Centre</name></wpt><wpt lat="-35.36059" lon="149.09934"><name>Public Toilet, AUS-Ainsworth Street</name></wpt><wpt lat="-35.29229" lon="149.10014"><name>Public Toilet, AUS-Black Mountain Peninsula 2</name></wpt><wpt lat="-35.30677" lon="149.10014"><name>Public Toilet, AUS-Loftus Street</name></wpt><wpt lat="-35.28730" lon="149.10125"><name>Public Toilet, AUS-Black Mountain Peninsula 1</name></wpt><wpt lat="-35.26707" lon="149.10130"><name>Public Toilet, AUS-Australian National Botanic Gardens - Plant Use Walk</name></wpt><wpt lat="-35.26348" lon="149.10169"><name>Public Toilet, AUS-Australian National Botanic Gardens - Tasmanian Garden</name></wpt><wpt lat="-35.29928" lon="149.10298"><name>Public Toilet, AUS-Alexandrina Drive</name></wpt><wpt lat="-35.37705" lon="149.10447"><name>Public Toilet, AUS-Longerenong Street</name></wpt><wpt lat="-35.22714" lon="149.10537"><name>Public Toilet, AUS-Diamantina Crescent</name></wpt><wpt lat="-35.26956" lon="149.10563"><name>Public Toilet, AUS-Australian National Botanic Gardens - Camp</name></wpt><wpt lat="-35.22994" lon="149.10600"><name>Public Toilet, AUS-Fitzmaurice Street</name></wpt><wpt lat="-35.34329" lon="149.10768"><name>Public Toilet, AUS-Garran Place</name></wpt><wpt lat="-35.27055" lon="149.10823"><name>Public Toilet, AUS-Australian National Botanic Gardens - Top Depot</name></wpt><wpt lat="-35.27240" lon="149.10866"><name>Public Toilet, AUS-Australian National Botanic Gardens - Ducrou Pavilion</name></wpt><wpt lat="-35.27834" lon="149.10876"><name>Public Toilet, AUS-Australian National Botanic Gardens</name></wpt><wpt lat="-35.41352" lon="149.11066"><name>Public Toilet, AUS-Jefferies Street</name></wpt><wpt lat="-35.28916" lon="149.11077"><name>Public Toilet, AUS-Springbank Island</name></wpt><wpt lat="-35.27710" lon="149.11086"><name>Public Toilet, AUS-Australian National Botanic Gardens - Crosbie Morrison Building</name></wpt><wpt lat="-35.31822" lon="149.11328"><name>Public Toilet, AUS-Bedford Street</name></wpt><wpt lat="-35.22278" lon="149.11346"><name>Public Toilet, AUS-Ashburton Crescent</name></wpt><wpt lat="-35.32882" lon="149.11678"><name>Public Toilet, AUS-Red Hill Drive</name></wpt><wpt lat="-35.30032" lon="149.11709"><name>Public Toilet, AUS-Mariner Place</name></wpt><wpt lat="-35.43919" lon="149.12008"><name>Public Toilet, AUS-Calwell Shopping Centre</name></wpt><wpt lat="-35.41168" lon="149.12077"><name>Public Toilet, AUS-Bugden Avenue</name></wpt><wpt lat="-35.26432" lon="149.12258"><name>Public Toilet, AUS-MacPherson Street</name></wpt><wpt lat="-35.26054" lon="149.12373"><name>Public Toilet, AUS-Macarthur Avenue 1</name></wpt><wpt lat="-35.26230" lon="149.12380"><name>Public Toilet, AUS-Pedder Street</name></wpt><wpt lat="-35.28678" lon="149.12494"><name>Public Toilet, AUS-Barrine Drive</name></wpt><wpt lat="-35.25208" lon="149.12525"><name>Public Toilet, AUS-Hall Street</name></wpt><wpt lat="-35.41412" lon="149.12545"><name>Public Toilet, AUS-Park</name></wpt><wpt lat="-35.26085" lon="149.12570"><name>Public Toilet, AUS-Macarthur Avenue 2</name></wpt><wpt lat="-35.25079" lon="149.12791"><name>Public Toilet, AUS-Park</name></wpt><wpt lat="-35.41339" lon="149.12830"><name>Public Toilet, AUS-Halley Street</name></wpt><wpt lat="-35.24661" lon="149.12914"><name>Public Toilet, AUS-Mouat Street</name></wpt><wpt lat="-35.30040" lon="149.12941"><name>Public Toilet, AUS-King George Terrace</name></wpt><wpt lat="-35.27768" lon="149.13061"><name>Public Toilet, AUS-Mort Street</name></wpt><wpt lat="-35.17927" lon="149.13071"><name>Public Toilet, AUS-Gundaroo Drive 2</name></wpt><wpt lat="-35.28848" lon="149.13076"><name>Public Toilet, AUS-Commonwealth Park 2</name></wpt><wpt lat="-35.29023" lon="149.13076"><name>Public Toilet, AUS-Commonwealth Park 1</name></wpt><wpt lat="-35.17925" lon="149.13077"><name>Public Toilet, AUS-Gundaroo Drive 1</name></wpt><wpt lat="-35.27011" lon="149.13181"><name>Public Toilet, AUS-Girrahween Street</name></wpt><wpt lat="-35.27942" lon="149.13209"><name>Public Toilet, AUS-Canberra Centre</name></wpt><wpt lat="-35.27763" lon="149.13219"><name>Public Toilet, AUS-Bunda Street 1</name></wpt><wpt lat="-35.28249" lon="149.13271"><name>Public Toilet, AUS-London Circuit</name></wpt><wpt lat="-35.27808" lon="149.13286"><name>Public Toilet, AUS-Bunda Street 2</name></wpt><wpt lat="-35.24627" lon="149.13302"><name>Public Toilet, AUS-Northbourne Avenue</name></wpt><wpt lat="-35.28167" lon="149.13324"><name>Public Toilet, AUS-City Walk</name></wpt><wpt lat="-35.32041" lon="149.13332"><name>Public Toilet, AUS-The Terrace Manuka</name></wpt><wpt lat="-35.25554" lon="149.13350"><name>Public Toilet, AUS-Northbourne Avenue</name></wpt><wpt lat="-35.32538" lon="149.13379"><name>Public Toilet, AUS-Captain Cook Crescent</name></wpt><wpt lat="-35.32385" lon="149.13394"><name>Public Toilet, AUS-Captain Cook Crescent 2</name></wpt><wpt lat="-35.28882" lon="149.13540"><name>Public Toilet, AUS-Commonwealth Park 3</name></wpt><wpt lat="-35.28241" lon="149.13641"><name>Public Toilet, AUS-Akuna Street</name></wpt><wpt lat="-35.30067" lon="149.13668"><name>Public Toilet, AUS-National Gallery Of Australia</name></wpt><wpt lat="-35.31440" lon="149.13752"><name>Public Toilet, AUS-Telopea Park</name></wpt><wpt lat="-35.26227" lon="149.13770"><name>Public Toilet, AUS-Angas Street</name></wpt><wpt lat="-35.25998" lon="149.13775"><name>Public Toilet, AUS-Wakefield Avenue</name></wpt><wpt lat="-35.25037" lon="149.14046"><name>Public Toilet, AUS-Cowper Street</name></wpt><wpt lat="-35.21835" lon="149.14217"><name>Public Toilet, AUS-Heffernan Street 1</name></wpt><wpt lat="-35.32827" lon="149.14221"><name>Public Toilet, AUS-Barker Street</name></wpt><wpt lat="-35.21824" lon="149.14227"><name>Public Toilet, AUS-Heffernan Street 2</name></wpt><wpt lat="-35.31641" lon="149.14236"><name>Public Toilet, AUS-Eyre Street - Road Verge</name></wpt><wpt lat="-35.32009" lon="149.14250"><name>Public Toilet, AUS-Dawes Street</name></wpt><wpt lat="-35.24525" lon="149.14345"><name>Public Toilet, AUS-Park</name></wpt><wpt lat="-35.29797" lon="149.14388"><name>Public Toilet, AUS-Kings Park</name></wpt><wpt lat="-35.26209" lon="149.14461"><name>Public Toilet, AUS-Wakefield Gardens Street</name></wpt><wpt lat="-35.28100" lon="149.14499"><name>Public Toilet, AUS-Elimatta Street</name></wpt><wpt lat="-35.24537" lon="149.14516"><name>Public Toilet, AUS-Frenchman Place</name></wpt><wpt lat="-35.33246" lon="149.14619"><name>Public Toilet, AUS-Captain Cook Crescent 1</name></wpt><wpt lat="-35.33336" lon="149.14645"><name>Public Toilet, AUS-Sturt Avenue</name></wpt><wpt lat="-35.24929" lon="149.14901"><name>Public Toilet, AUS-Park</name></wpt><wpt lat="-35.31934" lon="149.14932"><name>Public Toilet, AUS-Canberra Train Station</name></wpt><wpt lat="-35.32580" lon="149.15296"><name>Public Toilet, AUS-Canberra Avenue</name></wpt><wpt lat="-35.33301" lon="149.15403"><name>Public Toilet, AUS-Iluka Street</name></wpt><wpt lat="-35.33917" lon="149.15572"><name>Public Toilet, AUS-Kayeema Street</name></wpt><wpt lat="-35.33767" lon="149.15799"><name>Public Toilet, AUS-Kayeema Street</name></wpt><wpt lat="-35.25166" lon="149.16043"><name>Public Toilet, AUS-Holtze Close</name></wpt><wpt lat="-35.30430" lon="149.16721"><name>Public Toilet, AUS-Morshead Drive</name></wpt><wpt lat="-35.30408" lon="149.17399"><name>Public Toilet, AUS-Dairy Road</name></wpt><wpt lat="-35.32697" lon="149.17658"><name>Public Toilet, AUS-Maryborough Street</name></wpt><wpt lat="-35.32361" lon="149.24713"><name>Public Toilet, AUS-Kowen Forest - Shelter Block</name></wpt><wpt lat="-35.32717" lon="149.24848"><name>Public Toilet, AUS-Kowen Forest - Playground Block</name></wpt></gpx>
diff --git a/tests/auto/qlandmarkmanager/data/malformed.kmz b/tests/auto/qlandmarkmanager/data/malformed.kmz
new file mode 100644
index 0000000000..178656f174
--- /dev/null
+++ b/tests/auto/qlandmarkmanager/data/malformed.kmz
@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<kml xmlns="http://earth.google.com/kml/2.2">
+<Placemark>
+ <name>w0</name>
+ <StyleMap>
+ <Pair>
+ <key>normal</key>
+ <Style>
+ <IconStyle>
+ <Icon>
+ <href>http://maps.google.com/mapfiles/kml/paddle/D.png</href>
+ </Icon>
+ <hotSpot x="0.5" y="0" xunits="fraction" yunits="fraction"/>
+ </IconStyle>
+ <BalloonStyle>
+ <text><![CDATA[<table width ="200"><tr><td colspan="2"><font size="+1"><b><a href="http://maps.google.com/maps?q=taj+mahal&near=india&ie=UTF8&v=2.2&cv=4.3.7284.3916&hl=en&sll=37.062500,-95.677068&sspn=23.875000,57.630033&latlng=27173023,78042099,15875245860649948695&ei=0wTaSKu5BKD4ugOsgqHcBQ&cd=4">$[name]</a></b></font><br/><font color="#808080"></font></td></tr><tr><td>Tajganj<br/>Agra, Agra, Uttar Pradesh, India<br/></td></tr></table><br/><br/>&#160;&#160;$[geDirections]]]></text>
+ <textColor>ff000000</textColor>
+ <displayMode>default</displayMode>
+ </BalloonStyle>
+ <ListStyle>
+ <listItemType>check</listItemType>
+ <ItemIcon>
+ <state>open closed error fetching0 fetching1 fetching2</state>
+ <href>http://maps.google.com/mapfiles/kml/paddle/D-lv.png</href>
+ </ItemIcon>
+ <bgColor>00ffffff</bgColor>
+ <maxSnippetLines>2</maxSnippetLines>
+ </ListStyle>
+ </Style>
+ </Pair>
+ <Pair>
+ <key>highlight</key>
+ <Style>
+ <IconStyle>
+ <scale>1.3</scale>
+ <Icon>
+ <href>http://maps.google.com/mapfiles/kml/paddle/D.png</href>
+ </Icon>
+ <hotSpot x="0.5" y="0" xunits="fraction" yunits="fraction"/>
+ </IconStyle>
+ <BalloonStyle>
+ <text><![CDATA[<table width ="200"><tr><td colspan="2"><font size="+1"><b><a href="http://maps.google.com/maps?q=taj+mahal&near=india&ie=UTF8&v=2.2&cv=4.3.7284.3916&hl=en&sll=37.062500,-95.677068&sspn=23.875000,57.630033&latlng=27173023,78042099,15875245860649948695&ei=0wTaSKu5BKD4ugOsgqHcBQ&cd=4">$[name]</a></b></font><br/><font color="#808080"></font></td></tr><tr><td>Tajganj<br/>Agra, Agra, Uttar Pradesh, India<br/></td></tr></table><br/><br/>&#160;&#160;$[geDirections]]]></text>
+ <textColor>ff000000</textColor>
+ <displayMode>default</displayMode>
+ </BalloonStyle>
+ <ListStyle>
+ <listItemType>check</listItemType>
+ <ItemIcon>
+ <state>open closed error fetching0 fetching1 fetching2</state>
+ <href>http://maps.google.com/mapfiles/kml/paddle/D-lv.png</href>
+ </ItemIcon>
+ <bgColor>00ffffff</bgColor>
+ <maxSnippetLines>2</maxSnippetLines>
+ </ListStyle>
+ </Style>
+ </Pair>
+ </StyleMap>
+ <oint>
+ <coordinates>1.00000,2.00000,3</coordinates>
+ </Point>
+</Placemark>
+<Placemark>
+ <name>w1</name>
+ <StyleMap>
+ <Pair>
+ <key>normal</key>
+ <Style>
+ <IconStyle>
+ <Icon>
+ <href>http://maps.google.com/mapfiles/kml/paddle/D.png</href>
+ </Icon>
+ <hotSpot x="0.5" y="0" xunits="fraction" yunits="fraction"/>
+ </IconStyle>
+ <BalloonStyle>
+ <text><![CDATA[<table width ="200"><tr><td colspan="2"><font size="+1"><b><a href="http://maps.google.com/maps?q=taj+mahal&near=india&ie=UTF8&v=2.2&cv=4.3.7284.3916&hl=en&sll=37.062500,-95.677068&sspn=23.875000,57.630033&latlng=27173023,78042099,15875245860649948695&ei=0wTaSKu5BKD4ugOsgqHcBQ&cd=4">$[name]</a></b></font><br/><font color="#808080"></font></td></tr><tr><td>Tajganj<br/>Agra, Agra, Uttar Pradesh, India<br/></td></tr></table><br/><br/>&#160;&#160;$[geDirections]]]></text>
+ <textColor>ff000000</textColor>
+ <displayMode>default</displayMode>
+ </BalloonStyle>
+ <ListStyle>
+ <listItemType>check</listItemType>
+ <ItemIcon>
+ <state>open closed error fetching0 fetching1 fetching2</state>
+ <href>http://maps.google.com/mapfiles/kml/paddle/D-lv.png</href>
+ </ItemIcon>
+ <bgColor>00ffffff</bgColor>
+ <maxSnippetLines>2</maxSnippetLines>
+ </ListStyle>
+ </Style>
+ </Pair>
+ <Pair>
+ <key>highlight</key>
+ <Style>
+ <IconStyle>
+ <scale>1.3</scale>
+ <Icon>
+ <href>http://maps.google.com/mapfiles/kml/paddle/D.png</href>
+ </Icon>
+ <hotSpot x="0.5" y="0" xunits="fraction" yunits="fraction"/>
+ </IconStyle>
+ <BalloonStyle>
+ <text><![CDATA[<table width ="200"><tr><td colspan="2"><font size="+1"><b><a href="http://maps.google.com/maps?q=taj+mahal&near=india&ie=UTF8&v=2.2&cv=4.3.7284.3916&hl=en&sll=37.062500,-95.677068&sspn=23.875000,57.630033&latlng=27173023,78042099,15875245860649948695&ei=0wTaSKu5BKD4ugOsgqHcBQ&cd=4">$[name]</a></b></font><br/><font color="#808080"></font></td></tr><tr><td>Tajganj<br/>Agra, Agra, Uttar Pradesh, India<br/></td></tr></table><br/><br/>&#160;&#160;$[geDirections]]]></text>
+ <textColor>ff000000</textColor>
+ <displayMode>default</displayMode>
+ </BalloonStyle>
+ <ListStyle>
+ <listItemType>check</listItemType>
+ <ItemIcon>
+ <state>open closed error fetching0 fetching1 fetching2</state>
+ <href>http://maps.google.com/mapfiles/kml/paddle/D-lv.png</href>
+ </ItemIcon>
+ <bgColor>00ffffff</bgColor>
+ <maxSnippetLines>2</maxSnippetLines>
+ </ListStyle>
+ </Style>
+ </Pair>
+ </StyleMap>
+ <Point>
+ <coordinates>2.00000,1.00000,3</coordinates>
+ </Point>
+</Placemark>
+<Placemark>
+ <name>w2</name>
+ <StyleMap>
+ <Pair>
+ <key>normal</key>
+ <Style>
+ <IconStyle>
+ <Icon>
+ <href>http://maps.google.com/mapfiles/kml/paddle/D.png</href>
+ </Icon>
+ <hotSpot x="0.5" y="0" xunits="fraction" yunits="fraction"/>
+ </IconStyle>
+ <BalloonStyle>
+ <text><![CDATA[<table width ="200"><tr><td colspan="2"><font size="+1"><b><a href="http://maps.google.com/maps?q=taj+mahal&near=india&ie=UTF8&v=2.2&cv=4.3.7284.3916&hl=en&sll=37.062500,-95.677068&sspn=23.875000,57.630033&latlng=27173023,78042099,15875245860649948695&ei=0wTaSKu5BKD4ugOsgqHcBQ&cd=4">$[name]</a></b></font><br/><font color="#808080"></font></td></tr><tr><td>Tajganj<br/>Agra, Agra, Uttar Pradesh, India<br/></td></tr></table><br/><br/>&#160;&#160;$[geDirections]]]></text>
+ <textColor>ff000000</textColor>
+ <displayMode>default</displayMode>
+ </BalloonStyle>
+ <ListStyle>
+ <listItemType>check</listItemType>
+ <ItemIcon>
+ <state>open closed error fetching0 fetching1 fetching2</state>
+ <href>http://maps.google.com/mapfiles/kml/paddle/D-lv.png</href>
+ </ItemIcon>
+ <bgColor>00ffffff</bgColor>
+ <maxSnippetLines>2</maxSnippetLines>
+ </ListStyle>
+ </Style>
+ </Pair>
+ <Pair>
+ <key>highlight</key>
+ <Style>
+ <IconStyle>
+ <scale>1.3</scale>
+ <Icon>
+ <href>http://maps.google.com/mapfiles/kml/paddle/D.png</href>
+ </Icon>
+ <hotSpot x="0.5" y="0" xunits="fraction" yunits="fraction"/>
+ </IconStyle>
+ <BalloonStyle>
+ <text><![CDATA[<table width ="200"><tr><td colspan="2"><font size="+1"><b><a href="http://maps.google.com/maps?q=taj+mahal&near=india&ie=UTF8&v=2.2&cv=4.3.7284.3916&hl=en&sll=37.062500,-95.677068&sspn=23.875000,57.630033&latlng=27173023,78042099,15875245860649948695&ei=0wTaSKu5BKD4ugOsgqHcBQ&cd=4">$[name]</a></b></font><br/><font color="#808080"></font></td></tr><tr><td>Tajganj<br/>Agra, Agra, Uttar Pradesh, India<br/></td></tr></table><br/><br/>&#160;&#160;$[geDirections]]]></text>
+ <textColor>ff000000</textColor>
+ <displayMode>default</displayMode>
+ </BalloonStyle>
+ <ListStyle>
+ <listItemType>check</listItemType>
+ <ItemIcon>
+ <state>open closed error fetching0 fetching1 fetching2</state>
+ <href>http://maps.google.com/mapfiles/kml/paddle/D-lv.png</href>
+ </ItemIcon>
+ <bgColor>00ffffff</bgColor>
+ <maxSnippetLines>2</maxSnippetLines>
+ </ListStyle>
+ </Style>
+ </Pair>
+ </StyleMap>
+ <Point>
+ <coordinates>3.00000,2.00000,1</coordinates>
+ </Point>
+</Placemark>
+</kml>
diff --git a/tests/auto/qlandmarkmanager/data/test.kmz b/tests/auto/qlandmarkmanager/data/test.kmz
new file mode 100644
index 0000000000..05d8fead92
--- /dev/null
+++ b/tests/auto/qlandmarkmanager/data/test.kmz
@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<kml xmlns="http://earth.google.com/kml/2.2">
+<Placemark>
+ <name>w0</name>
+ <StyleMap>
+ <Pair>
+ <key>normal</key>
+ <Style>
+ <IconStyle>
+ <Icon>
+ <href>http://maps.google.com/mapfiles/kml/paddle/D.png</href>
+ </Icon>
+ <hotSpot x="0.5" y="0" xunits="fraction" yunits="fraction"/>
+ </IconStyle>
+ <BalloonStyle>
+ <text><![CDATA[<table width ="200"><tr><td colspan="2"><font size="+1"><b><a href="http://maps.google.com/maps?q=taj+mahal&near=india&ie=UTF8&v=2.2&cv=4.3.7284.3916&hl=en&sll=37.062500,-95.677068&sspn=23.875000,57.630033&latlng=27173023,78042099,15875245860649948695&ei=0wTaSKu5BKD4ugOsgqHcBQ&cd=4">$[name]</a></b></font><br/><font color="#808080"></font></td></tr><tr><td>Tajganj<br/>Agra, Agra, Uttar Pradesh, India<br/></td></tr></table><br/><br/>&#160;&#160;$[geDirections]]]></text>
+ <textColor>ff000000</textColor>
+ <displayMode>default</displayMode>
+ </BalloonStyle>
+ <ListStyle>
+ <listItemType>check</listItemType>
+ <ItemIcon>
+ <state>open closed error fetching0 fetching1 fetching2</state>
+ <href>http://maps.google.com/mapfiles/kml/paddle/D-lv.png</href>
+ </ItemIcon>
+ <bgColor>00ffffff</bgColor>
+ <maxSnippetLines>2</maxSnippetLines>
+ </ListStyle>
+ </Style>
+ </Pair>
+ <Pair>
+ <key>highlight</key>
+ <Style>
+ <IconStyle>
+ <scale>1.3</scale>
+ <Icon>
+ <href>http://maps.google.com/mapfiles/kml/paddle/D.png</href>
+ </Icon>
+ <hotSpot x="0.5" y="0" xunits="fraction" yunits="fraction"/>
+ </IconStyle>
+ <BalloonStyle>
+ <text><![CDATA[<table width ="200"><tr><td colspan="2"><font size="+1"><b><a href="http://maps.google.com/maps?q=taj+mahal&near=india&ie=UTF8&v=2.2&cv=4.3.7284.3916&hl=en&sll=37.062500,-95.677068&sspn=23.875000,57.630033&latlng=27173023,78042099,15875245860649948695&ei=0wTaSKu5BKD4ugOsgqHcBQ&cd=4">$[name]</a></b></font><br/><font color="#808080"></font></td></tr><tr><td>Tajganj<br/>Agra, Agra, Uttar Pradesh, India<br/></td></tr></table><br/><br/>&#160;&#160;$[geDirections]]]></text>
+ <textColor>ff000000</textColor>
+ <displayMode>default</displayMode>
+ </BalloonStyle>
+ <ListStyle>
+ <listItemType>check</listItemType>
+ <ItemIcon>
+ <state>open closed error fetching0 fetching1 fetching2</state>
+ <href>http://maps.google.com/mapfiles/kml/paddle/D-lv.png</href>
+ </ItemIcon>
+ <bgColor>00ffffff</bgColor>
+ <maxSnippetLines>2</maxSnippetLines>
+ </ListStyle>
+ </Style>
+ </Pair>
+ </StyleMap>
+ <Point>
+ <coordinates>1.00000,2.00000,3</coordinates>
+ </Point>
+</Placemark>
+<Placemark>
+ <name>w1</name>
+ <StyleMap>
+ <Pair>
+ <key>normal</key>
+ <Style>
+ <IconStyle>
+ <Icon>
+ <href>http://maps.google.com/mapfiles/kml/paddle/D.png</href>
+ </Icon>
+ <hotSpot x="0.5" y="0" xunits="fraction" yunits="fraction"/>
+ </IconStyle>
+ <BalloonStyle>
+ <text><![CDATA[<table width ="200"><tr><td colspan="2"><font size="+1"><b><a href="http://maps.google.com/maps?q=taj+mahal&near=india&ie=UTF8&v=2.2&cv=4.3.7284.3916&hl=en&sll=37.062500,-95.677068&sspn=23.875000,57.630033&latlng=27173023,78042099,15875245860649948695&ei=0wTaSKu5BKD4ugOsgqHcBQ&cd=4">$[name]</a></b></font><br/><font color="#808080"></font></td></tr><tr><td>Tajganj<br/>Agra, Agra, Uttar Pradesh, India<br/></td></tr></table><br/><br/>&#160;&#160;$[geDirections]]]></text>
+ <textColor>ff000000</textColor>
+ <displayMode>default</displayMode>
+ </BalloonStyle>
+ <ListStyle>
+ <listItemType>check</listItemType>
+ <ItemIcon>
+ <state>open closed error fetching0 fetching1 fetching2</state>
+ <href>http://maps.google.com/mapfiles/kml/paddle/D-lv.png</href>
+ </ItemIcon>
+ <bgColor>00ffffff</bgColor>
+ <maxSnippetLines>2</maxSnippetLines>
+ </ListStyle>
+ </Style>
+ </Pair>
+ <Pair>
+ <key>highlight</key>
+ <Style>
+ <IconStyle>
+ <scale>1.3</scale>
+ <Icon>
+ <href>http://maps.google.com/mapfiles/kml/paddle/D.png</href>
+ </Icon>
+ <hotSpot x="0.5" y="0" xunits="fraction" yunits="fraction"/>
+ </IconStyle>
+ <BalloonStyle>
+ <text><![CDATA[<table width ="200"><tr><td colspan="2"><font size="+1"><b><a href="http://maps.google.com/maps?q=taj+mahal&near=india&ie=UTF8&v=2.2&cv=4.3.7284.3916&hl=en&sll=37.062500,-95.677068&sspn=23.875000,57.630033&latlng=27173023,78042099,15875245860649948695&ei=0wTaSKu5BKD4ugOsgqHcBQ&cd=4">$[name]</a></b></font><br/><font color="#808080"></font></td></tr><tr><td>Tajganj<br/>Agra, Agra, Uttar Pradesh, India<br/></td></tr></table><br/><br/>&#160;&#160;$[geDirections]]]></text>
+ <textColor>ff000000</textColor>
+ <displayMode>default</displayMode>
+ </BalloonStyle>
+ <ListStyle>
+ <listItemType>check</listItemType>
+ <ItemIcon>
+ <state>open closed error fetching0 fetching1 fetching2</state>
+ <href>http://maps.google.com/mapfiles/kml/paddle/D-lv.png</href>
+ </ItemIcon>
+ <bgColor>00ffffff</bgColor>
+ <maxSnippetLines>2</maxSnippetLines>
+ </ListStyle>
+ </Style>
+ </Pair>
+ </StyleMap>
+ <Point>
+ <coordinates>2.00000,1.00000,3</coordinates>
+ </Point>
+</Placemark>
+<Placemark>
+ <name>w2</name>
+ <StyleMap>
+ <Pair>
+ <key>normal</key>
+ <Style>
+ <IconStyle>
+ <Icon>
+ <href>http://maps.google.com/mapfiles/kml/paddle/D.png</href>
+ </Icon>
+ <hotSpot x="0.5" y="0" xunits="fraction" yunits="fraction"/>
+ </IconStyle>
+ <BalloonStyle>
+ <text><![CDATA[<table width ="200"><tr><td colspan="2"><font size="+1"><b><a href="http://maps.google.com/maps?q=taj+mahal&near=india&ie=UTF8&v=2.2&cv=4.3.7284.3916&hl=en&sll=37.062500,-95.677068&sspn=23.875000,57.630033&latlng=27173023,78042099,15875245860649948695&ei=0wTaSKu5BKD4ugOsgqHcBQ&cd=4">$[name]</a></b></font><br/><font color="#808080"></font></td></tr><tr><td>Tajganj<br/>Agra, Agra, Uttar Pradesh, India<br/></td></tr></table><br/><br/>&#160;&#160;$[geDirections]]]></text>
+ <textColor>ff000000</textColor>
+ <displayMode>default</displayMode>
+ </BalloonStyle>
+ <ListStyle>
+ <listItemType>check</listItemType>
+ <ItemIcon>
+ <state>open closed error fetching0 fetching1 fetching2</state>
+ <href>http://maps.google.com/mapfiles/kml/paddle/D-lv.png</href>
+ </ItemIcon>
+ <bgColor>00ffffff</bgColor>
+ <maxSnippetLines>2</maxSnippetLines>
+ </ListStyle>
+ </Style>
+ </Pair>
+ <Pair>
+ <key>highlight</key>
+ <Style>
+ <IconStyle>
+ <scale>1.3</scale>
+ <Icon>
+ <href>http://maps.google.com/mapfiles/kml/paddle/D.png</href>
+ </Icon>
+ <hotSpot x="0.5" y="0" xunits="fraction" yunits="fraction"/>
+ </IconStyle>
+ <BalloonStyle>
+ <text><![CDATA[<table width ="200"><tr><td colspan="2"><font size="+1"><b><a href="http://maps.google.com/maps?q=taj+mahal&near=india&ie=UTF8&v=2.2&cv=4.3.7284.3916&hl=en&sll=37.062500,-95.677068&sspn=23.875000,57.630033&latlng=27173023,78042099,15875245860649948695&ei=0wTaSKu5BKD4ugOsgqHcBQ&cd=4">$[name]</a></b></font><br/><font color="#808080"></font></td></tr><tr><td>Tajganj<br/>Agra, Agra, Uttar Pradesh, India<br/></td></tr></table><br/><br/>&#160;&#160;$[geDirections]]]></text>
+ <textColor>ff000000</textColor>
+ <displayMode>default</displayMode>
+ </BalloonStyle>
+ <ListStyle>
+ <listItemType>check</listItemType>
+ <ItemIcon>
+ <state>open closed error fetching0 fetching1 fetching2</state>
+ <href>http://maps.google.com/mapfiles/kml/paddle/D-lv.png</href>
+ </ItemIcon>
+ <bgColor>00ffffff</bgColor>
+ <maxSnippetLines>2</maxSnippetLines>
+ </ListStyle>
+ </Style>
+ </Pair>
+ </StyleMap>
+ <Point>
+ <coordinates>3.00000,2.00000,1</coordinates>
+ </Point>
+</Placemark>
+</kml>
diff --git a/tests/auto/qlandmarkmanager/tst_qlandmarkmanager.cpp b/tests/auto/qlandmarkmanager/tst_qlandmarkmanager.cpp
index a64522cd09..f72a1c7a6f 100644..100755
--- a/tests/auto/qlandmarkmanager/tst_qlandmarkmanager.cpp
+++ b/tests/auto/qlandmarkmanager/tst_qlandmarkmanager.cpp
@@ -97,6 +97,7 @@
#endif
//defines to turn on and off tests for symbian
+
#define INVALID_MANAGER
#define RETRIEVE_CATEGORY
#define RETRIEVE_LANDMARK
@@ -106,6 +107,7 @@
#define SAVE_MULTIPLE_LANDMARKS
#define REMOVE_CATEGORY
#define REMOVE_LANDMARK
+
#define GET_ALL_CATEGORIES
#define FILTER_DEFAULT
#define FILTER_NAME
@@ -127,6 +129,7 @@
#define IMPORT_LMX
#define IMPORT_FILE
#define EXPORT_LMX
+#define SIMPLE_WAIT_FOR_FINISHED
#define WAIT_FOR_FINISHED
#define MISC
#define TEST_SIGNALS
@@ -193,24 +196,21 @@ private:
bool waitForAsync(QSignalSpy &spy, QLandmarkAbstractRequest *request,
QLandmarkManager::Error error = QLandmarkManager::NoError,
- int ms=1500, QLandmarkAbstractRequest::State state = QLandmarkAbstractRequest::FinishedState) {
+ int ms=5000, QLandmarkAbstractRequest::State state = QLandmarkAbstractRequest::FinishedState) {
bool ret = true;
- bool stateVerified = true;
+
int msWaitedSoFar =0;
while(msWaitedSoFar < ms) {
- QTest::qWait(100);
- msWaitedSoFar +=100;
+ QTest::qWait(50);
+ msWaitedSoFar +=50;
if (spy.count() ==2)
break;
- if (!request->isActive())
- stateVerified = false;
}
- if (!stateVerified)
- qWarning() << "The state was not verified to be active when it was supposed to be";
-
- if (!request->isFinished()) {
- stateVerified = false;
+ bool stateVerified = false;
+ if (request->isFinished()) {
+ stateVerified = true;
+ } else {
qWarning() << "The state was not verified to be finished when it was supposed to be";
}
@@ -251,7 +251,7 @@ private:
QSignalSpy spy(&fetchRequest, SIGNAL(stateChanged(QLandmarkAbstractRequest::State)));
fetchRequest.setCategoryIds(ids);
fetchRequest.start();
- bool waitResult = waitForAsync(spy, &fetchRequest,expectedError,100);
+ bool waitResult = waitForAsync(spy, &fetchRequest,expectedError);
if (!waitResult)
qWarning("Wait for async failed for category fetch");
@@ -286,11 +286,9 @@ private:
QSignalSpy spy(&fetchRequest, SIGNAL(stateChanged(QLandmarkAbstractRequest::State)));
fetchRequest.setLimit(limit);
fetchRequest.setOffset(offset);
- fetchRequest.setSorting(nameSort)
-;
+ fetchRequest.setSorting(nameSort);
fetchRequest.start();
-
- bool waitResult = waitForAsync(spy, &fetchRequest,error,100);
+ bool waitResult = waitForAsync(spy, &fetchRequest,error);
if (!waitResult)
qWarning("Wait for async failed for category fetch");
result = waitResult;
@@ -302,7 +300,7 @@ private:
idFetchRequest.setOffset(offset);
idFetchRequest.setSorting(nameSort);
idFetchRequest.start();
- bool waitIdResult = waitForAsync(spyId, &idFetchRequest,error,100);
+ bool waitIdResult = waitForAsync(spyId, &idFetchRequest,error);
if (!waitIdResult)
qWarning("Wait for async failed for category id fetch");
QList<QLandmarkCategoryId> catIds = idFetchRequest.categoryIds();
@@ -353,9 +351,12 @@ private:
fetchRequest.setOffset(offset);
fetchRequest.setSorting(sortOrder);
fetchRequest.start();
-
- bool waitResult = waitForAsync(spy, &fetchRequest, error,500);
-
+ bool waitResult;
+#if defined(Q_WS_MAEMO_6)
+ waitResult = waitForAsync(spy, &fetchRequest, error,8000);
+#else
+ waitResult = waitForAsync(spy, &fetchRequest, error);
+#endif
if (!waitResult)
qWarning("Wait for async failed for landmark fetch");
result = waitResult;
@@ -367,7 +368,11 @@ private:
idFetchRequest.setOffset(offset);
idFetchRequest.setSorting(sortOrder);
idFetchRequest.start();
- waitResult = waitForAsync(spyId, &idFetchRequest, error,500);
+#if defined(Q_WS_MAEMO_6)
+ waitResult = waitForAsync(spyId, &idFetchRequest, error,8000);
+#else
+ waitResult = waitForAsync(spyId, &idFetchRequest, error);
+#endif
if (!waitResult)
qWarning("Wait for async failed for landmark id fetch");
QList<QLandmarkId> lmIds = idFetchRequest.landmarkIds();
@@ -392,7 +397,7 @@ private:
QSignalSpy spy(&fetchRequest, SIGNAL(stateChanged(QLandmarkAbstractRequest::State)));
fetchRequest.setLandmarkIds(lmIds);
fetchRequest.start();
- result = waitForAsync(spy, &fetchRequest,error,100);
+ result = waitForAsync(spy, &fetchRequest,error);
*lms = fetchRequest.landmarks();
} else {
qFatal("Unknown test row type");
@@ -423,7 +428,7 @@ private:
QSignalSpy resultsAvailableSpy(&catSaveRequest, SIGNAL(resultsAvailable()));
catSaveRequest.setCategory(*category);
catSaveRequest.start();
- result = waitForAsync(spy, &catSaveRequest,error,1000);
+ result = waitForAsync(spy, &catSaveRequest,error);
if (!result) {
qWarning() << "Wait for asynchronous request failed";
}
@@ -469,7 +474,7 @@ private:
QSignalSpy resultsAvailableSpy(&lmSaveRequest, SIGNAL(resultsAvailable()));
lmSaveRequest.setLandmark(*landmark);
lmSaveRequest.start();
- result = waitForAsync(spy, &lmSaveRequest,error,1000);
+ result = waitForAsync(spy, &lmSaveRequest,error);
result = result && (resultsAvailableSpy.count()==1);
QMap<int, QLandmarkManager::Error> errorMap;
errorMap = lmSaveRequest.errorMap();
@@ -511,7 +516,7 @@ private:
QSignalSpy spy(&saveRequest, SIGNAL(stateChanged(QLandmarkAbstractRequest::State)));
saveRequest.setLandmarks(*lms);
saveRequest.start();
- result = waitForAsync(spy, &saveRequest,error,1000);
+ result = waitForAsync(spy, &saveRequest,error);
if (errorMap)
*errorMap = saveRequest.errorMap();
*lms = saveRequest.landmarks();
@@ -544,7 +549,7 @@ private:
QSignalSpy resultsAvailableSpy(&catRemoveRequest, SIGNAL(resultsAvailable()));
catRemoveRequest.setCategoryId(categoryId);
catRemoveRequest.start();
- result = waitForAsync(spy, &catRemoveRequest,error,1000);
+ result = waitForAsync(spy, &catRemoveRequest,error);
bool alreadyWarned = false;
if (!result) {
@@ -603,7 +608,7 @@ private:
QSignalSpy resultsAvailableSpy(&lmRemoveRequest, SIGNAL(resultsAvailable()));
lmRemoveRequest.setLandmarkId(landmarkId);
lmRemoveRequest.start();
- result = waitForAsync(spy, &lmRemoveRequest,error,1000);
+ result = waitForAsync(spy, &lmRemoveRequest,error);
bool alreadyWarned = false;
if (!result) {
@@ -658,7 +663,7 @@ private:
QSignalSpy spy(&removeRequest, SIGNAL(stateChanged(QLandmarkAbstractRequest::State)));
removeRequest.setLandmarkIds(lmIds);
removeRequest.start();
- result = waitForAsync(spy, &removeRequest,error,200);
+ result = waitForAsync(spy, &removeRequest,error);
if (errorMap)
*errorMap = removeRequest.errorMap();
} else {
@@ -712,7 +717,7 @@ private:
if (lmIds != NULL)
*lmIds = importRequest.landmarkIds();
- result = waitForAsync(spy, &importRequest,error,150);
+ result = waitForAsync(spy, &importRequest,error);
} else {
qFatal("Unknown test row type");
}
@@ -955,8 +960,13 @@ private:
QVERIFY(m_manager->removeCategory(catIds.at(i)));
}
- QTest::qWait(20);//try ensure notifications for these deletions
- //are made prior to each test function
+ //try ensure notifications for these deletions
+ //are made prior to each test function
+#ifdef Q_OS_SYMBIAN
+ QTest::qWait(100);
+#else
+ QTest::qWait(20);
+#endif
}
#endif
@@ -1117,6 +1127,9 @@ private slots:
void filterAttribute2();
void filterAttribute2_data();
+
+ void filterAttribute3();
+ void filterAttribute3_data();
#endif
#ifdef IMPORT_KML
@@ -1155,12 +1168,15 @@ private slots:
void sortLandmarksName_data();
#endif
+#ifdef SIMPLE_WAIT_FOR_FINISHED
+ void simpleWaitForFinished();
+#endif
+
#ifdef WAIT_FOR_FINISHED
void importWaitForFinished();
void fetchWaitForFinished();
#endif
-
#ifdef MISC
void supportedFormats();
void filterSupportLevel();
@@ -1249,7 +1265,7 @@ void tst_QLandmarkManager::cleanup() {
void tst_QLandmarkManager::cleanupTestCase() {
QFile::remove(exportFile);
- if (QFile::exists("nopermfile"));
+ if (QFile::exists("nopermfile"))
QFile::remove("nopermfile");
}
@@ -1475,7 +1491,7 @@ void tst_QLandmarkManager::retrieveCategory() {
//try a default constructed id
catFetchByIdRequest.setCategoryId(QLandmarkCategoryId());
catFetchByIdRequest.start();
- QVERIFY(waitForAsync(spy, &catFetchByIdRequest,QLandmarkManager::CategoryDoesNotExistError,100));
+ QVERIFY(waitForAsync(spy, &catFetchByIdRequest,QLandmarkManager::CategoryDoesNotExistError));
cats = catFetchByIdRequest.categories();
QCOMPARE(cats.count(), 1);
QCOMPARE(cats.at(0), QLandmarkCategory());
@@ -1486,7 +1502,7 @@ void tst_QLandmarkManager::retrieveCategory() {
id1.setLocalId("100");
catFetchByIdRequest.setCategoryId(id1);
catFetchByIdRequest.start();
- QVERIFY(waitForAsync(spy, &catFetchByIdRequest,QLandmarkManager::CategoryDoesNotExistError,100));
+ QVERIFY(waitForAsync(spy, &catFetchByIdRequest,QLandmarkManager::CategoryDoesNotExistError));
cats = catFetchByIdRequest.categories();
QCOMPARE(cats.count(), 1);
QCOMPARE(cats.at(0), QLandmarkCategory());
@@ -1530,7 +1546,7 @@ void tst_QLandmarkManager::retrieveCategory() {
id2.setLocalId(cat2.categoryId().localId());
catFetchByIdRequest.setCategoryId(id2);
catFetchByIdRequest.start();
- QVERIFY(waitForAsync(spy, &catFetchByIdRequest,QLandmarkManager::CategoryDoesNotExistError,100));
+ QVERIFY(waitForAsync(spy, &catFetchByIdRequest,QLandmarkManager::CategoryDoesNotExistError));
cats = catFetchByIdRequest.categories();
QCOMPARE(cats.count(), 1);
QCOMPARE(cats.at(0), QLandmarkCategory());
@@ -1541,7 +1557,7 @@ void tst_QLandmarkManager::retrieveCategory() {
id2.setLocalId(cat2.categoryId().localId());
catFetchByIdRequest.setCategoryId(id2);
catFetchByIdRequest.start();
- QVERIFY(waitForAsync(spy, &catFetchByIdRequest,QLandmarkManager::NoError,100));
+ QVERIFY(waitForAsync(spy, &catFetchByIdRequest,QLandmarkManager::NoError));
cats = catFetchByIdRequest.categories();
QCOMPARE(cats.count(), 1);
QCOMPARE(cats.at(0), cat2);
@@ -1613,7 +1629,7 @@ void tst_QLandmarkManager::retrieveCategory() {
QSignalSpy spyResult(&catFetchByIdRequest, SIGNAL(resultsAvailable()));
catFetchByIdRequest.setCategoryIds(catIds);
catFetchByIdRequest.start();
- QVERIFY(waitForAsync(spy, &catFetchByIdRequest, QLandmarkManager::CategoryDoesNotExistError,100));
+ QVERIFY(waitForAsync(spy, &catFetchByIdRequest, QLandmarkManager::CategoryDoesNotExistError));
cats = catFetchByIdRequest.categories();
QCOMPARE(cats.count(), 4);
QCOMPARE(cats.at(0), catA);
@@ -1632,7 +1648,7 @@ void tst_QLandmarkManager::retrieveCategory() {
catIds << catA.categoryId() << catB.categoryId() << cat2.categoryId();
catFetchByIdRequest.setCategoryIds(catIds);
catFetchByIdRequest.start();
- QVERIFY(waitForAsync(spy, &catFetchByIdRequest, QLandmarkManager::NoError,100));
+ QVERIFY(waitForAsync(spy, &catFetchByIdRequest, QLandmarkManager::NoError));
cats = catFetchByIdRequest.categories();
QCOMPARE(cats.count(), 3);
QCOMPARE(cats.at(0), catA);
@@ -1672,7 +1688,7 @@ void tst_QLandmarkManager::categoryFetchCancelAsync()
QTest::qWait(50);
#endif
catFetchRequest.cancel();
- QVERIFY(waitForAsync(spy, &catFetchRequest, QLandmarkManager::CancelError,2000));
+ QVERIFY(waitForAsync(spy, &catFetchRequest, QLandmarkManager::CancelError));
QCOMPARE(catFetchRequest.categories().count(), 0);
/*
@@ -1737,7 +1753,7 @@ void tst_QLandmarkManager::retrieveLandmark() {
//try a default constructed landmark id
lmFetchByIdRequest.setLandmarkId(QLandmarkId());
lmFetchByIdRequest.start();
- QVERIFY(waitForAsync(spy, &lmFetchByIdRequest,QLandmarkManager::LandmarkDoesNotExistError,100));
+ QVERIFY(waitForAsync(spy, &lmFetchByIdRequest,QLandmarkManager::LandmarkDoesNotExistError));
QCOMPARE(lmFetchByIdRequest.errorMap().count(),1);
QCOMPARE(lmFetchByIdRequest.errorMap().keys().at(0),0);
QCOMPARE(lmFetchByIdRequest.errorMap().value(0), QLandmarkManager::LandmarkDoesNotExistError);
@@ -1753,7 +1769,7 @@ void tst_QLandmarkManager::retrieveLandmark() {
lmFetchByIdRequest.setLandmarkId(id1);
lmFetchByIdRequest.start();
- QVERIFY(waitForAsync(spy, &lmFetchByIdRequest,QLandmarkManager::LandmarkDoesNotExistError,100));
+ QVERIFY(waitForAsync(spy, &lmFetchByIdRequest,QLandmarkManager::LandmarkDoesNotExistError));
QCOMPARE(lmFetchByIdRequest.errorMap().count(),1);
QCOMPARE(lmFetchByIdRequest.errorMap().keys().at(0),0);
QCOMPARE(lmFetchByIdRequest.errorMap().value(0), QLandmarkManager::LandmarkDoesNotExistError);
@@ -1815,7 +1831,7 @@ void tst_QLandmarkManager::retrieveLandmark() {
id2.setLocalId(lm2.landmarkId().localId());
lmFetchByIdRequest.setLandmarkId(id2);
lmFetchByIdRequest.start();
- QVERIFY(waitForAsync(spy, &lmFetchByIdRequest, QLandmarkManager::LandmarkDoesNotExistError,100));
+ QVERIFY(waitForAsync(spy, &lmFetchByIdRequest, QLandmarkManager::LandmarkDoesNotExistError));
QCOMPARE(lmFetchByIdRequest.errorMap().count(),1);
QCOMPARE(lmFetchByIdRequest.errorMap().keys().at(0),0);
QCOMPARE(lmFetchByIdRequest.errorMap().value(0), QLandmarkManager::LandmarkDoesNotExistError);
@@ -1829,7 +1845,7 @@ void tst_QLandmarkManager::retrieveLandmark() {
id2 = lm2.landmarkId();
lmFetchByIdRequest.setLandmarkId(id2);
lmFetchByIdRequest.start();
- QVERIFY(waitForAsync(spy, &lmFetchByIdRequest, QLandmarkManager::NoError,100));
+ QVERIFY(waitForAsync(spy, &lmFetchByIdRequest, QLandmarkManager::NoError));
QCOMPARE(lmFetchByIdRequest.errorMap().count(),0);
lms = lmFetchByIdRequest.landmarks();
@@ -1896,7 +1912,7 @@ void tst_QLandmarkManager::retrieveLandmark() {
//check that we can retrieve a landmark with a single catergory
lmFetchByIdRequest.setLandmarkId(id3);
lmFetchByIdRequest.start();
- QVERIFY(waitForAsync(spy, &lmFetchByIdRequest, QLandmarkManager::NoError,100));
+ QVERIFY(waitForAsync(spy, &lmFetchByIdRequest, QLandmarkManager::NoError));
QCOMPARE(lmFetchByIdRequest.errorMap().count(),0);
lms = lmFetchByIdRequest.landmarks();
@@ -1910,7 +1926,7 @@ void tst_QLandmarkManager::retrieveLandmark() {
//check that we can retrieve a landmark with multiple categories
lmFetchByIdRequest.setLandmarkId(id4);
lmFetchByIdRequest.start();
- QVERIFY(waitForAsync(spy, &lmFetchByIdRequest, QLandmarkManager::NoError,100));
+ QVERIFY(waitForAsync(spy, &lmFetchByIdRequest, QLandmarkManager::NoError));
QCOMPARE(lmFetchByIdRequest.errorMap().count(),0);
lms = lmFetchByIdRequest.landmarks();
@@ -2024,7 +2040,7 @@ void tst_QLandmarkManager::retrieveLandmark() {
fetchByIdRequest.setLandmarkIds(lmIds);
QVERIFY(fetchByIdRequest.isInactive());
fetchByIdRequest.start();
- QVERIFY(waitForAsync(spy, &fetchByIdRequest,QLandmarkManager::LandmarkDoesNotExistError,1000));
+ QVERIFY(waitForAsync(spy, &fetchByIdRequest,QLandmarkManager::LandmarkDoesNotExistError));
QCOMPARE(fetchByIdRequest.errorMap().count(),2);
QCOMPARE(fetchByIdRequest.errorMap().keys().at(0),1);
QCOMPARE(fetchByIdRequest.errorMap().keys().at(1),3);
@@ -2047,7 +2063,7 @@ void tst_QLandmarkManager::retrieveLandmark() {
fetchByIdRequest.setLandmarkIds(lmIds);
fetchByIdRequest.start();
- QVERIFY(waitForAsync(spy, &fetchByIdRequest,QLandmarkManager::NoError,1000));
+ QVERIFY(waitForAsync(spy, &fetchByIdRequest,QLandmarkManager::NoError));
lms = fetchByIdRequest.landmarks();
QCOMPARE(lms.count(), 3);
QCOMPARE(lms.at(0),lmA);
@@ -2090,8 +2106,11 @@ void tst_QLandmarkManager::saveCategory() {
QVERIFY(doSingleCategorySave(type,&cat1,QLandmarkManager::NoError));
cat1Initial.setCategoryId(cat1.categoryId());
QCOMPARE(cat1, cat1Initial);
-
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
QTest::qWait(10);
+#endif
QCOMPARE(spyAdd.count(), 1);
QCOMPARE(spyAdd.at(0).at(0).value<QList<QLandmarkCategoryId> >().at(0), cat1.categoryId());
QCOMPARE(spyChange.count(), 0);
@@ -2102,8 +2121,11 @@ void tst_QLandmarkManager::saveCategory() {
QLandmarkCategory cat2;
cat2.setName("CAT2");
QVERIFY(doSingleCategorySave(type, &cat2, QLandmarkManager::NoError));
-
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
QTest::qWait(10);
+#endif
QCOMPARE(spyAdd.count(), 1);
QCOMPARE(spyAdd.at(0).at(0).value<QList<QLandmarkCategoryId> >().at(0), cat2.categoryId());
QCOMPARE(spyChange.count(), 0);
@@ -2188,7 +2210,11 @@ void tst_QLandmarkManager::saveCategory() {
QCOMPARE(m_manager->category(cat2OriginalId).name(), QString("CAT2Modified"));
QCOMPARE(m_manager->category(cat2OriginalId).iconUrl(), QUrl("cat2 url modified"));
- QTest::qWait(10);
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
+ QTest::qWait(10);
+#endif
QCOMPARE(spyAdd.count(), 0);
QCOMPARE(spyChange.count(), 1);
QCOMPARE(spyRemove.count(), 0);
@@ -2239,7 +2265,11 @@ void tst_QLandmarkManager::saveCategory() {
QCOMPARE(catBad, saveCategoryRequest.categories().at(1));
QCOMPARE(catChange, saveCategoryRequest.categories().at(2));
- QTest::qWait(10);
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
+ QTest::qWait(10);
+#endif
QCOMPARE(spyAdd.count(), 1);
QCOMPARE(spyChange.count(), 1);
QCOMPARE(spyRemove.count(), 0);
@@ -2283,13 +2313,17 @@ void tst_QLandmarkManager::saveCategory() {
QCOMPARE(catNew2, saveCategoryRequest.categories().at(1));
QCOMPARE(catNew3, saveCategoryRequest.categories().at(2));
- QTest::qWait(10);
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
+ QTest::qWait(10);
+#endif
QCOMPARE(spyAdd.count(), 1);
QCOMPARE(spyChange.count(), 0);
QCOMPARE(spyRemove.count(), 0);
- QCOMPARE(spyAdd.at(0).at(0).value<QList<QLandmarkCategoryId> >().at(0), firstCategoryId);
- QCOMPARE(spyAdd.at(0).at(0).value<QList<QLandmarkCategoryId> >().at(1), secondCategoryId);
- QCOMPARE(spyAdd.at(0).at(0).value<QList<QLandmarkCategoryId> >().at(2), thirdCategoryId);
+ QVERIFY(spyAdd.at(0).at(0).value<QList<QLandmarkCategoryId> >().contains(firstCategoryId));
+ QVERIFY(spyAdd.at(0).at(0).value<QList<QLandmarkCategoryId> >().contains(secondCategoryId));
+ QVERIFY(spyAdd.at(0).at(0).value<QList<QLandmarkCategoryId> >().contains(thirdCategoryId));
spyAdd.clear();
//try changing multiple categories
@@ -2317,13 +2351,17 @@ void tst_QLandmarkManager::saveCategory() {
QCOMPARE(catNew2, saveCategoryRequest.categories().at(1));
QCOMPARE(catNew3, saveCategoryRequest.categories().at(2));
- QTest::qWait(10);
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
+ QTest::qWait(10);
+#endif
QCOMPARE(spyAdd.count(), 0);
QCOMPARE(spyChange.count(), 1);
QCOMPARE(spyRemove.count(), 0);
- QCOMPARE(spyChange.at(0).at(0).value<QList<QLandmarkCategoryId> >().at(0), firstCategoryId);
- QCOMPARE(spyChange.at(0).at(0).value<QList<QLandmarkCategoryId> >().at(1), secondCategoryId);
- QCOMPARE(spyChange.at(0).at(0).value<QList<QLandmarkCategoryId> >().at(2), thirdCategoryId);
+ QVERIFY(spyChange.at(0).at(0).value<QList<QLandmarkCategoryId> >().contains(firstCategoryId));
+ QVERIFY(spyChange.at(0).at(0).value<QList<QLandmarkCategoryId> >().contains(secondCategoryId));
+ QVERIFY(spyChange.at(0).at(0).value<QList<QLandmarkCategoryId> >().contains(thirdCategoryId));
spyChange.clear();
}
@@ -2353,7 +2391,6 @@ void tst_QLandmarkManager::simpleSaveLandmark() {
QLandmark lm1;
lm1.setName("lm1");
QVERIFY(m_manager->saveLandmark(&lm1));
-
lm1.setName("lm1Changed");
QVERIFY(m_manager->saveLandmark(&lm1));
@@ -2365,7 +2402,8 @@ void tst_QLandmarkManager::simpleSaveLandmark() {
void tst_QLandmarkManager::saveLandmark() {
QFETCH(QString, type);
QLandmarkManager* otherManager = new QLandmarkManager();
- connect(otherManager, SIGNAL(dataChanged()),m_listener, SLOT(dataChanged()));
+ connect(otherManager, SIGNAL(landmarksAdded(QList<QLandmarkId>)),m_listener,
+ SLOT(landmarksAdded(QList<QLandmarkId>)));
QSignalSpy spyAdd(m_manager, SIGNAL(landmarksAdded(QList<QLandmarkId>)));
QSignalSpy spyChange(m_manager, SIGNAL(landmarksChanged(QList<QLandmarkId>)));
@@ -2375,7 +2413,7 @@ void tst_QLandmarkManager::saveLandmark() {
QSignalSpy spyCatRemove(m_manager, SIGNAL(categoriesRemoved(QList<QLandmarkCategoryId>)));
QSignalSpy spyDataChanged(m_manager, SIGNAL(dataChanged()));
- QSignalSpy spyOtherDataChanged(otherManager, SIGNAL(dataChanged()));
+ QSignalSpy spyOtherAdd(otherManager, SIGNAL(landmarksAdded(QList<QLandmarkId>)));
int originalLandmarkCount = m_manager->landmarks().count();
QLandmark emptyLandmark;
@@ -2386,7 +2424,11 @@ void tst_QLandmarkManager::saveLandmark() {
QVERIFY(doSingleLandmarkSave(type, &emptyLandmark,QLandmarkManager::NoError));
QVERIFY(checkLandmarkCount(originalLandmarkCount + 1));
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
QTest::qWait(10);
+#endif
QCOMPARE(spyAdd.count(), 1);
QCOMPARE(spyChange.count(), 0);
QCOMPARE(spyRemove.count(),0);
@@ -2395,11 +2437,11 @@ void tst_QLandmarkManager::saveLandmark() {
QCOMPARE(spyCatRemove.count(), 0);
QCOMPARE(spyDataChanged.count(), 0);
#if (defined(Q_WS_MAEMO_6))
- QCOMPARE(spyOtherDataChanged.count(), 1);
+ QCOMPARE(spyOtherAdd.count(), 1);
#endif
QCOMPARE(spyAdd.at(0).at(0).value<QList<QLandmarkId> >().at(0), emptyLandmark.landmarkId());
spyAdd.clear();
- spyOtherDataChanged.clear();
+ spyOtherAdd.clear();
QLandmarkCategory cat1;
cat1.setName("CAT1");
QVERIFY(m_manager->saveCategory(&cat1));
@@ -2437,22 +2479,25 @@ void tst_QLandmarkManager::saveLandmark() {
QVERIFY(doSingleLandmarkSave(type, &lm1,QLandmarkManager::NoError));
QVERIFY(checkLandmarkCount(originalLandmarkCount +2));
int newLandmarkCount = originalLandmarkCount + 2;
-
QCOMPARE(lm1, m_manager->landmark(lm1.landmarkId()));
lm1Initial.setLandmarkId(lm1.landmarkId());
QCOMPARE(lm1,lm1Initial);
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
QTest::qWait(10);
+#endif
QCOMPARE(spyAdd.count(), 1);
QCOMPARE(spyChange.count(), 0);
QCOMPARE(spyRemove.count(),0);
QCOMPARE(spyAdd.at(0).at(0).value<QList<QLandmarkId> >().at(0), lm1.landmarkId());
-#if !(defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_6))
+#if !defined(Q_OS_SYMBIAN)
QCOMPARE(spyCatAdd.count(), 1);
- QCOMPARE(spyCatAdd.at(0).at(0).value<QList<QLandmarkCategoryId> >().at(0), cat1.categoryId());
- QCOMPARE(spyCatAdd.at(0).at(0).value<QList<QLandmarkCategoryId> >().at(1), cat2.categoryId());
- QCOMPARE(spyCatAdd.at(0).at(0).value<QList<QLandmarkCategoryId> >().at(2), cat3.categoryId());
+ QVERIFY(spyCatAdd.at(0).at(0).value<QList<QLandmarkCategoryId> >().contains(cat1.categoryId()));
+ QVERIFY(spyCatAdd.at(0).at(0).value<QList<QLandmarkCategoryId> >().contains(cat2.categoryId()));
+ QVERIFY(spyCatAdd.at(0).at(0).value<QList<QLandmarkCategoryId> >().contains(cat3.categoryId()));
#else
QCOMPARE(spyCatAdd.count(), 3);
QCOMPARE(spyCatAdd.at(0).at(0).value<QList<QLandmarkCategoryId> >().at(0), cat1.categoryId());
@@ -2463,8 +2508,9 @@ void tst_QLandmarkManager::saveLandmark() {
QCOMPARE(spyCatRemove.count(), 0);
QCOMPARE(spyDataChanged.count(), 0);
#if (defined(Q_WS_MAEMO_6))
- QCOMPARE(spyOtherDataChanged.count(), 4);
+ QCOMPARE(spyOtherAdd.count(), 1);
#endif
+ delete otherManager;
spyAdd.clear();
spyCatAdd.clear();
@@ -2498,7 +2544,11 @@ void tst_QLandmarkManager::saveLandmark() {
QCOMPARE(lm1ChangedInitial, m_manager->landmark(lm1.landmarkId()));
QCOMPARE(lm1ChangedInitial, lm1Changed);
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
QTest::qWait(10);
+#endif
QCOMPARE(spyAdd.count(), 0);
QCOMPARE(spyChange.count(), 1);
QCOMPARE(spyRemove.count(),0);
@@ -2515,7 +2565,11 @@ void tst_QLandmarkManager::saveLandmark() {
QVERIFY(checkLandmarkCount(newLandmarkCount));
QCOMPARE(m_manager->landmark(lm1Changed.landmarkId()).phoneNumber(),QString());
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
QTest::qWait(10);
+#endif
QCOMPARE(spyAdd.count(), 0);
QCOMPARE(spyChange.count(), 1);
QCOMPARE(spyRemove.count(),0);
@@ -2555,7 +2609,9 @@ void tst_QLandmarkManager::saveLandmark() {
QVERIFY(checkLandmarkCount(newLandmarkCount));
lmOutOfRangeInitial.setLandmarkId(lmOutOfRange.landmarkId());
QCOMPARE(lmOutOfRange, lmOutOfRangeInitial);
-
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#endif
//try saving a landmark with an out of range latitude
QLandmark lmOutOfRange2;
outOfRangeCoord.setLatitude(91);
@@ -2611,10 +2667,16 @@ void tst_QLandmarkManager::saveLandmark() {
QVERIFY(m_manager->landmark(lm2.landmarkId()).categoryIds().contains(cat2.categoryId()));
newLandmarkCount = newLandmarkCount +1;
lm2.removeCategoryId(cat2.categoryId());
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#endif
QVERIFY(doSingleLandmarkSave(type, &lm2, QLandmarkManager::NoError));
QCOMPARE(m_manager->landmark(lm2.landmarkId()).categoryIds().count(), 0);
-
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
QTest::qWait(10);
+#endif
if (type == "sync") {
#if (defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_6))
QCOMPARE(spyAdd.count(), 2);
@@ -2623,10 +2685,19 @@ void tst_QLandmarkManager::saveLandmark() {
#else
QCOMPARE(spyAdd.count(), 1);
+ QVERIFY(spyAdd.at(0).at(0).value<QList<QLandmarkId> >().contains(lmOutOfRange.landmarkId()));
+ QVERIFY(spyAdd.at(0).at(0).value<QList<QLandmarkId> >().contains(lm2.landmarkId()));
#endif
}
- else if (type == "async")
+ else if (type == "async") {
+//#if defined(Q_WS_MAEMO_6)
+// QCOMPARE(spyAdd.count(), 1);
+// QVERIFY(spyAdd.at(0).at(0).value<QList<QLandmarkId> >().contains(lmOutOfRange.landmarkId()));
+// QVERIFY(spyAdd.at(0).at(0).value<QList<QLandmarkId> >().contains(lm2.landmarkId()));
+//#else
QCOMPARE(spyAdd.count(), 2);
+//#endif
+ }
QCOMPARE(spyChange.count(), 1);
QCOMPARE(spyRemove.count(),0);
QCOMPARE(spyCatAdd.count(), 0);
@@ -2673,14 +2744,17 @@ void tst_QLandmarkManager::saveMultipleLandmarks()
QSignalSpy spyCatRemove(m_manager, SIGNAL(categoriesRemoved(QList<QLandmarkCategoryId>)));
QSignalSpy spyDataChanged(m_manager, SIGNAL(dataChanged()));
- int originalLandmarkCount = m_manager->landmarks().count();
QGeoAddress address;
QGeoCoordinate coordinate;
QLandmark lm;
lm.setName("LM");
QVERIFY(m_manager->saveLandmark(&lm));
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
QTest::qWait(10);
+#endif
spyAdd.clear();
//try saving multiple landamrks the first is new, the second should fail and the third is an update
@@ -2730,7 +2804,11 @@ void tst_QLandmarkManager::saveMultipleLandmarks()
QCOMPARE(lmBad, lms.at(1));
QCOMPARE(lmChange, lms.at(2));
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
QTest::qWait(10);
+#endif
QCOMPARE(spyAdd.count(), 1);
QCOMPARE(spyChange.count(), 1);
QCOMPARE(spyRemove.count(), 0);
@@ -2782,13 +2860,17 @@ void tst_QLandmarkManager::saveMultipleLandmarks()
QCOMPARE(lmNew2, lms.at(1));
QCOMPARE(lmNew3, lms.at(2));
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
QTest::qWait(10);
+#endif
QCOMPARE(spyAdd.count(), 1);
QCOMPARE(spyChange.count(), 0);
QCOMPARE(spyRemove.count(), 0);
- QCOMPARE(spyAdd.at(0).at(0).value<QList<QLandmarkId> >().at(0), firstLandmarkId);
- QCOMPARE(spyAdd.at(0).at(0).value<QList<QLandmarkId> >().at(1), secondLandmarkId);
- QCOMPARE(spyAdd.at(0).at(0).value<QList<QLandmarkId> >().at(2), thirdLandmarkId);
+ QVERIFY(spyAdd.at(0).at(0).value<QList<QLandmarkId> >().contains(firstLandmarkId));
+ QVERIFY(spyAdd.at(0).at(0).value<QList<QLandmarkId> >().contains(secondLandmarkId));
+ QVERIFY(spyAdd.at(0).at(0).value<QList<QLandmarkId> >().contains(thirdLandmarkId));
QCOMPARE(spyCatAdd.count(), 0);
QCOMPARE(spyCatChange.count(), 0);
QCOMPARE(spyCatRemove.count(), 0);
@@ -2819,13 +2901,17 @@ void tst_QLandmarkManager::saveMultipleLandmarks()
QCOMPARE(lmNew2, lms.at(1));
QCOMPARE(lmNew3, lms.at(2));
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
QTest::qWait(10);
+#endif
QCOMPARE(spyAdd.count(), 0);
QCOMPARE(spyChange.count(), 1);
QCOMPARE(spyRemove.count(), 0);
- QCOMPARE(spyChange.at(0).at(0).value<QList<QLandmarkId> >().at(0), firstLandmarkId);
- QCOMPARE(spyChange.at(0).at(0).value<QList<QLandmarkId> >().at(1), secondLandmarkId);
- QCOMPARE(spyChange.at(0).at(0).value<QList<QLandmarkId> >().at(2), thirdLandmarkId);
+ QVERIFY(spyChange.at(0).at(0).value<QList<QLandmarkId> >().contains(firstLandmarkId));
+ QVERIFY(spyChange.at(0).at(0).value<QList<QLandmarkId> >().contains(secondLandmarkId));
+ QVERIFY(spyChange.at(0).at(0).value<QList<QLandmarkId> >().contains(thirdLandmarkId));
QCOMPARE(spyCatAdd.count(), 0);
QCOMPARE(spyCatChange.count(), 0);
QCOMPARE(spyCatRemove.count(), 0);
@@ -2847,12 +2933,14 @@ void tst_QLandmarkManager::saveMultipleLandmarks()
QCOMPARE(lmSaveRequest.errorMap().value(1), QLandmarkManager::LandmarkDoesNotExistError);
QCOMPARE(spyResults.count(), 1);
spyResults.clear();
-
+#if (defined(Q_WS_MAEMO_6))
+ QTest::qWait(2000);
+#endif
QCOMPARE(spyAdd.count(), 0);
QCOMPARE(spyChange.count(), 1);
QCOMPARE(spyRemove.count(), 0);
- QCOMPARE(spyChange.at(0).at(0).value<QList<QLandmarkId> >().at(0), lmNew.landmarkId());
- QCOMPARE(spyChange.at(0).at(0).value<QList<QLandmarkId> >().at(1), lmChange.landmarkId());
+ QVERIFY(spyChange.at(0).at(0).value<QList<QLandmarkId> >().contains(lmNew.landmarkId()));
+ QVERIFY(spyChange.at(0).at(0).value<QList<QLandmarkId> >().contains(lmChange.landmarkId()));
QCOMPARE(spyCatAdd.count(), 0);
QCOMPARE(spyCatChange.count(), 0);
QCOMPARE(spyCatRemove.count(), 0);
@@ -2866,12 +2954,16 @@ void tst_QLandmarkManager::saveMultipleLandmarks()
QVERIFY(waitForAsync(spy, &lmSaveRequest, QLandmarkManager::NoError));
QCOMPARE(lmSaveRequest.errorMap().count(), 0);
QCOMPARE(spyResults.count(), 1);
-
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
+ QTest::qWait(10);
+#endif
QCOMPARE(spyAdd.count(), 0);
QCOMPARE(spyChange.count(), 1);
- QCOMPARE(spyChange.at(0).at(0).value<QList<QLandmarkId> >().at(0), lmNew1.landmarkId());
- QCOMPARE(spyChange.at(0).at(0).value<QList<QLandmarkId> >().at(1), lmNew2.landmarkId());
- QCOMPARE(spyChange.at(0).at(0).value<QList<QLandmarkId> >().at(2), lmNew3.landmarkId());
+ QVERIFY(spyChange.at(0).at(0).value<QList<QLandmarkId> >().contains(lmNew1.landmarkId()));
+ QVERIFY(spyChange.at(0).at(0).value<QList<QLandmarkId> >().contains(lmNew2.landmarkId()));
+ QVERIFY(spyChange.at(0).at(0).value<QList<QLandmarkId> >().contains(lmNew3.landmarkId()));
QCOMPARE(spyRemove.count(), 0);
QCOMPARE(spyCatAdd.count(), 0);
QCOMPARE(spyCatChange.count(), 0);
@@ -2948,7 +3040,11 @@ void tst_QLandmarkManager::removeCategory() {
id1.setManagerUri("different.manager");
id1.setLocalId("100");
QVERIFY(doSingleCategoryRemove(type,id1,QLandmarkManager::CategoryDoesNotExistError));
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
QTest::qWait(10);
+#endif
QCOMPARE(spyLmAdd.count(), 0);
QCOMPARE(spyLmChange.count(), 0);
QCOMPARE(spyLmRemove.count(), 0);
@@ -2959,12 +3055,18 @@ void tst_QLandmarkManager::removeCategory() {
QLandmarkCategory cat1;
cat1.setName("CAT1");
QVERIFY(m_manager->saveCategory(&cat1));
-
+#if (defined(Q_WS_MAEMO_6))
+ QTest::qWait(2000);
+#endif
QVERIFY(doSingleCategoryRemove(type, cat1.categoryId(),QLandmarkManager::NoError));
QCOMPARE(m_manager->category(cat1.categoryId()), QLandmarkCategory());
QCOMPARE(m_manager->error(), QLandmarkManager::CategoryDoesNotExistError);
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
QTest::qWait(10);
+#endif
QCOMPARE(spyLmAdd.count(), 0);
QCOMPARE(spyLmChange.count(), 0);
QCOMPARE(spyLmRemove.count(), 0);
@@ -2995,7 +3097,9 @@ void tst_QLandmarkManager::removeCategory() {
lm1.addCategoryId(cat3.categoryId());
lm1.addCategoryId(cat2.categoryId());
lm1.addCategoryId(cat1.categoryId());
-
+#if (defined(Q_WS_MAEMO_6))
+ QTest::qWait(2000);
+#endif
QVERIFY(m_manager->saveLandmark(&lm1));
QCOMPARE(lm1, m_manager->landmark(lm1.landmarkId()));
QCOMPARE(lm1.categoryIds().count(), 3);
@@ -3011,9 +3115,15 @@ void tst_QLandmarkManager::removeCategory() {
QCOMPARE(lm2, m_manager->landmark(lm2.landmarkId()));
QCOMPARE(lm2.categoryIds().count(), 1);
QVERIFY(lm2.categoryIds().contains(cat2.categoryId()));
-
+#if (defined(Q_WS_MAEMO_6))
+ QTest::qWait(2000);
+#endif
QVERIFY(doSingleCategoryRemove(type, cat2.categoryId(),QLandmarkManager::NoError));
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
QTest::qWait(10);
+#endif
#if (defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_6))
QCOMPARE(spyLmAdd.count(), 2);
#else
@@ -3024,7 +3134,7 @@ void tst_QLandmarkManager::removeCategory() {
QCOMPARE(spyLmChange.at(0).at(0).value<QList<QLandmarkId> >().count(), 1);
QCOMPARE(spyLmChange.at(0).at(0).value<QList<QLandmarkId> >().at(0), lm1.landmarkId());
QCOMPARE(spyLmRemove.count(), 0);
-#if (defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_6))
+#if defined(Q_OS_SYMBIAN)
QCOMPARE(spyCatAdd.count(), 3);
#else
QCOMPARE(spyCatAdd.count(), 1);
@@ -3082,7 +3192,9 @@ void tst_QLandmarkManager::removeCategory() {
query.finish();
#endif
-
+#if (defined(Q_WS_MAEMO_6))
+ QTest::qWait(2000);
+#endif
QVERIFY(m_manager->removeCategory(cat5));
QCOMPARE(m_manager->category(cat4.categoryId()),cat4);
QCOMPARE(m_manager->category(cat5.categoryId()), QLandmarkCategory());
@@ -3099,11 +3211,15 @@ void tst_QLandmarkManager::removeCategory() {
QSqlDatabase::removeDatabase("testing");
#endif
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
QTest::qWait(10);
+#endif
QCOMPARE(spyLmAdd.count(), 0);
QCOMPARE(spyLmChange.count(), 0);
QCOMPARE(spyLmRemove.count(), 0);
-#if (defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_6))
+#if defined(Q_OS_SYMBIAN)
QCOMPARE(spyCatAdd.count(), 3);
#else
QCOMPARE(spyCatAdd.count(), 1);
@@ -3137,13 +3253,15 @@ void tst_QLandmarkManager::removeCategory() {
QLandmarkCategoryId catIdNotExist2;
QList<QLandmarkCategoryId> catIds;
catIds << catA.categoryId() << catIdNotExist << catC.categoryId() << catIdNotExist2;
-
+#if (defined(Q_WS_MAEMO_6))
+ QTest::qWait(2000);
+#endif
QLandmarkCategoryRemoveRequest removeRequest(m_manager);
QSignalSpy spy(&removeRequest, SIGNAL(stateChanged(QLandmarkAbstractRequest::State)));
QSignalSpy spyResult(&removeRequest, SIGNAL(resultsAvailable()));
removeRequest.setCategoryIds(catIds);
removeRequest.start();
- QVERIFY(waitForAsync(spy, &removeRequest,QLandmarkManager::CategoryDoesNotExistError,1000));
+ QVERIFY(waitForAsync(spy, &removeRequest,QLandmarkManager::CategoryDoesNotExistError));
QCOMPARE(removeRequest.errorMap().count(),2);
QCOMPARE(removeRequest.errorMap().keys().at(0),1);
QCOMPARE(removeRequest.errorMap().keys().at(1),3);
@@ -3157,20 +3275,23 @@ void tst_QLandmarkManager::removeCategory() {
QCOMPARE(spyResult.count(), 1);
spyResult.clear();
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
QTest::qWait(10);
-
+#endif
QCOMPARE(spyLmAdd.count(), 0);
QCOMPARE(spyLmChange.count(), 0);
QCOMPARE(spyLmRemove.count(), 0);
-#if (defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_6))
+#if defined(Q_OS_SYMBIAN)
QCOMPARE(spyCatAdd.count(), 3);
#else
QCOMPARE(spyCatAdd.count(), 1);
#endif
QCOMPARE(spyCatChange.count(), 0);
QCOMPARE(spyCatRemove.count(), 1);
- QCOMPARE(spyCatRemove.at(0).at(0).value<QList<QLandmarkCategoryId> >().at(0), catA.categoryId());
- QCOMPARE(spyCatRemove.at(0).at(0).value<QList<QLandmarkCategoryId> >().at(1), catC.categoryId());
+ QVERIFY(spyCatRemove.at(0).at(0).value<QList<QLandmarkCategoryId> >().contains(catA.categoryId()));
+ QVERIFY(spyCatRemove.at(0).at(0).value<QList<QLandmarkCategoryId> >().contains(catC.categoryId()));
spyCatAdd.clear();
spyCatRemove.clear();
@@ -3179,22 +3300,28 @@ void tst_QLandmarkManager::removeCategory() {
catC.setCategoryId(QLandmarkCategoryId());
QVERIFY(m_manager->saveCategory(&catA));
QVERIFY(m_manager->saveCategory(&catC));
+#if (defined(Q_WS_MAEMO_6))
+ QTest::qWait(2000);
+#endif
catIds.clear();
catIds << catC.categoryId() << catB.categoryId() << catA.categoryId();
removeRequest.setCategoryIds(catIds);
removeRequest.start();
- QVERIFY(waitForAsync(spy, &removeRequest,QLandmarkManager::NoError,1000));
+ QVERIFY(waitForAsync(spy, &removeRequest,QLandmarkManager::NoError));
QCOMPARE(removeRequest.errorMap().count(),0);
QCOMPARE(m_manager->category(catA.categoryId()), QLandmarkCategory());
QCOMPARE(m_manager->category(catB.categoryId()), QLandmarkCategory());
QCOMPARE(m_manager->category(catC.categoryId()), QLandmarkCategory());
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
QTest::qWait(10);
-
+#endif
QCOMPARE(spyLmAdd.count(), 0);
QCOMPARE(spyLmChange.count(), 0);
QCOMPARE(spyLmRemove.count(), 0);
-#if (defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_6))
+#if defined(Q_OS_SYMBIAN)
QCOMPARE(spyCatAdd.count(), 2);
#else
QCOMPARE(spyCatAdd.count(), 1);
@@ -3262,7 +3389,11 @@ void tst_QLandmarkManager::removeLandmark()
id1.setManagerUri("different.manager");
id1.setLocalId("100");
QVERIFY(doSingleLandmarkRemove(type,id1,QLandmarkManager::LandmarkDoesNotExistError));
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
QTest::qWait(10);
+#endif
QCOMPARE(spyLmAdd.count(), 0);
QCOMPARE(spyLmChange.count(), 0);
QCOMPARE(spyLmRemove.count(), 0);
@@ -3273,11 +3404,18 @@ void tst_QLandmarkManager::removeLandmark()
QLandmark lm1;
lm1.setName("LM1");
QVERIFY(m_manager->saveLandmark(&lm1));
+#if (defined(Q_WS_MAEMO_6))
+ QTest::qWait(2000);
+#endif
QVERIFY(doSingleLandmarkRemove(type, lm1.landmarkId(), QLandmarkManager::NoError));
QCOMPARE(m_manager->landmark(lm1.landmarkId()), QLandmark());
QCOMPARE(m_manager->error(), QLandmarkManager::LandmarkDoesNotExistError);
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
QTest::qWait(10);
+#endif
QCOMPARE(spyLmAdd.count(), 1);
QCOMPARE(spyLmChange.count(), 0);
QCOMPARE(spyLmRemove.count(), 1);
@@ -3307,8 +3445,12 @@ void tst_QLandmarkManager::removeLandmark()
lm4.setName("LM4");
QVERIFY(m_manager->saveLandmark(&lm4));
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
QTest::qWait(10);
-#if (defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_6))
+#endif
+#if defined(Q_OS_SYMBIAN)
QCOMPARE(spyLmAdd.count(), 4);
#else
QCOMPARE(spyLmAdd.count(), 1);
@@ -3341,14 +3483,18 @@ void tst_QLandmarkManager::removeLandmark()
QCOMPARE(m_manager->landmark(lm3.landmarkId()), QLandmark());
QCOMPARE(m_manager->landmark(lm4.landmarkId()), QLandmark());
- QTest::qWait(10);
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
+ QTest::qWait(10);
+#endif
QCOMPARE(spyLmAdd.count(), 0);
QCOMPARE(spyLmChange.count(), 0);
QCOMPARE(spyLmRemove.count(), 1);
QCOMPARE(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().count(), 3);
- QCOMPARE(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().at(0), lm1.landmarkId());
- QCOMPARE(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().at(1), lm3.landmarkId());
- QCOMPARE(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().at(2), lm4.landmarkId());
+ QVERIFY(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().contains(lm1.landmarkId()));
+ QVERIFY(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().contains(lm3.landmarkId()));
+ QVERIFY(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().contains(lm4.landmarkId()));
QCOMPARE(spyCatAdd.count(), 0);
QCOMPARE(spyCatChange.count(), 0);
@@ -3362,7 +3508,9 @@ void tst_QLandmarkManager::removeLandmark()
QVERIFY(m_manager->saveLandmark(&lm3));
lm4.setLandmarkId(QLandmarkId());
QVERIFY(m_manager->saveLandmark(&lm4));
-
+#if (defined(Q_WS_MAEMO_6))
+ QTest::qWait(2000);
+#endif
lmIds.clear();
lmIds << lm1.landmarkId() << lmIdNotExist << lm3.landmarkId() << lmIdNotExist2 << lm4.landmarkId();
@@ -3380,8 +3528,12 @@ void tst_QLandmarkManager::removeLandmark()
QCOMPARE(errorMap.value(1), QLandmarkManager::LandmarkDoesNotExistError);
QCOMPARE(errorMap.value(3), QLandmarkManager::LandmarkDoesNotExistError);
- QTest::qWait(10);
-#if (defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_6))
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
+ QTest::qWait(10);
+#endif
+#if defined(Q_OS_SYMBIAN)
QCOMPARE(spyLmAdd.count(), 3);
QCOMPARE(spyLmAdd.at(0).at(0).value<QList<QLandmarkId> >().at(0), lm1.landmarkId());
QCOMPARE(spyLmAdd.at(1).at(0).value<QList<QLandmarkId> >().at(0), lm3.landmarkId());
@@ -3389,18 +3541,17 @@ void tst_QLandmarkManager::removeLandmark()
#else
QCOMPARE(spyLmAdd.count(), 1);
QCOMPARE(spyLmAdd.at(0).at(0).value<QList<QLandmarkId> >().count(), 3);
- QCOMPARE(spyLmAdd.at(0).at(0).value<QList<QLandmarkId> >().at(0), lm1.landmarkId());
- QCOMPARE(spyLmAdd.at(0).at(0).value<QList<QLandmarkId> >().at(1), lm3.landmarkId());
- QCOMPARE(spyLmAdd.at(0).at(0).value<QList<QLandmarkId> >().at(2), lm4.landmarkId());
+ QVERIFY(spyLmAdd.at(0).at(0).value<QList<QLandmarkId> >().contains(lm1.landmarkId()));
+ QVERIFY(spyLmAdd.at(0).at(0).value<QList<QLandmarkId> >().contains(lm3.landmarkId()));
+ QVERIFY(spyLmAdd.at(0).at(0).value<QList<QLandmarkId> >().contains(lm4.landmarkId()));
#endif
QCOMPARE(spyLmChange.count(), 0);
QCOMPARE(spyLmRemove.count(), 1);
QCOMPARE(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().count(), 3);
-
- QCOMPARE(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().at(0), lm1.landmarkId());
- QCOMPARE(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().at(1), lm3.landmarkId());
- QCOMPARE(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().at(2), lm4.landmarkId());
+ QVERIFY(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().contains(lm1.landmarkId()));
+ QVERIFY(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().contains(lm3.landmarkId()));
+ QVERIFY(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().contains(lm4.landmarkId()));
QCOMPARE(spyCatAdd.count(), 0);
QCOMPARE(spyCatChange.count(), 0);
QCOMPARE(spyCatRemove.count(), 0);
@@ -3409,7 +3560,7 @@ void tst_QLandmarkManager::removeLandmark()
} else if (type == "async") {
removeRequest.setLandmarkIds(lmIds);
removeRequest.start();
- QVERIFY(waitForAsync(spy, &removeRequest,QLandmarkManager::LandmarkDoesNotExistError,1000));
+ QVERIFY(waitForAsync(spy, &removeRequest,QLandmarkManager::LandmarkDoesNotExistError));
QCOMPARE(spyResult.count(), 1);
spyResult.clear();
@@ -3424,14 +3575,18 @@ void tst_QLandmarkManager::removeLandmark()
QCOMPARE(m_manager->landmark(lm3.landmarkId()), QLandmark());
QCOMPARE(m_manager->landmark(lm4.landmarkId()), QLandmark());
- QTest::qWait(10);
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
+ QTest::qWait(10);
+#endif
QCOMPARE(spyLmAdd.count(), 0);
QCOMPARE(spyLmChange.count(), 0);
QCOMPARE(spyLmRemove.count(), 1);
QCOMPARE(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().count(), 3);
- QCOMPARE(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().at(0), lm1.landmarkId());
- QCOMPARE(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().at(1), lm3.landmarkId());
- QCOMPARE(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().at(2), lm4.landmarkId());
+ QVERIFY(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().contains(lm1.landmarkId()));
+ QVERIFY(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().contains(lm3.landmarkId()));
+ QVERIFY(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().contains(lm4.landmarkId()));
QCOMPARE(spyCatAdd.count(), 0);
QCOMPARE(spyCatChange.count(), 0);
spyLmRemove.clear();
@@ -3448,7 +3603,11 @@ void tst_QLandmarkManager::removeLandmark()
QLandmark lmC;
lmB.setName("LM-C");
QVERIFY(m_manager->saveLandmark(&lmC));
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
QTest::qWait(10);
+#endif
spyLmAdd.clear();
lmIds.clear();
@@ -3464,14 +3623,18 @@ void tst_QLandmarkManager::removeLandmark()
QCOMPARE(m_manager->landmark(lmB.landmarkId()), QLandmark());
QCOMPARE(m_manager->landmark(lmC.landmarkId()), QLandmark());
- QTest::qWait(10);
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
+ QTest::qWait(10);
+#endif
QCOMPARE(spyLmAdd.count(), 0);
QCOMPARE(spyLmChange.count(), 0);
QCOMPARE(spyLmRemove.count(), 1);
QCOMPARE(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().count(), 3);
- QCOMPARE(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().at(0), lmA.landmarkId());
- QCOMPARE(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().at(1), lmB.landmarkId());
- QCOMPARE(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().at(2), lmC.landmarkId());
+ QVERIFY(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().contains(lmA.landmarkId()));
+ QVERIFY(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().contains(lmB.landmarkId()));
+ QVERIFY(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().contains(lmC.landmarkId()));
QCOMPARE(spyCatAdd.count(), 0);
QCOMPARE(spyCatChange.count(), 0);
QCOMPARE(spyCatRemove.count(), 0);
@@ -3479,7 +3642,7 @@ void tst_QLandmarkManager::removeLandmark()
} else if (type == "async") {
removeRequest.setLandmarkIds(lmIds);
removeRequest.start();
- QVERIFY(waitForAsync(spy, &removeRequest,QLandmarkManager::NoError,1000));
+ QVERIFY(waitForAsync(spy, &removeRequest,QLandmarkManager::NoError));
QCOMPARE(spyResult.count(), 1);
spyResult.clear();
@@ -3489,14 +3652,18 @@ void tst_QLandmarkManager::removeLandmark()
QCOMPARE(m_manager->landmark(lmB.landmarkId()), QLandmark());
QCOMPARE(m_manager->landmark(lmC.landmarkId()), QLandmark());
- QTest::qWait(10);
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
+ QTest::qWait(10);
+#endif
QCOMPARE(spyLmAdd.count(), 0);
QCOMPARE(spyLmChange.count(), 0);
QCOMPARE(spyLmRemove.count(), 1);
QCOMPARE(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().count(), 3);
- QCOMPARE(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().at(0), lmA.landmarkId());
- QCOMPARE(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().at(1), lmB.landmarkId());
- QCOMPARE(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().at(2), lmC.landmarkId());
+ QVERIFY(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().contains(lmA.landmarkId()));
+ QVERIFY(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().contains(lmB.landmarkId()));
+ QVERIFY(spyLmRemove.at(0).at(0).value<QList<QLandmarkId> >().contains(lmC.landmarkId()));
QCOMPARE(spyCatAdd.count(), 0);
QCOMPARE(spyCatChange.count(), 0);
QCOMPARE(spyCatRemove.count(), 0);
@@ -3688,7 +3855,7 @@ void tst_QLandmarkManager::categories()
QLandmarkCategoryFetchRequest fetchRequest(m_manager);
QSignalSpy spy(&fetchRequest, SIGNAL(stateChanged(QLandmarkAbstractRequest::State)));
fetchRequest.start();
- QVERIFY(waitForAsync(spy, &fetchRequest,QLandmarkManager::NoError,100));
+ QVERIFY(waitForAsync(spy, &fetchRequest,QLandmarkManager::NoError));
cats = fetchRequest.categories();
}
@@ -3706,6 +3873,7 @@ void tst_QLandmarkManager::categories()
nameSort.setCaseSensitivity(Qt::CaseInsensitive);
nameSort.setDirection(Qt::AscendingOrder);
QVERIFY(doCategoryFetch(type, -1, 0, nameSort, &cats, QLandmarkManager::NoError));
+
#if (defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_6))
removeGlobalCategories(&cats);
#endif
@@ -4367,22 +4535,12 @@ void tst_QLandmarkManager::filterLandmarksProximityOrder()
//TODO: Symbian proximity filter not matching landmarks which exactly lie on the edge of the radius
QVERIFY(doFetch(type, proximityFilter,&lms,QLandmarkManager::NoError));
-#ifdef Q_OS_SYMBIAN
- QEXPECT_FAIL("", "MOBILITY-1735: On symbian proximity filter doesn't detect landark right on edge of radius", Continue);
-#endif
QCOMPARE(lms.count(),4);
-#ifdef Q_OS_SYMBIAN
- //TODO: REMOVE WORKAROUND FOR MOBILITY-1735
- QCOMPARE(lms.at(0), lm1);
- QCOMPARE(lms.at(1), lm3);
- QCOMPARE(lms.at(2), lm4);
-#else
QCOMPARE(lms.at(0), lm1);
QCOMPARE(lms.at(1), lm3);
QCOMPARE(lms.at(2), lm4);
QCOMPARE(lms.at(3), lm2);
-#endif
//try a radius of less than -1
proximityFilter.setRadius(-5);
@@ -4846,11 +5004,13 @@ void tst_QLandmarkManager::asyncLandmarkFetchCancel() {
//test canceling of a landmark fetch
fetchRequest.setFilter(unionFilter);
fetchRequest.start();
- QTest::qWait(75);
- QCOMPARE(spy.count(),1);
- QCOMPARE(qvariant_cast<QLandmarkAbstractRequest::State>(spy.at(0).at(0)), QLandmarkAbstractRequest::ActiveState);
fetchRequest.cancel();
+#if defined(Q_WS_MAEMO_6)
+ QVERIFY(waitForAsync(spy, &fetchRequest, QLandmarkManager::CancelError, 16000));
+#else
QVERIFY(waitForAsync(spy, &fetchRequest, QLandmarkManager::CancelError));
+#endif
+
QCOMPARE(fetchRequest.landmarks().count(), 0);
//test canceling of a landmark id fetch
@@ -4858,9 +5018,13 @@ void tst_QLandmarkManager::asyncLandmarkFetchCancel() {
idFetchRequest.setFilter(unionFilter);
QSignalSpy spy2(&idFetchRequest, SIGNAL(stateChanged(QLandmarkAbstractRequest::State)));
idFetchRequest.start();
- QTest::qWait(50);
+ QTest::qWait(75);
idFetchRequest.cancel();
+#if defined(Q_WS_MAEMO_6)
+ QVERIFY(waitForAsync(spy2, &idFetchRequest, QLandmarkManager::CancelError, 16000));
+#else
QVERIFY(waitForAsync(spy2, &idFetchRequest, QLandmarkManager::CancelError));
+#endif
QCOMPARE(idFetchRequest.landmarkIds().count(), 0);
//check that we can delete an request halfway during an operation.
@@ -4868,7 +5032,11 @@ void tst_QLandmarkManager::asyncLandmarkFetchCancel() {
QSignalSpy spy3(fetchRequestPointer, SIGNAL(stateChanged(QLandmarkAbstractRequest::State)));
fetchRequestPointer->setFilter(unionFilter);
fetchRequestPointer->start();
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(200);
+#else
QTest::qWait(75);
+#endif
QCOMPARE(spy3.count(),1);
QCOMPARE(qvariant_cast<QLandmarkAbstractRequest::State>(spy3.at(0).at(0)), QLandmarkAbstractRequest::ActiveState);
delete fetchRequestPointer; //failure to delete usually results in a segfault
@@ -6003,11 +6171,13 @@ void tst_QLandmarkManager::filterAttribute2()
lm1.setName("aaabbbccc");
lm1.setDescription("aaabbbccc");
lm1.setPhoneNumber("aaabbbccc");
+#ifndef Q_WS_MAEMO_6
address.setCountryCode("aaabbbccc");
- address.setCountry("aaabbbccc");
address.setState("aaabbbccc");
- address.setCity("aaabbbccc");
address.setDistrict("aaabbbccc");
+#endif
+ address.setCountry("aaabbbccc");
+ address.setCity("aaabbbccc");
address.setStreet("aaabbbccc");
address.setPostcode("aaabbbccc");
lm1.setAddress(address);
@@ -6019,11 +6189,13 @@ void tst_QLandmarkManager::filterAttribute2()
lm2.setName("bbbaaaccc");
lm2.setDescription("bbbaaaccc");
lm2.setPhoneNumber("bbbaaaccc");
+#ifndef Q_WS_MAEMO_6
address.setCountryCode("bbbaaaccc");
- address.setCountry("bbbaaaccc");
address.setState("bbbaaaccc");
- address.setCity("bbbaaaccc");
address.setDistrict("bbbaaaccc");
+#endif
+ address.setCountry("bbbaaaccc");
+ address.setCity("bbbaaaccc");
address.setStreet("bbbaaaccc");
address.setPostcode("bbbaaaccc");
lm2.setAddress(address);
@@ -6035,11 +6207,13 @@ void tst_QLandmarkManager::filterAttribute2()
lm3.setName("bbbcccaaa");
lm3.setDescription("bbbcccaaa");
lm3.setPhoneNumber("bbbcccaaa");
+#ifndef Q_WS_MAEMO_6
address.setCountryCode("bbbcccaaa");
- address.setCountry("bbbcccaaa");
address.setState("bbbcccaaa");
- address.setCity("bbbcccaaa");
address.setDistrict("bbbcccaaa");
+#endif
+ address.setCity("bbbcccaaa");
+ address.setCountry("bbbcccaaa");
address.setStreet("bbbcccaaa");
address.setPostcode("bbbcccaaa");
lm3.setAddress(address);
@@ -6051,11 +6225,13 @@ void tst_QLandmarkManager::filterAttribute2()
lm4.setName("aaaabbbbcccc");
lm4.setDescription("aaaabbbbcccc");
lm4.setPhoneNumber("aaaabbbbcccc");
+#ifndef Q_WS_MAEMO_6
address.setCountryCode("aaaabbbbcccc");
- address.setCountry("aaaabbbbcccc");
address.setState("aaaabbbbcccc");
- address.setCity("aaaabbbbcccc");
address.setDistrict("aaaabbbbcccc");
+#endif
+ address.setCity("aaaabbbbcccc");
+ address.setCountry("aaaabbbbcccc");
address.setStreet("aaaabbbbcccc");
address.setPostcode("aaaabbbbcccc");
lm4.setAddress(address);
@@ -6067,11 +6243,13 @@ void tst_QLandmarkManager::filterAttribute2()
lm5.setName("ccccaaaabbbb");
lm5.setDescription("ccccaaaabbbb");
lm5.setPhoneNumber("ccccaaaabbbb");
+#ifndef Q_WS_MAEMO_6
address.setCountryCode("ccccaaaabbbb");
- address.setCountry("ccccaaaabbbb");
address.setState("ccccaaaabbbb");
- address.setCity("ccccaaaabbbb");
address.setDistrict("ccccaaaabbbb");
+#endif
+ address.setCity("ccccaaaabbbb");
+ address.setCountry("ccccaaaabbbb");
address.setStreet("ccccaaaabbbb");
address.setPostcode("ccccaaaabbbb");
lm5.setAddress(address);
@@ -6083,11 +6261,13 @@ void tst_QLandmarkManager::filterAttribute2()
lm6.setName("ccccbbbbaaaa");
lm6.setDescription("ccccbbbbaaaa");
lm6.setPhoneNumber("ccccbbbbaaaa");
+#ifndef Q_WS_MAEMO_6
address.setCountryCode("ccccbbbbaaaa");
- address.setCountry("ccccbbbbaaaa");
address.setState("ccccbbbbaaaa");
- address.setCity("ccccbbbbaaaa");
address.setDistrict("ccccbbbbaaaa");
+#endif
+ address.setCountry("ccccbbbbaaaa");
+ address.setCity("ccccbbbbaaaa");
address.setStreet("ccccbbbbaaaa");
address.setPostcode("ccccbbbbaaaa");
lm6.setAddress(address);
@@ -6099,11 +6279,13 @@ void tst_QLandmarkManager::filterAttribute2()
lm7.setName("AAABBBCCC");
lm7.setDescription("AAABBBCCC");
lm7.setPhoneNumber("AAABBBCCC");
+#ifndef Q_WS_MAEMO_6
address.setCountryCode("AAABBBCCC");
- address.setCountry("AAABBBCCC");
address.setState("AAABBBCCC");
- address.setCity("AAABBBCCC");
address.setDistrict("AAABBBCCC");
+#endif
+ address.setCity("AAABBBCCC");
+ address.setCountry("AAABBBCCC");
address.setStreet("AAABBBCCC");
address.setPostcode("AAABBBCCC");
lm7.setAddress(address);
@@ -6115,11 +6297,13 @@ void tst_QLandmarkManager::filterAttribute2()
lm8.setName("BBBAAACCC");
lm8.setDescription("BBBAAACCC");
lm8.setPhoneNumber("BBBAAACCC");
+#ifndef Q_WS_MAEMO_6
address.setCountryCode("BBBAAACCC");
- address.setCountry("BBBAAACCC");
address.setState("BBBAAACCC");
- address.setCity("BBBAAACCC");
address.setDistrict("BBBAAACCC");
+#endif
+ address.setCountry("BBBAAACCC");
+ address.setCity("BBBAAACCC");
address.setStreet("BBBAAACCC");
address.setPostcode("BBBAAACCC");
lm8.setAddress(address);
@@ -6131,11 +6315,13 @@ void tst_QLandmarkManager::filterAttribute2()
lm9.setName("BBBCCCAAA");
lm9.setDescription("BBBCCCAAA");
lm9.setPhoneNumber("BBBCCCAAA");
+#ifndef Q_WS_MAEMO_6
address.setCountryCode("BBBCCCAAA");
- address.setCountry("BBBCCCAAA");
address.setState("BBBCCCAAA");
- address.setCity("BBBCCCAAA");
address.setDistrict("BBBCCCAAA");
+#endif
+ address.setCity("BBBCCCAAA");
+ address.setCountry("BBBCCCAAA");
address.setStreet("BBBCCCAAA");
address.setPostcode("BBBCCCAAA");
lm9.setAddress(address);
@@ -6147,11 +6333,13 @@ void tst_QLandmarkManager::filterAttribute2()
lm10.setName("AAAABBBBCCCC");
lm10.setDescription("AAAABBBBCCCC");
lm10.setPhoneNumber("AAAABBBBCCCC");
+#ifndef Q_WS_MAEMO_6
address.setCountryCode("AAAABBBBCCCC");
- address.setCountry("AAAABBBBCCCC");
address.setState("AAAABBBBCCCC");
- address.setCity("AAAABBBBCCCC");
address.setDistrict("AAAABBBBCCCC");
+#endif
+ address.setCity("AAAABBBBCCCC");
+ address.setCountry("AAAABBBBCCCC");
address.setStreet("AAAABBBBCCCC");
address.setPostcode("AAAABBBBCCCC");
lm10.setAddress(address);
@@ -6163,11 +6351,13 @@ void tst_QLandmarkManager::filterAttribute2()
lm11.setName("CCCCAAAABBBB");
lm11.setDescription("CCCCAAAABBBB");
lm11.setPhoneNumber("CCCCAAAABBBB");
+#ifndef Q_WS_MAEMO_6
address.setCountryCode("CCCCAAAABBBB");
- address.setCountry("CCCCAAAABBBB");
address.setState("CCCCAAAABBBB");
- address.setCity("CCCCAAAABBBB");
address.setDistrict("CCCCAAAABBBB");
+#endif
+ address.setCity("CCCCAAAABBBB");
+ address.setCountry("CCCCAAAABBBB");
address.setStreet("CCCCAAAABBBB");
address.setPostcode("CCCCAAAABBBB");
lm11.setAddress(address);
@@ -6179,11 +6369,13 @@ void tst_QLandmarkManager::filterAttribute2()
lm12.setName("CCCCBBBBAAAA");
lm12.setDescription("CCCCBBBBAAAA");
lm12.setPhoneNumber("CCCCBBBBAAAA");
+#ifndef Q_WS_MAEMO_6
address.setCountryCode("CCCCBBBBAAAA");
- address.setCountry("CCCCBBBBAAAA");
address.setState("CCCCBBBBAAAA");
- address.setCity("CCCCBBBBAAAA");
address.setDistrict("CCCCBBBBAAAA");
+#endif
+ address.setCity("CCCCBBBBAAAA");
+ address.setCountry("CCCCBBBBAAAA");
address.setStreet("CCCCBBBBAAAA");
address.setPostcode("CCCCBBBBAAAA");
lm12.setAddress(address);
@@ -6195,11 +6387,13 @@ void tst_QLandmarkManager::filterAttribute2()
lm13.setName("xxxyyyzzz");
lm13.setDescription("xxxyyyzzz");
lm13.setPhoneNumber("xxxyyyzzz");
+#ifndef Q_WS_MAEMO_6
address.setCountryCode("xxxyyyzzz");
- address.setCountry("xxxyyyzzz");
address.setState("xxxyyyzzz");
- address.setCity("xxxyyyzzz");
address.setDistrict("xxxyyyzzz");
+#endif
+ address.setCity("xxxyyyzzz");
+ address.setCountry("xxxyyyzzz");
address.setStreet("xxxyyyzzz");
address.setPostcode("xxxyyyzzz");
lm13.setAddress(address);
@@ -6208,7 +6402,6 @@ void tst_QLandmarkManager::filterAttribute2()
QLandmark lm14;
m_manager->saveLandmark(&lm14);
-
QLandmarkAttributeFilter attributeFilter;
attributeFilter.setAttribute(field, "aaa",QLandmarkFilter::MatchStartsWith);
@@ -6274,20 +6467,144 @@ void tst_QLandmarkManager::filterAttribute2_data()
QTest::newRow("description async") << "description" << "async";
QTest::newRow("phone number sync") << "phoneNumber" << "sync";
QTest::newRow("phone number async") << "phoneNumber" << "async";
- QTest::newRow("countryCode sync") << "countryCode" << "sync";
- QTest::newRow("countryCode async") << "countryCode" << "async";
QTest::newRow("country sync") << "country" << "sync";
QTest::newRow("country async") << "country" << "async";
- QTest::newRow("state sync") << "state" << "sync";
- QTest::newRow("state sync") << "state" << "async";
QTest::newRow("city sync") << "city" << "sync";
QTest::newRow("city async") << "city" << "async";
- QTest::newRow("district sync") << "district" << "sync";
- QTest::newRow("district async") << "district" << "async";
QTest::newRow("street sync") << "street" << "sync";
QTest::newRow("street async") << "street" << "async";
QTest::newRow("postcode sync") << "postcode" << "sync";
QTest::newRow("postcode async") << "postcode" << "async";
+#ifndef Q_WS_MAEMO_6
+ QTest::newRow("countryCode sync") << "countryCode" << "sync";
+ QTest::newRow("countryCode async") << "countryCode" << "async";
+ QTest::newRow("state sync") << "state" << "sync";
+ QTest::newRow("state sync") << "state" << "async";
+ QTest::newRow("district sync") << "district" << "sync";
+ QTest::newRow("district async") << "district" << "async";
+#endif
+}
+
+void tst_QLandmarkManager::filterAttribute3()
+{
+ QFETCH(QString, type);
+
+ QGeoAddress address;
+ QLandmark lm1;
+ lm1.setName("LM1");
+ lm1.setDescription("LM1 description");
+ lm1.setPhoneNumber("555-5555");
+#ifndef Q_WS_MAEMO_6
+ address.setCountryCode("AUS");
+ address.setState("QLD");
+ address.setDistrict("Eight Mile Plains");
+#endif
+ address.setCity("Brisbane");
+ address.setCountry("Australia");
+ address.setStreet("32 Kent St");
+ address.setPostcode("3044");
+ lm1.setAddress(address);
+ m_manager->saveLandmark(&lm1);
+
+ QLandmark lm2;
+ lm2.setName("LM2");
+ lm2.setDescription("LM2 description");
+ lm2.setPhoneNumber("555-5555");
+ address.clear();
+#ifndef Q_WS_MAEMO_6
+ address.setCountryCode("AUS");
+ address.setState("QLD");
+ address.setDistrict("Mt Gravatt");
+#endif
+ address.setCity("Brisbane");
+ address.setCountry("Australia");
+ address.setStreet("14 Orderly Road");
+ address.setPostcode("41111");
+ lm2.setAddress(address);
+ m_manager->saveLandmark(&lm1);
+
+ QLandmark lm3;
+ lm3.setName("LM3");
+ lm3.setDescription("LM3 description");
+ lm3.setPhoneNumber("555-5555");
+ address.clear();
+#ifndef Q_WS_MAEMO_6
+ address.setCountryCode("AUS");
+ address.setState("QLD");
+ address.setDistrict("Mt Gravatt");
+#endif
+ address.setCity("Kent");
+ address.setCountry("Australia");
+ address.setStreet("18 Brandl Street");
+ address.setPostcode("4112");
+ lm3.setAddress(address);
+ m_manager->saveLandmark(&lm3);
+
+ QLandmark lm4;
+ lm4.setName("LM4");
+ lm4.setDescription("Kent's place");
+ lm4.setPhoneNumber("555-5555");
+ address.clear();
+ address.setCountry("Arctic");
+ address.setStreet("North pole");
+ address.setPostcode("0");
+ lm4.setAddress(address);
+ m_manager->saveLandmark(&lm4);
+
+ QLandmark lm5;
+ lm5.setDescription("Kent's other place");
+ address.clear();
+ address.setCountry("USA");
+ address.setCity("SmallVille");
+ address.setStreet("1 Kent road");
+ lm5.setAddress(address);
+ m_manager->saveLandmark(&lm5);
+
+ //testing setAttributes
+ QLandmarkAttributeFilter attributeFilter;
+ QStringList attributeList;
+#ifndef Q_WS_MAEMO_6
+ attributeList << "description" << "countryCode" << "country" << "state" << "city" << "district" << "street";
+#else
+ attributeList << "description" << "country" << "state" << "city" << "district" << "street";
+#endif
+ attributeFilter.setAttributes(attributeList, "kent",QLandmarkFilter::MatchContains);
+ attributeFilter.setOperationType(QLandmarkAttributeFilter::OrOperation);
+
+ QList<QLandmark> lms;
+ QVERIFY(doFetch(type, attributeFilter, &lms));
+ QCOMPARE(lms.count(), 4);
+ QVERIFY(lms.contains(lm1));
+ QVERIFY(lms.contains(lm3));
+ QVERIFY(lms.contains(lm4));
+ QVERIFY(lms.contains(lm5));
+
+ attributeFilter.removeAttribute("description");
+ QVERIFY(doFetch(type, attributeFilter, &lms));
+ QCOMPARE(lms.count(), 3);
+ QVERIFY(lms.contains(lm1));
+ QVERIFY(lms.contains(lm3));
+ QVERIFY(lms.contains(lm5));
+
+ QLandmarkAttributeFilter attributeFilter2;
+ attributeFilter.clearAttributes();
+ attributeFilter.setOperationType(QLandmarkAttributeFilter::AndOperation);
+ QCOMPARE(attributeFilter,attributeFilter2);
+
+ attributeList.clear();
+ attributeList << "street" << "name";
+ attributeFilter.setAttributes(attributeList,"val", QLandmarkAttributeFilter::MatchContains);
+ attributeFilter2.setAttribute("name", "val", QLandmarkAttributeFilter::MatchContains);
+ attributeFilter2.setAttribute("street", "val", QLandmarkAttributeFilter::MatchContains);
+ QCOMPARE(attributeFilter, attributeFilter2);
+
+}
+
+void tst_QLandmarkManager::filterAttribute3_data()
+{
+ QTest::addColumn<QString> ("type");
+ QTest::newRow("sync") << "sync";
+ QTest::newRow("async") << "async";
}
#endif
@@ -6741,7 +7058,7 @@ void tst_QLandmarkManager::importGpx() {
#else
prefix = ":";
#endif
- int originalCategoryCount = m_manager->categoryIds().count();
+ int originalCategoryCount = m_manager->categoryIds().count();
QSignalSpy spyAdd(m_manager, SIGNAL(landmarksAdded(QList<QLandmarkId>)));
QSignalSpy spyChange(m_manager,SIGNAL(landmarksChanged(QList<QLandmarkId>)));
@@ -6750,20 +7067,16 @@ void tst_QLandmarkManager::importGpx() {
QLandmarkImportRequest importRequest(m_manager);
QSignalSpy spy(&importRequest, SIGNAL(stateChanged(QLandmarkAbstractRequest::State)));
-
QLandmarkCategory cat1;
cat1.setName("CAT1");
QVERIFY(m_manager->saveCategory(&cat1));
-
QLandmarkCategory cat2;
cat2.setName("CAT2");
QVERIFY(m_manager->saveCategory(&cat2));
-
QLandmarkCategory cat3;
cat3.setName("CAT3");
QVERIFY(m_manager->saveCategory(&cat3));
QVERIFY(m_manager->removeCategory(cat3.categoryId()));
-
QFETCH(QString, type);
if (type == "sync") {
QVERIFY(!m_manager->importLandmarks(NULL, QLandmarkManager::Gpx)); //no iodevice set
@@ -6831,14 +7144,22 @@ void tst_QLandmarkManager::importGpx() {
importRequest.setFileName(prefix + "data/AUS-PublicToilet-AustralianCapitalTerritory.gpx");
importRequest.setFormat(QLandmarkManager::Gpx);
importRequest.start();
- QVERIFY(waitForAsync(spy, &importRequest, QLandmarkManager::NoError,2000));
+#if defined(Q_WS_MAEMO_6)
+ QVERIFY(waitForAsync(spy, &importRequest, QLandmarkManager::NoError,12000));
+#else
+ QVERIFY(waitForAsync(spy, &importRequest, QLandmarkManager::NoError));
+#endif
QCOMPARE(importRequest.landmarkIds().count(),187);
} else if (type == "asyncExcludeCategoryData") {
importRequest.setFileName(prefix + "data/AUS-PublicToilet-AustralianCapitalTerritory.gpx");
importRequest.setFormat(QLandmarkManager::Gpx);
importRequest.setTransferOption(QLandmarkManager::ExcludeCategoryData);
importRequest.start();
- QVERIFY(waitForAsync(spy, &importRequest, QLandmarkManager::NoError,2000));
+#if defined(Q_WS_MAEMO_6)
+ QVERIFY(waitForAsync(spy, &importRequest, QLandmarkManager::NoError,12000));
+#else
+ QVERIFY(waitForAsync(spy, &importRequest, QLandmarkManager::NoError));
+#endif
QCOMPARE(importRequest.landmarkIds().count(),187);
} else if (type == "asyncAttachSingleCategory") {
importRequest.setFileName(prefix + "data/AUS-PublicToilet-AustralianCapitalTerritory.gpx");
@@ -6859,12 +7180,15 @@ void tst_QLandmarkManager::importGpx() {
importRequest.setTransferOption(QLandmarkManager::AttachSingleCategory);
importRequest.setCategoryId(cat2.categoryId()); //valid id
importRequest.start();
+#if defined(Q_WS_MAEMO_6)
+ QVERIFY(waitForAsync(spy, &importRequest, QLandmarkManager::NoError,16000));
+#else
QVERIFY(waitForAsync(spy, &importRequest, QLandmarkManager::NoError));
+#endif
QCOMPARE(importRequest.landmarkIds().count(),187);
} else {
qFatal("Unknown row test type");
}
-
QList<QLandmark> landmarks = m_manager->landmarks(QLandmarkFilter());
QCOMPARE(m_manager->categories().count(),originalCategoryCount + 2);
@@ -6876,21 +7200,21 @@ void tst_QLandmarkManager::importGpx() {
landmarks.first().setCategoryIds(QList<QLandmarkCategoryId>());
landmarks.last().setCategoryIds(QList<QLandmarkCategoryId>());
}
-
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
QTest::qWait(100);
-
+#endif
QCOMPARE(spyRemove.count(), 0);
QCOMPARE(spyChange.count(), 0);
QList<QLandmarkId> ids;
QCOMPARE(spyAdd.count(), 0);
-
#ifdef Q_OS_SYMBIAN
if (type == "asyncAttachSingleCategory")
QEXPECT_FAIL("", "MOBILITY-1733: inconsistent datachanged signalling on symbian", Continue);
#endif
QCOMPARE(dataChanged.count(),1);
-
spyAdd.clear();
dataChanged.clear();
@@ -6930,7 +7254,6 @@ void tst_QLandmarkManager::importGpx() {
QCOMPARE(lmLast, retrievedLast);
QCOMPARE(lmLast.coordinate(), retrievedLast.coordinate());
-
if (type == "sync") {
QVERIFY(m_manager->importLandmarks(prefix + "data/test.gpx", QLandmarkManager::Gpx));
QCOMPARE(m_manager->error(), QLandmarkManager::NoError);
@@ -6962,8 +7285,11 @@ void tst_QLandmarkManager::importGpx() {
} else {
qFatal("Unknown test row type");
}
-
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
QTest::qWait(10);
+#endif
QCOMPARE(spyRemove.count(), 0);
QCOMPARE(spyChange.count(), 0);
@@ -7007,7 +7333,6 @@ void tst_QLandmarkManager::importGpx() {
QVERIFY(lmNames.contains("test1"));
QVERIFY(lmNames.contains("test2"));
QVERIFY(lmNames.contains("test3"));
-
if ((type=="syncAttachSingleCategory") || (type == "asyncAttachSingleCategory")) {
foreach(const QLandmark &landmark,lms) {
QCOMPARE(landmark.categoryIds().count(),1);
@@ -7028,7 +7353,7 @@ void tst_QLandmarkManager::importGpx() {
QCOMPARE(spy.count(),1);
QCOMPARE(qvariant_cast<QLandmarkAbstractRequest::State>(spy.at(0).at(0)), QLandmarkAbstractRequest::ActiveState);
importRequest.cancel();
- QVERIFY(waitForAsync(spy, &importRequest, QLandmarkManager::CancelError,2000));
+ QVERIFY(waitForAsync(spy, &importRequest, QLandmarkManager::CancelError));
QCOMPARE(originalLandmarksCount, m_manager->landmarkIds().count());
QCOMPARE(importRequest.landmarkIds().count(),0);
@@ -7041,12 +7366,15 @@ void tst_QLandmarkManager::importGpx() {
importRequest.setFormat(QLandmarkManager::Gpx);
importRequest.setTransferOption(QLandmarkManager::IncludeCategoryData);
importRequest.start();
- QVERIFY(waitForAsync(spy, &importRequest, QLandmarkManager::NoError,2000));
+#if defined(Q_WS_MAEMO_6)
+ QVERIFY(waitForAsync(spy, &importRequest, QLandmarkManager::NoError,16000));
+#else
+ QVERIFY(waitForAsync(spy, &importRequest, QLandmarkManager::NoError));
+#endif
QCOMPARE(originalLandmarksCount + 187, m_manager->landmarks().count());
QCOMPARE(spyRemove.count(), 0);
QCOMPARE(spyChange.count(), 0);
-
QCOMPARE(spyAdd.count(), 0);
QCOMPARE(dataChanged.count(), 1);
}
@@ -7104,7 +7432,11 @@ void tst_QLandmarkManager::importLmx() {
importRequest.setFileName(prefix + "data/convert-collection-in.xml");
importRequest.setFormat(QLandmarkManager::Lmx);
importRequest.start();
+#if defined(Q_WS_MAEMO_6)
+ QVERIFY(waitForAsync(spy, &importRequest,QLandmarkManager::NoError,12000));
+#else
QVERIFY(waitForAsync(spy, &importRequest,QLandmarkManager::NoError));
+#endif
QCOMPARE(importRequest.landmarkIds().count(), 16);
} else if (type == "syncExcludeCategoryData") {
QVERIFY(m_manager->importLandmarks(prefix + "data/convert-collection-in.xml", QLandmarkManager::Lmx,QLandmarkManager::ExcludeCategoryData));
@@ -7114,7 +7446,11 @@ void tst_QLandmarkManager::importLmx() {
importRequest.setFormat(QLandmarkManager::Lmx);
importRequest.setTransferOption(QLandmarkManager::ExcludeCategoryData);
importRequest.start();
+#if defined(Q_WS_MAEMO_6)
+ QVERIFY(waitForAsync(spy, &importRequest,QLandmarkManager::NoError,12000));
+#else
QVERIFY(waitForAsync(spy, &importRequest,QLandmarkManager::NoError));
+#endif
QCOMPARE(importRequest.landmarkIds().count(), 16);
} else if (type == "syncAttachSingleCategory") {
QVERIFY(m_manager->saveCategory(&catAlpha));
@@ -7151,8 +7487,11 @@ void tst_QLandmarkManager::importLmx() {
importRequest.setTransferOption(QLandmarkManager::AttachSingleCategory);
importRequest.setCategoryId(nullId);
importRequest.start();
+#if defined(Q_WS_MAEMO_6)
+ QVERIFY(waitForAsync(spy,&importRequest,QLandmarkManager::CategoryDoesNotExistError,6000));
+#else
QVERIFY(waitForAsync(spy,&importRequest,QLandmarkManager::CategoryDoesNotExistError));
-
+#endif
//try with an id with the wrong manager;
QLandmarkCategoryId wrongManagerId;
wrongManagerId.setLocalId(cat0.categoryId().localId());
@@ -7162,8 +7501,11 @@ void tst_QLandmarkManager::importLmx() {
importRequest.setTransferOption(QLandmarkManager::AttachSingleCategory);
importRequest.setCategoryId(wrongManagerId);
importRequest.start();
+#if defined(Q_WS_MAEMO_6)
+ QVERIFY(waitForAsync(spy,&importRequest,QLandmarkManager::CategoryDoesNotExistError,6000));
+#else
QVERIFY(waitForAsync(spy,&importRequest,QLandmarkManager::CategoryDoesNotExistError));
-
+#endif
//try with the correct manager but with a non-existent localid
QLandmarkCategoryId wrongLocalId;
wrongLocalId.setLocalId("500");
@@ -7173,21 +7515,31 @@ void tst_QLandmarkManager::importLmx() {
importRequest.setTransferOption(QLandmarkManager::AttachSingleCategory);
importRequest.setCategoryId(wrongLocalId);
importRequest.start();
+#if defined(Q_WS_MAEMO_6)
+ QVERIFY(waitForAsync(spy,&importRequest,QLandmarkManager::CategoryDoesNotExistError,6000));
+#else
QVERIFY(waitForAsync(spy,&importRequest,QLandmarkManager::CategoryDoesNotExistError));
-
+#endif
//try with a valid category id
importRequest.setFileName(prefix + "data/convert-collection-in.xml");
importRequest.setFormat(QLandmarkManager::Lmx);
importRequest.setTransferOption(QLandmarkManager::AttachSingleCategory);
importRequest.setCategoryId(catAlpha.categoryId());
importRequest.start();
- QVERIFY(waitForAsync(spy, &importRequest, QLandmarkManager::NoError));
+#if defined(Q_WS_MAEMO_6)
+ QVERIFY(waitForAsync(spy, &importRequest, QLandmarkManager::NoError, 10000));
+#else
+ QVERIFY(waitForAsync(spy, &importRequest, QLandmarkManager::NoError));
+#endif
QCOMPARE(importRequest.landmarkIds().count(), 16);
} else {
qFatal("Unknown row test type");
}
-
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
QTest::qWait(10);
+#endif
#if (defined(Q_OS_SYMBIAN))
QCOMPARE(spyRemove.count(), 0);
QCOMPARE(spyChange.count(), 0);
@@ -7207,13 +7559,10 @@ void tst_QLandmarkManager::importLmx() {
#else
QCOMPARE(spyRemove.count(), 0);
QCOMPARE(spyChange.count(), 0);
- QCOMPARE(spyAdd.count(), 1);
#if defined(Q_WS_MAEMO_6)
- if (type == "async" || type == "sync" ||type == "syncAttachSingleCategory" || type == "asyncAttachSingleCategory" )
- QCOMPARE(spyCatAdd.count(), 2);
- else
- QCOMPARE(spyCatAdd.count(), 1);
+ QVERIFY(spyCatAdd.count() > 0);
#else
+ QCOMPARE(spyAdd.count(), 1);
if (type == "async")
QCOMPARE(spyCatAdd.count(), 2);
else
@@ -7235,8 +7584,14 @@ void tst_QLandmarkManager::importLmx() {
else
QCOMPARE(addedCategories, 3);
-
- QList<QLandmarkId> ids = spyAdd.at(0).at(0).value<QList<QLandmarkId> >();
+ QList<QLandmarkId> ids;
+#if defined(Q_WS_MAEMO_6)
+ for (int i=0; i < spyAdd.count();++i) {
+ ids.append(spyAdd.at(i).at(0).value<QList<QLandmarkId> >());
+ }
+#else
+ ids = spyAdd.at(0).at(0).value<QList<QLandmarkId> >();
+#endif
QCOMPARE(ids.count(), 16);
spyAdd.clear();
spyCatAdd.clear();
@@ -7323,7 +7678,7 @@ void tst_QLandmarkManager::importLmx() {
QCOMPARE(spy.count(),1);
QCOMPARE(qvariant_cast<QLandmarkAbstractRequest::State>(spy.at(0).at(0)), QLandmarkAbstractRequest::ActiveState);
importRequest.cancel();
- QVERIFY(waitForAsync(spy, &importRequest, QLandmarkManager::CancelError,2000));
+ QVERIFY(waitForAsync(spy, &importRequest, QLandmarkManager::CancelError));
QCOMPARE(originalLandmarksCount, m_manager->landmarkIds().count());
QCOMPARE(importRequest.landmarkIds().count(),0);
@@ -7336,9 +7691,13 @@ void tst_QLandmarkManager::importLmx() {
importRequest.setFormat(QLandmarkManager::Lmx);
importRequest.setTransferOption(QLandmarkManager::IncludeCategoryData);
importRequest.start();
- QVERIFY(waitForAsync(spy, &importRequest, QLandmarkManager::NoError,2000));
+ QVERIFY(waitForAsync(spy, &importRequest, QLandmarkManager::NoError));
QCOMPARE(originalLandmarksCount + 16, m_manager->landmarks().count());
+#if defined (Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#endif
+
QCOMPARE(spyRemove.count(), 0);
QCOMPARE(spyChange.count(), 0);
QCOMPARE(spyAdd.count(), 1);
@@ -7407,6 +7766,17 @@ void tst_QLandmarkManager::importFile()
#endif
QCOMPARE(m_manager->landmarks().count(), 0);
QCOMPARE(m_manager->categories().count(), originalCategoryCount);
+
+ QLandmarkImportRequest importRequest(m_manager);
+ importRequest.setFileName(prefix + "data/places.gpx");
+ QCOMPARE(importRequest.fileName(), prefix + "data/places.gpx");
+
+ importRequest.setDevice(NULL);
+ QCOMPARE(importRequest.fileName(), QString());
+
+ QFile file(prefix + "data/places.gpx");
+ importRequest.setDevice(&file);
+ QCOMPARE(importRequest.fileName(), prefix + "data/places.gpx");
}
void tst_QLandmarkManager::importFile_data()
@@ -7581,9 +7951,11 @@ void tst_QLandmarkManager::exportLmx() {
} else if (type == "syncAttachSingleCategory") {
QVERIFY(m_manager->exportLandmarks(exportFile, QLandmarkManager::Lmx,QList<QLandmarkId>(),QLandmarkManager::AttachSingleCategory));
} else if (type == "async") {
+ QCOMPARE(exportRequest.fileName(), QString());
exportRequest.start();
QVERIFY(waitForAsync(spy, &exportRequest,QLandmarkManager::BadArgumentError));//no iodevice set
exportRequest.setFileName(exportFile);
+ QCOMPARE(exportRequest.fileName(), exportFile);
exportRequest.start();
QVERIFY(waitForAsync(spy, &exportRequest, QLandmarkManager::BadArgumentError)); //no format
@@ -7593,6 +7965,7 @@ void tst_QLandmarkManager::exportLmx() {
noPermFile->close();
exportRequest.setDevice(noPermFile);
+ QVERIFY(exportRequest.fileName() == "nopermfile");
exportRequest.setFormat(QLandmarkManager::Lmx);
exportRequest.start();
QVERIFY(waitForAsync(spy, &exportRequest, QLandmarkManager::PermissionsError));
@@ -7806,7 +8179,7 @@ void tst_QLandmarkManager::exportLmx() {
exportRequest.start();
QTest::qWait(50);
exportRequest.cancel();
- result = waitForAsync(spy, &exportRequest, QLandmarkManager::CancelError,2500);
+ result = waitForAsync(spy, &exportRequest, QLandmarkManager::CancelError);
if (result)
break;
}
@@ -7833,14 +8206,35 @@ void tst_QLandmarkManager::exportLmx_data()
}
#endif
+#ifdef SIMPLE_WAIT_FOR_FINISHED
+void tst_QLandmarkManager::simpleWaitForFinished()
+{
+ QVERIFY(m_manager->importLandmarks(prefix + "data/places.gpx"));
+ QLandmarkFetchRequest fetchRequest(m_manager);
+ QSignalSpy spy(&fetchRequest,SIGNAL(stateChanged(QLandmarkAbstractRequest::State)));
+
+ QVERIFY(fetchRequest.start());
+ QVERIFY(waitForActive(spy, &fetchRequest,100));
+ QVERIFY(fetchRequest.waitForFinished(10000));
+ QTest::qWait(100);
+ QVERIFY(fetchRequest.landmarks().count() > 0 );
+}
+#endif
+
#ifdef WAIT_FOR_FINISHED
void tst_QLandmarkManager::importWaitForFinished()
{
+ QString prefix;
+#ifdef Q_OS_SYMBIAN
+ prefix = "";
+#else
+ prefix = ":";
+#endif
QLandmarkImportRequest importRequest(m_manager);
QSignalSpy spy(&importRequest,SIGNAL(stateChanged(QLandmarkAbstractRequest::State)));
-
//try wait for finished with default arguments to block
importRequest.setFileName(prefix + "data/AUS-PublicToilet-AustralianCapitalTerritory.gpx");
+ importRequest.setFormat(QLandmarkManager::Gpx);
importRequest.start();
QVERIFY(waitForActive(spy, &importRequest,100));
#ifdef Q_OS_SYMBIAN
@@ -7849,29 +8243,33 @@ void tst_QLandmarkManager::importWaitForFinished()
#else
QVERIFY(importRequest.waitForFinished());
spy.clear();
-
const int fileLandmarkCount = 187;
QCOMPARE(m_manager->landmarkIds().count(), fileLandmarkCount);
-
//try wait for finished but providing a time period less than the time needed
//to finish the operation
importRequest.setFileName(prefix + "data/AUS-PublicToilet-AustralianCapitalTerritory.gpx");
+ importRequest.setFormat(QLandmarkManager::Gpx);
importRequest.start();
- QVERIFY(waitForActive(spy, &importRequest,100));
+ QVERIFY(waitForActive(spy, &importRequest,100));
QVERIFY(!importRequest.waitForFinished(5));
+#ifndef Q_WS_MAEMO_6
QCOMPARE(m_manager->landmarkIds().count(), fileLandmarkCount);
-
+#endif
//try wait for finished with a negative time period
importRequest.waitForFinished(-1);
QCOMPARE(m_manager->landmarkIds().count(), fileLandmarkCount*2);
spy.clear();
-
//try wait for finished with a time period greater than the amount of time
//needed to complete the operation
importRequest.setFileName(prefix + "data/AUS-PublicToilet-AustralianCapitalTerritory.gpx");
+ importRequest.setFormat(QLandmarkManager::Gpx);
importRequest.start();
QVERIFY(waitForActive(spy, &importRequest,100));
- QVERIFY(importRequest.waitForFinished(1000));
+#ifdef Q_WS_MAEMO_6
+ QVERIFY(importRequest.waitForFinished(30000));
+#else
+ QVERIFY(importRequest.waitForFinished(10000));
+#endif
spy.clear();
QCOMPARE(m_manager->landmarkIds().count(), fileLandmarkCount*3);
#endif
@@ -7879,6 +8277,12 @@ void tst_QLandmarkManager::importWaitForFinished()
void tst_QLandmarkManager::fetchWaitForFinished()
{
+ QString prefix;
+#ifdef Q_OS_SYMBIAN
+ prefix = "";
+#else
+ prefix = ":";
+#endif
int fileLandmarksCount = 187;
QVERIFY(m_manager->importLandmarks(prefix + "data/AUS-PublicToilet-AustralianCapitalTerritory.gpx"));
QVERIFY(m_manager->importLandmarks(prefix + "data/AUS-PublicToilet-AustralianCapitalTerritory.gpx"));
@@ -7888,6 +8292,7 @@ void tst_QLandmarkManager::fetchWaitForFinished()
QVERIFY(m_manager->importLandmarks(prefix + "data/AUS-PublicToilet-AustralianCapitalTerritory.gpx"));
QVERIFY(m_manager->importLandmarks(prefix + "data/AUS-PublicToilet-AustralianCapitalTerritory.gpx"));
QVERIFY(m_manager->importLandmarks(prefix + "data/AUS-PublicToilet-AustralianCapitalTerritory.gpx"));
+
int expectedLandmarksCount = fileLandmarksCount * 8;
QLandmarkFetchRequest fetchRequest(m_manager);
@@ -7898,25 +8303,38 @@ void tst_QLandmarkManager::fetchWaitForFinished()
QVERIFY(waitForActive(spy, &fetchRequest,100));
QVERIFY(fetchRequest.waitForFinished());
QCOMPARE(fetchRequest.landmarks().count(), expectedLandmarksCount);
-
+ spy.clear();
//try wait for finished by providing time period less than the time needed to finish the operation.
QVERIFY(fetchRequest.start());
QVERIFY(waitForActive(spy, &fetchRequest,100));
QVERIFY(!fetchRequest.waitForFinished(5));
-
//try wait with a negative time period
fetchRequest.waitForFinished(-1);
QCOMPARE(fetchRequest.landmarks().count(), expectedLandmarksCount);
-
+ spy.clear();
//try wait for finished with a time period greater than the amount of time
//needed to complete the operation
QVERIFY(fetchRequest.start());
QVERIFY(waitForActive(spy, &fetchRequest,100));
- QVERIFY(fetchRequest.waitForFinished(1000));
+#if (defined(Q_WS_MAEMO_6))
+ QVERIFY(fetchRequest.waitForFinished(140000));
+#else
+ QVERIFY(fetchRequest.waitForFinished(10000));
+#endif
+
QCOMPARE(fetchRequest.landmarks().count(), expectedLandmarksCount);
-}
+#ifdef Q_OS_SYMBIAN
+ QList<QLandmarkId> ids = m_manager->landmarkIds();
+ QEXPECT_FAIL("", "MOBILITY-2275: Removal of a large number of landmarks results in DatabaseLockedError", Continue);
+ QVERIFY(m_manager->removeLandmarks(ids));
+ //need to workaround deletion of these landmarks for symbian
+ for (int i=0; i < 20; ++i) {
+ m_manager->removeLandmarks(ids);
+ }
+#endif
+}
#endif
#ifdef MISC
@@ -8107,7 +8525,6 @@ void tst_QLandmarkManager::filterSupportLevel() {
#else
QCOMPARE(m_manager->filterSupportLevel(attributeFilter), QLandmarkManager::NativeSupport);
#endif
- QCOMPARE(m_manager->filterSupportLevel(attributeFilter), QLandmarkManager::NativeSupport);
//try a landmark id filter
QLandmarkIdFilter idFilter;
@@ -8193,7 +8610,11 @@ void tst_QLandmarkManager::notificationCheck()
lm1.setName("LM1");
m_manager->saveLandmark(&lm1);
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
QTest::qWait(10);
+#endif
QCOMPARE(spyCatAdd.count(),0);
QCOMPARE(spyLmAdd.count(),1);
delete m_manager;
@@ -8211,7 +8632,11 @@ void tst_QLandmarkManager::notificationCheck()
cat1.setName("CAT1");
QVERIFY(m_manager->saveCategory(&cat1));
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
QTest::qWait(10);
+#endif
QCOMPARE(spyCatAdd2.count(),1);
QCOMPARE(spyLmAdd2.count(),0);
@@ -8306,9 +8731,11 @@ void tst_QLandmarkManager::exportGpx() {
} else if (type == "syncAttachSingleCategory") {
QVERIFY(m_manager->exportLandmarks(exportFile,QLandmarkManager::Gpx, QList<QLandmarkId>(), QLandmarkManager::AttachSingleCategory));
} else if (type == "async"){
+ QCOMPARE(exportRequest.fileName(), QString());
exportRequest.start();
QVERIFY(waitForAsync(spy, &exportRequest,QLandmarkManager::BadArgumentError));//no iodevice set
exportRequest.setFileName(exportFile);
+ QCOMPARE(exportRequest.fileName(), exportFile);
exportRequest.start();
QVERIFY(waitForAsync(spy, &exportRequest, QLandmarkManager::BadArgumentError)); //no format
@@ -8318,6 +8745,7 @@ void tst_QLandmarkManager::exportGpx() {
noPermFile->close();
exportRequest.setDevice(noPermFile);
+ QVERIFY(exportRequest.fileName() == "nopermfile");
exportRequest.setFormat(QLandmarkManager::Gpx);
exportRequest.start();
QVERIFY(waitForAsync(spy, &exportRequest, QLandmarkManager::PermissionsError));
@@ -8432,7 +8860,7 @@ void tst_QLandmarkManager::exportGpx() {
exportRequest.start();
QTest::qWait(50);
exportRequest.cancel();
- QVERIFY(waitForAsync(spy, &exportRequest, QLandmarkManager::CancelError,2000));
+ QVERIFY(waitForAsync(spy, &exportRequest, QLandmarkManager::CancelError));
}
#endif
@@ -8849,7 +9277,11 @@ void tst_QLandmarkManager::testSignals()
lm1.setName("lm 1");
lm1.addCategoryId(cat1.categoryId());
QVERIFY(m_manager->saveLandmark(&lm1));
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
QTest::qWait(10);
+#endif
QCOMPARE(spyAdd.count(), 1);
QCOMPARE(spyChange.count(), 0);
QCOMPARE(spyRemove.count(), 0);
@@ -8863,7 +9295,11 @@ void tst_QLandmarkManager::testSignals()
spyCatAdd.clear();
QVERIFY(m_manager->saveLandmark(&lm1));
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
QTest::qWait(10);
+#endif
QCOMPARE(spyAdd.count(), 0);
QCOMPARE(spyChange.count(), 1);
@@ -8883,8 +9319,11 @@ void tst_QLandmarkManager::testSignals()
lm1.removeCategoryId(cat1.categoryId());
lm1.addCategoryId(cat2.categoryId());
QVERIFY(m_manager->saveLandmark(&lm1));
+#if defined(Q_WS_MAEMO_6)
+ QTest::qWait(2000);
+#else
QTest::qWait(10);
-
+#endif
QCOMPARE(spyAdd.count(), 0);
QCOMPARE(spyChange.count(), 1);
QCOMPARE(spyRemove.count(), 0);
@@ -9010,9 +9449,6 @@ void tst_QLandmarkManager::testProximityRadius()
proximityFilter.setRadius(lm1.coordinate().distanceTo(QGeoCoordinate(0,0)));
QList<QLandmark> lms;
QVERIFY(doFetch(type,proximityFilter,&lms,QLandmarkManager::NoError));
-#ifdef Q_OS_SYMBIAN
- QEXPECT_FAIL("", "MOBILITY-1735: symbian backend does not return landmark right on edge of radius of proximity filter", Continue);
-#endif
QCOMPARE(lms.count(), 1);
}
@@ -9099,7 +9535,11 @@ void tst_QLandmarkManager::removeStress()
QSignalSpy spy(&lmRemoveRequest, SIGNAL(stateChanged(QLandmarkAbstractRequest::State)));
lmRemoveRequest.setLandmarks(lms);
lmRemoveRequest.start();
+#if defined(Q_WS_MAEMO_6)
+ waitForAsync(spy, &lmRemoveRequest, QLandmarkManager::NoError,12000);
+#else
waitForAsync(spy, &lmRemoveRequest, QLandmarkManager::NoError);
+#endif
qDebug() << "Async remove error = " << lmRemoveRequest.error();
qDebug() << "Async remove string=" << lmRemoveRequest.errorString();
qDebug() << "Async remove Error map size =" << lmRemoveRequest.errorMap().count();
@@ -9181,7 +9621,11 @@ void tst_QLandmarkManager::saveStress()
QSignalSpy spy(&lmSaveRequest, SIGNAL(stateChanged(QLandmarkAbstractRequest::State)));
lmSaveRequest.setLandmarks(lms);
lmSaveRequest.start();
+#if defined(Q_WS_MAEMO_6)
+ waitForAsync(spy, &lmSaveRequest, QLandmarkManager::NoError,16000);
+#else
waitForAsync(spy, &lmSaveRequest, QLandmarkManager::NoError);
+#endif
qDebug() << "Async Save error =" << lmSaveRequest.error();
qDebug() << "Async save error string=" << lmSaveRequest.errorString();
qDebug() << "Async error map size = " << lmSaveRequest.errorMap().count();
@@ -9235,7 +9679,11 @@ void tst_QLandmarkManager::saveCategoryStress()
QSignalSpy spy(&catSaveRequest, SIGNAL(stateChanged(QLandmarkAbstractRequest::State)));
catSaveRequest.setCategories(cats);
catSaveRequest.start();
+#if defined(Q_WS_MAEMO_6)
+ waitForAsync(spy, &catSaveRequest,QLandmarkManager::NoError, 12000);
+#else
waitForAsync(spy, &catSaveRequest,QLandmarkManager::NoError);
+#endif
qDebug() << "Async cat save error=" << catSaveRequest.error();
qDebug() << "Async cat save errorstring= " << catSaveRequest.errorString();
qDebug() << "Async error map size =" << catSaveRequest.errorMap().count();
@@ -9292,7 +9740,11 @@ void tst_QLandmarkManager::removeCategoryStress()
QSignalSpy spy(&catRemoveRequest, SIGNAL(stateChanged(QLandmarkAbstractRequest::State)));
catRemoveRequest.setCategories(cats);
catRemoveRequest.start();
+#if defined(Q_WS_MAEMO_6)
+ waitForAsync(spy, &catRemoveRequest, QLandmarkManager::NoError, 12000);
+#else
waitForAsync(spy, &catRemoveRequest, QLandmarkManager::NoError);
+#endif
qDebug() << "Async remove error = " << catRemoveRequest.error();
qDebug() << "Async remove string=" << catRemoveRequest.errorString();
qDebug() << "Async remove Error map size =" << catRemoveRequest.errorMap().count();
diff --git a/tests/auto/qlandmarkmanagerdataholder.h b/tests/auto/qlandmarkmanagerdataholder.h
new file mode 100644
index 0000000000..57de892531
--- /dev/null
+++ b/tests/auto/qlandmarkmanagerdataholder.h
@@ -0,0 +1,130 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QLANDMARKMANAGERDATAHOLDER_H
+#define QLANDMARKMANAGERDATAHOLDER_H
+
+#include <QMap>
+#include <QMultiMap>
+#include <QList>
+#include <QString>
+#include <QDebug>
+
+#include "qlandmarkmanager.h"
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+QTM_BEGIN_NAMESPACE
+class QLandmark;
+class QLandmarkManagerDataHolder
+{
+public:
+ QLandmarkManagerDataHolder()
+ {
+ QLandmarkManager *lm = new QLandmarkManager();
+ if (lm) {
+ savedCategories = lm->categories();
+ savedLandmarks = lm->landmarks();
+
+ for (int i=0; i < savedLandmarks.count(); ++i) {
+ QList<int> indexes;
+ for (int j=0; j < savedLandmarks.at(i).categoryIds().count(); ++j) {
+ for (int k=0; k < savedCategories.count(); ++k) {
+ if (savedCategories.at(k).categoryId() == savedLandmarks.at(i).categoryIds().at(j)) {
+ indexes.append(k);
+ }
+ }
+ }
+ landmarkCategoryIndex.append(indexes);
+ }
+
+ for (int i=0; i < savedCategories.count(); ++i) {
+ lm->removeCategory(savedCategories.at(i));
+ }
+
+ lm->removeLandmarks(lm->landmarkIds());
+ delete lm;
+ }
+ }
+
+ ~QLandmarkManagerDataHolder()
+ {
+ QLandmarkManager* lm = new QLandmarkManager();
+ if (lm) {
+ qDebug() << "Restoring landmarks for" << lm->managerName();
+ for (int i=0; i < savedCategories.count(); ++i) {
+ if (!lm->isReadOnly(savedCategories[i].categoryId())) {
+ savedCategories[i].setCategoryId(QLandmarkCategoryId());
+ lm->saveCategory(&(savedCategories[i]));
+ }
+ }
+
+ for (int i=0; i < savedLandmarks.count(); ++i) {
+ savedLandmarks[i].setLandmarkId(QLandmarkId());
+ savedLandmarks[i].setCategoryIds(QList<QLandmarkCategoryId>());
+ for (int j=0; j < landmarkCategoryIndex.at(i).count(); ++j) {
+ savedLandmarks[i].addCategoryId(savedCategories.at(landmarkCategoryIndex.at(i).at(j)).categoryId());
+ }
+ lm->saveLandmark(&(savedLandmarks[i]));
+
+ }
+ delete lm;
+ }
+ }
+private:
+ QList<QLandmark> savedLandmarks;
+ QList<QLandmarkCategory> savedCategories;
+ QList<QList<int> > landmarkCategoryIndex;
+};
+
+QTM_END_NAMESPACE
+
+#endif
+
diff --git a/tests/auto/qmediaplayer/tst_qmediaplayer.cpp b/tests/auto/qmediaplayer/tst_qmediaplayer.cpp
index 56bcaf3436..afd2b93ffe 100644
--- a/tests/auto/qmediaplayer/tst_qmediaplayer.cpp
+++ b/tests/auto/qmediaplayer/tst_qmediaplayer.cpp
@@ -786,3 +786,35 @@ void tst_QMediaPlayer::testPlaylist()
QVERIFY(player->playlist() == 0);
QCOMPARE(player->media(), QMediaContent());
}
+
+void tst_QMediaPlayer::testPositionPropertyWatch()
+{
+ QMediaContent content0(QUrl(QLatin1String("test://audio/song1.mp3")));
+ QMediaContent content1(QUrl(QLatin1String("test://audio/song2.mp3")));
+
+ mockService->setIsValid(true);
+ mockService->setState(QMediaPlayer::StoppedState, QMediaPlayer::NoMedia);
+
+ QMediaPlaylist *playlist = new QMediaPlaylist;
+
+ playlist->addMedia(content0);
+ playlist->addMedia(content1);
+
+ player->setPlaylist(playlist);
+ player->setNotifyInterval(5);
+
+ player->play();
+ QSignalSpy positionSpy(player, SIGNAL(positionChanged(qint64)));
+ playlist->next();
+ QCOMPARE(player->state(), QMediaPlayer::PlayingState);
+ QTest::qWait(50);
+ QVERIFY(positionSpy.count() > 0);
+
+ playlist->next();
+ QCOMPARE(player->state(), QMediaPlayer::StoppedState);
+
+ positionSpy.clear();
+ QTest::qWait(50);
+ QCOMPARE(positionSpy.count(), 0);
+}
+
diff --git a/tests/auto/qmediaplayer/tst_qmediaplayer.h b/tests/auto/qmediaplayer/tst_qmediaplayer.h
index ac5dd68f33..f9c4ea947e 100755
--- a/tests/auto/qmediaplayer/tst_qmediaplayer.h
+++ b/tests/auto/qmediaplayer/tst_qmediaplayer.h
@@ -300,6 +300,7 @@ private slots:
void testStop();
void testMediaStatus();
void testPlaylist();
+ void testPositionPropertyWatch();
private:
MockProvider *mockProvider;
diff --git a/tests/auto/qorganizercollection/tst_qorganizercollection.cpp b/tests/auto/qorganizercollection/tst_qorganizercollection.cpp
index d432a63fc6..e5cad44d16 100644
--- a/tests/auto/qorganizercollection/tst_qorganizercollection.cpp
+++ b/tests/auto/qorganizercollection/tst_qorganizercollection.cpp
@@ -63,6 +63,7 @@ private slots:
void metaData();
void idLessThan();
void idHash();
+ void idStringFunctions();
void hash();
void datastream();
void traits();
@@ -84,70 +85,69 @@ void tst_QOrganizerCollection::metaData()
QVERIFY(c.metaData().isEmpty());
c.setMetaData("test", 5);
QVERIFY(c.metaData().contains("test"));
+ QCOMPARE(c.metaData(QString("test")).toInt(), 5);
QVariantMap mdm;
mdm.insert("test2", 6);
c.setMetaData(mdm);
QCOMPARE(c.metaData(), mdm);
+ QCOMPARE(c.metaData(QString("test2")).toInt(), 6);
}
class BasicCollectionLocalId : public QOrganizerCollectionEngineId
{
public:
- BasicCollectionLocalId(uint id) : m_id(id) {}
+ BasicCollectionLocalId(const QString& managerUri, uint id) : m_managerUri(managerUri), m_id(id) {}
bool isEqualTo(const QOrganizerCollectionEngineId* other) const {
- return m_id == static_cast<const BasicCollectionLocalId*>(other)->m_id;
+ if (m_managerUri == static_cast<const BasicCollectionLocalId*>(other)->m_managerUri)
+ return m_id == static_cast<const BasicCollectionLocalId*>(other)->m_id;
+ return false;
}
bool isLessThan(const QOrganizerCollectionEngineId* other) const {
- return m_id < static_cast<const BasicCollectionLocalId*>(other)->m_id;
+ if (m_managerUri == static_cast<const BasicCollectionLocalId*>(other)->m_managerUri)
+ return m_id < static_cast<const BasicCollectionLocalId*>(other)->m_id;
+ return m_managerUri < static_cast<const BasicCollectionLocalId*>(other)->m_managerUri;
}
QString managerUri() const {
static const QString uri(QLatin1String("qtorganizer:basic:"));
return uri;
}
QOrganizerCollectionEngineId* clone() const {
- BasicCollectionLocalId* cloned = new BasicCollectionLocalId(m_id);
+ BasicCollectionLocalId* cloned = new BasicCollectionLocalId(m_managerUri, m_id);
return cloned;
}
QDebug& debugStreamOut(QDebug& dbg) const {
- return dbg << m_id;
+ return dbg << m_managerUri << m_id;
}
QString toString() const {
- return QString::number(m_id);
+ return m_managerUri + QString("::") + QString::number(m_id);
}
uint hash() const {
return m_id;
}
private:
+ QString m_managerUri;
uint m_id;
};
-QOrganizerCollectionId makeId(uint id)
+QOrganizerCollectionId makeId(const QString& managerUri, uint id)
{
- return QOrganizerCollectionId(new BasicCollectionLocalId(id));
+ return QOrganizerCollectionId(new BasicCollectionLocalId(managerUri, id));
}
void tst_QOrganizerCollection::idLessThan()
{
// TODO: review tests
-/* QOrganizerCollectionId id1;
- id1.setManagerUri("a");
- id1.setId(makeId(1));
- QOrganizerCollectionId id2;
- id2.setManagerUri("a");
- id2.setId(makeId(1));
+ QOrganizerCollectionId id1(makeId("a", 1));
+ QOrganizerCollectionId id2(makeId("a", 1));
QVERIFY(!(id1 < id2));
QVERIFY(!(id2 < id1));
- QOrganizerCollectionId id3;
- id3.setManagerUri("a");
- id3.setId(makeId(2));
- QOrganizerCollectionId id4;
- id4.setManagerUri("b");
- id4.setId(makeId(1));
- QOrganizerCollectionId id5; // no URI
- id5.setId(makeId(2));
+ QVERIFY(id1 == id2);
+ QOrganizerCollectionId id3(makeId("a", 2));
+ QOrganizerCollectionId id4(makeId("b", 1));
+ QOrganizerCollectionId id5(makeId(QString(), 2));
QVERIFY(id1 < id3);
QVERIFY(!(id3 < id1));
QVERIFY(id1 < id4);
@@ -155,36 +155,93 @@ void tst_QOrganizerCollection::idLessThan()
QVERIFY(id3 < id4);
QVERIFY(!(id4 < id3));
QVERIFY(id5 < id1);
- QVERIFY(!(id1 < id5));*/
+ QVERIFY(!(id1 < id5));
}
void tst_QOrganizerCollection::idHash()
{
// TODO: review tests
-/* QOrganizerCollectionId id1;
- id1.setManagerUri("a");
- id1.setId(makeId(1));
- QOrganizerCollectionId id2;
- id2.setManagerUri("a");
- id2.setId(makeId(1));
- QOrganizerCollectionId id3;
- id3.setManagerUri("b");
- id3.setId(makeId(1));
+ QOrganizerCollectionId id1(makeId(QString(), 1));
+ QOrganizerCollectionId id2(makeId(QString(), 1));
+ QOrganizerCollectionId id3(makeId(QString(), 2));
+ QOrganizerCollectionId id4(makeId("a", 1));
QVERIFY(qHash(id1) == qHash(id2));
QVERIFY(qHash(id1) != qHash(id3));
+ // note that the hash function is dependent on the id type
+ // in BasicCollectionLocalId, the hash function ignores the managerUri.
+
QSet<QOrganizerCollectionId> set;
set.insert(id1);
set.insert(id2);
set.insert(id3);
- QCOMPARE(set.size(), 2);*/
+ set.insert(id4);
+ QCOMPARE(set.size(), 3);
+}
+
+void tst_QOrganizerCollection::idStringFunctions()
+{
+ // TODO: review test
+ QOrganizerCollectionId id1(makeId("a", 1));
+ QOrganizerCollectionId id2(makeId("a", 1));
+ QOrganizerCollectionId id3(makeId("b", 1));
+ QOrganizerCollectionId id4(makeId("a", 2));
+ QVERIFY(qHash(id1) == qHash(id2));
+ QVERIFY(qHash(id1) != qHash(id4));
+
+ // note that the toString and fromString functions are
+ // engine and id specific. This test merely checks that
+ // the API is hooked up correctly.
+
+ QVERIFY(id1.toString() == id2.toString());
+ QVERIFY(id1.toString() != id3.toString());
+ QVERIFY(id1.toString() != id4.toString());
+ QVERIFY(id3.toString() != id4.toString());
+
+ // this should "work" -- string of the correct format
+ QString prebuiltidstring = QString("qtorganizer") + QString(":") + QString("a") + QString("::") + QString::number(2);
+ QOrganizerCollectionId rebuiltid = QOrganizerCollectionId::fromString(prebuiltidstring);
+ // QVERIFY(rebuiltid == id4); // -- this requires a working backend.
+
+ // this string has the right format and one parameter, but requires a working backend
+ prebuiltidstring = QString("qtorganizer") + QString(":") + QString("a") + QString(":") + QString("key=value") + QString(":") + QString::number(2);
+ rebuiltid = QOrganizerCollectionId::fromString(prebuiltidstring);
+ // QVERIFY(rebuiltid == id4); // -- this requires a working backend.
+
+ // this string has the right format and some parameters, but requires a working backend
+ prebuiltidstring = QString("qtorganizer") + QString(":") + QString("a") + QString(":") + QString("key=value&key2=value2") + QString(":") + QString::number(2);
+ rebuiltid = QOrganizerCollectionId::fromString(prebuiltidstring);
+ // QVERIFY(rebuiltid == id4); // -- this requires a working backend.
+
+ // this string has the right format but misses the value for a parameter
+ prebuiltidstring = QString("qtorganizer") + QString(":") + QString("a") + QString(":") + QString("key=value&key2=") + QString(":") + QString::number(2);
+ rebuiltid = QOrganizerCollectionId::fromString(prebuiltidstring);
+ // QVERIFY(rebuiltid == id4); // -- this requires a working backend.
+
+ // this string misses a field (the parameters)
+ prebuiltidstring = QString("qtorganizer") + QString(":") + QString("a") + QString(":") + QString::number(2);
+ rebuiltid = QOrganizerCollectionId::fromString(prebuiltidstring);
+ QVERIFY(rebuiltid == QOrganizerCollectionId()); // invalid so should be null.
+
+ // this string misses two fields (params plus manager uri)
+ prebuiltidstring = QString("qtorganizer") + QString(":") + QString::number(2);
+ rebuiltid = QOrganizerCollectionId::fromString(prebuiltidstring);
+ QVERIFY(rebuiltid == QOrganizerCollectionId()); // invalid so should be null.
+
+ // this string misses the prefix (qtorganizer)
+ prebuiltidstring = QString("notorganizer") + QString(":") + QString("a") + QString("::") + QString::number(2);
+ rebuiltid = QOrganizerCollectionId::fromString(prebuiltidstring);
+ QVERIFY(rebuiltid == QOrganizerCollectionId()); // invalid so should be null.
+
+ // this string misses the manager uri
+ prebuiltidstring = QString("notorganizer") + QString(":::") + QString::number(2);
+ rebuiltid = QOrganizerCollectionId::fromString(prebuiltidstring);
+ QVERIFY(rebuiltid == QOrganizerCollectionId()); // invalid so should be null.
}
void tst_QOrganizerCollection::hash()
{
// TODO: review tests
-/* QOrganizerCollectionId id;
- id.setManagerUri("a");
- id.setId(makeId(1));
+ QOrganizerCollectionId id(makeId("a", 1));
QOrganizerCollection c1;
c1.setId(id);
c1.setMetaData("key", "value");
@@ -202,7 +259,7 @@ void tst_QOrganizerCollection::hash()
QVERIFY(qHash(c1) == qHash(c2));
QVERIFY(qHash(c1) != qHash(c3));
QVERIFY(qHash(c1) != qHash(c4));
- QVERIFY(qHash(c1) == qHash(c5));*/
+ QVERIFY(qHash(c1) == qHash(c5));
}
void tst_QOrganizerCollection::datastream()
diff --git a/tests/auto/qorganizeritem/tst_qorganizeritem.cpp b/tests/auto/qorganizeritem/tst_qorganizeritem.cpp
index 474512014c..e8034ba3c4 100644
--- a/tests/auto/qorganizeritem/tst_qorganizeritem.cpp
+++ b/tests/auto/qorganizeritem/tst_qorganizeritem.cpp
@@ -69,6 +69,7 @@ private slots:
void emptiness();
void idLessThan();
void idHash();
+ void idStringFunctions();
void hash();
void datastream();
void traits();
@@ -582,59 +583,55 @@ void tst_QOrganizerItem::emptiness()
class BasicItemLocalId : public QOrganizerItemEngineId
{
public:
- BasicItemLocalId(uint id) : m_id(id) {}
+ BasicItemLocalId(const QString& managerUri, uint id) : m_managerUri(managerUri), m_id(id) {}
bool isEqualTo(const QOrganizerItemEngineId* other) const {
- return m_id == static_cast<const BasicItemLocalId*>(other)->m_id;
+ if (m_managerUri == static_cast<const BasicItemLocalId*>(other)->m_managerUri)
+ return m_id == static_cast<const BasicItemLocalId*>(other)->m_id;
+ return false;
}
bool isLessThan(const QOrganizerItemEngineId* other) const {
- return m_id < static_cast<const BasicItemLocalId*>(other)->m_id;
+ if (m_managerUri == static_cast<const BasicItemLocalId*>(other)->m_managerUri)
+ return m_id < static_cast<const BasicItemLocalId*>(other)->m_id;
+ return m_managerUri < static_cast<const BasicItemLocalId*>(other)->m_managerUri;
}
QString managerUri() const {
- static const QString uri(QLatin1String("qtorganizer:basicid:"));
+ static const QString uri(QLatin1String("qtorganizer:basic:"));
return uri;
}
QOrganizerItemEngineId* clone() const {
- BasicItemLocalId* cloned = new BasicItemLocalId(m_id);
+ BasicItemLocalId* cloned = new BasicItemLocalId(m_managerUri, m_id);
return cloned;
}
QDebug& debugStreamOut(QDebug& dbg) const {
- return dbg << m_id;
+ return dbg << m_managerUri << m_id;
}
QString toString() const {
- return QString::number(m_id);
+ return m_managerUri + QString("::") + QString::number(m_id);
}
uint hash() const {
return m_id;
}
private:
+ QString m_managerUri;
uint m_id;
};
-QOrganizerItemId makeId(uint id)
+QOrganizerItemId makeId(const QString& managerUri, uint id)
{
- return QOrganizerItemId(new BasicItemLocalId(id));
+ return QOrganizerItemId(new BasicItemLocalId(managerUri, id));
}
void tst_QOrganizerItem::idLessThan()
{
// TODO: review test
-/* QOrganizerItemId id1;
- id1.setManagerUri("a");
- id1.setLocalId(makeId(1));
- QOrganizerItemId id2;
- id2.setManagerUri("a");
- id2.setLocalId(makeId(1));
+ QOrganizerItemId id1(makeId("a", 1));
+ QOrganizerItemId id2(makeId("a", 1));
QVERIFY(!(id1 < id2));
QVERIFY(!(id2 < id1));
- QOrganizerItemId id3;
- id3.setManagerUri("a");
- id3.setLocalId(makeId(2));
- QOrganizerItemId id4;
- id4.setManagerUri("b");
- id4.setLocalId(makeId(1));
- QOrganizerItemId id5; // no URI
- id5.setLocalId(makeId(2));
+ QOrganizerItemId id3(makeId("a", 2));
+ QOrganizerItemId id4(makeId("b", 1));
+ QOrganizerItemId id5(makeId(QString(), 2)); // no Uri specified.
QVERIFY(id1 < id3);
QVERIFY(!(id3 < id1));
QVERIFY(id1 < id4);
@@ -642,36 +639,93 @@ void tst_QOrganizerItem::idLessThan()
QVERIFY(id3 < id4);
QVERIFY(!(id4 < id3));
QVERIFY(id5 < id1);
- QVERIFY(!(id1 < id5));*/
+ QVERIFY(!(id1 < id5));
}
void tst_QOrganizerItem::idHash()
{
// TODO: review test
-/* QOrganizerItemId id1;
- id1.setManagerUri("a");
- id1.setLocalId(makeId(1));
- QOrganizerItemId id2;
- id2.setManagerUri("a");
- id2.setLocalId(makeId(1));
- QOrganizerItemId id3;
- id3.setManagerUri("b");
- id3.setLocalId(makeId(1));
+ QOrganizerItemId id1(makeId("a", 1));
+ QOrganizerItemId id2(makeId("a", 1));
+ QOrganizerItemId id3(makeId("b", 1));
+ QOrganizerItemId id4(makeId("a", 2));
QVERIFY(qHash(id1) == qHash(id2));
- QVERIFY(qHash(id1) != qHash(id3));
+ QVERIFY(qHash(id1) != qHash(id4));
+ // note that the hash function is dependent on the id type
+ // in BasicCollectionLocalId, the hash function ignores the managerUri.
+
QSet<QOrganizerItemId> set;
set.insert(id1);
set.insert(id2);
set.insert(id3);
- QCOMPARE(set.size(), 2);*/
+ set.insert(id4);
+ QCOMPARE(set.size(), 3);
+}
+
+void tst_QOrganizerItem::idStringFunctions()
+{
+ // TODO: review test
+ QOrganizerItemId id1(makeId("a", 1));
+ QOrganizerItemId id2(makeId("a", 1));
+ QOrganizerItemId id3(makeId("b", 1));
+ QOrganizerItemId id4(makeId("a", 2));
+ QVERIFY(qHash(id1) == qHash(id2));
+ QVERIFY(qHash(id1) != qHash(id4));
+
+ // note that the toString and fromString functions are
+ // engine and id specific. This test merely checks that
+ // the API is hooked up correctly.
+
+ QVERIFY(id1.toString() == id2.toString());
+ QVERIFY(id1.toString() != id3.toString());
+ QVERIFY(id1.toString() != id4.toString());
+ QVERIFY(id3.toString() != id4.toString());
+
+ // this should "work" -- string of the correct format
+ QString prebuiltidstring = QString("qtorganizer") + QString(":") + QString("a") + QString("::") + QString::number(2);
+ QOrganizerItemId rebuiltid = QOrganizerItemId::fromString(prebuiltidstring);
+ // QVERIFY(rebuiltid == id4); // -- this requires a working backend.
+
+ // this string has the right format and one parameter, but requires a working backend
+ prebuiltidstring = QString("qtorganizer") + QString(":") + QString("a") + QString(":") + QString("key=value") + QString(":") + QString::number(2);
+ rebuiltid = QOrganizerItemId::fromString(prebuiltidstring);
+ // QVERIFY(rebuiltid == id4); // -- this requires a working backend.
+
+ // this string has the right format and some parameters, but requires a working backend
+ prebuiltidstring = QString("qtorganizer") + QString(":") + QString("a") + QString(":") + QString("key=value&key2=value2") + QString(":") + QString::number(2);
+ rebuiltid = QOrganizerItemId::fromString(prebuiltidstring);
+ // QVERIFY(rebuiltid == id4); // -- this requires a working backend.
+
+ // this string has the right format but misses the value for a parameter
+ prebuiltidstring = QString("qtorganizer") + QString(":") + QString("a") + QString(":") + QString("key=value&key2=") + QString(":") + QString::number(2);
+ rebuiltid = QOrganizerItemId::fromString(prebuiltidstring);
+ // QVERIFY(rebuiltid == id4); // -- this requires a working backend.
+
+ // this string misses a field (the parameters)
+ prebuiltidstring = QString("qtorganizer") + QString(":") + QString("a") + QString(":") + QString::number(2);
+ rebuiltid = QOrganizerItemId::fromString(prebuiltidstring);
+ QVERIFY(rebuiltid == QOrganizerItemId()); // invalid so should be null.
+
+ // this string misses two fields (params plus manager uri)
+ prebuiltidstring = QString("qtorganizer") + QString(":") + QString::number(2);
+ rebuiltid = QOrganizerItemId::fromString(prebuiltidstring);
+ QVERIFY(rebuiltid == QOrganizerItemId()); // invalid so should be null.
+
+ // this string misses the prefix (qtorganizer)
+ prebuiltidstring = QString("notorganizer") + QString(":") + QString("a") + QString("::") + QString::number(2);
+ rebuiltid = QOrganizerItemId::fromString(prebuiltidstring);
+ QVERIFY(rebuiltid == QOrganizerItemId()); // invalid so should be null.
+
+ // this string misses the manager uri
+ prebuiltidstring = QString("notorganizer") + QString(":::") + QString::number(2);
+ rebuiltid = QOrganizerItemId::fromString(prebuiltidstring);
+ QVERIFY(rebuiltid == QOrganizerItemId()); // invalid so should be null.
}
void tst_QOrganizerItem::hash()
{
// TODO: review test
-/* QOrganizerItemId id;
- id.setManagerUri("a");
- id.setLocalId(makeId(1));
+ QOrganizerItemId id(makeId("a", 1));
QOrganizerItem oi1;
oi1.setId(id);
QOrganizerItemDetail detail1("definition");
@@ -693,7 +747,7 @@ void tst_QOrganizerItem::hash()
QVERIFY(qHash(oi1) == qHash(oi2));
QVERIFY(qHash(oi1) != qHash(oi3));
QVERIFY(qHash(oi1) != qHash(oi4));
- QVERIFY(qHash(oi1) == qHash(oi5));*/
+ QVERIFY(qHash(oi1) == qHash(oi5));
}
void tst_QOrganizerItem::datastream()
diff --git a/tests/auto/qorganizeritemasync/unittest/tst_qorganizeritemasync.cpp b/tests/auto/qorganizeritemasync/unittest/tst_qorganizeritemasync.cpp
index e53a18fd0f..f8f33c94e5 100644
--- a/tests/auto/qorganizeritemasync/unittest/tst_qorganizeritemasync.cpp
+++ b/tests/auto/qorganizeritemasync/unittest/tst_qorganizeritemasync.cpp
@@ -1495,7 +1495,7 @@ void tst_QOrganizerItemAsync::itemRemove()
// remove all items
dfil.setDetailDefinitionName(QOrganizerItemDisplayLabel::DefinitionName); // delete everything.
- irr.setItemIds(oim->itemIds(dfil));
+ irr.setItemIds(oim->itemIds());
QVERIFY(!irr.cancel()); // not started
QVERIFY(irr.start());
@@ -1510,12 +1510,13 @@ void tst_QOrganizerItemAsync::itemRemove()
spy.clear();
// cancelling
- QOrganizerItem temp;
+ QOrganizerTodo temp;
QOrganizerItemDescription description;
description.setDescription("Should not be removed");
temp.saveDetail(&description);
oim->saveItem(&temp);
- irr.setItemIds(oim->itemIds(dfil));
+ QCOMPARE(oim->itemIds().size(), 1);
+ irr.setItemIds(oim->itemIds());
int bailoutCount = MAX_OPTIMISTIC_SCHEDULING_LIMIT; // attempt to cancel 40 times. If it doesn't work due to threading, bail out.
while (true) {
@@ -1527,14 +1528,14 @@ void tst_QOrganizerItemAsync::itemRemove()
// due to thread scheduling, async cancel might be attempted
// after the request has already finished.. so loop and try again.
irr.waitForFinished();
- irr.setItemIds(oim->itemIds(dfil));
temp.setId(QOrganizerItemId());
if (!oim->saveItem(&temp)) {
QSKIP("Unable to save temporary item for remove request cancellation test!", SkipSingle);
}
+ irr.setItemIds(oim->itemIds());
bailoutCount -= 1;
if (!bailoutCount) {
-// qWarning("Unable to test cancelling due to thread scheduling!");
+// QSKIP("Unable to test cancelling due to thread scheduling!", SkipSingle);
bailoutCount = MAX_OPTIMISTIC_SCHEDULING_LIMIT;
break;
}
@@ -1561,9 +1562,9 @@ void tst_QOrganizerItemAsync::itemRemove()
// due to thread scheduling, async cancel might be attempted
// after the request has already finished.. so loop and try again.
irr.waitForFinished();
- irr.setItemIds(oim->itemIds(dfil));
temp.setId(QOrganizerItemId());
oim->saveItem(&temp);
+ irr.setItemIds(oim->itemIds());
bailoutCount -= 1;
if (!bailoutCount) {
// qWarning("Unable to test cancelling due to thread scheduling!");
diff --git a/tests/auto/qorganizeritemdetaildefinition/tst_qorganizeritemdetaildefinition.cpp b/tests/auto/qorganizeritemdetaildefinition/tst_qorganizeritemdetaildefinition.cpp
index ea6344dbba..a23bf39bb4 100644
--- a/tests/auto/qorganizeritemdetaildefinition/tst_qorganizeritemdetaildefinition.cpp
+++ b/tests/auto/qorganizeritemdetaildefinition/tst_qorganizeritemdetaildefinition.cpp
@@ -64,6 +64,7 @@ private slots:
void testGetSet();
void testEquality();
void testEmpty();
+ void testStreaming();
void traits();
void fieldTraits();
};
@@ -266,6 +267,103 @@ void tst_QOrganizerItemDetailDefinition::testEquality()
QVERIFY(def2 == def1);
}
+void tst_QOrganizerItemDetailDefinition::testStreaming()
+{
+ QMap<QString, QOrganizerItemDetailFieldDefinition> allFields;
+
+ QVariantList allowedStrings;
+ allowedStrings << QString("First") << QString("Second");
+
+ // generate some field definitions
+ QOrganizerItemDetailFieldDefinition dfd;
+ dfd.setDataType(QVariant::String);
+ dfd.setAllowableValues(allowedStrings);
+ allFields.insert("TestFieldDefinition", dfd);
+
+ dfd.setDataType(QVariant::Int);
+ dfd.setAllowableValues(QVariantList());
+ allFields.insert("TestCount", dfd);
+
+ // now create our detail definition
+ QOrganizerItemDetailDefinition dd;
+ dd.setName("TestDefinitionName");
+ dd.setUnique(true);
+ dd.setFields(allFields);
+
+ // testing streaming of field definition, with no allowable values set
+ {
+ QByteArray buffer;
+ QOrganizerItemDetailFieldDefinition fieldDefIn = allFields.value("TestCount");
+ QOrganizerItemDetailFieldDefinition fieldDefOut;
+ QDataStream stream1(&buffer, QIODevice::WriteOnly);
+ stream1 << fieldDefIn;
+ QVERIFY(buffer.size() > 0);
+ QDataStream stream2(buffer);
+ stream2 >> fieldDefOut;
+ QVERIFY(fieldDefIn == fieldDefOut);
+ }
+
+ // testing streaming of field definition, with specific allowable values set
+ {
+ QByteArray buffer;
+ QOrganizerItemDetailFieldDefinition fieldDefIn = allFields.value("TestFieldDefinition");
+ QOrganizerItemDetailFieldDefinition fieldDefOut;
+ QDataStream stream1(&buffer, QIODevice::WriteOnly);
+ stream1 << fieldDefIn;
+ QVERIFY(buffer.size() > 0);
+ QDataStream stream2(buffer);
+ stream2 >> fieldDefOut;
+ QVERIFY(fieldDefIn == fieldDefOut);
+ }
+
+ // testing streaming of detail definition
+ {
+ QByteArray buffer;
+ QOrganizerItemDetailDefinition defIn = dd;
+ QOrganizerItemDetailDefinition defOut;
+ QDataStream stream1(&buffer, QIODevice::WriteOnly);
+ stream1 << defIn;
+ QVERIFY(buffer.size() > 0);
+ QDataStream stream2(buffer);
+ stream2 >> defOut;
+ QVERIFY(defIn == defOut);
+ }
+
+ // now try inserting and removing a field, streaming again, and testing.
+ {
+ // remove the field
+ QByteArray buffer;
+ QOrganizerItemDetailDefinition defIn = dd;
+ defIn.removeField("TestCount");
+ QVERIFY(defIn != dd);
+ QOrganizerItemDetailDefinition defOut;
+ QDataStream stream1(&buffer, QIODevice::WriteOnly);
+ stream1 << defIn;
+ QVERIFY(buffer.size() > 0);
+ QDataStream stream2(buffer);
+ stream2 >> defOut;
+ QVERIFY(defIn == defOut);
+ }
+
+ {
+ // re-add the field.
+ QByteArray buffer;
+ QOrganizerItemDetailDefinition defIn = dd;
+ defIn.removeField("TestCount"); // remove and reinsert the field
+ QVERIFY(defIn != dd);
+ defIn.insertField("TestCount", dfd);
+ QVERIFY(defIn == dd);
+ QOrganizerItemDetailDefinition defOut;
+ QDataStream stream1(&buffer, QIODevice::WriteOnly);
+ stream1 << defIn;
+ QVERIFY(buffer.size() > 0);
+ QDataStream stream2(buffer);
+ stream2 >> defOut;
+ QVERIFY(defIn == defOut);
+ QVERIFY(defOut == dd); // should be equal to the original.
+ }
+}
+
void tst_QOrganizerItemDetailDefinition::traits()
{
QCOMPARE(sizeof(QOrganizerItemDetailDefinition), sizeof(void *));
diff --git a/tests/auto/qorganizermanager/tst_qorganizermanager.cpp b/tests/auto/qorganizermanager/tst_qorganizermanager.cpp
index 9c0f790ed7..121b46e815 100644
--- a/tests/auto/qorganizermanager/tst_qorganizermanager.cpp
+++ b/tests/auto/qorganizermanager/tst_qorganizermanager.cpp
@@ -3656,6 +3656,24 @@ void tst_QOrganizerManager::recurrence()
QCOMPARE(items.count(), 0);
}
+ //test for unlimited count limit
+ //for bug:MOBILITY-2125
+ cm->removeItems(cm->itemIds());
+ event.setId(QOrganizerItemId());
+ rrule.setLimit(INT_MAX);
+ rrule.setFrequency(QOrganizerRecurrenceRule::Weekly);
+ rrule.setInterval(4);
+ rrule.setDaysOfWeek(QSet<Qt::DayOfWeek>() << Qt::Friday);
+ event.setEndDateTime(QDateTime(QDate(2013, 8, 9), QTime(11, 30, 0)));
+ event.setRecurrenceRule(rrule);
+ QVERIFY(cm->saveItem(&event));
+ {
+ // Fetch all events with occurrences
+ QList<QOrganizerItem> items = cm->items(QDateTime(QDate(2012, 8, 9)),
+ QDateTime(QDate(2013, 8, 12), QTime(23,59,59)));
+ QVERIFY(items.count() > 1);
+ }
+
// second, test date limit. The results should be the same as the count limit, if the limit date is the 11th.
cm->removeItems(cm->itemIds()); // empty the calendar to prevent the previous test from interfering this one
QOrganizerRecurrenceRule rrule2;
diff --git a/tests/auto/qservicemanager/qservicemanager.pro b/tests/auto/qservicemanager/qservicemanager.pro
index 2f7b167dcf..d11bfe543d 100644
--- a/tests/auto/qservicemanager/qservicemanager.pro
+++ b/tests/auto/qservicemanager/qservicemanager.pro
@@ -21,6 +21,9 @@ symbian|wince* {
symbian {
TARGET.CAPABILITY = ALL -TCB
LIBS += -lefsrv
+ contains(S60_VERSION, 5.2)|contains(MOBILITY_SD_MCL_BUILD, yes){
+ DEFINES += SYMBIAN_EMULATOR_SUPPORTS_PERPROCESS_WSD
+ }
}
wince* {
SFWTEST_PLUGIN_DEPLOY.sources = \
diff --git a/tests/auto/qsoundeffect/qsoundeffect.pro b/tests/auto/qsoundeffect/qsoundeffect.pro
index df7942693c..4b4d731056 100644
--- a/tests/auto/qsoundeffect/qsoundeffect.pro
+++ b/tests/auto/qsoundeffect/qsoundeffect.pro
@@ -17,9 +17,11 @@ MOBILITY = multimedia
QT += declarative
wince*|symbian {
- deploy.sources = test.wav
+ deploy.files = test.wav
DEPLOYMENT = deploy
- !symbian:DEFINES += SRCDIR=\\\"\\\"
+ DEFINES += QT_QSOUNDEFFECT_USEAPPLICATIONPATH
+} else:maemo* {
+ DEFINES += QT_QSOUNDEFFECT_USEAPPLICATIONPATH
} else {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
diff --git a/tests/auto/qsoundeffect/tst_qsoundeffect.cpp b/tests/auto/qsoundeffect/tst_qsoundeffect.cpp
index fef162a759..9891a12407 100644
--- a/tests/auto/qsoundeffect/tst_qsoundeffect.cpp
+++ b/tests/auto/qsoundeffect/tst_qsoundeffect.cpp
@@ -48,9 +48,6 @@
#include <qaudio.h>
#include <qsoundeffect_p.h>
-#if defined(Q_OS_SYMBIAN)
-#define SRCDIR ""
-#endif
class tst_QSoundEffect : public QObject
{
@@ -70,10 +67,17 @@ private slots:
private:
QSoundEffect* sound;
+ QUrl url;
};
void tst_QSoundEffect::initTestCase()
{
+#ifdef QT_QSOUNDEFFECT_USEAPPLICATIONPATH
+ url = QUrl::fromLocalFile(QCoreApplication::applicationDirPath() + QString("/test.wav"));
+#else
+ url = QUrl::fromLocalFile(QString(SRCDIR "test.wav"));
+#endif
+
sound = new QSoundEffect(this);
QVERIFY(sound->source().isEmpty());
@@ -86,7 +90,6 @@ void tst_QSoundEffect::testSource()
{
QSignalSpy readSignal(sound, SIGNAL(sourceChanged()));
- QUrl url = QUrl::fromLocalFile(QString(QLatin1String("%1%2")).arg(QLatin1String(SRCDIR)).arg(QLatin1String("test.wav")));
sound->setSource(url);
QCOMPARE(sound->source(),url);
@@ -138,7 +141,6 @@ void tst_QSoundEffect::testPlaying()
{
sound->setLoopCount(QSoundEffect::Infinite);
//valid source
- QUrl url = QUrl::fromLocalFile(QString(QLatin1String("%1%2")).arg(QLatin1String(SRCDIR)).arg(QLatin1String("test.wav")));
sound->setSource(url);
QTestEventLoop::instance().enterLoop(1);
sound->play();
@@ -147,16 +149,14 @@ void tst_QSoundEffect::testPlaying()
sound->stop();
//empty source
- url = QUrl();
- sound->setSource(url);
+ sound->setSource(QUrl());
QTestEventLoop::instance().enterLoop(1);
sound->play();
QTestEventLoop::instance().enterLoop(1);
QCOMPARE(sound->isPlaying(), false);
//invalid source
- url = QUrl((QLatin1String("invalid source")));
- sound->setSource(url);
+ sound->setSource(QUrl((QLatin1String("invalid source"))));
QTestEventLoop::instance().enterLoop(1);
sound->play();
QTestEventLoop::instance().enterLoop(1);
@@ -167,28 +167,24 @@ void tst_QSoundEffect::testPlaying()
void tst_QSoundEffect::testStatus()
{
- QUrl url = QUrl();
- sound->setSource(url);
+ sound->setSource(QUrl());
QCOMPARE(sound->status(), QSoundEffect::Null);
//valid source
- url = QUrl::fromLocalFile(QString(QLatin1String("%1%2")).arg(QLatin1String(SRCDIR)).arg(QLatin1String("test.wav")));
sound->setSource(url);
QTestEventLoop::instance().enterLoop(1);
QCOMPARE(sound->status(), QSoundEffect::Ready);
//empty source
- url = QUrl();
- sound->setSource(url);
+ sound->setSource(QUrl());
QTestEventLoop::instance().enterLoop(1);
QCOMPARE(sound->status(), QSoundEffect::Null);
//invalid source
sound->setLoopCount(QSoundEffect::Infinite);
- url = QUrl(QLatin1String("invalid source"));
- sound->setSource(url);
+ sound->setSource(QUrl(QLatin1String("invalid source")));
QTestEventLoop::instance().enterLoop(1);
QCOMPARE(sound->status(), QSoundEffect::Error);
}
diff --git a/tests/auto/qversitorganizerexporter/tst_qversitorganizerexporter.cpp b/tests/auto/qversitorganizerexporter/tst_qversitorganizerexporter.cpp
index 99a3e5e69e..e0ff4ff344 100644
--- a/tests/auto/qversitorganizerexporter/tst_qversitorganizerexporter.cpp
+++ b/tests/auto/qversitorganizerexporter/tst_qversitorganizerexporter.cpp
@@ -297,6 +297,26 @@ void tst_QVersitOrganizerExporter::testExportEventDetails_data()
{
QList<QVersitProperty> properties;
+ QVersitProperty dtstart;
+ dtstart.setName(QLatin1String("DTSTART"));
+ dtstart.setValue(QLatin1String("20100102"));
+ dtstart.insertParameter(QLatin1String("VALUE"), QLatin1String("DATE"));
+ properties << dtstart;
+ QVersitProperty dtend;
+ dtend.setName(QLatin1String("DTEND"));
+ dtend.setValue(QLatin1String("20100103"));
+ dtend.insertParameter(QLatin1String("VALUE"), QLatin1String("DATE"));
+ properties << dtend;
+ QOrganizerEventTime etr;
+ etr.setStartDateTime(QDateTime(QDate(2010, 1, 2), QTime(3, 4, 5)));
+ etr.setEndDateTime(QDateTime(QDate(2010, 1, 3), QTime(3, 4, 6)));
+ etr.setAllDay(true);
+ QTest::newRow("all day event") << (QList<QOrganizerItemDetail>() << etr)
+ << properties;
+ }
+
+ {
+ QList<QVersitProperty> properties;
QVersitProperty created;
created.setName(QLatin1String("CREATED"));
created.setValue(QDateTime(QDate(2010, 1, 2), QTime(3, 4, 5)).toUTC().toString(
@@ -634,6 +654,26 @@ void tst_QVersitOrganizerExporter::testExportTodoDetails_data()
QTest::addColumn<QList<QVersitProperty> >("expectedProperties");
{
+ QList<QVersitProperty> properties;
+ QVersitProperty dtstart;
+ dtstart.setName(QLatin1String("DTSTART"));
+ dtstart.setValue(QLatin1String("20100102"));
+ dtstart.insertParameter(QLatin1String("VALUE"), QLatin1String("DATE"));
+ properties << dtstart;
+ QVersitProperty due;
+ due.setName(QLatin1String("DUE"));
+ due.setValue(QLatin1String("20100103"));
+ due.insertParameter(QLatin1String("VALUE"), QLatin1String("DATE"));
+ properties << due;
+ QOrganizerTodoTime todoTime;
+ todoTime.setStartDateTime(QDateTime(QDate(2010, 1, 2), QTime(3, 4, 5)));
+ todoTime.setDueDateTime(QDateTime(QDate(2010, 1, 3), QTime(3, 4, 6)));
+ todoTime.setAllDay(true);
+ QTest::newRow("all day todo") << (QList<QOrganizerItemDetail>() << todoTime)
+ << properties;
+ }
+
+ {
QVersitProperty property;
property.setName(QLatin1String("STATUS"));
property.setValue(QLatin1String("COMPLETED"));
diff --git a/tests/auto/qversitorganizerimporter/tst_qversitorganizerimporter.cpp b/tests/auto/qversitorganizerimporter/tst_qversitorganizerimporter.cpp
index 3b14f25153..acd356e08d 100644
--- a/tests/auto/qversitorganizerimporter/tst_qversitorganizerimporter.cpp
+++ b/tests/auto/qversitorganizerimporter/tst_qversitorganizerimporter.cpp
@@ -212,7 +212,7 @@ void tst_QVersitOrganizerImporter::testImportEventProperties()
qDebug() << "Expected to find:" << expectedDetail;
QVERIFY(false);
}
- }
+ }
}
void tst_QVersitOrganizerImporter::testImportEventProperties_data()
@@ -290,6 +290,28 @@ void tst_QVersitOrganizerImporter::testImportEventProperties_data()
}
{
+ QList<QVersitProperty> properties;
+ QVersitProperty dtstart;
+ dtstart.setName(QLatin1String("DTSTART"));
+ dtstart.setValue(QLatin1String("20100102"));
+ dtstart.insertParameter(QLatin1String("VALUE"), QLatin1String("DATE"));
+ properties << dtstart;
+ QVersitProperty dtend;
+ dtend.setName(QLatin1String("DTEND"));
+ dtend.setValue(QLatin1String("20100103"));
+ dtend.insertParameter(QLatin1String("VALUE"), QLatin1String("DATE"));
+ properties << dtend;
+ QOrganizerEventTime etr;
+ // The time portion must be valid but is ignored. This test cheats a bit because it knows
+ // the implementation sets it to 00:00:00
+ etr.setStartDateTime(QDateTime(QDate(2010, 1, 2), QTime(0, 0, 0)));
+ etr.setEndDateTime(QDateTime(QDate(2010, 1, 3), QTime(0, 0, 0)));
+ etr.setAllDay(true);
+ QTest::newRow("all day event") << properties
+ << (QList<QOrganizerItemDetail>() << etr);
+ }
+
+ {
QVersitProperty dtstart;
dtstart.setName(QLatin1String("DTSTART"));
dtstart.setValue(QLatin1String("20091231T000000")); // equivalent to 2010, day zero
@@ -768,7 +790,7 @@ void tst_QVersitOrganizerImporter::testImportTodoProperties()
qDebug() << "Expected:" << expectedDetail;
QCOMPARE(actualDetail, expectedDetail);
}
- }
+ }
}
void tst_QVersitOrganizerImporter::testImportTodoProperties_data()
@@ -777,6 +799,28 @@ void tst_QVersitOrganizerImporter::testImportTodoProperties_data()
QTest::addColumn<QList<QOrganizerItemDetail> >("expectedDetails");
{
+ QList<QVersitProperty> properties;
+ QVersitProperty dtstart;
+ dtstart.setName(QLatin1String("DTSTART"));
+ dtstart.setValue(QLatin1String("20100102"));
+ dtstart.insertParameter(QLatin1String("VALUE"), QLatin1String("DATE"));
+ properties << dtstart;
+ QVersitProperty dtdue;
+ dtdue.setName(QLatin1String("DUE"));
+ dtdue.setValue(QLatin1String("20100103"));
+ dtdue.insertParameter(QLatin1String("VALUE"), QLatin1String("DATE"));
+ properties << dtdue;
+ QOrganizerTodoTime todoTime;
+ // The time portion must be valid but is ignored. This test cheats a bit because it knows
+ // the implementation sets it to 00:00:00
+ todoTime.setStartDateTime(QDateTime(QDate(2010, 1, 2), QTime(0, 0, 0)));
+ todoTime.setDueDateTime(QDateTime(QDate(2010, 1, 3), QTime(0, 0, 0)));
+ todoTime.setAllDay(true);
+ QTest::newRow("all day todo") << properties
+ << (QList<QOrganizerItemDetail>() << todoTime);
+ }
+
+ {
QVersitProperty property;
property.setName(QLatin1String("STATUS"));
property.setValue(QLatin1String("COMPLETED"));
diff --git a/tests/qmlauto/README b/tests/qmlauto/README
new file mode 100644
index 0000000000..310a11b308
--- /dev/null
+++ b/tests/qmlauto/README
@@ -0,0 +1,8 @@
+This directory makes use of an experimental internal testing tool 'qtest-qml'
+(git@scm.dev.nokia.troll.no:research/qtest-qml.git).The test content have been
+provided to show what tests are being done to verify Qt Mobility's QML bindings.
+
+To run these tests, the QtQuickTest library needs to be built and installed first, see
+http://scm.dev.nokia.troll.no/projects/research/repos/qtest-qml/blobs/master/README for more details.
+
+The tests included in this and sub-directories are subject to change/removal without notice.
diff --git a/tests/qmlauto/organizer/organizer.pro b/tests/qmlauto/organizer/organizer.pro
new file mode 100644
index 0000000000..2e67b59e37
--- /dev/null
+++ b/tests/qmlauto/organizer/organizer.pro
@@ -0,0 +1,5 @@
+TEMPLATE=app
+TARGET=tst_qmlorganizer
+SOURCES += tst_qmlorganizer.cpp
+MOBILITY = organizer versit
+include (../qmlauto.pri)
diff --git a/tests/qmlauto/organizer/testcases/addEvent.qml b/tests/qmlauto/organizer/testcases/addEvent.qml
new file mode 100644
index 0000000000..0e47a550ad
--- /dev/null
+++ b/tests/qmlauto/organizer/testcases/addEvent.qml
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+import QtMobility.organizer 1.1
+
+OrganizerModel {
+ id:myModel;
+
+ property Event myEvent : Event {id:myEvent; startDateTime: new Date(); endDateTime: new Date() }
+ property RecurrenceRule myReccuranceRule: RecurrenceRule {
+ id: myReccuranceRule
+ frequency: RecurrenceRule.Monthly
+ daysOfWeek:[Qt.Friday]
+ limit: 2
+ }
+ property bool testComplete : false
+
+ function addEvents(testEvents)
+ {
+ for (var index=0; index < testEvents.length; index++){
+ var event = testEvents[index]
+ console.log("Creating event " + event.subject)
+ myModel.myEvent.description = event.subject
+ myModel.myEvent.startDateTime = event.startDateTime
+ myModel.myEvent.endDateTime = event.endDateTime
+
+ // only support testing simple RecurrenceRules ATM
+ if (event.repeat){
+ myReccuranceRule.frequency = event.repeat
+ myReccuranceRule.limit = event.repeatCount
+ myReccuranceRule.daysOfWeek = event.repeatDays
+ myModel.myEvent.recurrence.recurrenceRules = [myReccuranceRule]
+ }
+
+ // TODO verify that the OrganizerModel::itemsSaved() signal is fired
+ saveItem(myModel.myEvent)
+ }
+ update()
+ myModel.testComplete = (items.length == testEvents.length)
+ }
+
+ function testEvents()
+ {
+ return myModel.items
+ }
+}
+
diff --git a/plugins/landmarks/qsparql/databasefilewatcher.cpp b/tests/qmlauto/organizer/testcases/tst_detailfilter.qml
index ad559b10b2..afe191b34d 100644
--- a/plugins/landmarks/qsparql/databasefilewatcher.cpp
+++ b/tests/qmlauto/organizer/testcases/tst_detailfilter.qml
@@ -1,3 +1,4 @@
+
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
@@ -39,37 +40,32 @@
**
****************************************************************************/
-#include <QDir>
-#include <QFile>
-#include <QDebug>
-
-#include "databasefilewatcher_p.h"
+import QtQuick 1.0
+import QtQuickTest 1.0
+import QtMobility.organizer 1.1
-DatabaseFileWatcher::DatabaseFileWatcher(const QString &databaseWatcherPath, QObject *parent)
- : QObject(parent),
- m_watcher(0),
- m_databaseWatcherPath(databaseWatcherPath)
-{
-}
+TestCase {
+ name: "DetailFilterTests"
+ id:detailFilter
-void DatabaseFileWatcher::setEnabled(bool enabled)
-{
- if (!m_watcher) {
- m_watcher = new QFileSystemWatcher(this);
- connect(m_watcher, SIGNAL(fileChanged(QString)),
- SLOT(databaseChanged(QString)));
+ OrganizerModel {
+ id:model
+ manager:"memory"
+ startPeriod:'2009-01-01'
+ endPeriod:'2012-12-31'
+ autoUpdate:true
+ Component.onCompleted : {
+ if (manager == "memory")
+ organizer.importItems("test.ics");
+ }
+ filter:DetailFilter {
+ detail:Detail.Description
+ field:"Description"
+ value: "Event 1"
+ }
}
- if (enabled) {
- if (QFile::exists(m_databaseWatcherPath)) {
- if (!m_watcher->files().contains(m_databaseWatcherPath))
- m_watcher->addPath(m_databaseWatcherPath);
- }
- } else {
- m_watcher->removePath(m_databaseWatcherPath);
+
+ function test_filter() {
}
-}
-void DatabaseFileWatcher::databaseChanged(const QString &)
-{
- emit notifyChange();
}
diff --git a/tests/qmlauto/organizer/testcases/tst_organizeritems.qml b/tests/qmlauto/organizer/testcases/tst_organizeritems.qml
new file mode 100644
index 0000000000..88c54f8111
--- /dev/null
+++ b/tests/qmlauto/organizer/testcases/tst_organizeritems.qml
@@ -0,0 +1,185 @@
+
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+import QtQuickTest 1.0
+import QtMobility.organizer 1.1
+
+TestCase {
+ name: "OrganizerItemTests"
+ OrganizerModel {
+ id:model
+ manager:"memory"
+ startPeriod:'2009-01-01'
+ endPeriod:'2012-12-31'
+ autoUpdate:false
+ }
+
+ Event { id: event }
+ Todo { id:todo }
+ Journal { id:journal }
+ Note { id:note }
+
+ DetailFilter {
+ id:detailFilter
+ detail:Detail.DisplayLabel
+ field:DisplayLabel.Label
+ }
+
+ Event {
+ id:newEvent1
+ displayLabel: "NewEvent1"
+ description: "This is a new created event 1"
+ startDateTime: '2010-12-12'
+ endDateTime: '2010-12-13'
+ }
+
+ Event {
+ id:newEvent2
+ displayLabel: "NewEvent2"
+ description: "This is a new created event 2"
+ startDateTime: '2010-12-13'
+ endDateTime: '2010-12-14'
+ }
+
+ function test_event() {
+ verify(!event.modified);
+ verify(event.type == "Event");
+ event.location = "test address";
+ verify(event.location == "test address");
+ verify(event.modified);
+ event.startDateTime = new Date();
+ verify(event.startDateTime, new Date());
+
+ event.endDateTime = new Date();
+ verify(event.endDateTime, new Date());
+
+ verify(!event.allDay);
+ event.allDay = true;
+ verify(event.allDay);
+
+ event.priority = Priority.VeryHigh;
+ verify(event.priority == Priority.VeryHigh);
+ event.priority = Priority.VeryLow;
+ verify(event.priority == Priority.VeryLow);
+
+ verify(event.recurrence, undefined);
+ event.recurrence.recurrenceDates = [new Date(2010, 11, 12), new Date(2010, 11, 14)];
+ verify(event.recurrence.recurrenceDates.length == 2);
+ verify(event.recurrence.recurrenceDates[0].getMonth() == 11);
+ verify(event.recurrence.recurrenceDates[0].getFullYear() == 2010);
+ verify(event.recurrence.recurrenceDates[0].getDate() == 12);
+ verify(event.recurrence.recurrenceDates[1].getDate() == 14);
+
+ event.recurrence.exceptionDates =event.recurrence.recurrenceDates;
+ event.recurrence.recurrenceDates = [];
+ verify (event.recurrence.exceptionDates.length == 2);
+ verify(event.recurrence.recurrenceDates.length === 0);
+ verify(event.recurrence.exceptionDates[0].getMonth() == 11);
+ verify(event.recurrence.exceptionDates[0].getFullYear() == 2010);
+ verify(event.recurrence.exceptionDates[0].getDate() == 12);
+ verify(event.recurrence.exceptionDates[1].getDate() == 14);
+
+ verify (event.recurrence.recurrenceRules.length === 0);
+ verify (event.recurrence.exceptionRules.length === 0);
+ var rrule = Qt.createQmlObject("import QtMobility.organizer 1.1\nRecurrenceRule {}", event.recurrence);
+ event.recurrence.recurrenceRules = [rrule];
+ verify (event.recurrence.recurrenceRules.length == 1);
+
+ verify(model.itemCount === 0);
+ model.saveItem(newEvent1) ;
+ //make sure event saved
+ wait(100);
+ verify(model.itemCount === 1);
+ var ids = model.itemIds();
+ verify(ids.length === 1);
+ var item = model.item(ids[0]);
+ verify(item.displayLabel === "NewEvent1");
+ verify(item.description === "This is a new created event 1");
+
+ //modify
+ item.displayLabel = "EditedEvent1";
+ model.saveItem(item);
+ //make sure event saved
+ wait(100);
+ verify(model.itemCount === 1);
+ var item2 = model.item(ids[0]);
+ verify(item2.displayLabel === "EditedEvent1");
+
+ //filter
+ model.saveItem(newEvent2);
+ wait(100);
+ verify(model.itemCount === 2);
+ model.autoUpdate = true;
+ detailFilter.value = "New"
+ detailFilter.matchFlags = Filter.MatchStartsWith;
+ model.filter = detailFilter;
+ wait(100);
+ verify(model.itemCount === 1); //only NewEvent2 matched
+
+ model.autoUpdate = false;
+ detailFilter.value = "Event"
+ detailFilter.matchFlags = Filter.MatchContains;
+ wait(100);
+ verify(model.itemCount === 1); //not updated yet
+ model.update();
+ wait(100);
+ verify(model.itemCount === 2); //both events matched now
+
+ }
+
+ function test_todo() {
+ }
+
+ function test_journal() {
+ }
+
+ function test_note() {
+ }
+
+ function test_eventOccurrence() {
+ }
+
+ function test_todoOccurrence() {
+ }
+
+}
diff --git a/tests/qmlauto/organizer/testcases/tst_organizermodel.qml b/tests/qmlauto/organizer/testcases/tst_organizermodel.qml
new file mode 100644
index 0000000000..50d8bebdbf
--- /dev/null
+++ b/tests/qmlauto/organizer/testcases/tst_organizermodel.qml
@@ -0,0 +1,399 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//TESTED_COMPONENT=src/organizer
+
+import QtQuick 1.0
+import QtQuickTest 1.0
+import QtMobility.organizer 1.1
+
+TestCase {
+ name: "ModelTests"
+ id:modelTests
+
+ property Rectangle rect: Rectangle {
+ id:myRectangle
+ }
+
+ function test_componentCreation_data() {
+ return [
+ // OrganizerModel
+ {tag: "No properties",
+ code: "import QtQuick 1.0\n"
+ + "import QtMobility.organizer 1.1 \n"
+ + " OrganizerModel {\n"
+ + " }"
+ },
+ {tag: "Only id property",
+ code: "import QtQuick 1.0\n"
+ + "import QtMobility.organizer 1.1\n"
+ + " OrganizerModel {\n"
+ + " id:organizerModelId\n"
+ + " }\n"
+ },
+ {tag: "Valuetype properties",
+ code: "import QtQuick 1.0\n"
+ + "import QtMobility.organizer 1.1\n"
+ + " OrganizerModel {\n"
+ + " id:organizerModelId\n"
+ + " manager:'memory'\n"
+ + " startPeriod:'2010-08-12T13:22:01'\n"
+ + " endPeriod:'2010-09-12T13:22:01'\n"
+ + " }\n"
+ },
+ {tag: "With filter",
+ code: "import QtQuick 1.0\n"
+ + "import QtMobility.organizer 1.1\n"
+ + "OrganizerModel {\n"
+ + " id:organizerModelId\n"
+ + " filter:DetailFilter{\n"
+ + " id:filter\n"
+ + " field:EventTime.StartDateTime\n"
+ + " value:'2010-08-12T13:22:01'\n"
+ + " }\n"
+ + "}\n"
+ },
+ {tag: "With invalid filter",
+ code: "import Qt 4.7\n"
+ + "import QtMobility.organizer 1.1\n"
+ + "OrganizerModel {\n"
+ + " id:organizerModelId\n"
+ + " filter:InvalidFilter{\n"
+ + " id:filter\n"
+ + " }\n"
+ + "}\n"
+ },
+ {tag: "With range filter",
+ code: "import Qt 4.7\n"
+ + "import QtMobility.organizer 1.1\n"
+ + "OrganizerModel {\n"
+ + " id:organizerModelId\n"
+ + " filter:DetailRangeFilter{\n"
+ + " id:filter\n"
+ + " field:EventTime.StartDateTime\n"
+ + " min:'2010-08-12T13:22:01'\n"
+ + " max:'2010-09-12T13:22:01'\n"
+ + " }\n"
+ + "}\n"
+ },
+ {tag: "With changelog filter",
+ code: "import Qt 4.7\n"
+ + "import QtMobility.organizer 1.1\n"
+ + "OrganizerModel {\n"
+ + " id:organizerModelId\n"
+ + " filter:ChangeLogFilter{\n"
+ + " id:filter\n"
+ + " eventType:ChangeLogFilter.EventAdded\n"
+ + " since:'2010-08-12T13:22:01'\n"
+ + " }\n"
+ + "}\n"
+ },
+ // Reserved for future use
+ /*
+ {tag: "With action filter",
+ code: "import Qt 4.7\n"
+ + "import QtMobility.organizer 1.1\n"
+ + "OrganizerModel {\n"
+ + " id:organizerModelId\n"
+ + " filter:ActionFilter{\n"
+ + " id:filter\n"
+ + " actionName:'SomeAction'\n"
+ + " }\n"
+ + "}\n"
+ },
+ */
+ {tag: "With collection filter",
+ code: "import Qt 4.7\n"
+ + "import QtMobility.organizer 1.1\n"
+ + "OrganizerModel {\n"
+ + " id:organizerModelId\n"
+ + " filter:CollectionFilter{\n"
+ + " id:filter\n"
+ + " ids:['1234', '456', '90']\n"
+ + " }\n"
+ + "}\n"
+ },
+ {tag: "With intersection filter",
+ code: "import Qt 4.7\n"
+ + "import QtMobility.organizer 1.1\n"
+ + "OrganizerModel {\n"
+ + " id:organizerModelId\n"
+ + " filter:IntersectionFilter {\n"
+ + " id:filter\n"
+ + " filters:[\n"
+ + " DetailFilter{\n"
+ + " id:filter1\n"
+ + " field:EventTime.StartDateTime\n"
+ + " value:'2010-08-12T13:22:01'\n"
+ + " },\n"
+ + " DetailRangeFilter{\n"
+ + " id:filter2\n"
+ + " field:EventTime.StartDateTime\n"
+ + " min:'2010-08-12T13:22:01'\n"
+ + " max:'2010-09-12T13:22:01'\n"
+ + " }\n"
+ + " ]\n"
+ + " }\n"
+ + "}\n"
+ },
+ {tag: "With fetchHint",
+ code: "import Qt 4.7 \n"
+ + "import QtMobility.organizer 1.1\n"
+ + "OrganizerModel {\n"
+ + " id:organizerModelId\n"
+ + " fetchHint:FetchHint {\n"
+ + " id:hint\n"
+ + " optimizationHints:FetchHint.AllRequired\n"
+ + " }\n"
+ + "}\n"
+ },
+
+ // Organizer Items
+ {tag: "Base organizer item",
+ code: "import Qt 4.7\n"
+ + "import QtMobility.organizer 1.1\n"
+ + "OrganizerItem {\n"
+ + "}\n"
+ },
+ {tag: "Base organizer item: only id",
+ code: "import Qt 4.7\n"
+ + "import QtMobility.organizer 1.1\n"
+ + "OrganizerItem {\n"
+ + " id:organizerItem\n"
+ + "}\n"
+ },
+ {tag: "Base organizer item: Valuetype properties",
+ code: "import Qt 4.7\n"
+ + "import QtMobility.organizer 1.1\n"
+ + "OrganizerItem {\n"
+ + " id:organizerItem\n"
+ + " displayLabel:'test item'\n"
+ + " description:'item description'\n"
+ + " guid:'1112232133'\n"
+ + "}\n"
+ },
+ {tag: "Base organizer item: default property",
+ code: "import Qt 4.7\n"
+ + "import QtMobility.organizer 1.1\n"
+ + "OrganizerItem {\n"
+ + " id:organizerItem\n"
+ + " DisplayLabel {\n"
+ + " label:'test item'\n"
+ + " }\n"
+ + " Description {\n"
+ + " description:'item description'\n"
+ + " }\n"
+ + " Guid{\n"
+ + " guid:'111223213'\n"
+ + " }\n"
+ + "}\n"
+ },
+
+ //Event
+ {tag: "Organizer event",
+ code: "import Qt 4.7 \n"
+ + "import QtMobility.organizer 1.1\n"
+ + "Event {\n"
+ + "}\n"
+ },
+ {tag: "Organizer event:Valuetype properties",
+ code: "import Qt 4.7 \n"
+ + "import QtMobility.organizer 1.1\n"
+ + "Event {\n"
+ + " id:organizerEvent\n"
+ + " displayLabel:'meeting'\n"
+ + " startDateTime:'2010-08-12T13:00:00'\n"
+ + " endDateTime:'2010-08-12T15:00:00'\n"
+ + " allDay:false\n"
+ + " location:'office'\n"
+ + " Location {\n"
+ + " label:'53 Brandl st'\n"
+ + " latitude:-27.579570\n"
+ + " longitude:153.10031\n"
+ + " }\n"
+ + " priority:Priority.Low\n"
+ + " recurrence.recurrenceRules:[\n"
+ + " RecurrenceRule {\n"
+ + " }\n"
+ + " ]\n"
+ + " recurrence.recurrenceDates:[]\n"
+ + " recurrence.exceptionDates:[]\n"
+ + "}\n"
+ },
+ /*
+ {tag: "",
+ code: ""
+ },
+ */
+
+ ]
+ }
+
+ function test_componentCreation(data)
+ {
+ try{
+ var obj = Qt.createQmlObject(data.code, myRectangle, "dynamicSnippet1");
+ verify(obj != undefined, "Unable to load script for " + data.tag);
+ obj.destroy();
+ console.log("Completed test on '" + data.tag + "'")
+ }
+ catch (errorObject) {
+ console.log("For code " + data.code + " Error was seen is " + errorObject );
+ }
+
+ }
+
+ function checkDetails(events)
+ {
+ var testDataEvents = test_addEvent_data()[0].events
+ var foundEvent = false
+ var testDataEvent = undefined
+ for (var index = 0; index < testDataEvents.length; index++){
+ testDataEvent = testDataEvents[index]
+ foundEvent = false
+ console.log("Checking event " + testDataEvent.subject)
+ for (var index2 = 0; index2 < events.length; index2++){
+ var actualEvent = events[index2];
+ if (testDataEvent.subject == actualEvent.description){
+ foundEvent = true
+ compare(actualEvent.type, testDataEvent.type)
+ compare(actualEvent.startDateTime.toString(), testDataEvent.startDateTime.toString())
+ compare(actualEvent.endDateTime.toString(), testDataEvent.endDateTime.toString())
+ if (testDataEvent.repeat != undefined){
+ verify(actualEvent.recurrence != undefined, "Expected recurrance Element to be present for event")
+ verify(actualEvent.recurrence.recurrenceRules.length == 1, "Expected there to be one RecurranceRule")
+ var recurranceRule = actualEvent.recurrence.recurrenceRules[0] // first rule only
+ switch (event.repeat){
+ case RecurrenceRule.Daily:
+ case RecurrenceRule.Weekly:
+ case RecurrenceRule.Monthly:
+ case RecurrenceRule.Yearly:
+ compare(recurranceRule.frequency, RecurrenceRule.Weekly)
+ for (var dayIndex=0; dayIndex < testDataEvent.repeatDays; dayIndex++){
+ verify(recurranceRule.daysOfWeek.indexOf(testDataEvent.repeatDays[dayIndex]) != -1, "Expected event to recurrence on day " + testDataEvent.repeatDays[dayIndex])
+ }
+ compare(recurranceRule.limit.toString(), testDataEvent.limit.toString())
+ break
+ default:
+ if (event.repeat != RecurrenceRule.Invalid)
+ console.log("Unsupported repeat for Event actual:" + actualEvent.reoccurance + " expected:" + testDataEvent.repeat);
+ }
+ }
+ break
+ }
+ }
+ verify(foundEvent, "Did not find event " + testDataEvent.subject)
+ }
+ console.log("Done checking Event")
+ }
+
+ // test data is handled by addEvent.qml function addEvents()
+ function test_addEvent_data() {
+ return [
+ {tag: "Event set 1",
+ events:[
+ {tag: "Event 1",
+ type: 'Event',
+ subject: "Event 1",
+ description: "starts 2010-12-09 8AM finishes 5PM",
+ startDateTime: new Date(2010, 12, 9, 8, 0),
+ endDateTime: new Date(2010, 12, 9, 17, 0),
+ },
+ {tag: "Event 2",
+ type: 'Event',
+ subject: "Event 2",
+ description: "starts 2010-12-08 8AM finishes 1PM",
+ startDateTime: new Date(2010, 12, 8, 8, 0),
+ endDateTime: new Date(2010, 12, 8, 13, 0),
+ },
+ {tag: "Event 3",
+ type: 'Event',
+ subject: "Event 3",
+ description: "starts a month from 2010-12-08 at 11AM finish at 2PM",
+ startDateTime: new Date(2010, 12, 8, 11, 0),
+ endDateTime: new Date(2010, 12, 8, 14, 0),
+ },
+ {tag: "Event 4",
+ type: 'Event',
+ subject: "Event 4",
+ description: "starts after Event 3 and finishes 4PM",
+ startDateTime: new Date(2010, 12, 8, 14, 0),
+ endDateTime: new Date(2010, 12, 8, 16, 0),
+ },
+ {tag: "Event 5",
+ type: 'Event',
+ subject: "Event 5",
+ description: "starts after Event 4 and finishes 5PM",
+ startDateTime: new Date(2010, 12, 8, 16, 0),
+ endDateTime: new Date(2010, 12, 8, 17, 0),
+ },
+ {tag: "Event 6",
+ type: 'Event',
+ subject: "Event 6",
+ description: "starts 2010-12-10 at 11AM finishing 1PM, repeating for 4 weeks",
+ startDateTime: new Date(2010, 12, 10, 11, 0),
+ endDateTime: new Date(2010, 12, 10, 13, 0),
+ repeat: RecurrenceRule.Weekly,
+ repeatDays: [Qt.Friday],
+ repeatCount: 4
+ },
+ ]
+ }
+ ]
+ }
+
+ function test_addEvent(data)
+ {
+ var component = Qt.createComponent("addEvent.qml")
+ var obj = component.createObject(top)
+ if (obj == undefined)
+ console.log("Unable to load component from " + name + " error is ", component.errorString())
+ verify(obj != undefined, 'Unable to load component ' + name)
+ obj.addEvents(data.events)
+ var items = obj.testEvents()
+ checkDetails(items)
+ if (items.length == 0)
+ console.log("No records added")
+ obj.destroy()
+ component.destroy()
+ }
+}
+
diff --git a/tests/qmlauto/organizer/tst_qmlorganizer.cpp b/tests/qmlauto/organizer/tst_qmlorganizer.cpp
new file mode 100644
index 0000000000..45885da3b4
--- /dev/null
+++ b/tests/qmlauto/organizer/tst_qmlorganizer.cpp
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtQuickTest/quicktest.h>
+QUICK_TEST_MAIN(qmlorganizer)
diff --git a/tests/qmlauto/qmlauto.pri b/tests/qmlauto/qmlauto.pri
new file mode 100644
index 0000000000..1ddb5815c5
--- /dev/null
+++ b/tests/qmlauto/qmlauto.pri
@@ -0,0 +1,17 @@
+CONFIG += warn_on testcase
+DEFINES += QUICK_TEST_SOURCE_DIR=\"\\\"$$PWD\\\"\"
+CONFIG += mobility
+
+QT += declarative testlib
+INCLUDEPATH += $$PWD
+
+win32:CONFIG(debug, debug|release) {
+ LIBS += -lQtQuickTest$${QT_LIBINFIX}d
+} else {
+ LIBS += -lQtQuickTest$${QT_LIBINFIX}
+}
+
+
+include(../../common.pri)
+
+
diff --git a/tests/qmlauto/qmlauto.pro b/tests/qmlauto/qmlauto.pro
new file mode 100644
index 0000000000..fc7a0fbce6
--- /dev/null
+++ b/tests/qmlauto/qmlauto.pro
@@ -0,0 +1,7 @@
+TEMPLATE = subdirs
+
+include(../../staticconfig.pri)
+
+contains(mobility_modules,versit):contains(mobility_modules,organizer) {
+ include(./contacts/organizer.pro)
+}