phoneapp/phoneuiqtviewadapter/src/phonemessagecontroller.cpp
changeset 36 2eacb6118286
parent 30 ebdbd102c78a
child 37 ba76fc04e6c2
equal deleted inserted replaced
30:ebdbd102c78a 36:2eacb6118286
     1 /*!
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Handles message editor.
       
    15 */
       
    16 
       
    17 #include "phonemessagecontroller.h"
       
    18 #include "tphonecmdparamsfidata.h"
       
    19 #include "phoneconstants.h"
       
    20 #include "cphonecenrepproxy.h"
       
    21 #include "cphonepubsubproxy.h"
       
    22 #include <settingsinternalcrkeys.h>
       
    23 #include <coreapplicationuisdomainpskeys.h>
       
    24 #include <hbglobal.h>
       
    25 #include <xqservicerequest.h>
       
    26 
       
    27 
       
    28 PhoneMessageController::PhoneMessageController(QObject *parent) : 
       
    29     QObject(parent)
       
    30 {
       
    31 
       
    32 }
       
    33 
       
    34 PhoneMessageController::~PhoneMessageController()
       
    35 {
       
    36 
       
    37 }
       
    38 
       
    39 void PhoneMessageController::openSoftRejectMessageEditor(
       
    40         TPhoneCommandParam *commandParam)
       
    41 {
       
    42     TPhoneCmdParamSfiData* sfiParam =
       
    43         static_cast<TPhoneCmdParamSfiData*>( commandParam );
       
    44     
       
    45     QString toField;
       
    46     QString alias;
       
    47     QString messageBody;
       
    48     
       
    49     
       
    50     // Get message body
       
    51     TInt softRejectDefaultInUseValue = 0;
       
    52     const TInt err = CPhoneCenRepProxy::Instance()->GetInt(
       
    53         KCRUidTelephonySettings,
       
    54         KSettingsSoftRejectDefaultInUse,
       
    55         softRejectDefaultInUseValue );
       
    56     
       
    57     if (softRejectDefaultInUseValue) {
       
    58         HBufC* softRejectTxt = NULL;
       
    59         TRAP_IGNORE( softRejectTxt = HBufC::NewL( KPhoneSMSLength ) );
       
    60         
       
    61         if (softRejectTxt) {
       
    62             TPtr string( softRejectTxt->Des() );
       
    63         
       
    64             // Default txt used or not
       
    65             CPhoneCenRepProxy::Instance()->GetString(
       
    66                 KCRUidTelephonySettings,
       
    67                 KSettingsSoftRejectText,
       
    68                 string );
       
    69             
       
    70             messageBody = QString::fromUtf16(string.Ptr(), string.Length());
       
    71             delete softRejectTxt;
       
    72         }
       
    73     } else {
       
    74         messageBody = hbTrId("txt_phone_setlabel_soft_reject_val_default_text");
       
    75     }
       
    76     
       
    77     // store the remote caller's info
       
    78     alias = QString::fromUtf16(sfiParam->Name().Ptr(), 
       
    79             sfiParam->Name().Length());
       
    80     
       
    81     toField = QString::fromUtf16(sfiParam->Number().Ptr(), 
       
    82             sfiParam->Number().Length());
       
    83 
       
    84     
       
    85     // open message editor
       
    86     openEditor(toField, alias, messageBody );
       
    87 }
       
    88 
       
    89 void PhoneMessageController::openEditor(
       
    90         QString /*toField*/, QString /*name*/, QString /*messageBody*/)
       
    91 {
       
    92     //TODO
       
    93     /*XQServiceRequest snd(QLatin1String("com.nokia.services.hbserviceprovider.imessage.send"), QLatin1String("send(QVariant)"));
       
    94     QVariant data;
       
    95     snd << data;
       
    96     snd.send();*/
       
    97 }
       
    98 
       
    99 
       
   100