85 } |
85 } |
86 |
86 |
87 iEdwinUtils = CMIDEdwinUtils::NewL(this, iDecimalSeparator); |
87 iEdwinUtils = CMIDEdwinUtils::NewL(this, iDecimalSeparator); |
88 |
88 |
89 iConstraints = aConstraints; |
89 iConstraints = aConstraints; |
90 |
90 iLastCountLine = 0; |
91 // if text is invalid according to constraints, throw IllegalArgumentException, |
91 // if text is invalid according to constraints, throw IllegalArgumentException, |
92 // except for a PHONENUMBER which only has the invalid characters removed |
92 // except for a PHONENUMBER which only has the invalid characters removed |
93 if ((iConstraints & MMIDTextField::EConstraintMask) != MMIDTextField::EPhoneNumber |
93 if ((iConstraints & MMIDTextField::EConstraintMask) != MMIDTextField::EPhoneNumber |
94 && !iEdwinUtils->ConstraintsValidForText(aText,iConstraints,ETrue)) |
94 && !iEdwinUtils->ConstraintsValidForText(aText,iConstraints,ETrue)) |
95 { |
95 { |
454 |
454 |
455 void CMIDTextBoxQueryDialog::FocusChanged(TDrawNow aDrawNow) |
455 void CMIDTextBoxQueryDialog::FocusChanged(TDrawNow aDrawNow) |
456 { |
456 { |
457 CAknTextQueryDialog::FocusChanged(aDrawNow); |
457 CAknTextQueryDialog::FocusChanged(aDrawNow); |
458 TBool isFocused = IsFocused(); |
458 TBool isFocused = IsFocused(); |
|
459 SetRightScrollBarPosition(); |
459 } |
460 } |
460 // |
461 // |
461 // We do not want to become visible if we are not showing |
462 // We do not want to become visible if we are not showing |
462 // |
463 // |
463 void CMIDTextBoxQueryDialog::MakeVisible(TBool aVisible) |
464 void CMIDTextBoxQueryDialog::MakeVisible(TBool aVisible) |
481 void CMIDTextBoxQueryDialog::SizeChanged() |
482 void CMIDTextBoxQueryDialog::SizeChanged() |
482 { |
483 { |
483 if (iShowing) |
484 if (iShowing) |
484 { |
485 { |
485 CAknTextQueryDialog::SizeChanged(); |
486 CAknTextQueryDialog::SizeChanged(); |
|
487 } |
|
488 if (iEditor && iEditor->ScrollBarFrame() && iEditor->ScrollBarFrame()->VerticalScrollBar()) |
|
489 { |
|
490 iEditorRect = iEditor->Rect(); |
|
491 iEditorRect.SetWidth(iEditorRect.Width() - iEditor->ScrollBarFrame()->VerticalScrollBar()->Rect().Width()); |
|
492 SetRightScrollBarPosition(); |
486 } |
493 } |
487 } |
494 } |
488 |
495 |
489 TKeyResponse CMIDTextBoxQueryDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) |
496 TKeyResponse CMIDTextBoxQueryDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) |
490 { |
497 { |
951 // if there were any modifications the text is updated |
958 // if there were any modifications the text is updated |
952 if (textChanged) |
959 if (textChanged) |
953 { |
960 { |
954 iEditor->HandleTextChangedL(); |
961 iEditor->HandleTextChangedL(); |
955 } |
962 } |
|
963 if (iEditor && iEditor->TextLayout()) |
|
964 { |
|
965 if (iLastCountLine != iEditor->TextLayout()->GetLineNumber(iEditor->TextLength() - 1)) |
|
966 { |
|
967 iLastCountLine = iEditor->TextLayout()->GetLineNumber(iEditor->TextLength() - 1); |
|
968 SetRightScrollBarPosition(); |
|
969 } |
|
970 } |
956 } |
971 } |
957 } |
972 } |
958 |
973 |
959 void CMIDTextBoxQueryDialog::GetCaptionForFep(TDes& aCaption) const |
974 void CMIDTextBoxQueryDialog::GetCaptionForFep(TDes& aCaption) const |
960 { |
975 { |
1306 /** |
1321 /** |
1307 Creates and adds new command to edwin based on shot & long label resource ids |
1322 Creates and adds new command to edwin based on shot & long label resource ids |
1308 and other parameters. |
1323 and other parameters. |
1309 */ |
1324 */ |
1310 void CMIDTextBoxQueryDialog::AddCommandToEdwinL(TInt aCommandResIdShort, |
1325 void CMIDTextBoxQueryDialog::AddCommandToEdwinL(TInt aCommandResIdShort, |
1311 TInt aCommandResIdLong, |
1326 TInt aCommandResIdLong, |
1312 TInt aCommandId) |
1327 TInt aCommandId) |
1313 { |
1328 { |
1314 TBuf<64> shortLabel; |
1329 TBuf<64> shortLabel; |
1315 iEikonEnv->ReadResourceL(shortLabel, aCommandResIdShort); |
1330 iEikonEnv->ReadResourceL(shortLabel, aCommandResIdShort); |
1316 TBuf<64> longLabel; |
1331 TBuf<64> longLabel; |
1317 iEikonEnv->ReadResourceL(longLabel, aCommandResIdLong); |
1332 iEikonEnv->ReadResourceL(longLabel, aCommandResIdLong); |
1327 |
1342 |
1328 /** |
1343 /** |
1329 Creates and adds new command to edwin, short label is the same as long label. |
1344 Creates and adds new command to edwin, short label is the same as long label. |
1330 */ |
1345 */ |
1331 void CMIDTextBoxQueryDialog::AddCommandToEdwinL(TInt aCommandResId, |
1346 void CMIDTextBoxQueryDialog::AddCommandToEdwinL(TInt aCommandResId, |
1332 TInt aCommandId) |
1347 TInt aCommandId) |
1333 { |
1348 { |
1334 AddCommandToEdwinL(aCommandResId, aCommandResId, aCommandId); |
1349 AddCommandToEdwinL(aCommandResId, aCommandResId, aCommandId); |
1335 } |
1350 } |
1336 |
1351 |
1337 /** This method is called from the destructor and removes |
1352 /** This method is called from the destructor and removes |
1429 } |
1444 } |
1430 } |
1445 } |
1431 |
1446 |
1432 TTypeUid::Ptr CMIDTextBoxQueryDialog::MopSupplyObject(TTypeUid aId) |
1447 TTypeUid::Ptr CMIDTextBoxQueryDialog::MopSupplyObject(TTypeUid aId) |
1433 { |
1448 { |
|
1449 TTypeUid::Ptr ret = TTypeUid::Null(); |
|
1450 |
1434 if (aId.iUid == CEikMenuBar::ETypeId) |
1451 if (aId.iUid == CEikMenuBar::ETypeId) |
1435 { |
1452 { |
1436 if (iDisplayable && iDisplayable->MenuHandler()) |
1453 if (iDisplayable && iDisplayable->MenuHandler()) |
1437 { |
1454 { |
1438 return SupplyMopObject(aId, |
1455 // number of all commands |
1439 iDisplayable->MenuHandler()->Cba(), |
1456 TInt numberOfCommands = iDisplayable->CommandCount(); |
1440 iDisplayable->MenuHandler()->MenuBar()); |
1457 |
1441 } |
1458 // If there are no commands we should not call SupplyMopObject |
1442 } |
1459 if (numberOfCommands > 0) |
1443 return CAknTextQueryDialog::MopSupplyObject(aId); |
1460 { |
1444 } |
1461 ret = SupplyMopObject(aId, |
1445 |
1462 iDisplayable->MenuHandler()->Cba(), |
|
1463 iDisplayable->MenuHandler()->MenuBar()); |
|
1464 } |
|
1465 } |
|
1466 } |
|
1467 |
|
1468 if (!ret.Pointer()) |
|
1469 { |
|
1470 ret = CAknTextQueryDialog::MopSupplyObject(aId); |
|
1471 } |
|
1472 return ret; |
|
1473 } |
|
1474 |
|
1475 /* HandleResourceChange |
|
1476 * |
|
1477 * This method is called after a resource change event, for example after |
|
1478 * screen dynamic resolution change. |
|
1479 */ |
|
1480 void CMIDTextBoxQueryDialog::HandleResourceChange(TInt aType) |
|
1481 { |
|
1482 CAknTextQueryDialog::HandleResourceChange(aType); |
|
1483 if (aType == KEikDynamicLayoutVariantSwitch || |
|
1484 aType == KEikColorResourceChange || aType == KAknsMessageSkinChange || |
|
1485 aType == KUidValueCoeColorSchemeChangeEvent) |
|
1486 { |
|
1487 SetRightScrollBarPosition(); |
|
1488 } |
|
1489 |
|
1490 } |
|
1491 |
|
1492 void CMIDTextBoxQueryDialog::SetRightScrollBarPosition() |
|
1493 { |
|
1494 if (iEditor) |
|
1495 { |
|
1496 iEditor->SetRect(iEditorRect); |
|
1497 } |
|
1498 } |
1446 // End of file |
1499 // End of file |