Item
{
- id: root
- anchors.fill: parent
- property variant call: null
-
- state: 'disconnected'
- onStateChanged: {
- console.log("*** STATE IS now >> " + root.state);
- }
-
- onCallChanged: {
- if(call) {
- largeView.call = call;
- console.log("*** QML *** :: CALL ITEM CHANGED, STATE: " + call.state);
- root.state = call.state;
-
- if (call.stateChanged)
- {
- call.stateChanged.connect(function(state) {
- console.log("*** QML *** :: CALL ITEM STATE CHANGED: " + state);
- console.log("");
-
- root.state = state;
- });
- }
- else
- {
- console.log("*** call.stateChanged doesn't exist.. setting state to disconnect");
- // root.state = 'disconnected';
- }
- }
- else
- console.log("*** call doesn't exist.. setting to disconnect");
- //root.state = 'disconnected';
- }
-
- states {
- State {
- name: 'active'
- PropertyChanges {target: root; visible: true}
- }
-
- State {
- name: 'held'
- PropertyChanges {target: root; visible: true}
- }
+ id: root
+ anchors.fill: parent
+ property variant call: null
- State {
- name: 'dialing'
- PropertyChanges {target: root; visible: true}
+ state: 'disconnected'
+ onStateChanged: {
+ console.log("*** STATE IS now >> " + root.state);
}
-
- State {
- name: 'alerting'
- PropertyChanges {target: root; visible: true}
- }
-
- State {
- name: 'incoming'
- PropertyChanges {target: root; visible: true}
+ Connections {
+ target: adapter
+ onCallCountChanged: {
+ if (callCount <= 0)
+ root.state = 'disconnected'
+ }
}
-
- State {
- name: 'waiting'
- PropertyChanges {target: root; visible: true}
+ onCallChanged: {
+ if(call) {
+ largeView.call = call;
+ console.log("*** QML *** :: CALL ITEM CHANGED, STATE: " + call.state);
+ root.state = call.state;
+
+ if (call.stateChanged)
+ {
+ call.stateChanged.connect(function(state) {
+ console.log("*** QML *** :: CALL ITEM STATE CHANGED: " + state);
+ console.log("");
+
+ root.state = state;
+ });
+ }
+ }
}
- State {
- name: 'disconnected'
- PropertyChanges {target: root; visible: false}
+ states {
+ State {
+ name: 'active'
+ PropertyChanges {target: root; visible: true}
+ }
+
+ State {
+ name: 'held'
+ PropertyChanges {target: root; visible: true}
+ }
+
+ State {
+ name: 'dialing'
+ PropertyChanges {target: root; visible: true}
+ }
+
+ State {
+ name: 'alerting'
+ PropertyChanges {target: root; visible: true}
+ }
+
+ State {
+ name: 'incoming'
+ PropertyChanges {target: root; visible: true}
+ }
+
+ State {
+ name: 'waiting'
+ PropertyChanges {target: root; visible: true}
+ }
+
+ State {
+ name: 'disconnected'
+ PropertyChanges {target: root; visible: false}
+ }
}
- }
- Rectangle
- {
- id: background
- anchors {top: parent.top; left: parent.left; right: parent.right; bottom: parent.bottom; topMargin: parent.height / 4; bottomMargin: parent.height / 5}
-
- gradient: Gradient {
- GradientStop {position: 0.0; color: '#4f4f4f'}
- GradientStop {position: 1.0; color: '#000000'}
- }
-
- CallItemViewLarge
+ Rectangle
{
- id: largeView
- call: root.call //parent.call
- state: root.state //parent.state
+ id: background
+ anchors {top: parent.top; left: parent.left; right: parent.right; bottom: parent.bottom; topMargin: parent.height / 4; bottomMargin: parent.height / 5}
+
+ gradient: Gradient {
+ GradientStop {position: 0.0; color: '#4f4f4f'}
+ GradientStop {position: 1.0; color: '#000000'}
+ }
+
+ CallItemViewLarge
+ {
+ id: largeView
+ call: root.call //parent.call
+ state: root.state //parent.state
+ }
}
}
-}
this->connectAll();
connect(ManagerProxy::instance(), SIGNAL(callManagerChanged()), SLOT(onCallManagerChanged()));
+ connect(cm, SIGNAL(callCountChanged()), SIGNAL(callCountChanged(cm->callCount())));
if(cm && cm->activeCall()) d->currentCall = new QMLCallItem(cm->activeCall(), this);
}
return d->currentCall;
}
+int QMLDialer::callCount()
+{
+ TRACE;
+ CallManager *cm = ManagerProxy::instance()->callManager();
+ return cm->callCount();
+}
+
+
void QMLDialer::dial(const QString &msisdn)
{
TRACE;
{
delete d->currentCall;
d->currentCall = NULL;
+ emit callCountChanged(cm->callCount());
}
+
}
void QMLDialer::onIncomingCall(CallItem *callitem)
Q_PROPERTY(QString mailbox READ mailbox WRITE setMailbox);
Q_PROPERTY(QMLCallItem* currentCall READ currentCall);
Q_PROPERTY(bool modemOnline READ modemOnline WRITE setModemOnline);
+ Q_PROPERTY(int callCount READ callCount NOTIFY callCountChanged);
public:
explicit QMLDialer(QObject *parent = 0);
QString mailbox () const;
QMLCallItem* currentCall () const;
bool modemOnline ();
+ int callCount ();
Q_SIGNALS:
void incomingCall();
void outgoingCall();
+ void callCountChanged(int callCount);
public Q_SLOTS:
void setMailbox(const QString &number);