phoneplugins/csplugin/tsrc/automaticanswertest/automaticanswertest.cpp
branchRCL_3
changeset 61 41a7f70b3818
equal deleted inserted replaced
58:40a3f856b14d 61:41a7f70b3818
       
     1 
       
     2 #include <hbaction.h>
       
     3 #include <hbmenu.h>
       
     4 #include <hbpushbutton.h>
       
     5 #include <qgraphicslinearlayout.h>
       
     6 #include <QDebug>
       
     7 #include "etelincomingcallmonitor.h"
       
     8 #include "automaticanswertest.h"
       
     9 
       
    10 
       
    11 automaticanswertest::automaticanswertest(QGraphicsItem *parent)
       
    12     : HbView(parent), m_incomingVoiceCallMonitor(NULL)
       
    13 {
       
    14     qDebug () << "automaticanswertest::automaticanswertest<<";
       
    15     setTitle(tr("automaticanswer"));
       
    16 
       
    17     // Add menu item for automatic answer
       
    18     /*   connect(
       
    19            menu()->addAction("start automatic answer"), SIGNAL(triggered()), 
       
    20            this, SLOT(answer()));*/
       
    21 
       
    22     createContent();
       
    23     qDebug () << "automaticanswertest::automaticanswertest>>";
       
    24 }
       
    25 
       
    26 automaticanswertest::~automaticanswertest()
       
    27 {
       
    28     delete m_incomingVoiceCallMonitor;
       
    29 }
       
    30 
       
    31 void automaticanswertest::createContent()
       
    32 {
       
    33     qDebug () << "automaticanswertest::createContent<<";
       
    34     QGraphicsLinearLayout *mainLayout = new QGraphicsLinearLayout(Qt::Vertical);
       
    35     
       
    36     answering = new HbPushButton(tr("start autom. answer"), this); 
       
    37     connect(answering, SIGNAL(clicked()), this, SLOT(answer()));
       
    38     mainLayout->addItem(answering);
       
    39     stopanswering = new HbPushButton(tr("stop autom. answer"), this); 
       
    40     connect(stopanswering, SIGNAL(clicked()), this, SLOT(stopanswer()));
       
    41     mainLayout->addItem(stopanswering);
       
    42     stopanswering->setEnabled(false); 
       
    43     setLayout(mainLayout);
       
    44 }
       
    45 
       
    46 void automaticanswertest::answer()
       
    47     {
       
    48     qDebug () << "automaticanswertest::answer()<<";
       
    49     if (m_incomingVoiceCallMonitor == NULL)
       
    50         {
       
    51         // Create and start incoming voice call monitor for primary line
       
    52         m_incomingVoiceCallMonitor = new CEtelIncomingCallMonitor();
       
    53         m_incomingVoiceCallMonitor->StartMonitoring();
       
    54         qDebug () << "automaticanswertest::answer()__etelmonitor__started";
       
    55         }
       
    56     else
       
    57         {
       
    58         m_incomingVoiceCallMonitor->StartMonitoring();
       
    59         }
       
    60     stopanswering->setEnabled(true);
       
    61     answering->setEnabled(false);
       
    62     }
       
    63 void automaticanswertest::stopanswer()
       
    64     {
       
    65     if (m_incomingVoiceCallMonitor)
       
    66         {
       
    67         m_incomingVoiceCallMonitor->Cancel();
       
    68         }
       
    69     stopanswering->setEnabled(false);
       
    70     answering->setEnabled(true);    
       
    71     }
       
    72