phoneapp/phoneuiqtviewadapter/src/phonemessagecontroller.cpp
changeset 22 6bb1b21d2484
child 45 6b911d05207e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneapp/phoneuiqtviewadapter/src/phonemessagecontroller.cpp	Fri Apr 16 14:58:25 2010 +0300
@@ -0,0 +1,100 @@
+/*!
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Handles message editor.
+*/
+
+#include "phonemessagecontroller.h"
+#include "tphonecmdparamsfidata.h"
+#include "phoneconstants.h"
+#include "cphonecenrepproxy.h"
+#include "cphonepubsubproxy.h"
+#include <settingsinternalcrkeys.h>
+#include <coreapplicationuisdomainpskeys.h>
+#include <hbglobal.h>
+#include <xqservicerequest.h>
+
+
+PhoneMessageController::PhoneMessageController(QObject *parent) : 
+    QObject(parent)
+{
+
+}
+
+PhoneMessageController::~PhoneMessageController()
+{
+
+}
+
+void PhoneMessageController::openSoftRejectMessageEditor(
+        TPhoneCommandParam *commandParam)
+{
+    TPhoneCmdParamSfiData* sfiParam =
+        static_cast<TPhoneCmdParamSfiData*>( commandParam );
+    
+    QString toField;
+    QString alias;
+    QString messageBody;
+    
+    
+    // Get message body
+    TInt softRejectDefaultInUseValue = 0;
+    const TInt err = CPhoneCenRepProxy::Instance()->GetInt(
+        KCRUidTelephonySettings,
+        KSettingsSoftRejectDefaultInUse,
+        softRejectDefaultInUseValue );
+    
+    if (softRejectDefaultInUseValue) {
+        HBufC* softRejectTxt = NULL;
+        TRAP_IGNORE( softRejectTxt = HBufC::NewL( KPhoneSMSLength ) );
+        
+        if (softRejectTxt) {
+            TPtr string( softRejectTxt->Des() );
+        
+            // Default txt used or not
+            CPhoneCenRepProxy::Instance()->GetString(
+                KCRUidTelephonySettings,
+                KSettingsSoftRejectText,
+                string );
+            
+            messageBody = QString::fromUtf16(string.Ptr(), string.Length());
+            delete softRejectTxt;
+        }
+    } else {
+        messageBody = hbTrId("txt_phone_setlabel_soft_reject_val_default_text");
+    }
+    
+    // store the remote caller's info
+    alias = QString::fromUtf16(sfiParam->Name().Ptr(), 
+            sfiParam->Name().Length());
+    
+    toField = QString::fromUtf16(sfiParam->Number().Ptr(), 
+            sfiParam->Number().Length());
+
+    
+    // open message editor
+    openEditor(toField, alias, messageBody );
+}
+
+void PhoneMessageController::openEditor(
+        QString /*toField*/, QString /*name*/, QString /*messageBody*/)
+{
+    //TODO
+    /*XQServiceRequest snd(QLatin1String("com.nokia.services.hbserviceprovider.imessage.send"), QLatin1String("send(QVariant)"));
+    QVariant data;
+    snd << data;
+    snd.send();*/
+}
+
+
+