logsui/logsengine/inc/logsmessage.h
changeset 27 de1630741fbe
parent 25 76a2435edfd4
child 28 3fad710701f2
child 31 2a11b5b00470
equal deleted inserted replaced
25:76a2435edfd4 27:de1630741fbe
     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:
       
    15 *
       
    16 */
       
    17 #ifndef LOGSMESSAGE_H
       
    18 #define LOGSMESSAGE_H
       
    19 
       
    20 
       
    21 #include <QObject>
       
    22 #include <logsexport.h>
       
    23 
       
    24 #include "logsevent.h"
       
    25 
       
    26 class XQServiceRequest;
       
    27 
       
    28 /**
       
    29  * LogsMessage can be used to send message.
       
    30  */
       
    31 class LogsMessage : public QObject 
       
    32 {
       
    33     Q_OBJECT
       
    34     
       
    35 public: 
       
    36  		
       
    37     explicit LogsMessage(LogsEvent& aEvent);
       
    38     explicit LogsMessage(unsigned int contactId, const QString& number, const QString& displayName);
       
    39     LOGSENGINE_EXPORT ~LogsMessage();
       
    40     
       
    41     LOGSENGINE_EXPORT static bool sendMessageToNumber(
       
    42             const QString& number, const QString& displayName = QString(), unsigned int contactId = 0);
       
    43     
       
    44     bool isMessagingAllowed();
       
    45     
       
    46 public slots:
       
    47 
       
    48     /**
       
    49      * Send message
       
    50      * @return true if sent succesfully
       
    51      */
       
    52     LOGSENGINE_EXPORT bool sendMessage();
       
    53     
       
    54 protected slots:
       
    55     void requestCompleted(const QVariant& value);
       
    56     void requestError(int err);    
       
    57 
       
    58 private:
       
    59     static bool doSendMessageToNumber(
       
    60             XQServiceRequest& request, const QString& number, 
       
    61             const QString& displayName, unsigned int contactId);
       
    62     
       
    63 private: //data 
       
    64     
       
    65     bool mIsAllowed;
       
    66     QString mNumber;
       
    67     unsigned int mContactId;
       
    68     QString mDisplayName;
       
    69     XQServiceRequest* mService;
       
    70 private:
       
    71     friend class UT_LogsMessage;
       
    72     
       
    73 };
       
    74                   
       
    75 #endif // LOGSMESSAGE_H