Revision: 201029
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 18 Aug 2010 09:46:00 +0300
changeset 29 36d7ded3ca23
parent 26 5554410e16f5
child 34 01f0bb65bcf1
Revision: 201029 Kit: 201033
mmsharing/livecommsui/lcui/src/lcuicomponentrepository.cpp
mmsharing/livecommsui/lcui/src/lcview.cpp
mmsharing/livecommsui/lcui/tsrc/ut_lcui/src/main.cpp
mmsharing/livecommsui/lcuiengine/inc/lcuiengine_p.h
mmsharing/livecommsui/lcuiengine/src/lcuiengine_p.cpp
mmsharing/livecommsui/lcuiengine/tsrc/ut_lcuieng/inc/ut_lcuiengine.h
mmsharing/livecommsui/lcuiengine/tsrc/ut_lcuieng/lcstub/src/lcenginestub.cpp
mmsharing/livecommsui/lcuiengine/tsrc/ut_lcuieng/src/ut_lcuiengine.cpp
mmsharing/livecommsui/lcuiengine/tsrc/ut_lcuieng/ut_lcuieng.pro
mmsharing/livecommsui/livecommsui.pro
--- a/mmsharing/livecommsui/lcui/src/lcuicomponentrepository.cpp	Tue Jul 06 14:13:16 2010 +0300
+++ b/mmsharing/livecommsui/lcui/src/lcuicomponentrepository.cpp	Wed Aug 18 09:46:00 2010 +0300
@@ -550,7 +550,7 @@
     if ( mLastLoadedView.length() > 0) {
         LC_QDEBUG_4( "layout = ", layoutName, ", view =",  mLastLoadedView )
 
-        QObjectList objects = load( mLastLoadedView, layoutName, &ok );
+        load( mLastLoadedView, layoutName, &ok );
         if (!ok) {
             LC_QCRITICAL( "! loading of XML failed !" )
         }
--- a/mmsharing/livecommsui/lcui/src/lcview.cpp	Tue Jul 06 14:13:16 2010 +0300
+++ b/mmsharing/livecommsui/lcui/src/lcview.cpp	Wed Aug 18 09:46:00 2010 +0300
@@ -667,15 +667,14 @@
 void LcView::gestureEvent(QGestureEvent *event)
 {
     LC_QDEBUG( "livecomms [UI] -> LcView::gestureEvent()" )
-    if(HbTapGesture *tap = static_cast<HbTapGesture *>(event->gesture(Qt::TapGesture))) {        
-        if ((tap->state() == Qt::GestureUpdated) &&
-            (tap->tapStyleHint() == HbTapGesture::TapAndHold)) {            
+    if( event ){
+        // unsafe typecast but no other way to access tapstylehint from orbit
+        HbTapGesture *tap = static_cast<HbTapGesture *>(event->gesture(Qt::TapGesture));
+        Qt::GestureState tapState = tap->state();
+        HbTapGesture::TapStyleHint hint = tap->tapStyleHint();
+        if ( tapState == Qt::GestureUpdated && hint == HbTapGesture::TapAndHold ) {            
             gestureLongPress(translatePointForOrientation(tap->position()));
-        } 
-        
-        else if ( (tap->state() == Qt::GestureFinished ) &&
-                ( tap->tapStyleHint() == HbTapGesture::Tap)) {
-        
+        } else if ( tapState == Qt::GestureFinished  && hint == HbTapGesture::Tap ) {
             gestureShortPress();
         }        
     }
@@ -755,8 +754,8 @@
 
     // mItemContextMenu is destroyed upon close 
     mItemContextMenu = new HbMenu();
-    mItemContextMenu->setDismissPolicy(HbDialog::TapOutside);
-    mItemContextMenu->setTimeout(HbDialog::ContextMenuTimeout);
+    mItemContextMenu->setDismissPolicy(HbMenu::TapAnywhere);
+    mItemContextMenu->setTimeout(HbMenu::ContextMenuTimeout);
     mItemContextMenu->setAttribute(Qt::WA_DeleteOnClose);
     
     LC_QDEBUG( "livecomms [UI] <- LcView::createContextMenu()" )
--- a/mmsharing/livecommsui/lcui/tsrc/ut_lcui/src/main.cpp	Tue Jul 06 14:13:16 2010 +0300
+++ b/mmsharing/livecommsui/lcui/tsrc/ut_lcui/src/main.cpp	Wed Aug 18 09:46:00 2010 +0300
@@ -26,6 +26,8 @@
 #include <QtTest/QtTest>
 #include <stdio.h>
 
+#include <QFile>
+#include <QTextStream>
 
 #define UT_ARGS( args, file )\
     QStringList args( "ut_lcui");\
--- a/mmsharing/livecommsui/lcuiengine/inc/lcuiengine_p.h	Tue Jul 06 14:13:16 2010 +0300
+++ b/mmsharing/livecommsui/lcuiengine/inc/lcuiengine_p.h	Wed Aug 18 09:46:00 2010 +0300
@@ -152,6 +152,7 @@
     void fillRemoteInfo(bool informChanges);
     void startStopGuardTimer();
     bool isAllowedToShareVideo();
+    int vtVideoSendingSetting();
     
 private: // New functions wrapping the leaving functions in LC plug-in API
     
@@ -192,6 +193,12 @@
     TRect mRemoteRect;
     LcActivityManager* mActivityManager;
     
+private: // Constants
+    
+    static const int VTSETTING_ALWAYS_ASK_FIRST = 0;
+    static const int VTSETTING_DO_NOT_SHOW = 1;
+    static const int VTSETTING_SHOW_AUTOMATICALLY = 2;
+    
 friend class LcUiEngine;    
 };
 
--- a/mmsharing/livecommsui/lcuiengine/src/lcuiengine_p.cpp	Tue Jul 06 14:13:16 2010 +0300
+++ b/mmsharing/livecommsui/lcuiengine/src/lcuiengine_p.cpp	Wed Aug 18 09:46:00 2010 +0300
@@ -48,6 +48,10 @@
 #include <lcsession.h>
 #include <lczoomcontrol.h>
 #include <lccameracontrol.h>
+#include <xqsettingsmanager.h>
+#include <xqsettingskey.h>
+#include <settingsinternalcrkeys.h>
+
 
 
 #define LC_VTPLUGIN_NAME "Videotelephony";
@@ -1417,13 +1421,38 @@
 //
 bool LcUiEnginePrivate::isAllowedToShareVideo()
 {
-    LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::isAllowedToShareVideo()" )    
-    if( featureSupported( CLcEngine::ELcSendVideoQuery ) && mShareOwnVideoQuery ){
-        mShareOwnVideoQuery->show();
-        return false;
-    }    
+    LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::isAllowedToShareVideo()" )
+    if (!featureSupported( CLcEngine::ELcSendVideoQuery )) //outgoing videocall
+        return true;
+    else { //incoming videocall
+        int ownVtVideoSendingSetting = vtVideoSendingSetting();
+        if (VTSETTING_SHOW_AUTOMATICALLY == ownVtVideoSendingSetting)
+            return true;
+        else if (VTSETTING_DO_NOT_SHOW == ownVtVideoSendingSetting)
+            return false;
+        else {
+            if (mShareOwnVideoQuery)
+                mShareOwnVideoQuery->show();
+            return false;
+        }
+    }
     LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::isAllowedToShareVideo()" )
-    return true;
+}
+
+// -----------------------------------------------------------------------------
+// LcUiEnginePrivate::vtVideoSendingSetting
+// -----------------------------------------------------------------------------
+//
+int LcUiEnginePrivate::vtVideoSendingSetting()
+{
+    LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::vtVideoSendingSetting()" )
+    XQSettingsManager settings;
+    XQSettingsKey settingsKey(XQSettingsKey::TargetCentralRepository, 
+                              KCRUidTelephonySettings.iUid, 
+                              KSettingsVTVideoSending);
+    QVariant ownVtVideoSendingSetting = settings.readItemValue(settingsKey);
+    LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::vtVideoSendingSetting()" )
+    return ownVtVideoSendingSetting.toInt();
 }
 
 // -----------------------------------------------------------------------------
--- a/mmsharing/livecommsui/lcuiengine/tsrc/ut_lcuieng/inc/ut_lcuiengine.h	Tue Jul 06 14:13:16 2010 +0300
+++ b/mmsharing/livecommsui/lcuiengine/tsrc/ut_lcuieng/inc/ut_lcuiengine.h	Wed Aug 18 09:46:00 2010 +0300
@@ -89,9 +89,17 @@
     void testIsMinimized();
     void testHandleForegroundStatus();
     void testSendDialTone();
+    void testVtVideoSendingSetting(); 
+    void testShareVideoIsAllowedShownAutomatically(); 
+    void testShareVideoIsNotAllowedShown();
+    void testShareVideoPermissionAskedAlways(); 
     
+private: // utility functions
+ 
+    bool setVtVideoSendingSetting(int key);
+
 private:
- 
+    
     LcUiEngine* mEngine;
     HbProgressDialog* mInvitingNote;
     HbProgressDialog* mWaitingNote;
--- a/mmsharing/livecommsui/lcuiengine/tsrc/ut_lcuieng/lcstub/src/lcenginestub.cpp	Tue Jul 06 14:13:16 2010 +0300
+++ b/mmsharing/livecommsui/lcuiengine/tsrc/ut_lcuieng/lcstub/src/lcenginestub.cpp	Wed Aug 18 09:46:00 2010 +0300
@@ -87,8 +87,10 @@
 //
 // -----------------------------------------------------------------------------
 //
-TBool CLcEngineStub::IsFeatureSupported( TLcFeature /*aLcFeature*/ )
+TBool CLcEngineStub::IsFeatureSupported( TLcFeature aLcFeature )
     {
+    if (ELcSendVideoQuery == aLcFeature)
+        return true;
     return lcutStub_LcEngine_lcFeatureSupported;
     }
 
--- a/mmsharing/livecommsui/lcuiengine/tsrc/ut_lcuieng/src/ut_lcuiengine.cpp	Tue Jul 06 14:13:16 2010 +0300
+++ b/mmsharing/livecommsui/lcuiengine/tsrc/ut_lcuieng/src/ut_lcuiengine.cpp	Wed Aug 18 09:46:00 2010 +0300
@@ -37,6 +37,10 @@
 #include <QSignalSpy>
 #include <hbview.h>
 
+#include <xqsettingsmanager.h>
+#include <xqsettingskey.h>
+#include <settingsinternalcrkeys.h>
+
 const char lcutMultimediaSharingEng[] = "MultimediaSharing";
 const char lcutVideotelephonyEng[] = "Videotelephony";
 
@@ -1202,3 +1206,57 @@
 }
 
 
+void UT_LcUiEngine::testVtVideoSendingSetting() 
+{
+    int settingsKeyValueDoNotShow = 1;
+    if (!setVtVideoSendingSetting(settingsKeyValueDoNotShow))
+        QFAIL("Writing test key to central repository failed.");
+    QCOMPARE(mEngine->d->vtVideoSendingSetting(), settingsKeyValueDoNotShow);
+}
+
+
+void UT_LcUiEngine::testShareVideoIsAllowedShownAutomatically() 
+{
+    mShareOwnVideoQuery->hide();
+    mEngine->d->setUiComponents(mInvitingNote,mWaitingNote,mAcceptQuery,mRecipientQuery,mShareOwnVideoQuery);
+    int settingsKeyValueShowAutomatically = 2;
+    if (!setVtVideoSendingSetting(settingsKeyValueShowAutomatically))
+        QFAIL("Writing test key to central repository failed.");
+    QVERIFY(mEngine->d->isAllowedToShareVideo());
+    QVERIFY(mEngine->d->mShareOwnVideoQuery && !mEngine->d->mShareOwnVideoQuery->isVisible());
+}
+
+
+void UT_LcUiEngine::testShareVideoIsNotAllowedShown() 
+{
+    mShareOwnVideoQuery->hide();
+    mEngine->d->setUiComponents(mInvitingNote,mWaitingNote,mAcceptQuery,mRecipientQuery,mShareOwnVideoQuery);
+    int settingsKeyValueDoNotShow = 1;
+    if (!setVtVideoSendingSetting(settingsKeyValueDoNotShow))
+        QFAIL("Writing test key to central repository failed.");
+    QVERIFY(!mEngine->d->isAllowedToShareVideo());
+    QVERIFY(mEngine->d->mShareOwnVideoQuery && !mEngine->d->mShareOwnVideoQuery->isVisible());    
+}
+
+
+void UT_LcUiEngine::testShareVideoPermissionAskedAlways() 
+{
+    mShareOwnVideoQuery->hide();
+    mEngine->d->setUiComponents(mInvitingNote,mWaitingNote,mAcceptQuery,mRecipientQuery,mShareOwnVideoQuery);
+    int settingsKeyValueAlwaysAsk = 0;
+    if (!setVtVideoSendingSetting(settingsKeyValueAlwaysAsk))
+        QFAIL("Writing test key to central repository failed.");
+    QVERIFY(!mEngine->d->isAllowedToShareVideo());
+    QVERIFY(mEngine->d->mShareOwnVideoQuery && mEngine->d->mShareOwnVideoQuery->isVisible());
+}
+
+
+bool UT_LcUiEngine::setVtVideoSendingSetting(int key)
+{
+    QVariant settingsKeyValue(key);  
+    XQSettingsManager settings;
+    XQSettingsKey settingsKey(XQSettingsKey::TargetCentralRepository, 
+                              KCRUidTelephonySettings.iUid, 
+                              KSettingsVTVideoSending);
+    return settings.writeItemValue(settingsKey, settingsKeyValue);
+}
--- a/mmsharing/livecommsui/lcuiengine/tsrc/ut_lcuieng/ut_lcuieng.pro	Tue Jul 06 14:13:16 2010 +0300
+++ b/mmsharing/livecommsui/lcuiengine/tsrc/ut_lcuieng/ut_lcuieng.pro	Wed Aug 18 09:46:00 2010 +0300
@@ -60,6 +60,6 @@
     TARGET.UID2 = 0x100039CE
     TARGET.UID3 = 0xEfa329b2
     TARGET.CAPABILITY = ALL -TCB
-    LIBS += -lecom -lflogger -lws32 -lbafl -lxqservice -lxqserviceutil -lcone
+    LIBS += -lecom -lflogger -lws32 -lbafl -lxqservice -lxqserviceutil -lcone -lxqsettingsmanager
     TARGET.EPOCALLOWDLLDATA = 1
 }
--- a/mmsharing/livecommsui/livecommsui.pro	Tue Jul 06 14:13:16 2010 +0300
+++ b/mmsharing/livecommsui/livecommsui.pro	Wed Aug 18 09:46:00 2010 +0300
@@ -74,7 +74,8 @@
         -lcone \
         -lcentralrepository \
         -lxqserviceutil \
-        -ldialpad
+        -ldialpad \
+        -lxqsettingsmanager
     
     defFiles = "$${LITERAL_HASH}ifdef WINS" \
         "DEFFILE bwins/livecommsui.def" \