146 switchToMsgSettings(data); |
152 switchToMsgSettings(data); |
147 break; |
153 break; |
148 } |
154 } |
149 default: |
155 default: |
150 { |
156 { |
151 HbApplication::quit(); |
157 // if send from editor is successful, then run effects |
152 } |
158 int previousView = data.at(1).toInt(); |
153 } |
159 if(previousView == MsgBaseView::UNIEDITOR) |
|
160 { |
|
161 startAnimation(SEND_EFFECT); |
|
162 } |
|
163 else |
|
164 { |
|
165 HbApplication::quit(); |
|
166 } |
|
167 } |
|
168 } |
154 } |
169 } |
155 |
170 |
156 //---------------------------------------------------------------------------- |
171 //---------------------------------------------------------------------------- |
157 // MsgServiceViewManager::send |
172 // MsgServiceViewManager::send |
158 // @see header |
173 // @see header |
159 //---------------------------------------------------------------------------- |
174 //---------------------------------------------------------------------------- |
160 void MsgServiceViewManager::send(const QString phoneNumber, |
175 void MsgServiceViewManager::send(const QString phoneNumber, |
161 const qint32 contactId, |
176 const qint32 contactId, |
162 const QString displayName) |
177 const QString displayName) |
163 { |
178 { |
|
179 Q_UNUSED(contactId); |
164 ConvergedMessage message; |
180 ConvergedMessage message; |
165 ConvergedMessageAddress address; |
181 ConvergedMessageAddress address; |
166 address.setAddress(phoneNumber); |
182 address.setAddress(phoneNumber); |
167 address.setAlias(displayName); |
183 address.setAlias(displayName); |
168 message.addToRecipient(address); |
184 message.addToRecipient(address); |
555 |
571 |
556 // close the application once its handled |
572 // close the application once its handled |
557 HbApplication::quit(); |
573 HbApplication::quit(); |
558 } |
574 } |
559 |
575 |
|
576 //----------------------------------------------------------------------------- |
|
577 //MsgServiceViewManager::startAnimation |
|
578 //@see header |
|
579 //----------------------------------------------------------------------------- |
|
580 void MsgServiceViewManager::startAnimation(QString effectEvent) |
|
581 { |
|
582 // take screen shot |
|
583 QGraphicsPixmapItem *animationScreenShot = screenShot(); |
|
584 if (animationScreenShot) |
|
585 { |
|
586 // but don't show it yet. |
|
587 animationScreenShot->hide(); |
|
588 animationScreenShot->setPos(0,0); |
|
589 animationScreenShot->setZValue(0); |
|
590 |
|
591 // hide items, so that background app's items are visible immediately |
|
592 mMainWindow->currentView()->hideItems(Hb::AllItems); |
|
593 |
|
594 // reset background & set the base transparent |
|
595 mMainWindow->setBackgroundImageName( |
|
596 mMainWindow->orientation(), QString("dummy_blank")); |
|
597 QPalette p = mMainWindow->viewport()->palette(); |
|
598 p.setColor(QPalette::Base, Qt::transparent); |
|
599 mMainWindow->viewport()->setPalette(p); |
|
600 |
|
601 // add animating item directly to the scene |
|
602 mMainWindow->scene()->addItem(animationScreenShot); |
|
603 |
|
604 // hide other views |
|
605 QList<HbView*> vws = mMainWindow->views(); |
|
606 while (!vws.isEmpty()) |
|
607 { |
|
608 HbView* view = vws.takeLast(); |
|
609 view->hide(); |
|
610 } |
|
611 |
|
612 // now show the animating item, and start animation on it |
|
613 animationScreenShot->show(); |
|
614 QString effectFile = getAnimationFile(effectEvent); |
|
615 HbEffect::add(animationScreenShot, effectFile, effectEvent); |
|
616 HbEffect::start(animationScreenShot, effectEvent, this, |
|
617 "onAnimationComplete"); |
|
618 } |
|
619 } |
|
620 |
|
621 //----------------------------------------------------------------------------- |
|
622 //MsgServiceViewManager::resetAnimation |
|
623 //@see header |
|
624 //----------------------------------------------------------------------------- |
|
625 void MsgServiceViewManager::resetAnimation( |
|
626 QString effectEvent, |
|
627 QGraphicsItem* item) |
|
628 { |
|
629 if (item) |
|
630 { |
|
631 QString effectFile = getAnimationFile(effectEvent); |
|
632 HbEffect::remove(item, effectFile, effectEvent); |
|
633 mMainWindow->scene()->removeItem(item); |
|
634 delete item; |
|
635 item = NULL; |
|
636 } |
|
637 } |
|
638 |
|
639 //----------------------------------------------------------------------------- |
|
640 //MsgServiceViewManager::onAnimationComplete |
|
641 //@see header |
|
642 //----------------------------------------------------------------------------- |
|
643 void MsgServiceViewManager::onAnimationComplete( |
|
644 const HbEffect::EffectStatus &status) |
|
645 { |
|
646 QGraphicsItem* item = status.item; |
|
647 QString effectEvent = status.effectEvent; |
|
648 resetAnimation(effectEvent, item); |
|
649 HbApplication::quit(); |
|
650 } |
|
651 |
|
652 //----------------------------------------------------------------------------- |
|
653 //MsgServiceViewManager::screenShot |
|
654 //@see header |
|
655 //----------------------------------------------------------------------------- |
|
656 QGraphicsPixmapItem* MsgServiceViewManager::screenShot() |
|
657 { |
|
658 // set fullscreen and hide unwanted items |
|
659 mMainWindow->currentView()->hideItems(Hb::ToolBarItem | Hb::DockWidgetItem | Hb::StatusBarItem); |
|
660 mMainWindow->currentView()->setContentFullScreen(true); |
|
661 |
|
662 // grab whole view into pixmap image |
|
663 QPixmap screenCapture = QPixmap::grabWindow(mMainWindow->internalWinId()); |
|
664 |
|
665 // create an QGraphicsItem to do animation |
|
666 QGraphicsPixmapItem *ret(NULL); |
|
667 |
|
668 // for landscape, the screenshot must be rotated |
|
669 if(mMainWindow->orientation() == Qt::Horizontal) |
|
670 { |
|
671 QMatrix mat; |
|
672 mat.rotate(-90); // rotate 90 degrees counter-clockwise |
|
673 ret = new QGraphicsPixmapItem(screenCapture.transformed(mat)); |
|
674 } |
|
675 else |
|
676 { |
|
677 ret = new QGraphicsPixmapItem(screenCapture); |
|
678 } |
|
679 return ret; |
|
680 } |
|
681 |
|
682 //----------------------------------------------------------------------------- |
|
683 //MsgServiceViewManager::getAnimationFile |
|
684 //@see header |
|
685 //----------------------------------------------------------------------------- |
|
686 QString MsgServiceViewManager::getAnimationFile(QString effectEvent) |
|
687 { |
|
688 QString animFile; |
|
689 if(effectEvent == SEND_EFFECT) |
|
690 { |
|
691 animFile.append(SEND_EFFECT_FILE); |
|
692 } |
|
693 |
|
694 return animFile; |
|
695 } |