[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [sflphone-kde] src: [ #13266 ] Fix invalid recording in history calls
From:       Emmanuel Lepage Vallee <emmanuel.lepage () savoirfairelinux ! com>
Date:       2012-07-30 21:36:41
Message-ID: 20120730213641.9783BA6094 () git ! kde ! org
[Download RAW message or body]

Git commit b9ef2b03b3a99c84b6e4450e6075801d8ba526e9 by Emmanuel Lepage Vallee.
Committed on 30/07/2012 at 23:36.
Pushed by lepagevalleeemmanuel into branch 'master'.

[ #13266 ] Fix invalid recording in history calls

M  +10   -1    src/lib/call.cpp
M  +1    -0    src/lib/call.h
M  +8    -0    src/lib/callmodel.cpp
M  +1    -0    src/lib/callmodel.h
M  +4    -2    src/widgets/historytreeitem.cpp

http://commits.kde.org/sflphone-kde/b9ef2b03b3a99c84b6e4450e6075801d8ba526e9

diff --git a/src/lib/call.cpp b/src/lib/call.cpp
index fb406f3..d894582 100644
--- a/src/lib/call.cpp
+++ b/src/lib/call.cpp
@@ -20,6 +20,9 @@
 //Parent
 #include "call.h"
 
+//Qt
+#include <QFile>
+
 //SFLPhone library
 #include "callmanager_interface_singleton.h"
 #include "configurationmanager_interface_singleton.h"
@@ -435,6 +438,12 @@ const QString Call::getFormattedName()
       return m_PeerPhoneNumber;
 }
 
+///If the call have a valid record
+bool Call::hasRecording()                   const
+{
+   return !getRecordingPath().isEmpty() && QFile::exists(getRecordingPath());
+}
+
 ///Get the current state
 call_state Call::getCurrentState()          const
 {
@@ -450,7 +459,7 @@ bool Call::getRecording()                   const
 }
 
 ///Get the call account id
-Account* Call::getAccount()           const
+Account* Call::getAccount()                 const
 {
    return AccountList::getInstance()->getAccountById(m_Account);
 }
diff --git a/src/lib/call.h b/src/lib/call.h
index ce67bf6..d3444f6 100644
--- a/src/lib/call.h
+++ b/src/lib/call.h
@@ -150,6 +150,7 @@ public:
    Contact*             getContact          ()      ;
    VideoRenderer*       getVideoRenderer    ()      ;
    const QString        getFormattedName    ()      ;
+   bool                 hasRecording        () const;
 
    //Automated function
    call_state stateChanged(const QString & newState);
diff --git a/src/lib/callmodel.cpp b/src/lib/callmodel.cpp
index 9915317..69b0d3c 100644
--- a/src/lib/callmodel.cpp
+++ b/src/lib/callmodel.cpp
@@ -43,6 +43,7 @@ CallModelBase::CallModelBase(QObject* parent) : QObject(parent)
       /**/connect(&callManager, SIGNAL(conferenceRemoved(QString))              , this , \
                SLOT(conferenceRemovedSlot(QString))      );
       /**/connect(&callManager, SIGNAL(voiceMailNotify(QString,int))            , this , \
                SLOT(voiceMailNotifySlot(QString,int))    );
       /**/connect(&callManager, SIGNAL(volumeChanged(QString,double))           , this , \
SLOT(volumeChangedSlot(QString,double))   ); +      /**/connect(&callManager, \
SIGNAL(recordPlaybackFilepath(QString,QString)) , this , SLOT(newRecordingAvail(QString,QString))  );  \
                #ifdef ENABLE_VIDEO
       /**/connect(&interface  , SIGNAL(startedDecoding(QString,QString,int,int)), this , \
                SLOT(startedDecoding(QString,QString))    );
       /**/connect(&interface  , SIGNAL(stoppedDecoding(QString,QString))        , this , \
SLOT(stoppedDecoding(QString,QString))    ); @@ -181,6 +182,13 @@ void \
CallModelBase::removeActiveCall(Call* call)  //m_sActiveCalls[call->getCallId()] = nullptr;
 }
 
+///Make the call aware it has a recording
+void CallModelBase::newRecordingAvail( const QString& callId, const QString& filePath)
+{
+   Call* call = getCall(callId);
+   call->setRecordingPath(filePath);
+}
+
 #ifdef ENABLE_VIDEO
 ///Updating call state when video is added
 void CallModelBase::startedDecoding(const QString& callId, const QString& shmKey  )
diff --git a/src/lib/callmodel.h b/src/lib/callmodel.h
index ba10189..a446d3b 100644
--- a/src/lib/callmodel.h
+++ b/src/lib/callmodel.h
@@ -66,6 +66,7 @@ private slots:
    void volumeChangedSlot     ( const QString& device    , double value           );
    void removeActiveCall      ( Call* call                                        );
    void addPrivateCall        ( Call* call                                        );
+   void newRecordingAvail     ( const QString& callId    , const QString& filePath);
    #ifdef ENABLE_VIDEO
    void startedDecoding       ( const QString& callId    , const QString& shmKey  );
    void stoppedDecoding       ( const QString& callId    , const QString& shmKey  );
diff --git a/src/widgets/historytreeitem.cpp b/src/widgets/historytreeitem.cpp
index 0056582..7fe65fe 100644
--- a/src/widgets/historytreeitem.cpp
+++ b/src/widgets/historytreeitem.cpp
@@ -337,6 +337,8 @@ void HistoryTreeItem::removeRecording()
    if (ret == KMessageBox::Yes) {
       kDebug() << "Deleting file";
       QFile::remove(m_pItemCall->getRecordingPath());
+      m_pPlay->setVisible(false);
+      m_pRemove->setVisible(false);
    }
 }
 
@@ -580,7 +582,7 @@ bool HistoryTreeItem::getContactInfo(QString phoneNumber)
       m_pPeerNameL->setText("<b>"+m_Name+"</b>");
    }
 
-   if (m_pItemCall && !m_pItemCall->getRecordingPath().isEmpty()) {
+   if (m_pItemCall && m_pItemCall->hasRecording()) {
       QPainter painter(&pxm);
       QPixmap status(KStandardDirs::locate("data","sflphone-client-kde/voicemail.png"));
       status=status.scaled(QSize(24,24));
@@ -592,7 +594,7 @@ bool HistoryTreeItem::getContactInfo(QString phoneNumber)
       status=status.scaled(QSize(24,24));
       painter.drawPixmap(pxm.width()-status.width(),pxm.height()-status.height(),status);
    }
-      m_pIconL->setPixmap(pxm);
+   m_pIconL->setPixmap(pxm);
 
    return m_pContact;
 } //getContactInfo


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic