~ubuntu-branches/ubuntu/wily/sflphone/wily

« back to all changes in this revision

Viewing changes to kde/src/eventmanager.cpp

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2015-01-07 14:51:16 UTC
  • mfrom: (4.3.5 sid)
  • Revision ID: package-import@ubuntu.com-20150107145116-yxnafinf4lrdvrmx
Tags: 1.4.1-0.1ubuntu1
* Merge with Debian, remaining changes:
 - Drop soprano, nepomuk build-dep
* Drop ubuntu patches, now upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
#include <lib/account.h>
30
30
#include <lib/phonedirectorymodel.h>
31
31
#include <lib/accountlistmodel.h>
 
32
#include <lib/contactmodel.h>
32
33
#include <klib/tipmanager.h>
33
 
#include <klib/akonadibackend.h>
34
34
#include "sflphoneview.h"
35
35
#include "sflphone.h"
36
36
#include "canvasobjectmanager.h"
150
150
      else if (e->mimeData()->hasFormat(MIME_CONTACT)) {
151
151
         const QByteArray encodedContact     = e->mimeData()->data( MIME_CONTACT     );
152
152
         kDebug() << "Contact dropped on empty space";
153
 
         const PhoneNumber* number = KPhoneNumberSelector().getNumber(AkonadiBackend::instance()->getContactByUid(encodedContact));
 
153
         const PhoneNumber* number = KPhoneNumberSelector().getNumber(ContactModel::instance()->getContactByUid(encodedContact));
154
154
         if (number->uri().isEmpty()) {
155
155
            Call* newCall = CallModel::instance()->dialingCall();
156
156
            newCall->setDialNumber(number->uri());
206
206
               (n->account()?n->account():AccountListModel::instance()->currentAccount())->alias()));
207
207
      }
208
208
      else if (e->mimeData()->hasFormat(MIME_CONTACT)) {
209
 
         Contact* c = AkonadiBackend::instance()->getContactByUid(e->mimeData()->data(MIME_CONTACT));
 
209
         Contact* c = ContactModel::instance()->getContactByUid(e->mimeData()->data(MIME_CONTACT));
210
210
         if (c) {
211
211
            TipCollection::removeConference()->setText(i18n("Call %1",c->formattedName()));
212
212
         }
226
226
               (n->account()?n->account():AccountListModel::instance()->currentAccount())->alias()));
227
227
      }
228
228
      else if (e->mimeData()->hasFormat(MIME_CONTACT)) {
229
 
         Contact* c = AkonadiBackend::instance()->getContactByUid(e->mimeData()->data(MIME_CONTACT));
 
229
         Contact* c = ContactModel::instance()->getContactByUid(e->mimeData()->data(MIME_CONTACT));
230
230
         if (c) {
231
231
            TipCollection::removeConference()->setText(i18n("Call %1",c->formattedName()));
232
232
         }
278
278
         break;
279
279
      case QEvent::DragMove:
280
280
         if (viewDragMoveEvent(static_cast<QDragMoveEvent*>(event))) return true;
 
281
         break;
281
282
      case QEvent::DragLeave:
282
283
         m_pParent->m_pCanvasManager->newEvent(CanvasObjectManager::CanvasEvent::DRAG_LEAVE);
 
284
         break;
283
285
   };
284
286
   #pragma GCC diagnostic pop
285
287
   return QObject::eventFilter(obj, event);
300
302
            Call* call = m_pParent->currentCall();
301
303
            if (call->state() == Call::State::DIALING) {
302
304
               call->setDialNumber(n->uri());
303
 
               if (PhoneDirectoryModel::instance()->callWithAccount() && n->account() && n->account()->id() != "IP2IP")
 
305
               if (PhoneDirectoryModel::instance()->callWithAccount()
 
306
                && n->account() && n->account()->id() != Account::ProtocolName::IP2IP)
304
307
                  call->setAccount(n->account());
305
308
               m_pParent->m_pAutoCompletion->reset();
306
309
               call->performAction(Call::Action::ACCEPT);
433
436
         case Call::State::ERROR:
434
437
         case Call::State::INCOMING:
435
438
         case Call::State::DIALING:
 
439
         case Call::State::INITIALIZATION:
436
440
         case Call::State::HOLD:
437
441
         case Call::State::RINGING:
438
442
         case Call::State::CURRENT:
441
445
         case Call::State::OVER:
442
446
         case Call::State::CONFERENCE:
443
447
         case Call::State::CONFERENCE_HOLD:
444
 
         case Call::State::COUNT:
 
448
         case Call::State::__COUNT:
445
449
         default:
446
450
            call->performAction(Call::Action::REFUSE);
447
451
      }
468
472
         case Call::State::HOLD:
469
473
            call->performAction(Call::Action::HOLD);
470
474
            break;
 
475
         case Call::State::INITIALIZATION:
471
476
         case Call::State::RINGING:
472
477
         case Call::State::CURRENT:
473
478
         case Call::State::FAILURE:
476
481
         case Call::State::ERROR:
477
482
         case Call::State::CONFERENCE:
478
483
         case Call::State::CONFERENCE_HOLD:
479
 
         case Call::State::COUNT:
 
484
         case Call::State::__COUNT:
480
485
         default:
481
486
            kDebug() << "Enter when call selected not in appropriate state. Doing nothing.";
482
487
      }
524
529
         m_pParent->m_pCanvasManager->newEvent(CanvasObjectManager::CanvasEvent::CALL_BUSY);
525
530
         SFLPhone::view()->updateWindowCallState();
526
531
         break;
 
532
      case Call::State::INITIALIZATION:
527
533
      case Call::State::TRANSFERRED:
528
534
      case Call::State::TRANSF_HOLD:
529
535
      case Call::State::HOLD:
531
537
      case Call::State::ERROR:
532
538
      case Call::State::CONFERENCE:
533
539
      case Call::State::CONFERENCE_HOLD:
534
 
      case Call::State::COUNT:
 
540
      case Call::State::__COUNT:
535
541
      default:
536
542
         m_pParent->m_pCanvasManager->newEvent(CanvasObjectManager::CanvasEvent::CALL_STATE_CHANGED);
537
543
         kDebug() << "Enter when call selected not in appropriate state. Doing nothing.";
547
553
   }
548
554
}
549
555
 
550
 
void EventManager::slotAutoCompletionVisibility(bool)
 
556
void EventManager::slotAutoCompletionVisibility(bool visible,bool hasCall)
551
557
{
552
 
   m_pParent->m_pCanvasManager->newEvent(CanvasObjectManager::CanvasEvent::CALL_DIALING_CHANGED);
 
558
   Q_UNUSED(visible)
 
559
   Q_UNUSED(hasCall)
 
560
   //Show/Hide the autocompletion widget. This does this way due to legacy reasons
 
561
   if (visible)
 
562
      m_pParent->m_pCanvasManager->newEvent(CanvasObjectManager::CanvasEvent::CALL_DIALING_CHANGED);
 
563
   else if (!hasCall)
 
564
      m_pParent->m_pCanvasManager->newEvent(CanvasObjectManager::CanvasEvent::USER_CANCEL);
 
565
   //The other is handled by call state changed
553
566
}
554
567
 
555
568
void EventManager::slotAccountRegistrationChanged(Account* a,bool reg)