void CAknEcsNote::SetEmergencyNumber( const TDesC& aMatchedNumber ) { TRect screen(iAvkonAppUi->ApplicationRect()); TAknLayoutRect mainPane; mainPane.LayoutRect(screen, AKN_LAYOUT_WINDOW_main_pane(screen, 0, 1, 1)); TAknLayoutRect popupNoteWindow; AknLayoutUtils::TAknCbaLocation cbaLocation( AknLayoutUtils::CbaLocation() ); TInt variety( 0 ); if ( cbaLocation == AknLayoutUtils::EAknCbaLocationRight ) { variety = 5; } else if ( cbaLocation == AknLayoutUtils::EAknCbaLocationLeft ) { variety = 8; } else { variety = 2; } popupNoteWindow.LayoutRect(mainPane.Rect(), AknLayoutScalable_Avkon::popup_note_window( variety )); TAknLayoutText textRect; textRect.LayoutText(popupNoteWindow.Rect(), AKN_LAYOUT_TEXT_Note_pop_up_window_texts_Line_1(4)); // Size of a temporary buffer that contains new lines, spaces and // emergency number for a note. TBuf16<KAknEcsMaxMatchingLength+80> number; number.Append('\n'); number.Append('\n'); TInt spaceCharWidthInPixels = textRect.Font()->CharWidthInPixels(' '); if (spaceCharWidthInPixels < 1) { // Avoid divide by zero situation even the space char would have zero length. spaceCharWidthInPixels = 1; } TInt length = (textRect.TextRect().Width() - textRect.Font()->TextWidthInPixels(aMatchedNumber)) / spaceCharWidthInPixels; const TInt matchedNumberLength = aMatchedNumber.Length(); const TInt numberLength = number.Length(); const TInt numberMaxLength = number.MaxLength(); if ( numberLength + length + matchedNumberLength > numberMaxLength) { // To make sure that buffer overflow does not happen. length = numberMaxLength - numberLength - matchedNumberLength; } for (int i = 0; i < length ; i++) { number.Append(' '); } number.Append(aMatchedNumber); TRAP_IGNORE(SetTextL(number)); }
void DFlatAssignmentVisitor::visitDItem(const DItem *item) { visitDObject(item); auto target = dynamic_cast<DItem *>(m_target); QMT_CHECK(target); target->setVariety(target->variety()); target->setShapeEditable(target->isShapeEditable()); target->setShape(target->shape()); }
void CAknNoteAttributes::CreateProgressBarL() { if (iProgressBar) { return; } TInt numLines = iNoteText->NumberOfLines(); // New parameter added to Wait_or_progress_note_pop_up_window_elements_Line_2 layout API. TInt tIndex = 0; if (numLines == 3) { tIndex = 1; } if (numLines >= 4) { tIndex = 2; } TRect mainPane = iAvkonAppUi->ClientRect(); TAknLayoutRect parent; AknLayoutUtils::TAknCbaLocation cbaLocation( AknLayoutUtils::CbaLocation() ); TInt variety( 0 ); if ( cbaLocation == AknLayoutUtils::EAknCbaLocationRight ) { variety = 3; } else if ( cbaLocation == AknLayoutUtils::EAknCbaLocationLeft ) { variety = 6; } else { variety = 0; } parent.LayoutRect(mainPane, AknLayoutScalable_Avkon::popup_note_wait_window( variety + tIndex )); TAknLayoutRect layRect; layRect.LayoutRect(parent.Rect(), AKN_LAYOUT_WINDOW_Wait_or_progress_note_pop_up_window_elements_Line_2(tIndex)); CEikProgressInfo::SInfo info; info.iHeight = layRect.Rect().Height();//lay.iH; info.iWidth = layRect.Rect().Width();//lay.iW; info.iFinalValue = 1; info.iSplitsInBlock = 0; info.iTextType = EEikProgressTextNone; iProgressBar = new(ELeave) CEikProgressInfo(info); iProgressBar->ConstructL(); TransferToControlL(iProgressBar); InvalidateLayout(); }
void DUpdateVisitor::visitMItem(const MItem *item) { auto ditem = dynamic_cast<DItem *>(m_target); QMT_CHECK(ditem); if (isUpdating(item->isShapeEditable() != ditem->isShapeEditable())) ditem->setShapeEditable(item->isShapeEditable()); if (isUpdating(item->variety() != ditem->variety())) ditem->setVariety(item->variety()); visitMObject(item); }