phoneuis/bubblemanager2/bubblecore/src/bubbleheader.cpp
changeset 37 ba76fc04e6c2
child 51 f39ed5e045e0
equal deleted inserted replaced
36:2eacb6118286 37:ba76fc04e6c2
       
     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:  Container for call data.
       
    15 *
       
    16 */
       
    17 
       
    18 #include "bubbleheader.h"
       
    19 
       
    20 BubbleHeader::BubbleHeader()
       
    21 {
       
    22     reset();
       
    23 }
       
    24 
       
    25 BubbleHeader::~BubbleHeader()
       
    26 {
       
    27 }
       
    28 
       
    29 void BubbleHeader::reset()
       
    30 {
       
    31     mIsUsed = false;
       
    32     mCallState = BubbleManager::None;
       
    33     mNumberType = BubbleManager::NotSet;
       
    34     mCallFlags = 0;
       
    35     mText.clear();
       
    36     mCli.clear();
       
    37     mTimerCost.clear();
       
    38     mSecondaryCli.clear();
       
    39     mActions.clear();
       
    40     mTextClip = Qt::ElideNone;
       
    41     mSecondaryCliClip = Qt::ElideNone;
       
    42     mCliClip = Qt::ElideNone;
       
    43     mCallImage.clear();
       
    44     mIsInConference = false;
       
    45     mExpandAction = 0;
       
    46     mShowDefaultAvatar = false;
       
    47 }
       
    48 
       
    49 void BubbleHeader::setIsUsed( bool used )
       
    50 {
       
    51     mIsUsed = used;
       
    52 }
       
    53 
       
    54 bool BubbleHeader::isUsed() const
       
    55 {
       
    56     return mIsUsed;
       
    57 }
       
    58 
       
    59 void BubbleHeader::setBubbleId( int bubbleId )
       
    60 {
       
    61     mBubbleId = bubbleId;   
       
    62 }
       
    63 
       
    64 int BubbleHeader::bubbleId() const
       
    65 {
       
    66     return mBubbleId;
       
    67 }
       
    68 
       
    69 void BubbleHeader::setCallState( BubbleManager::PhoneCallState state )
       
    70 {
       
    71     if (state == BubbleManager::Disconnected) {
       
    72         if ( mCallState == BubbleManager::Waiting ||
       
    73              mCallState == BubbleManager::Incoming ||
       
    74              mCallState == BubbleManager::Alerting ||
       
    75              mCallState == BubbleManager::Outgoing ||
       
    76              mCallState == BubbleManager::AlertToDisconnected ) {
       
    77             mCallState = BubbleManager::AlertToDisconnected;
       
    78             return;
       
    79             }
       
    80         }
       
    81 
       
    82     mCallState = state;
       
    83 }
       
    84 
       
    85 BubbleManager::PhoneCallState BubbleHeader::callState() const
       
    86 {
       
    87     return mCallState;
       
    88 }
       
    89 
       
    90 void BubbleHeader::setCallFlags( int flags )
       
    91 {
       
    92     mCallFlags = flags;
       
    93 }
       
    94 
       
    95 void BubbleHeader::setCallFlag( BubbleManager::PhoneCallFlags flag )
       
    96 {
       
    97     if ( flag == BubbleManager::Normal ) {
       
    98         mCallFlags = 0;
       
    99         return;
       
   100     }
       
   101     
       
   102     mCallFlags |= flag;
       
   103 }
       
   104 
       
   105 void BubbleHeader::removeCallFlag( BubbleManager::PhoneCallFlags flag )
       
   106 {
       
   107     if ( flag == BubbleManager::Normal ) {
       
   108         return;
       
   109     }
       
   110     
       
   111     mCallFlags &= ~flag;
       
   112 }
       
   113 
       
   114 int BubbleHeader::callFlags() const
       
   115 {
       
   116     return mCallFlags;
       
   117 }
       
   118 
       
   119 void BubbleHeader::setNumberType( BubbleManager::PhoneNumberType numberType )
       
   120 {
       
   121     mNumberType = numberType;
       
   122 }
       
   123 
       
   124 BubbleManager::PhoneNumberType BubbleHeader::numberType() const
       
   125 {
       
   126     return mNumberType;
       
   127 }
       
   128 
       
   129 void BubbleHeader::setText( 
       
   130     const QString& text,
       
   131     Qt::TextElideMode clip )
       
   132 {
       
   133     mText = text;
       
   134     mTextClip = clip;
       
   135 }
       
   136 
       
   137 const QString& BubbleHeader::text() const
       
   138 {
       
   139     return mText;
       
   140 }
       
   141 
       
   142 Qt::TextElideMode BubbleHeader::textClipDirection() const
       
   143 {
       
   144     return mTextClip;
       
   145 }
       
   146 
       
   147 void BubbleHeader::setCli( 
       
   148     const QString& cli, 
       
   149     Qt::TextElideMode clip )
       
   150 {
       
   151     mCli = cli;
       
   152     mCliClip = clip;
       
   153 }
       
   154 
       
   155 const QString& BubbleHeader::cli() const
       
   156 {
       
   157     return mCli;
       
   158 }
       
   159 
       
   160 Qt::TextElideMode BubbleHeader::cliClipDirection() const
       
   161 {
       
   162     return mCliClip;
       
   163 }
       
   164 
       
   165 void BubbleHeader::setSecondaryCli( 
       
   166     const QString& cli, 
       
   167     Qt::TextElideMode clip )
       
   168 {
       
   169     mSecondaryCli = cli;
       
   170     mSecondaryCliClip = clip;
       
   171 }
       
   172 
       
   173 const QString& BubbleHeader::secondaryCli() const
       
   174 {
       
   175     return mSecondaryCli;
       
   176 }
       
   177 
       
   178 Qt::TextElideMode BubbleHeader::secondaryCliClipDirection() const
       
   179 {
       
   180     return mSecondaryCliClip;
       
   181 }
       
   182 
       
   183 void BubbleHeader::setTimerCost( 
       
   184     const QString& timerCost )
       
   185 {
       
   186     mTimerCost = timerCost;
       
   187 }
       
   188 
       
   189 const QString& BubbleHeader::timerCost() const
       
   190 {
       
   191     return mTimerCost;
       
   192 }
       
   193 
       
   194 void BubbleHeader::setCallImage( const QString& image )
       
   195 {
       
   196     mCallImage = image;
       
   197 }
       
   198 
       
   199 const QString& BubbleHeader::callImage() const
       
   200 {
       
   201     return mCallImage;
       
   202 }
       
   203 
       
   204 void BubbleHeader::setShowDefaultAvatar(bool show)
       
   205 {
       
   206     mShowDefaultAvatar = show;
       
   207 }
       
   208 
       
   209 bool BubbleHeader::showDefaultAvatar() const
       
   210 {
       
   211     return mShowDefaultAvatar;
       
   212 }
       
   213 
       
   214 void BubbleHeader::addAction ( HbAction* action )
       
   215 {
       
   216     mActions.append( action );
       
   217 }
       
   218 
       
   219 const QList<HbAction*>& BubbleHeader::actions() const
       
   220 {
       
   221     return mActions;    
       
   222 }
       
   223 
       
   224 void BubbleHeader::clearActions()
       
   225 {
       
   226     mActions.clear();
       
   227 }
       
   228 
       
   229 bool BubbleHeader::isConference() const
       
   230 {
       
   231     return false;
       
   232 }
       
   233 
       
   234 void BubbleHeader::setInConference( bool inConference )
       
   235 {
       
   236     mIsInConference = inConference;
       
   237 }
       
   238 
       
   239 bool BubbleHeader::isInConference() const
       
   240 {
       
   241     return mIsInConference;
       
   242 }
       
   243 
       
   244 void BubbleHeader::setExpandAction( HbAction* action )
       
   245 {
       
   246     mExpandAction = action;
       
   247 }
       
   248 
       
   249 HbAction* BubbleHeader::expandAction() const
       
   250 {
       
   251     return mExpandAction;
       
   252 }