# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1266612300 -7200 # Node ID 3c271c9e661868ba4b9dd4abe0f63db73685e6b0 # Parent 522cd55cc3d7e8e4a01debfdd18017e5f02c6d70 Revision: 201003 Kit: 201007 diff -r 522cd55cc3d7 -r 3c271c9e6618 basiclocationinfodisplay/blid/engine/src/CBlidLocation.cpp --- a/basiclocationinfodisplay/blid/engine/src/CBlidLocation.cpp Tue Feb 02 00:16:03 2010 +0200 +++ b/basiclocationinfodisplay/blid/engine/src/CBlidLocation.cpp Fri Feb 19 22:45:00 2010 +0200 @@ -302,84 +302,105 @@ iPosStatus = iStatus; iDeviceStatus = EDeviceConnected; - - /// Check if we have satellite data - if(!(iStatus.Int() == KErrNone || - iStatus.Int() == KPositionPartialUpdate) ) - { - iPositionInfo.ClearSatellitesInView(); - } SortSatelliteDataL(); - - switch ( iStatus.Int() ) + + switch (iStatus.Int()) { //case KPositionPartialUpdate: case KErrNone: // Success { iOnlineMode = ETrue; iUpdateReceived = ETrue; - iGPSDataAvailable = ETrue; - iPositionInfo.GetPosition( iPosition ); - iPositionInfo.GetCourse( iCourse ); + iGPSDataAvailable = ETrue; + iPositionInfo.GetPosition(iPosition); + iPositionInfo.GetCourse(iCourse); iLastGoodFixTime.UniversalTime(); - - CalculateCourse(); - - if(iIsTripStart) - { - if(!iIsPreviousPositionUpdated) - { - iIsPreviousPositionUpdated = ETrue; - iPrevPosition = GetCurrentPosition(); - } - UpdateTripData(); - } - - //SortSatelliteDataL(); - - if(iObserver) - { - iObserver->NotifyL( iOnlineMode ); - } - if ( iRequesting ) - { - //DEBUG("KErrNone : NotifyPositionUpdate"); - iPositioner.NotifyPositionUpdate( iPositionInfo, iStatus ); - SetActive(); - } + + CalculateCourse(); + + if (iIsTripStart) + { + if (!iIsPreviousPositionUpdated) + { + iIsPreviousPositionUpdated = ETrue; + iPrevPosition = GetCurrentPosition(); + } + UpdateTripData(); + } + if (iObserver) + { + iObserver->NotifyL(iOnlineMode); + } + if (iRequesting) + { + //DEBUG("KErrNone : NotifyPositionUpdate"); + iPositioner.NotifyPositionUpdate(iPositionInfo, iStatus); + SetActive(); + } break; } case KErrAccessDenied: - /* - Happens if we don't specify requestor information. - This condition should not be encountered. - */ + /* + Happens if we don't specify requestor information. + This condition should not be encountered. + */ { + iPositionInfo.ClearSatellitesInView(); iRequesting = EFalse; - User::Leave( KErrAccessDenied ); + User::Leave(KErrAccessDenied); break; } case KErrCancel: // Postion update request cancelled { // We canceled the request so do nothing + iPositionInfo.ClearSatellitesInView(); break; } case KPositionPartialUpdate: // Incomplete position information - { - if ( iRequesting ) { - //DEBUG("KPositionPartialUpdate : NotifyPositionUpdate"); - iPositioner.NotifyPositionUpdate( iPositionInfo, iStatus ); - SetActive(); + TTime now; + now.UniversalTime(); + TTimeIntervalSeconds secondsSinceLastGoodFix; + now.SecondsFrom(iLastGoodFixTime, secondsSinceLastGoodFix); + if (secondsSinceLastGoodFix.Int() > 15) + { + iLastGoodFixTime.UniversalTime(); + if (iObserver) + { + iObserver->NotifyErrorL(KErrTimedOut); + } + } + + else + { + iLastGoodFixTime.UniversalTime(); + } + // end of addition for TSW error + + iGPSDataAvailable = EFalse; + iUpdateReceived = ETrue; + + // All cases are errors and hence go to offline mode + iOnlineMode = EFalse; + if (iObserver) + { + iObserver->NotifyErrorL(iStatus.Int()); + } + if (iRequesting) + { + iPositioner.NotifyPositionUpdate(iPositionInfo, iStatus); + SetActive(); + } + break; } - break; - } + case KErrTimedOut: // Position update timed out case KPositionQualityLoss: //GPS not connected { + iPositionInfo.ClearSatellitesInView(); iUpdateReceived = ETrue; - iGPSDataAvailable = EFalse; - if(iIsTripStart && !iIsTripClear) + iGPSDataAvailable = EFalse; + if (iIsTripStart && !iIsTripClear) { iTripGPSDataLost = ETrue; } @@ -387,71 +408,38 @@ } //-fallthrough case KErrNotFound: // No PSY selected. - case KErrUnknown: // This will be returned by MLFW + case KErrUnknown: // This will be returned by MLFW case KErrArgument: - /* - PSY does not support the information type specified - by BLID. - */ + + /* + PSY does not support the information type specified + by BLID. + */ default: - { - if(iStatus.Int() != KPositionPartialUpdate ) - { - iDeviceStatus = EDeviceNotFound; - iPositionInfo.ClearSatellitesInView(); - iWaitingGpsData = EFalse; - } - // added for TSW error. - if(iStatus.Int() == KPositionPartialUpdate ) - { - //SortSatelliteDataL(); - TTime now; - now.UniversalTime(); - TTimeIntervalSeconds secondsSinceLastGoodFix; - now.SecondsFrom( iLastGoodFixTime , secondsSinceLastGoodFix ); - if ( secondsSinceLastGoodFix.Int() > 15 ) - { - iLastGoodFixTime.UniversalTime(); - if(iObserver) - { - iObserver->NotifyErrorL( KErrTimedOut ); - } - } - } - else + { + iDeviceStatus = EDeviceNotFound; + iWaitingGpsData = EFalse; + if (iObserver) { - iLastGoodFixTime.UniversalTime(); + iObserver->NotifyErrorL(KErrNotFound); } - // end of addition for TSW error - - iGPSDataAvailable = EFalse; - iUpdateReceived = ETrue; - - // All cases are errors and hence go to offline mode - iOnlineMode = EFalse; - if(iObserver) + if (iRequesting) { - iObserver->NotifyErrorL(iStatus.Int()); - } - if ( iRequesting ) - { - - iPositioner.NotifyPositionUpdate( iPositionInfo, iStatus ); - SetActive(); - } + iPositioner.NotifyPositionUpdate(iPositionInfo, iStatus); + SetActive(); + } + } break; - } } - /*if( iStatus.Int() != KErrCancel ) + { + //DEBUG("RUNL : SetUpdateOptions"); + SetUpdateOptions(); + }*/ + if (iStatus.Int() != KPositionPartialUpdate) { - //DEBUG("RUNL : SetUpdateOptions"); - SetUpdateOptions(); - }*/ - if(iStatus.Int() != KPositionPartialUpdate ) - { - iWaitingGpsData = CheckIfWaitingGPSData(); - } + iWaitingGpsData = CheckIfWaitingGPSData(); + } } // ---------------------------------------------------------------------------- diff -r 522cd55cc3d7 -r 3c271c9e6618 basiclocationinfodisplay/blid/ui/inc/CBlidAppUi.h --- a/basiclocationinfodisplay/blid/ui/inc/CBlidAppUi.h Tue Feb 02 00:16:03 2010 +0200 +++ b/basiclocationinfodisplay/blid/ui/inc/CBlidAppUi.h Fri Feb 19 22:45:00 2010 +0200 @@ -33,7 +33,7 @@ #include "BlidNotes.h" // FORWARD DECLARATIONS -class CBlidMainContainer; +//class CBlidMainContainer; class CBlidDocument; class CSatelliteInfoUI; diff -r 522cd55cc3d7 -r 3c271c9e6618 basiclocationinfodisplay/blid/ui/inc/CBlidMainView.h --- a/basiclocationinfodisplay/blid/ui/inc/CBlidMainView.h Tue Feb 02 00:16:03 2010 +0200 +++ b/basiclocationinfodisplay/blid/ui/inc/CBlidMainView.h Fri Feb 19 22:45:00 2010 +0200 @@ -21,6 +21,8 @@ // INCLUDES #include "CBlidBaseView.h" #include "CBlidLocSettingLauncher.h" +#include "CBlidMainControl.h" + // FORWARD DECLARATIONS class CBlidMainControl; @@ -48,6 +50,11 @@ * Destructor. */ ~CBlidMainView(); + + /** + * View Getter + */ + CBlidMainControl* GetControl(); private: // constructor /** diff -r 522cd55cc3d7 -r 3c271c9e6618 basiclocationinfodisplay/blid/ui/inc/CBlidSatelliteView.h --- a/basiclocationinfodisplay/blid/ui/inc/CBlidSatelliteView.h Tue Feb 02 00:16:03 2010 +0200 +++ b/basiclocationinfodisplay/blid/ui/inc/CBlidSatelliteView.h Fri Feb 19 22:45:00 2010 +0200 @@ -47,6 +47,11 @@ * Destructor. */ ~CBlidSatelliteView(); + + /** + * Control Getter + */ + CBlidSatelliteControl* GetControl(); private: // constructor /** diff -r 522cd55cc3d7 -r 3c271c9e6618 basiclocationinfodisplay/blid/ui/src/CBlidAppUi.cpp --- a/basiclocationinfodisplay/blid/ui/src/CBlidAppUi.cpp Tue Feb 02 00:16:03 2010 +0200 +++ b/basiclocationinfodisplay/blid/ui/src/CBlidAppUi.cpp Fri Feb 19 22:45:00 2010 +0200 @@ -40,7 +40,7 @@ #include "CHtkTripMeterControl.h" #include "FileSystemInfo.h" #include "BlidUID.h" - +#include "CBlidSatelliteControl.h" #ifdef _DEBUG _LIT( KPanicMsg, "CBlidAppUi::TabChangedL"); @@ -267,36 +267,66 @@ iForeground = aForeground; CBlidEng* engine = BlidDocument()->Engine(); - if(aForeground) - { - engine->SetAppMode(CBlidEng::EAppForeground); - if(engine->LocationModel() ) - { - if( engine->LocationModel()->GetRegisteredViewId() == EBlidNavigationView ) - { - CBlidNavigationView* view = static_cast(View(TUid::Uid(EBlidNavigationView))); - view->GetControl()->UpdateL(); - } - if( engine->LocationModel()->GetRegisteredViewId() == EBlidTripMeterView ) - { - CBlidTripMeterView* view = static_cast( View( TUid::Uid( EBlidTripMeterView ) ) ); - view->GetControl()->UpdateL(); - } - } - } + if (aForeground) + { + engine->SetAppMode(CBlidEng::EAppForeground); + if (engine->LocationModel()) + { + if (engine->LocationModel()->GetRegisteredViewId() + == EBlidNavigationView) + { + CBlidNavigationView* view = + static_cast (View(TUid::Uid( + EBlidNavigationView))); + view->GetControl()->UpdateL(); + } + if (engine->LocationModel()->GetRegisteredViewId() + == EBlidTripMeterView) + { + CBlidTripMeterView* view = + static_cast (View(TUid::Uid( + EBlidTripMeterView))); + view->GetControl()->UpdateL(); + } + if (engine->LocationModel()->GetRegisteredViewId() + == EBlidMainSatelliteView) + { + CBlidSatelliteView* view = static_cast (View( + TUid::Uid(EBlidMainSatelliteView))); + view->GetControl()->UpdateL(); + } + if (engine->LocationModel()->GetRegisteredViewId() + == EBlidMainView) + { + CBlidMainView* view = static_cast (View( + TUid::Uid(EBlidMainView))); + view->GetControl()->UpdateL(); + } + } + } else - { - engine->SetAppMode(CBlidEng::EAppBackground); - engine->SetBackLightStateL(CBlidEng::EBlidBacklightNormal); - if( engine->LocationModel()->GetRegisteredViewId() == EBlidNavigationView ) - { - CBlidNavigationView* view = static_cast( View( TUid::Uid( EBlidNavigationView ) ) ); - view->GetControl()->StopPlayerL(); - } - } - - - if ( iSatelliteInfo ) + { + engine->SetAppMode(CBlidEng::EAppBackground); + engine->SetBackLightStateL(CBlidEng::EBlidBacklightNormal); + if (engine->LocationModel()->GetRegisteredViewId() + == EBlidNavigationView) + { + CBlidNavigationView* view = + static_cast (View(TUid::Uid( + EBlidNavigationView))); + view->GetControl()->StopPlayerL(); + } + if (engine->LocationModel()->GetRegisteredViewId() + == EBlidNavigationView) + { + CBlidNavigationView* view = + static_cast (View(TUid::Uid( + EBlidNavigationView))); + view->GetControl()->StopPlayerL(); + } + } + + if (iSatelliteInfo) { iSatelliteInfo->HandleForegroundEventL( aForeground ); } diff -r 522cd55cc3d7 -r 3c271c9e6618 basiclocationinfodisplay/blid/ui/src/CBlidMainControl.cpp --- a/basiclocationinfodisplay/blid/ui/src/CBlidMainControl.cpp Tue Feb 02 00:16:03 2010 +0200 +++ b/basiclocationinfodisplay/blid/ui/src/CBlidMainControl.cpp Fri Feb 19 22:45:00 2010 +0200 @@ -1,21 +1,19 @@ /* -* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Provides blid startup view class methods. -* -*/ - - + * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Provides blid startup view class methods. + * + */ // SYSTEM INCLUDES #include //CAknMessageQueryDialog @@ -60,38 +58,33 @@ TInt CBlidMainControl::iPSYTimeoutCount = 0; -TInt MessageQueryCallBack( TAny* aPtr ); +TInt MessageQueryCallBack(TAny* aPtr); const TInt KTimerValue = 200000; - // ================= MEMBER FUNCTIONS ======================= // --------------------------------------------------------- // CBlidMainControl::NewL() // Two phased constructor // --------------------------------------------------------- // -CBlidMainControl* CBlidMainControl::NewL( CAlfEnv& aEnv, - const TRect& aRect, - CBlidBaseView& aView) +CBlidMainControl* CBlidMainControl::NewL(CAlfEnv& aEnv, const TRect& aRect, + CBlidBaseView& aView) { - CBlidMainControl* self = new (ELeave) CBlidMainControl(aEnv, - aView ); + CBlidMainControl* self = new (ELeave) CBlidMainControl(aEnv, aView); CleanupStack::PushL(self); - self->ConstructL( aRect ); + self->ConstructL(aRect); CleanupStack::Pop(self); return self; } - // --------------------------------------------------------- //CBlidMainControl::CBlidMainControl() // First phase constructor, can not leave // --------------------------------------------------------- // -CBlidMainControl::CBlidMainControl(CAlfEnv& aEnv, - CBlidBaseView& aView ) - : CAlfControl( ),iEnv(aEnv),iView(aView) +CBlidMainControl::CBlidMainControl(CAlfEnv& aEnv, CBlidBaseView& aView) : + CAlfControl(), iEnv(aEnv), iView(aView) { iOnlineMode = EFalse; } @@ -101,29 +94,32 @@ // Second phase constructor, may leave // --------------------------------------------------------- // -void CBlidMainControl::ConstructL( const TRect& /*aRect*/ ) +void CBlidMainControl::ConstructL(const TRect& /*aRect*/) { - CAlfControl::ConstructL( iEnv ); + CAlfControl::ConstructL(iEnv); - iMainLayout = CAlfAnchorLayout::AddNewL( *this ); - iSearchTextVisual = CAlfTextVisual::AddNewL( *this, iMainLayout ); - iAnimationVisual = CAlfImageVisual::AddNewL(*this, iMainLayout ); - + iMainLayout = CAlfAnchorLayout::AddNewL(*this); + iSearchTextVisual = CAlfTextVisual::AddNewL(*this, iMainLayout); + iAnimationVisual = CAlfImageVisual::AddNewL(*this, iMainLayout); + iDisplayIcon = 1; iPeriodic = CPeriodic::NewL(0); // neutral priority - iPeriodic->Start( TTimeIntervalMicroSeconds32( KTimerValue ), - TTimeIntervalMicroSeconds32( KTimerValue ), - TCallBack(Tick, this)); - + if (!iPeriodic->IsActive()) + { + iPeriodic->Start(TTimeIntervalMicroSeconds32(KTimerValue), + TTimeIntervalMicroSeconds32(KTimerValue), TCallBack(Tick, + this)); + } + UpdateDisplayLayoutL(); CreateSearchingTextL(); CreateAnimationL(); UpdateAnimation(); - iLauncher = NULL; - isSettingsLaunched = EFalse; - - //start requesting + iLauncher = NULL; + isSettingsLaunched = EFalse; + + //start requesting CBlidEng* engine = iView.BlidDocument()->Engine(); iLocation = engine->LocationModel(); } @@ -135,7 +131,7 @@ // TInt CBlidMainControl::Tick(TAny* aObject) { - ((CBlidMainControl*)aObject)->UpdateAnimation(); // cast, and call non-static function + ((CBlidMainControl*) aObject)->UpdateAnimation(); // cast, and call non-static function return KErrNone; } @@ -144,143 +140,143 @@ // Function to create search text visual // --------------------------------------------------------- // -void CBlidMainControl::CreateSearchingTextL( ) - { - /* Layout Hierarchy - main_blid2_pane -> blid2_search_pane -> blid2_search_pane_t1 - */ - +void CBlidMainControl::CreateSearchingTextL() + { + /* Layout Hierarchy + main_blid2_pane -> blid2_search_pane -> blid2_search_pane_t1 + */ + // Get the text font - - TInt typefaceStyleId = iEnv.TextStyleManager().CreatePlatformTextStyleL(EAknLogicalFontPrimarySmallFont, EAlfTextStyleNormal); - CAlfTextStyle* style1 = iEnv.TextStyleManager().TextStyle( typefaceStyleId ); - style1->SetBold( ETrue ); + + TInt typefaceStyleId = iEnv.TextStyleManager().CreatePlatformTextStyleL( + EAknLogicalFontPrimarySmallFont, EAlfTextStyleNormal); + CAlfTextStyle* style1 = + iEnv.TextStyleManager().TextStyle(typefaceStyleId); + style1->SetBold(ETrue); // Set the text font size in pixel - style1->SetTextPaneHeightInPixels( 26, ETrue ); - - TRgb rgb; - // Fetch the skin color - AknsUtils::GetCachedColor ( AknsUtils::SkinInstance(), - rgb, - KAknsIIDQsnTextColors, - EAknsCIQsnTextColorsCG1 - ); - - iSearchTextVisual->SetColor( rgb ); - HBufC* noteText = StringLoader::LoadLC( R_BLID_NOTE_SEARCHING_ANIMATION, CEikonEnv::Static() ); - iSearchTextVisual->SetTextL( *noteText ); - iSearchTextVisual->SetTextStyle( style1->Id() ); - iSearchTextVisual->SetAlign( EAlfAlignHCenter, EAlfAlignVCenter ); - CleanupStack::PopAndDestroy(noteText); //noteText - - } + style1->SetTextPaneHeightInPixels(26, ETrue); + + TRgb rgb; + // Fetch the skin color + AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), rgb, + KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG1); + + iSearchTextVisual->SetColor(rgb); + HBufC* noteText = StringLoader::LoadLC(R_BLID_NOTE_SEARCHING_ANIMATION, + CEikonEnv::Static()); + iSearchTextVisual->SetTextL(*noteText); + iSearchTextVisual->SetTextStyle(style1->Id()); + iSearchTextVisual->SetAlign(EAlfAlignHCenter, EAlfAlignVCenter); + CleanupStack::PopAndDestroy(noteText); //noteText + + } // --------------------------------------------------------- // CBlidMainControl::CreateAnimationL() // Creates image visuals for animation // --------------------------------------------------------- // -void CBlidMainControl::CreateAnimationL( ) - { - /* Layout Hierarchy - main_blid2_pane -> blid2_search_pane -> blid2_search_pane_g1 - */ +void CBlidMainControl::CreateAnimationL() + { + /* Layout Hierarchy + main_blid2_pane -> blid2_search_pane -> blid2_search_pane_g1 + */ + + // code to load svg icon + MAlfBitmapProvider* provider = NULL; - // code to load svg icon - MAlfBitmapProvider* provider = NULL; - - // first creste the image loader utils and then call SetSize. - iView.ImageLoaderUtils()->SetSize( iAnimationRect.Size() ); - + // first creste the image loader utils and then call SetSize. + iView.ImageLoaderUtils()->SetSize(iAnimationRect.Size()); + // then create the bitmap provider - provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidStartup, // svg icon skin constant id defiened in Aknsconstant.h file - iView.ImagePathName(), // mif file name with path. - EMbmBlidQgn_graf_blid_startup_01, // bitmap id defiened in mbg file - EMbmBlidQgn_graf_blid_startup_01_mask ); // bitmap mask id defiened in mbg file - // now using that bitmap provider create the texture. - CAlfTexture & texture1 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, - provider, - EAlfTextureFlagDefault ); + provider = iView.ImageLoaderUtils()->CreateImageLoaderL( + KAknsIIDQgnGrafBlidStartup, // svg icon skin constant id defiened in Aknsconstant.h file + iView.ImagePathName(), // mif file name with path. + EMbmBlidQgn_graf_blid_startup_01, // bitmap id defiened in mbg file + EMbmBlidQgn_graf_blid_startup_01_mask); // bitmap mask id defiened in mbg file + // now using that bitmap provider create the texture. + CAlfTexture & texture1 = iEnv.TextureManager().CreateTextureL( + KAlfAutoGeneratedTextureId, provider, EAlfTextureFlagDefault); iTextures.Append(&texture1); - + // then create the bitmap provider - provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidStartup, // svg icon skin constant id defiened in Aknsconstant.h file - iView.ImagePathName(), // mif file name with path. - EMbmBlidQgn_graf_blid_startup_02, // bitmap id defiened in mbg file - EMbmBlidQgn_graf_blid_startup_02_mask ); // bitmap mask id defiened in mbg file - // now using that bitmap provider create the texture. - CAlfTexture & texture2 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, - provider, - EAlfTextureFlagDefault ); + provider = iView.ImageLoaderUtils()->CreateImageLoaderL( + KAknsIIDQgnGrafBlidStartup, // svg icon skin constant id defiened in Aknsconstant.h file + iView.ImagePathName(), // mif file name with path. + EMbmBlidQgn_graf_blid_startup_02, // bitmap id defiened in mbg file + EMbmBlidQgn_graf_blid_startup_02_mask); // bitmap mask id defiened in mbg file + // now using that bitmap provider create the texture. + CAlfTexture & texture2 = iEnv.TextureManager().CreateTextureL( + KAlfAutoGeneratedTextureId, provider, EAlfTextureFlagDefault); iTextures.Append(&texture2); - + // then create the bitmap provider - provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidStartup, // svg icon skin constant id defiened in Aknsconstant.h file - iView.ImagePathName(), // mif file name with path. - EMbmBlidQgn_graf_blid_startup_03, // bitmap id defiened in mbg file - EMbmBlidQgn_graf_blid_startup_03_mask ); // bitmap mask id defiened in mbg file - // now using that bitmap provider create the texture. - CAlfTexture & texture3 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, - provider, - EAlfTextureFlagDefault ); + provider = iView.ImageLoaderUtils()->CreateImageLoaderL( + KAknsIIDQgnGrafBlidStartup, // svg icon skin constant id defiened in Aknsconstant.h file + iView.ImagePathName(), // mif file name with path. + EMbmBlidQgn_graf_blid_startup_03, // bitmap id defiened in mbg file + EMbmBlidQgn_graf_blid_startup_03_mask); // bitmap mask id defiened in mbg file + // now using that bitmap provider create the texture. + CAlfTexture & texture3 = iEnv.TextureManager().CreateTextureL( + KAlfAutoGeneratedTextureId, provider, EAlfTextureFlagDefault); iTextures.Append(&texture3); - + // then create the bitmap provider - provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidStartup, // svg icon skin constant id defiened in Aknsconstant.h file - iView.ImagePathName(), // mif file name with path. - EMbmBlidQgn_graf_blid_startup_04, // bitmap id defiened in mbg file - EMbmBlidQgn_graf_blid_startup_04_mask ); // bitmap mask id defiened in mbg file - // now using that bitmap provider create the texture. - CAlfTexture & texture4 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, - provider, - EAlfTextureFlagDefault ); + provider = iView.ImageLoaderUtils()->CreateImageLoaderL( + KAknsIIDQgnGrafBlidStartup, // svg icon skin constant id defiened in Aknsconstant.h file + iView.ImagePathName(), // mif file name with path. + EMbmBlidQgn_graf_blid_startup_04, // bitmap id defiened in mbg file + EMbmBlidQgn_graf_blid_startup_04_mask); // bitmap mask id defiened in mbg file + // now using that bitmap provider create the texture. + CAlfTexture & texture4 = iEnv.TextureManager().CreateTextureL( + KAlfAutoGeneratedTextureId, provider, EAlfTextureFlagDefault); iTextures.Append(&texture4); - + // then create the bitmap provider - provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidStartup, // svg icon skin constant id defiened in Aknsconstant.h file - iView.ImagePathName(), // mif file name with path. - EMbmBlidQgn_graf_blid_startup_05, // bitmap id defiened in mbg file - EMbmBlidQgn_graf_blid_startup_05_mask ); // bitmap mask id defiened in mbg file - // now using that bitmap provider create the texture. - CAlfTexture & texture5 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, - provider, - EAlfTextureFlagDefault ); + provider = iView.ImageLoaderUtils()->CreateImageLoaderL( + KAknsIIDQgnGrafBlidStartup, // svg icon skin constant id defiened in Aknsconstant.h file + iView.ImagePathName(), // mif file name with path. + EMbmBlidQgn_graf_blid_startup_05, // bitmap id defiened in mbg file + EMbmBlidQgn_graf_blid_startup_05_mask); // bitmap mask id defiened in mbg file + // now using that bitmap provider create the texture. + CAlfTexture & texture5 = iEnv.TextureManager().CreateTextureL( + KAlfAutoGeneratedTextureId, provider, EAlfTextureFlagDefault); iTextures.Append(&texture5); - + // then create the bitmap provider - provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidStartup, // svg icon skin constant id defiened in Aknsconstant.h file - iView.ImagePathName(), // mif file name with path. - EMbmBlidQgn_graf_blid_startup_06, // bitmap id defiened in mbg file - EMbmBlidQgn_graf_blid_startup_06_mask ); // bitmap mask id defiened in mbg file - // now using that bitmap provider create the texture. - CAlfTexture & texture6 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, - provider, - EAlfTextureFlagDefault ); + provider = iView.ImageLoaderUtils()->CreateImageLoaderL( + KAknsIIDQgnGrafBlidStartup, // svg icon skin constant id defiened in Aknsconstant.h file + iView.ImagePathName(), // mif file name with path. + EMbmBlidQgn_graf_blid_startup_06, // bitmap id defiened in mbg file + EMbmBlidQgn_graf_blid_startup_06_mask); // bitmap mask id defiened in mbg file + // now using that bitmap provider create the texture. + CAlfTexture & texture6 = iEnv.TextureManager().CreateTextureL( + KAlfAutoGeneratedTextureId, provider, EAlfTextureFlagDefault); iTextures.Append(&texture6); - + // then create the bitmap provider - provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidStartup, // svg icon skin constant id defiened in Aknsconstant.h file - iView.ImagePathName(), // mif file name with path. - EMbmBlidQgn_graf_blid_startup_07, // bitmap id defiened in mbg file - EMbmBlidQgn_graf_blid_startup_07_mask ); // bitmap mask id defiened in mbg file - // now using that bitmap provider create the texture. - CAlfTexture & texture7 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, - provider, - EAlfTextureFlagDefault ); + provider = iView.ImageLoaderUtils()->CreateImageLoaderL( + KAknsIIDQgnGrafBlidStartup, // svg icon skin constant id defiened in Aknsconstant.h file + iView.ImagePathName(), // mif file name with path. + EMbmBlidQgn_graf_blid_startup_07, // bitmap id defiened in mbg file + EMbmBlidQgn_graf_blid_startup_07_mask); // bitmap mask id defiened in mbg file + // now using that bitmap provider create the texture. + CAlfTexture & texture7 = iEnv.TextureManager().CreateTextureL( + KAlfAutoGeneratedTextureId, provider, EAlfTextureFlagDefault); iTextures.Append(&texture7); - + // then create the bitmap provider - provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidStartup, // svg icon skin constant id defiened in Aknsconstant.h file - iView.ImagePathName(), // mif file name with path. - EMbmBlidQgn_graf_blid_startup_08, // bitmap id defiened in mbg file - EMbmBlidQgn_graf_blid_startup_08_mask ); // bitmap mask id defiened in mbg file - // now using that bitmap provider create the texture. - CAlfTexture & texture8 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, - provider, - EAlfTextureFlagDefault ); + provider = iView.ImageLoaderUtils()->CreateImageLoaderL( + KAknsIIDQgnGrafBlidStartup, // svg icon skin constant id defiened in Aknsconstant.h file + iView.ImagePathName(), // mif file name with path. + EMbmBlidQgn_graf_blid_startup_08, // bitmap id defiened in mbg file + EMbmBlidQgn_graf_blid_startup_08_mask); // bitmap mask id defiened in mbg file + // now using that bitmap provider create the texture. + CAlfTexture & texture8 = iEnv.TextureManager().CreateTextureL( + KAlfAutoGeneratedTextureId, provider, EAlfTextureFlagDefault); iTextures.Append(&texture8); - } + } // --------------------------------------------------------- // CBlidMainControl::UpdateAnimation @@ -288,8 +284,8 @@ // --------------------------------------------------------- // void CBlidMainControl::UpdateAnimation() -{ - if(KNumOfStartUpIcon > iDisplayIcon) + { + if (KNumOfStartUpIcon > iDisplayIcon) { iDisplayIcon++; } @@ -297,8 +293,8 @@ { iDisplayIcon = 1; } - iAnimationVisual->SetImage( TAlfImage( *iTextures[iDisplayIcon-1] ) );//N -} + iAnimationVisual->SetImage(TAlfImage(*iTextures[iDisplayIcon - 1]));//N + } // ---------------------------------------------------- // CBlidMainControl::~CBlidMainControl @@ -311,14 +307,13 @@ iTextures.Reset(); iTextures.Close(); delete iLauncher; - delete iHeadPaneText; - delete iMsgQueryText; - delete iLinkText; - delete iMsgQText; - delete iPeriodic; - } - - + delete iHeadPaneText; + delete iMsgQueryText; + delete iLinkText; + delete iMsgQText; + delete iPeriodic; + } + // --------------------------------------------------------- // CBlidMainControl::UpdateL // Updates the view after getting update from location model @@ -328,265 +323,254 @@ { TInt result = 0; DEBUG1(" CBlidMainControl::UpdateL iErrorCode ::%d", iErrorCode ); - - if( !iView.IsSatViewActive() && iOnlineMode ) - { - iView.ActivateSatelliteViewL(); - } - else if( iErrorCode != KErrNone ) - { - // Check GPS device availability - TInt retVal = iLocation->CheckGPSAvailability(); - DEBUG1(" CBlidMainControl::CheckGPSAvailability code ::%d", retVal ); - switch(iErrorCode) - { - case KErrTimedOut: - { - if( retVal == 1 ) - { - /* - GPS device connected but position information - available but not of good quality - */ - iView.ActivateSatelliteViewL(); - } - break; - } - case KErrArgument: - // The positioning module is unable to support the requested type - case KErrNotFound: - // No module (PSY) selected or invalid PSY - { - iOnlineMode = EFalse; - // Notify not module selected - if(iPSYTimeoutCount == 0) - { - if( iView.IsForeGroundApp() ) - { - iLocation->StopRequesting(); - TCallBack callback( MessageQueryCallBack, this ); - result = DispMsgQueryWithLinkL(R_BLID_NOPSY_ENABLED, - R_BLID_ERROR_NO_PSY, - R_BLID_SELECT_POSITIONING_METHOD, - ETrue, - callback ); - if( result == EBlidSoftkeyRetry ) - { - iLocation->StartRequesting(); - } - else if( result != KErrNotFound ) - { - iView.ExitMainApplicationL( EEikCmdExit ); - } - } - } + + if (!iView.IsSatViewActive() && iOnlineMode) + { - iPSYTimeoutCount++; - TInt currentInterval; - iLocation->GetCurrentUpdateInterval(currentInterval); - if(iPSYTimeoutCount*currentInterval >= KNotesTimeOut) - { - iPSYTimeoutCount = 0; - } - return; - } - case KPositionPartialUpdate: - { - iView.ActivateSatelliteViewL(); - break; - } - default: - { - iOnlineMode = EFalse; - break; - } - } - - if(iErrorCode != KErrNotFound) - { - if ( retVal == 0 ) - { - if( iLocation->IsSatCapablePsyAvailable() ) - { - iLocation->StopRequesting(); - iOnlineMode = EFalse; - TCallBack callback( MessageQueryCallBack, this ); - result = DispMsgQueryWithLinkL(R_BLID_NOGPS_FOUND, - R_BLID_NOGPS_FOUND_TEXT, - R_BLID_SELECT_POSITIONING_METHOD, - ETrue, - callback ); - if( result == EBlidSoftkeyRetry ) - { - iLocation->StartRequesting(); - } - else if( result != KErrNotFound ) - { - iView.ExitMainApplicationL( EEikCmdExit ); - } - } - // no GPS device note - else if(iErrorCode != KErrNotFound) - { - // GPS un-available - if( iView.IsForeGroundApp() ) - { - iLocation->StopRequesting(); - TCallBack callback( MessageQueryCallBack, this ); - DispMsgQueryWithLinkL( R_BLID_NOGPS_FOUND, - R_BLID_NOGPS_AVAILABLE_TEXT, - R_BLID_SELECT_POSITIONING_METHOD, - EFalse, - callback ); - iView.ExitMainApplicationL( EEikCmdExit ); - } - } - else - { - BlidNotes::iGPSUnavailableDisplayed = ETrue; - } - CBlidBaseContainer::SetGPSAvailability(EFalse); - } - } - } + if (iView.IsForeGroundApp()) + { + iView.ActivateSatelliteViewL(); + } + } + TInt retVal = iLocation->CheckGPSAvailability(); + // Check GPS device availability + DEBUG1(" CBlidMainControl::CheckGPSAvailability code ::%d", retVal ); + switch (iErrorCode) + { + case KErrTimedOut: + { + if (retVal == 1) + { + /* + GPS device connected but position information + available but not of good quality + */ + if (iView.IsForeGroundApp()) + { + iView.ActivateSatelliteViewL(); + } + break; + } + case KErrNotFound: + // No module (PSY) selected or invalid PSY + { + iOnlineMode = EFalse; + // Notify not module selected + // if (iPSYTimeoutCount == 0) + // { + if (iView.IsForeGroundApp()) + { + iLocation->StopRequesting(); + TCallBack callback(MessageQueryCallBack, this); + result + = DispMsgQueryWithLinkL(R_BLID_NOPSY_ENABLED, + R_BLID_ERROR_NO_PSY, + R_BLID_SELECT_POSITIONING_METHOD, ETrue, + callback); + if (result == EBlidSoftkeyRetry) + { + iLocation->StartRequesting(); + } + else if (result == EAknSoftkeyOk) + { + iView.ExitMainApplicationL(EEikCmdExit); + } + } + break; + } + case KPositionPartialUpdate: + { + if (iView.IsForeGroundApp()) + { + iView.ActivateSatelliteViewL(); + } + break; + } + case KErrArgument: + // The positioning module is unable to support the requested type + default: + { + iOnlineMode = EFalse; + + if (retVal == 0) + { + if (iLocation->IsSatCapablePsyAvailable()) + { + iLocation->StopRequesting(); + iOnlineMode = EFalse; + TCallBack callback(MessageQueryCallBack, this); + result = DispMsgQueryWithLinkL(R_BLID_NOGPS_FOUND, + R_BLID_NOGPS_FOUND_TEXT, + R_BLID_SELECT_POSITIONING_METHOD, ETrue, + callback); + if (result == EBlidSoftkeyRetry) + { + iLocation->StartRequesting(); + } + else if (result == EAknSoftkeyOk) + { + iView.ExitMainApplicationL(EEikCmdExit); + } + } + // no GPS device note + // GPS un-available + else if (iView.IsForeGroundApp()) + { + iLocation->StopRequesting(); + TCallBack callback(MessageQueryCallBack, this); + DispMsgQueryWithLinkL(R_BLID_NOGPS_FOUND, + R_BLID_NOGPS_AVAILABLE_TEXT, + R_BLID_SELECT_POSITIONING_METHOD, EFalse, + callback); + iView.ExitMainApplicationL(EEikCmdExit); + } + else + { + BlidNotes::iGPSUnavailableDisplayed = ETrue; + } + CBlidBaseContainer::SetGPSAvailability(EFalse); + } + break; + + } + } + } } - + // ---------------------------------------------------- // CBlidMainControl::MakeTitleL // Sets the title to string represented by resource // ---------------------------------------------------- // -void CBlidMainControl::MakeTitleL( TInt aResourceText ) +void CBlidMainControl::MakeTitleL(TInt aResourceText) { - HBufC* buffer = StringLoader::LoadLC( aResourceText ); - CAknTitlePane* title = static_cast( StatusPane()-> - ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); + HBufC* buffer = StringLoader::LoadLC(aResourceText); + CAknTitlePane* title = + static_cast (StatusPane()-> ControlL(TUid::Uid( + EEikStatusPaneUidTitle))); CleanupStack::Pop(); //buffer - title->SetText( buffer ); // Takes ownership of buf - } - + title->SetText(buffer); // Takes ownership of buf + } + // ---------------------------------------------------- // CBlidMainControl::StatusPane // Returns the status pane // ---------------------------------------------------- // -CEikStatusPane* CBlidMainControl::StatusPane() const +CEikStatusPane* CBlidMainControl::StatusPane() const { return CEikonEnv::Static()->AppUiFactory()->StatusPane(); } - + // ---------------------------------------------------- // CBlidMainControl::SetErrorCode // Sets the error code // ---------------------------------------------------- // -void CBlidMainControl::SetErrorCode( const TInt aErrorCode ) - { - iErrorCode = aErrorCode; - } - +void CBlidMainControl::SetErrorCode(const TInt aErrorCode) + { + iErrorCode = aErrorCode; + } + // ---------------------------------------------------- // CBlidMainControl::SetOnlineMode // Sets the online mode // ---------------------------------------------------- // -void CBlidMainControl::SetOnlineMode( const TBool aOnlineMode ) - { - iOnlineMode = aOnlineMode; - } - +void CBlidMainControl::SetOnlineMode(const TBool aOnlineMode) + { + iOnlineMode = aOnlineMode; + } + // ---------------------------------------------------- // CBlidMainControl::DispMsgQueryWithLinkL() // Displays the message query with a link // ---------------------------------------------------- // -TInt CBlidMainControl::DispMsgQueryWithLinkL( TInt aHeadingText, - TInt aMsgQueryText, - TInt aLinkText, - TBool aLinkShow, - TCallBack aCallBack ) - { - CEikonEnv* env = CEikonEnv::Static(); - if( !iHeadPaneText ) - { - iHeadPaneText = env->AllocReadResourceL( aHeadingText ); - } +TInt CBlidMainControl::DispMsgQueryWithLinkL(TInt aHeadingText, + TInt aMsgQueryText, TInt aLinkText, TBool aLinkShow, + TCallBack aCallBack) + { + CEikonEnv* env = CEikonEnv::Static(); + if (!iHeadPaneText) + { + iHeadPaneText = env->AllocReadResourceL(aHeadingText); + } - if( !iMsgQueryText ) - { - iMsgQueryText = env->AllocReadResourceL( aMsgQueryText ); - } + if (!iMsgQueryText) + { + iMsgQueryText = env->AllocReadResourceL(aMsgQueryText); + } - if( !iLinkText ) - { - iLinkText = env->AllocReadResourceL( aLinkText ); - } + if (!iLinkText) + { + iLinkText = env->AllocReadResourceL(aLinkText); + } - if( !iMsgQText ) - { - iMsgQText = HBufC::NewL ( iMsgQueryText->Length() + - KNewLine().Length() + KOpeningLinkTag().Length() + - iLinkText->Length() + KClosingLinkTag().Length() ) ; - } - - iMsgQText->Des().Copy(*iMsgQueryText); + if (!iMsgQText) + { + iMsgQText = HBufC::NewL(iMsgQueryText->Length() + KNewLine().Length() + + KOpeningLinkTag().Length() + iLinkText->Length() + + KClosingLinkTag().Length()); + } + + iMsgQText->Des().Copy(*iMsgQueryText); iMsgQText->Des().Append(KNewLine); - if( aLinkShow ) - { - iMsgQText->Des().Append( KOpeningLinkTag ); - iMsgQText->Des().Append(*iLinkText); - iMsgQText->Des().Append( KClosingLinkTag ); - } - else - { - iMsgQText->Des().Append(_L( " ")); - } - ////////////////////////////////////////////////////// - CAknMessageQueryDialog* msgDlg = CAknMessageQueryDialog::NewL( *iMsgQText ); - - // if we remove this if part it will give CONE8 panic - if( iDialog ) - { - delete iDialog; - iDialog = NULL; - } - - iDialog = msgDlg; - - msgDlg->PrepareLC( R_BLID_MESSAGE_QUERY_DIALOG ); // Pushed dialog is popped inside RunLD + if (aLinkShow) + { + iMsgQText->Des().Append(KOpeningLinkTag); + iMsgQText->Des().Append(*iLinkText); + iMsgQText->Des().Append(KClosingLinkTag); + } + else + { + iMsgQText->Des().Append(_L( " ")); + } + ////////////////////////////////////////////////////// + CAknMessageQueryDialog* msgDlg = CAknMessageQueryDialog::NewL(*iMsgQText); + + // if we remove this if part it will give CONE8 panic + if (iDialog) + { + delete iDialog; + iDialog = NULL; + } - msgDlg->Heading()->SetTextL( *iHeadPaneText ); + iDialog = msgDlg; + + msgDlg->PrepareLC(R_BLID_MESSAGE_QUERY_DIALOG); // Pushed dialog is popped inside RunLD - msgDlg->SetLink(aCallBack); + msgDlg->Heading()->SetTextL(*iHeadPaneText); + msgDlg->SetLink(aCallBack); - msgDlg->ButtonGroupContainer().SetCommandSetL( - R_BLID_INFOPOPUP_SOFTKEYS_RETRY__EXIT ); - isDialogLaunched = ETrue; - TInt retval = msgDlg->RunLD(); - if( isDialogLaunched ) - { - msgDlg = NULL; - iDialog = NULL; - isDialogLaunched = EFalse; - return retval; - } - return -1; - } + msgDlg->ButtonGroupContainer().SetCommandSetL( + R_BLID_INFOPOPUP_SOFTKEYS_RETRY__EXIT); + isDialogLaunched = ETrue; + TInt retval = msgDlg->RunLD(); + if (isDialogLaunched) + { + msgDlg = NULL; + iDialog = NULL; + isDialogLaunched = EFalse; + return retval; + } + return -1; + } // ---------------------------------------------------- // CBlidMainControl::CreateNaviPaneL // Creates navigation pane // ---------------------------------------------------- // -void CBlidMainControl::CreateNaviPaneL( ) +void CBlidMainControl::CreateNaviPaneL() { CEikStatusPane* sp = CEikonEnv::Static()->AppUiFactory()->StatusPane(); // Fetch pointer to the default navi pane control - CAknNavigationControlContainer* naviPane = - static_cast(sp->ControlL( - TUid::Uid(EEikStatusPaneUidNavi))); - + CAknNavigationControlContainer* naviPane = + static_cast (sp->ControlL( + TUid::Uid(EEikStatusPaneUidNavi))); + naviPane->PushDefaultL(EFalse); } @@ -595,132 +579,132 @@ // Launches positioning settings view // ---------------------------------------------------- // -void CBlidMainControl::LaunchPositioningSettingsViewL( ) - { - if(!iLauncher ) - { - iLauncher = CBlidLocSettingsLauncher::NewL(); - } - iLauncher->SetControl( this ); - isSettingsLaunched = ETrue; - iLauncher->LaunchL(); - } +void CBlidMainControl::LaunchPositioningSettingsViewL() + { + if (!iLauncher) + { + iLauncher = CBlidLocSettingsLauncher::NewL(); + } + iLauncher->SetControl(this); + isSettingsLaunched = ETrue; + iLauncher->LaunchL(); + } // ---------------------------------------------------- // CBlidMainControl::DeleteDialogResource // Seletes the dialog resources // ---------------------------------------------------- // -void CBlidMainControl::DeleteDialogResource( ) - { - if( isSettingsLaunched ) - { - delete iHeadPaneText; - iHeadPaneText = NULL; - - delete iMsgQueryText; - iMsgQueryText = NULL; - - delete iLinkText; - iLinkText = NULL; - - delete iMsgQText; - iMsgQText = NULL; - } - } +void CBlidMainControl::DeleteDialogResource() + { + if (isSettingsLaunched) + { + delete iHeadPaneText; + iHeadPaneText = NULL; + + delete iMsgQueryText; + iMsgQueryText = NULL; + + delete iLinkText; + iLinkText = NULL; + + delete iMsgQText; + iMsgQText = NULL; + } + } // ---------------------------------------------------- // CBlidMainControl::UpdateDisplayLayoutL // Updates the display layout in response to a change in app resource // ---------------------------------------------------- // -void CBlidMainControl::UpdateDisplayLayoutL( ) - { - /* Layout Hierarchy - main_blid2_pane -> blid2_search_pane -> blid2_search_pane_t1 - - main_blid2_pane -> blid2_search_pane -> blid2_search_pane_g1 - */ - - TAknLayoutRect mainBlid2Pane; - TAknLayoutRect blid2SearchPane; - TAknLayoutRect blid2SearchPaneG1; - TAknLayoutText blid2SearchPaneT1; - //TRect animationRect; - TInt variety; +void CBlidMainControl::UpdateDisplayLayoutL() + { + /* Layout Hierarchy + main_blid2_pane -> blid2_search_pane -> blid2_search_pane_t1 + + main_blid2_pane -> blid2_search_pane -> blid2_search_pane_g1 + */ - if( Layout_Meta_Data::IsLandscapeOrientation() ) - { - variety = 1; - } - else - { - variety = 0; - } + TAknLayoutRect mainBlid2Pane; + TAknLayoutRect blid2SearchPane; + TAknLayoutRect blid2SearchPaneG1; + TAknLayoutText blid2SearchPaneT1; + //TRect animationRect; + TInt variety; + + if (Layout_Meta_Data::IsLandscapeOrientation()) + { + variety = 1; + } + else + { + variety = 0; + } /////////////// recalculate text rect ///////////////////////// TRect rect; AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect); - mainBlid2Pane.LayoutRect( rect, - AknLayoutScalable_Apps::main_blid2_pane().LayoutLine() ); - - blid2SearchPane.LayoutRect( mainBlid2Pane.Rect(), - AknLayoutScalable_Apps::blid2_search_pane( variety ).LayoutLine() ); - - blid2SearchPaneT1.LayoutText( blid2SearchPane.Rect(), - AknLayoutScalable_Apps::blid2_search_pane_t1( variety ).LayoutLine() ); - - /////////////// recalculate animation rect ///////////////////////// - blid2SearchPaneG1.LayoutRect( blid2SearchPane.Rect(), - AknLayoutScalable_Apps::blid2_search_pane_g1( variety ).LayoutLine() ); - iAnimationRect = blid2SearchPaneG1.Rect(); - - - TAlfRealPoint topTextPoint( blid2SearchPaneT1.TextRect().iTl ); - TAlfRealPoint bottomTextPoint( blid2SearchPaneT1.TextRect().iBr ); - - //Anchor for searching Text - iMainLayout->SetAnchor( EAlfAnchorTopLeft, 0, - EAlfAnchorOriginLeft, EAlfAnchorOriginTop, - EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, - TAlfTimedPoint( topTextPoint.iX, topTextPoint.iY ) ); - iMainLayout->SetAnchor( EAlfAnchorBottomRight, 0, - EAlfAnchorOriginLeft, EAlfAnchorOriginTop, - EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, - TAlfTimedPoint( bottomTextPoint.iX, bottomTextPoint.iY ) ); + mainBlid2Pane.LayoutRect(rect, + AknLayoutScalable_Apps::main_blid2_pane().LayoutLine()); + + blid2SearchPane.LayoutRect(mainBlid2Pane.Rect(), + AknLayoutScalable_Apps::blid2_search_pane(variety).LayoutLine()); + + blid2SearchPaneT1.LayoutText( + blid2SearchPane.Rect(), + AknLayoutScalable_Apps::blid2_search_pane_t1(variety).LayoutLine()); + + /////////////// recalculate animation rect ///////////////////////// + blid2SearchPaneG1.LayoutRect( + blid2SearchPane.Rect(), + AknLayoutScalable_Apps::blid2_search_pane_g1(variety).LayoutLine()); + iAnimationRect = blid2SearchPaneG1.Rect(); + + TAlfRealPoint topTextPoint(blid2SearchPaneT1.TextRect().iTl); + TAlfRealPoint bottomTextPoint(blid2SearchPaneT1.TextRect().iBr); + //Anchor for searching Text + iMainLayout->SetAnchor(EAlfAnchorTopLeft, 0, EAlfAnchorOriginLeft, + EAlfAnchorOriginTop, EAlfAnchorMetricAbsolute, + EAlfAnchorMetricAbsolute, TAlfTimedPoint(topTextPoint.iX, + topTextPoint.iY)); + iMainLayout->SetAnchor(EAlfAnchorBottomRight, 0, EAlfAnchorOriginLeft, + EAlfAnchorOriginTop, EAlfAnchorMetricAbsolute, + EAlfAnchorMetricAbsolute, TAlfTimedPoint(bottomTextPoint.iX, + bottomTextPoint.iY)); - TAlfRealPoint topAnimationPoint( iAnimationRect.iTl ); - TAlfRealPoint bottomAnimationPoint( iAnimationRect.iBr ); - - //Anchor for animation - iMainLayout->SetAnchor( EAlfAnchorTopLeft, 1, - EAlfAnchorOriginLeft, EAlfAnchorOriginTop, - EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, - TAlfTimedPoint( topAnimationPoint.iX, topAnimationPoint.iY ) ); - iMainLayout->SetAnchor( EAlfAnchorBottomRight, 1, - EAlfAnchorOriginLeft, EAlfAnchorOriginTop, - EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, - TAlfTimedPoint( bottomAnimationPoint.iX, bottomAnimationPoint.iY ) ); - - } - + TAlfRealPoint topAnimationPoint(iAnimationRect.iTl); + TAlfRealPoint bottomAnimationPoint(iAnimationRect.iBr); + + //Anchor for animation + iMainLayout->SetAnchor(EAlfAnchorTopLeft, 1, EAlfAnchorOriginLeft, + EAlfAnchorOriginTop, EAlfAnchorMetricAbsolute, + EAlfAnchorMetricAbsolute, TAlfTimedPoint(topAnimationPoint.iX, + topAnimationPoint.iY)); + iMainLayout->SetAnchor(EAlfAnchorBottomRight, 1, EAlfAnchorOriginLeft, + EAlfAnchorOriginTop, EAlfAnchorMetricAbsolute, + EAlfAnchorMetricAbsolute, TAlfTimedPoint(bottomAnimationPoint.iX, + bottomAnimationPoint.iY)); + + } + // ----------------------------------------------------------------------------- // CBlidMainControl::MessageQueryCallBack() // Called when link is clicked on message query dialog // ----------------------------------------------------------------------------- // -TInt MessageQueryCallBack( TAny* aPtr ) - { - CBlidMainControl* ptr = static_cast(aPtr); - if( ptr ) - { - TRAP_IGNORE( ptr->LaunchPositioningSettingsViewL() ); - if( ptr->iDialog ) - { - TRAP_IGNORE( ptr->iDialog->ProcessCommandL( 3001 ) ); - } - } - return KErrNone; - } +TInt MessageQueryCallBack(TAny* aPtr) + { + CBlidMainControl* ptr = static_cast (aPtr); + if (ptr) + { + TRAP_IGNORE( ptr->LaunchPositioningSettingsViewL() ); + if (ptr->iDialog) + { + TRAP_IGNORE( ptr->iDialog->ProcessCommandL( 3001 ) ); + } + } + return KErrNone; + } //End Of File diff -r 522cd55cc3d7 -r 3c271c9e6618 basiclocationinfodisplay/blid/ui/src/CBlidMainView.cpp --- a/basiclocationinfodisplay/blid/ui/src/CBlidMainView.cpp Tue Feb 02 00:16:03 2010 +0200 +++ b/basiclocationinfodisplay/blid/ui/src/CBlidMainView.cpp Fri Feb 19 22:45:00 2010 +0200 @@ -163,8 +163,9 @@ { if( iMainCtrl && aOnlineMode ) { + iMainCtrl->SetErrorCode( KErrNone ); + iMainCtrl->SetOnlineMode( aOnlineMode ); iMainCtrl->UpdateL(); - iMainCtrl->SetOnlineMode( aOnlineMode ); } DEBUG1(" CBlidMainView::NotifyL called ::%d", aOnlineMode ); CBlidBaseView::NotifyL( aOnlineMode ); @@ -180,8 +181,8 @@ DEBUG1(" CBlidMainView::NotifyErrorL errorcode ::%d", aErrorCode ); if( iMainCtrl ) { + iMainCtrl->SetErrorCode( aErrorCode ); iMainCtrl->UpdateL(); - iMainCtrl->SetErrorCode( aErrorCode ); } } @@ -202,6 +203,10 @@ } } +CBlidMainControl* CBlidMainView::GetControl() + { + return iMainCtrl; + } #ifdef RD_SCALABLE_UI_V2 // --------------------------------------------------------------------------- diff -r 522cd55cc3d7 -r 3c271c9e6618 basiclocationinfodisplay/blid/ui/src/CBlidSatelliteControl.cpp --- a/basiclocationinfodisplay/blid/ui/src/CBlidSatelliteControl.cpp Tue Feb 02 00:16:03 2010 +0200 +++ b/basiclocationinfodisplay/blid/ui/src/CBlidSatelliteControl.cpp Fri Feb 19 22:45:00 2010 +0200 @@ -552,12 +552,15 @@ // ---------------------------------------------------- // void CBlidSatelliteControl::ChangeNavigationViewL() - { - iView.ActivateNavigationViewL(); + { + if (iView.IsForeGroundApp()) + { + iView.ActivateNavigationViewL(); + } //delete the timer if present delete iTimer; iTimer = NULL; - } + } // ---------------------------------------------------- // CBlidSatelliteControl::ChangeSoftKeyL diff -r 522cd55cc3d7 -r 3c271c9e6618 basiclocationinfodisplay/blid/ui/src/CBlidSatelliteView.cpp --- a/basiclocationinfodisplay/blid/ui/src/CBlidSatelliteView.cpp Tue Feb 02 00:16:03 2010 +0200 +++ b/basiclocationinfodisplay/blid/ui/src/CBlidSatelliteView.cpp Fri Feb 19 22:45:00 2010 +0200 @@ -227,6 +227,14 @@ iEnv.PrimaryDisplay().SetVisibleArea(rect); } } + +/** + * + */ +CBlidSatelliteControl* CBlidSatelliteView::GetControl() + { + return iMainSatelliteCtrl; + } #ifdef RD_SCALABLE_UI_V2 // --------------------------------------------------------------------------- diff -r 522cd55cc3d7 -r 3c271c9e6618 eventsui/eventseditor/inc/evteditor.h --- a/eventsui/eventseditor/inc/evteditor.h Tue Feb 02 00:16:03 2010 +0200 +++ b/eventsui/eventseditor/inc/evteditor.h Fri Feb 19 22:45:00 2010 +0200 @@ -261,8 +261,8 @@ // Inherited from MEvtMgmtUiSOMObserver void NotifySOMChangeL( ); - - void HandlePointerEventL(const TPointerEvent& aPointerEvent); + + void HandleDialogPageEventL( TInt aEventID ); TKeyResponse OfferKeyEventL (const TKeyEvent &aKeyEvent, TEventCode aType); diff -r 522cd55cc3d7 -r 3c271c9e6618 eventsui/eventseditor/src/evteditor.cpp --- a/eventsui/eventseditor/src/evteditor.cpp Tue Feb 02 00:16:03 2010 +0200 +++ b/eventsui/eventseditor/src/evteditor.cpp Fri Feb 19 22:45:00 2010 +0200 @@ -117,7 +117,7 @@ // Observer for a change in System of Measurement iSysOfMeas = CEvtMgmtUiSysOfMeasurement::NewL(*this); - EVTUIDEBUG("- CEvtEditor::ConstructL()"); + EVTUIDEBUG("- CEvtEditor::ConstructL()"); } // --------------------------------------------------------------------------- @@ -495,20 +495,19 @@ aMenuPane->SetItemDimmed(EAknFormCmdEdit, ETrue); aMenuPane->SetItemDimmed(EEvtEditorCmdAssignTone, EFalse); break; - } + } case EEvtMgmtUiDlgCIdRepeat: case EEvtMgmtUiDlgCIdAudioLoop: - case EEvtMgmtUiDlgCIdStatus: + case EEvtMgmtUiDlgCIdStatus: { - aMenuPane->SetItemDimmed(EAknFormCmdEdit, EFalse); - aMenuPane->SetItemTextL(EAknFormCmdEdit,R_EVTUI_CREATENEW_FORM_CMDCHANGE); - break; - } + aMenuPane->SetItemDimmed(EAknFormCmdEdit, EFalse); + aMenuPane->SetItemTextL(EAknFormCmdEdit,R_EVTUI_CREATENEW_FORM_CMDCHANGE); + break; + } default: { break; } - }//switch // Activate and Draft are absent in Edit mode @@ -1514,7 +1513,7 @@ { case EKeyLeftArrow: case EKeyRightArrow: - case EKeyOK: + // case EKeyOK: case EKeyEnter: { CheckStatusL(); @@ -1527,82 +1526,83 @@ } // ----------------------------------------------------------------------------- -// CEvtEditor::HandlePointerEventL() +// CEvtEditor::HandleDialogPageEventL() // Inherited from CAknForm // ----------------------------------------------------------------------------- // -void CEvtEditor::HandlePointerEventL(const TPointerEvent& aPointerEvent) - { - EVTUIDEBUG("+ CEvtEditor::HandlePointerEventL()"); - - /* As default HandlePointerEventL() calls control's HandlePointerEventL() - * We have to modify status's array before CAknForm::HandlePointerEventL() is called. - */ - if(aPointerEvent.iType == TPointerEvent::EButton1Up ) - { - CAknPopupFieldText* statusEditor = static_cast ( ControlOrNull(EEvtMgmtUiDlgCIdStatus) ); - if (statusEditor) - { - if( statusEditor->Rect().Contains(aPointerEvent.iPosition) ) - CheckStatusL(); - } - } - - EVTUIDEBUG1("+ b4 HandlePointerEventL- %d", aPointerEvent.iType); - CAknForm::HandlePointerEventL( aPointerEvent ); - EVTUIDEBUG1("+ after HandlePointerEventL- %d", aPointerEvent.iType); - if(aPointerEvent.iType == TPointerEvent::EButton1Up ) - { - if( !IsEditable() ) - { - iIsEditMode = ETrue; - SetEditableL(ETrue); - ChangeRSKCaptionL(); - ChangeMSKCaptionL( IdOfFocusControl() ); - return; - } - - switch ( IdOfFocusControl() ) +void CEvtEditor::HandleDialogPageEventL( TInt aEventID ) + { + EVTUIDEBUG("+ CEvtEditor::HandleDialogPageEventL()"); + CAknForm::HandleDialogPageEventL( aEventID ); + if( aEventID == MEikDialogPageObserver::EDialogPageTapped ) + { + EVTUIDEBUG("+ CEvtEditor::HandleDialogPageEventL() EDialogPageTapped"); + if( !IsEditable() ) { - case EEvtMgmtUiDlgCIdPlace: - { - CEikEdwin* placeEditor = static_cast (ControlOrNull(EEvtMgmtUiDlgCIdPlace)); - if (placeEditor) + iIsEditMode = ETrue; + SetEditableL(ETrue); + ChangeRSKCaptionL(); + ChangeMSKCaptionL( IdOfFocusControl() ); + return; + } + + CEikEdwin* editor = NULL; + CAknPopupFieldText* popupFieldText = NULL; + switch(IdOfFocusControl()) + { + case EEvtMgmtUiDlgCIdPlace: // Place Editor + editor = static_cast (ControlOrNull(EEvtMgmtUiDlgCIdPlace)); + if ( editor ) + { + iCmdHandler->HandleEditorCmdL( EEvtEditorCmdSetPlace ); + } + break; + case EEvtMgmtUiDlgCIdDesc: // Description Editor + editor = static_cast (ControlOrNull(EEvtMgmtUiDlgCIdDesc)); + if ( editor ) { - if( placeEditor->Rect().Contains(aPointerEvent.iPosition) ) - iCmdHandler->HandleEditorCmdL( EEvtEditorCmdSetPlace ); + iCmdHandler->HandleEditorCmdL( EEvtEditorCmdEditDesc ); } break; - } - case EEvtMgmtUiDlgCIdDesc: - { - CEikEdwin* descEditor = static_cast (ControlOrNull(EEvtMgmtUiDlgCIdDesc)); - if (descEditor) + case EEvtMgmtUiDlgCIdAssignTone: // Tone Editor + editor = static_cast (ControlOrNull(EEvtMgmtUiDlgCIdAssignTone)); + if ( editor ) { - if( descEditor->Rect().Contains(aPointerEvent.iPosition) ) - iCmdHandler->HandleEditorCmdL( EEvtEditorCmdEditDesc ); + iCmdHandler->HandleEditorCmdL( EEvtEditorCmdAssignTone ); } break; - } - case EEvtMgmtUiDlgCIdAssignTone: - { - CEikEdwin* toneEditor = static_cast (ControlOrNull(EEvtMgmtUiDlgCIdAssignTone)); - if (toneEditor) - { - if( toneEditor->Rect().Contains(aPointerEvent.iPosition) ) - iCmdHandler->HandleEditorCmdL( EEvtEditorCmdAssignTone ); - } + case EEvtMgmtUiDlgCIdStatus: // Status Editor + popupFieldText = static_cast ( ControlOrNull(EEvtMgmtUiDlgCIdStatus) ); + if( popupFieldText ) + { + TInt editorStatus = popupFieldText->CurrentValueIndex(); + CheckStatusL(); + if( ECompleted != editorStatus ) + { + if( EActive == editorStatus ) + { + popupFieldText->SetCurrentValueIndex ( EDraft ); + } + else + { + popupFieldText->SetCurrentValueIndex ( EActive ); + } + HandleControlStateChangeL( EEvtMgmtUiDlgCIdStatus ); + UpdatePageL(ETrue); + return; + } + } break; - } - default: - { + case EEvtMgmtUiDlgCIdRepeat: // Repeat editor + case EEvtMgmtUiDlgCIdAudioLoop: // audio loop editor + TogglePopupFieldControlL( IdOfFocusControl() ); break; - } + default: + break; } + } + EVTUIDEBUG("- CEvtEditor::HandleDialogPageEventL()"); } - - EVTUIDEBUG("- CEvtEditor::HandlePointerEventL()"); - } // --------------------------------------------------------------------------- // CEvtEditor::MakeTitleL() // Set the Title Text diff -r 522cd55cc3d7 -r 3c271c9e6618 landmarksui/app/src/CLmkCategoryContentsContainer.cpp --- a/landmarksui/app/src/CLmkCategoryContentsContainer.cpp Tue Feb 02 00:16:03 2010 +0200 +++ b/landmarksui/app/src/CLmkCategoryContentsContainer.cpp Fri Feb 19 22:45:00 2010 +0200 @@ -173,8 +173,8 @@ CLmkAppSelectorImplBase& selector = SelectorImpl(); TInt markedCount(selector.ListMarkedItemCountL()); TInt visibleCount(selector.ListVisibleItemCount()); - DEBUG1( CLmkByLmContainer::OfferKeyEventL markedCount=%d,markedCount ); - DEBUG1( CLmkByLmContainer::OfferKeyEventL visibleCount=%d,visibleCount ); + DEBUG1( CLmkCategoryContentsContainer::OfferKeyEventL markedCount=%d,markedCount ); + DEBUG1( CLmkCategoryContentsContainer::OfferKeyEventL visibleCount=%d,visibleCount ); if (aKeyEvent.iCode == EKeyOK && !shiftKeyPressed && aType == EEventKey) { @@ -232,14 +232,8 @@ iIsEditorOpened = EFalse; TKeyResponse response = CLmkLbWithFilterContainer::OfferKeyEventL( aKeyEvent, aType); - - if (static_cast (ListBox().Model())->ItemTextArray()->MdcaCount() - == 0) - { - (static_cast (&iView))->HandleCommandL( - EAknSoftkeyBack); - } - + + DEBUG( CLmkCategoryContentsContainer::OfferKeyEventL End ); return response; } @@ -255,6 +249,15 @@ { SelectorImpl().ProcessCommandL(ELmkCmdFindBoxSearchAfresh); } + if (aEventType == EEventStateChanged && aControl == iListBox ) + { + if (static_cast (ListBox().Model())->ItemTextArray()->MdcaCount() + == 0) + { + (static_cast (&iView))->HandleCommandL( + EAknSoftkeyBack); + } + } } // ---------------------------------------------------------------------------- diff -r 522cd55cc3d7 -r 3c271c9e6618 landmarksui/app/src/CLmkCategoryContentsView.cpp --- a/landmarksui/app/src/CLmkCategoryContentsView.cpp Tue Feb 02 00:16:03 2010 +0200 +++ b/landmarksui/app/src/CLmkCategoryContentsView.cpp Fri Feb 19 22:45:00 2010 +0200 @@ -218,18 +218,21 @@ if (static_cast (iContainer->ListBox().Model())->ItemTextArray()->MdcaCount() == 0) { + DEBUG( CLmkCategoryContentsView::HandleCommandL listbx count = 0 ); AppUi()->ActivateLocalViewL(TUid::Uid(ELmkByCategoryView)); } break; } case EAknSoftkeyBack: { + DEBUG( CLmkCategoryContentsView::HandleCommandL Back Button ); AppUi()->ActivateLocalViewL(TUid::Uid(ELmkByCategoryView)); break; } case ERemoveFromCat: { + DEBUG( CLmkCategoryContentsView::HandleCommandL ERemoveFromCat ); iContainer->RemoveFromThisCategoryL(); if (static_cast (iContainer->ListBox().Model())->ItemTextArray()->MdcaCount() == 0) diff -r 522cd55cc3d7 -r 3c271c9e6618 landmarksui/app/src/CLmkLbWithFilterContainer.cpp --- a/landmarksui/app/src/CLmkLbWithFilterContainer.cpp Tue Feb 02 00:16:03 2010 +0200 +++ b/landmarksui/app/src/CLmkLbWithFilterContainer.cpp Fri Feb 19 22:45:00 2010 +0200 @@ -27,6 +27,7 @@ #include "CLmkAppSelectorImplBase.h" #include "CLmkLbWithFilterContainer.h" #include +#include "Debug.h" // CONSTANTS namespace { @@ -117,6 +118,7 @@ const TKeyEvent& aKeyEvent, TEventCode aType ) { + DEBUG( CLmkLbWithFilterContainer::OfferKeyEventL start ); TKeyResponse result( EKeyWasNotConsumed ); if ( ( aType == EEventKey || aType == EEventKeyUp) ) { @@ -130,16 +132,19 @@ CLmkAppSelectorImplBase& selector = SelectorImpl(); TInt markedCount( selector.ListMarkedItemCountL() ); + DEBUG1( CLmkLbWithFilterContainer::OfferKeyEventL markedCount = %d,markedCount); CEikMenuBar* menuBar = MenuBar(); if( menuBar ) { - if( MenuBar()->ItemSpecificCommandsEnabled() - && markedCount <= 0 ) + if( MenuBar()->ItemSpecificCommandsEnabled()) { return EKeyWasConsumed; } } - + if( markedCount <= 0) + { + return EKeyWasConsumed; + } selector.ProcessCommandL( ELmkCmdDeleteLm ); return EKeyWasConsumed; } @@ -152,6 +157,7 @@ UpdateMskContainerL(); } } + DEBUG1( CLmkLbWithFilterContainer::OfferKeyEventL End result=%d,result ); return result; } diff -r 522cd55cc3d7 -r 3c271c9e6618 landmarksui/engine/src/CLmkSearchedLmListProvider.cpp --- a/landmarksui/engine/src/CLmkSearchedLmListProvider.cpp Tue Feb 02 00:16:03 2010 +0200 +++ b/landmarksui/engine/src/CLmkSearchedLmListProvider.cpp Fri Feb 19 22:45:00 2010 +0200 @@ -1,20 +1,19 @@ /* -* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Filtered landmarks list provider -* -*/ - + * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Filtered landmarks list provider + * + */ // SYSTEM INCLUDES #include @@ -38,24 +37,24 @@ #include "CLmkAOOperation.h" #include "MLmkSelectorIconMgr.h" #include +#include "Debug.h" // CONSTANTS _LIT(KSpaceTextCriteria,"* "); _LIT(KDefaultTextCriteria,"*"); #if defined(_DEBUG) -// CONSTANTS /// Unnamed namespace for local definitions -namespace { - -_LIT( KPanicMsg, "CLmkSearchedLmListProvider" ); +namespace + { + _LIT( KPanicMsg, "CLmkSearchedLmListProvider" ); + void Panic(TPanicCode aReason) + { + User::Panic(KPanicMsg, aReason); + } + } // namespace +#endif -void Panic( TPanicCode aReason ) - { - User::Panic( KPanicMsg, aReason ); - } -} // namespace -#endif // ============================ MEMBER FUNCTIONS =============================== // ----------------------------------------------------------------------------- @@ -65,11 +64,9 @@ // ----------------------------------------------------------------------------- // CLmkSearchedLmListProvider::CLmkSearchedLmListProvider( - CPosLandmarkDatabase& aDb, - CPosLmSearchCriteria& aCriteria ) - : CLmkLmItemListProvider( aDb ), - iCriteria( aCriteria ), - iIsSecondSearchStarted(EFalse) + CPosLandmarkDatabase& aDb, CPosLmSearchCriteria& aCriteria) : + CLmkLmItemListProvider(aDb), iCriteria(aCriteria), + iIsSecondSearchStarted(EFalse) { } @@ -85,10 +82,10 @@ iReadParams = CPosLmPartialReadParameters::NewLC(); CleanupStack::Pop(); // iReadParams - iReadParams->SetRequestedAttributes( CPosLandmark::ELandmarkName | - CPosLandmark::EIcon | CPosLandmark::ECategoryInfo); + iReadParams->SetRequestedAttributes(CPosLandmark::ELandmarkName + | CPosLandmark::EIcon | CPosLandmark::ECategoryInfo); - iSearch = CPosLandmarkSearch::NewL( iDb ); + iSearch = CPosLandmarkSearch::NewL(iDb); } // ----------------------------------------------------------------------------- @@ -97,13 +94,12 @@ // ----------------------------------------------------------------------------- // CLmkSearchedLmListProvider* CLmkSearchedLmListProvider::NewL( - CPosLandmarkDatabase& aDb, - CPosLmSearchCriteria& aCriteria ) + CPosLandmarkDatabase& aDb, CPosLmSearchCriteria& aCriteria) { CLmkSearchedLmListProvider* self = - new ( ELeave ) CLmkSearchedLmListProvider( aDb, aCriteria ); + new (ELeave) CLmkSearchedLmListProvider(aDb, aCriteria); - CleanupStack::PushL( self ); + CleanupStack::PushL(self); self->ConstructL(); CleanupStack::Pop(); @@ -119,9 +115,9 @@ delete iReadParams; delete iSearch; if (iSearchAO) - { - iSearchAO->StopOperation(); - } + { + iSearchAO->StopOperation(); + } delete iSearchAO; } @@ -129,7 +125,7 @@ // CLmkSearchedLmListProvider::ItemAtL // --------------------------------------------------------- // -CLmkUiItemBase* CLmkSearchedLmListProvider::ItemAtL( TInt aIndex ) +CLmkUiItemBase* CLmkSearchedLmListProvider::ItemAtL(TInt aIndex) { __ASSERT_DEBUG( iIconMgr, Panic( KLmkPanicNullMember ) ); //landmark with updated icon, if associated with one cat. @@ -138,25 +134,25 @@ TInt iconFileIndex = -1; TInt iconListIndex = -1; TInt iconMasktIndex = -1; - TInt result = landmark->GetIcon( mbmFile, iconFileIndex, iconMasktIndex ); - if ( result == KErrNone ) + TInt result = landmark->GetIcon(mbmFile, iconFileIndex, iconMasktIndex); + if (result == KErrNone) { TRAPD(err, iconListIndex = - iIconMgr->GetIconL( mbmFile, iconFileIndex ) ); - if ( err == KErrNotFound ) // icon file not found -> fallback to default + iIconMgr->GetIconL( mbmFile, iconFileIndex ) ); + if (err == KErrNotFound) // icon file not found -> fallback to default { iconListIndex = iIconMgr->GetDefaultIconL( - MLmkSelectorIconMgr::ELandmarkDefaultIcon ); + MLmkSelectorIconMgr::ELandmarkDefaultIcon); } } else { iconListIndex = iIconMgr->GetDefaultIconL( - MLmkSelectorIconMgr::ELandmarkDefaultIcon ); + MLmkSelectorIconMgr::ELandmarkDefaultIcon); } - CLmkLandmarkUiItem* uiItem = - CLmkLandmarkUiItem::NewL( landmark, iconListIndex ); + CLmkLandmarkUiItem* uiItem = CLmkLandmarkUiItem::NewL(landmark, + iconListIndex); CleanupStack::Pop(); // landmark, ownership transferred return uiItem; } @@ -166,29 +162,29 @@ // --------------------------------------------------------- // void CLmkSearchedLmListProvider::PrepareListL() - { + { + DEBUG( CLmkSearchedLmListProvider::PrepareListL start ); iCount = 0; - iDb.SetPartialReadParametersL( *iReadParams ); + iDb.SetPartialReadParametersL(*iReadParams); - TPosLmSortPref sortOrder( CPosLandmark::ELandmarkName, - TPosLmSortPref::EAscending ); - CPosLmOperation* operation = - iSearch->StartLandmarkSearchL( iCriteria, sortOrder ); - CleanupStack::PushL( operation ); + TPosLmSortPref sortOrder(CPosLandmark::ELandmarkName, + TPosLmSortPref::EAscending); + CPosLmOperation* operation = iSearch->StartLandmarkSearchL(iCriteria, + sortOrder); + CleanupStack::PushL(operation); if (iSearchAO) - { - iSearchAO->StopOperation(); - delete iSearchAO; // cancel possibly pending operation - iSearchAO = NULL; - } - iSearchAO = CLmkAOOperation::NewL( operation, - *this, - MLmkAOOperationObserver::ESearch, - iOperationNotInUse ); - iOperationNotInUse = ETrue; - CleanupStack::Pop( operation ); // ownership transferred + { + iSearchAO->StopOperation(); + delete iSearchAO; // cancel possibly pending operation + iSearchAO = NULL; + } + iSearchAO = CLmkAOOperation::NewL(operation, *this, + MLmkAOOperationObserver::ESearch, iOperationNotInUse); + iOperationNotInUse = ETrue; + CleanupStack::Pop(operation); // ownership transferred iSearchAO->StartOperation(); + DEBUG( CLmkSearchedLmListProvider::PrepareListL End ); } // ----------------------------------------------------------------------------- @@ -196,235 +192,246 @@ // ----------------------------------------------------------------------------- // TBool CLmkSearchedLmListProvider::PrepareListL(const TDesC& aSearchPattern, - TBool aSearchOnlyInPreviousMatches) - { + TBool aSearchOnlyInPreviousMatches) + { iCount = 0; - iRequestFromFindBox = ETrue; - iOperationNotInUse = ETrue; + iRequestFromFindBox = ETrue; + iOperationNotInUse = ETrue; iIsSecondSearchStarted = EFalse; - - if( aSearchPattern.Compare( KDefaultTextCriteria ) == 0 - || aSearchPattern.Length() <= 0 ) - { - PrepareListL(); - iRequestFromFindBox = EFalse; - return ETrue; - } + DEBUG1( CLmkSearchedLmListProvider::PrepareListL 2 start with aSearchPattern = %d,aSearchPattern.Length()); - // We need to cancel if we are searching/reading landmarks. - if (iSearchAO) - { - iSearchAO->StopOperation(); - delete iSearchAO; // cancel possibly pending operation - iSearchAO = NULL; - } + if (aSearchPattern.Compare(KDefaultTextCriteria) == 0 + || aSearchPattern.Length() <= 0) + { + PrepareListL(); + iRequestFromFindBox = EFalse; + return ETrue; + } - // Create the composite criterion - CPosLmCompositeCriteria* compCrit = CPosLmCompositeCriteria::NewLC( - CPosLmCompositeCriteria::ECompositionOR ); + // We need to cancel if we are searching/reading landmarks. + if (iSearchAO) + { + iSearchAO->StopOperation(); + delete iSearchAO; // cancel possibly pending operation + iSearchAO = NULL; + } - // Create the text search criterion and add it to composite - CPosLmTextCriteria* textCrit1 = CPosLmTextCriteria::NewLC(); + // Create the composite criterion + CPosLmCompositeCriteria* compCrit = CPosLmCompositeCriteria::NewLC( + CPosLmCompositeCriteria::ECompositionOR); + + // Create the text search criterion and add it to composite + CPosLmTextCriteria* textCrit1 = CPosLmTextCriteria::NewLC(); const TInt KExtraChars = 3; // 2 chars wildcards HBufC* filterBuf = HBufC::NewLC(aSearchPattern.Length() + KExtraChars); TPtr filter = filterBuf->Des(); - filter.Copy(KSpaceTextCriteria); - filter.Append(aSearchPattern); + filter.Copy(KSpaceTextCriteria); + filter.Append(aSearchPattern); - textCrit1->SetTextL( filter ); + textCrit1->SetTextL(filter); textCrit1->SetAttributesToSearch(CPosLandmark::ELandmarkName); - User::LeaveIfError( compCrit->AddArgument( textCrit1 ) ); - // Ownership of the text criterion has been passed to the composite - CleanupStack::PopAndDestroy( filterBuf ); - CleanupStack::Pop( textCrit1 ); + User::LeaveIfError(compCrit->AddArgument(textCrit1)); + // Ownership of the text criterion has been passed to the composite + CleanupStack::PopAndDestroy(filterBuf); + CleanupStack::Pop(textCrit1); - // Create the text search criterion and add it to composite - CPosLmTextCriteria* textCrit2 = CPosLmTextCriteria::NewLC(); - textCrit2->SetTextL( aSearchPattern ); + // Create the text search criterion and add it to composite + CPosLmTextCriteria* textCrit2 = CPosLmTextCriteria::NewLC(); + textCrit2->SetTextL(aSearchPattern); textCrit2->SetAttributesToSearch(CPosLandmark::ELandmarkName); - User::LeaveIfError( compCrit->AddArgument( textCrit2 ) ); - // Ownership of the text criterion has been passed to the composite - CleanupStack::Pop( textCrit2 ); + User::LeaveIfError(compCrit->AddArgument(textCrit2)); + // Ownership of the text criterion has been passed to the composite + CleanupStack::Pop(textCrit2); - iDb.SetPartialReadParametersL( *iReadParams ); + iDb.SetPartialReadParametersL(*iReadParams); - TPosLmSortPref sortOrder( CPosLandmark::ELandmarkName, - TPosLmSortPref::EAscending ); - // Start the search + TPosLmSortPref sortOrder(CPosLandmark::ELandmarkName, + TPosLmSortPref::EAscending); + // Start the search // Create search operation - CPosLmOperation* operation = iSearch->StartLandmarkSearchL( - *compCrit, sortOrder, aSearchOnlyInPreviousMatches ); - - CleanupStack::PopAndDestroy( compCrit ); - CleanupStack::PushL( operation ); + CPosLmOperation* operation = iSearch->StartLandmarkSearchL(*compCrit, + sortOrder, aSearchOnlyInPreviousMatches); - iSearchAO = CLmkAOOperation::NewL( operation, - *this, - MLmkAOOperationObserver::ESearch, - ETrue ); - CleanupStack::Pop( operation ); // ownership transferred + CleanupStack::PopAndDestroy(compCrit); + CleanupStack::PushL(operation); + + iSearchAO = CLmkAOOperation::NewL(operation, *this, + MLmkAOOperationObserver::ESearch, ETrue); + CleanupStack::Pop(operation); // ownership transferred iSearchAO->StartOperation(); - + DEBUG( CLmkSearchedLmListProvider::PrepareListL 2 End ); return ETrue; - } + } // --------------------------------------------------------- // CLmkSearchedLmListProvider::StartSecondSearchL // --------------------------------------------------------- // void CLmkSearchedLmListProvider::StartSecondSearchL() - { - // Create the composite criterion - CPosLmCompositeCriteria* compCrit = CPosLmCompositeCriteria::NewLC( - CPosLmCompositeCriteria::ECompositionAND ); + { + DEBUG( CLmkSearchedLmListProvider::StartSecondSearchL start ); - // Create the category search criterion and add it to composite - CPosLmCategoryCriteria* catCrit = CPosLmCategoryCriteria::NewLC(); - catCrit->SetCategoryItemId( (static_cast(iCriteria)).CategoryItemId() ); + iIsSecondSearchStarted = ETrue; + + // Create the composite criterion + CPosLmCompositeCriteria* compCrit = CPosLmCompositeCriteria::NewLC( + CPosLmCompositeCriteria::ECompositionAND); - User::LeaveIfError( compCrit->AddArgument( catCrit ) ); - // Ownership of the category criterion has been passed to the composite - CleanupStack::Pop( catCrit ); + // Create the category search criterion and add it to composite + CPosLmCategoryCriteria* catCrit = CPosLmCategoryCriteria::NewLC(); + catCrit->SetCategoryItemId( + (static_cast (iCriteria)).CategoryItemId()); - // Create the text search criterion and add it to composite - CPosLmIdListCriteria* idListCrit = CPosLmIdListCriteria::NewLC(); - idListCrit->SetLandmarkIdsL( iIdArray ); + User::LeaveIfError(compCrit->AddArgument(catCrit)); + // Ownership of the category criterion has been passed to the composite + CleanupStack::Pop(catCrit); - User::LeaveIfError( compCrit->AddArgument( idListCrit ) ); - // Ownership of the text criterion has been passed to the composite - CleanupStack::Pop( idListCrit ); + // Create the text search criterion and add it to composite + CPosLmIdListCriteria* idListCrit = CPosLmIdListCriteria::NewLC(); + idListCrit->SetLandmarkIdsL(iIdArray); - iDb.SetPartialReadParametersL( *iReadParams ); + User::LeaveIfError(compCrit->AddArgument(idListCrit)); + // Ownership of the text criterion has been passed to the composite + CleanupStack::Pop(idListCrit); - TPosLmSortPref sortOrder( CPosLandmark::ELandmarkName, - TPosLmSortPref::EAscending ); - // Start the search - // Create search operation - CPosLmOperation* operation = iSearch->StartLandmarkSearchL( *compCrit, sortOrder ); - - CleanupStack::PopAndDestroy( compCrit ); - CleanupStack::PushL( operation ); + iDb.SetPartialReadParametersL(*iReadParams); - iSearchAO = CLmkAOOperation::NewL( operation, - *this, - MLmkAOOperationObserver::ESearch, - ETrue ); - CleanupStack::Pop( operation ); // ownership transferred + TPosLmSortPref sortOrder(CPosLandmark::ELandmarkName, + TPosLmSortPref::EAscending); + // Start the search + // Create search operation + CPosLmOperation* operation = iSearch->StartLandmarkSearchL(*compCrit, + sortOrder); - iIsSecondSearchStarted = EFalse; + CleanupStack::PopAndDestroy(compCrit); + CleanupStack::PushL(operation); + + iSearchAO = CLmkAOOperation::NewL(operation, *this, + MLmkAOOperationObserver::ESearch, ETrue); + CleanupStack::Pop(operation); // ownership transferred + iSearchAO->StartOperation(); - - } + DEBUG( CLmkSearchedLmListProvider::StartSecondSearchL End ); + } // --------------------------------------------------------- // CLmkSearchedLmListProvider::HandleOperationL // --------------------------------------------------------- // -void CLmkSearchedLmListProvider::HandleOperationL( - TOperationTypes aType, - TReal32 aProgress, - TInt aStatus ) +void CLmkSearchedLmListProvider::HandleOperationL(TOperationTypes aType, + TReal32 aProgress, TInt aStatus) { - if ( aType == MLmkAOOperationObserver::EDeleteLandmarks ) - { - return; - } - if ( aType == MLmkAOOperationObserver::ERemoveCategory ) - { - return; - } - if ( aType == MLmkAOOperationObserver::ESearch ) + DEBUG1( CLmkSearchedLmListProvider::HandleOperationL start aType=%d,aType); + if (aType == MLmkAOOperationObserver::EDeleteLandmarks) + { + return; + } + if (aType == MLmkAOOperationObserver::ERemoveCategory) + { + return; + } + if (aType == MLmkAOOperationObserver::ESearch) { - ReadItemsToArrayL(); - if ( aStatus == KErrNone ) - { - if( iSearchAO ) - { - iSearchAO->StopOperation(); - delete iSearchAO; - iSearchAO = NULL; - } + ReadItemsToArrayL(); + if (aStatus == KErrNone) + { + if (iSearchAO) + { + iSearchAO->StopOperation(); + delete iSearchAO; + iSearchAO = NULL; + } + + // reset operation values + iOperationCmd = ELmkCmdStopOperation;//temp default value + iCount = 0; + + DEBUG2( CLmkSearchedLmListProvider::HandleOperationL iRequestFromFindBox=%d iIsSecondSearchStarted=%d + ,iRequestFromFindBox,iIsSecondSearchStarted); - // reset operation values - iOperationCmd = ELmkCmdStopOperation;//temp default value - iCount = 0; + if (iRequestFromFindBox && iIsSecondSearchStarted == EFalse) + { + DEBUG( CLmkSearchedLmListProvider::HandleOperationL start secondsearch ); + StartSecondSearchL(); + return; + } - if( iIsSecondSearchStarted ) - { - StartSecondSearchL(); - } + DEBUG( CLmkSearchedLmListProvider::HandleOperationL refresh list ); + + iIsSecondSearchStarted = EFalse; - if(iOperationNotInUse == EFalse ) - { - NotifyObservers( ELmkEventItemAdditionComplete ); - } - else - { - if (iRequestFromFindBox) - { - NotifyObservers( ELmkEventFindListReady ); - } - else - { - NotifyObservers( ELmkEventListReady ); - } - } + if (iOperationNotInUse == EFalse) + { + NotifyObservers(ELmkEventItemAdditionComplete); + } + else + { + if (iRequestFromFindBox) + { + NotifyObservers(ELmkEventFindListReady); + } + else + { + NotifyObservers(ELmkEventListReady); + } + } - iOperationNotInUse = ETrue; + iOperationNotInUse = ETrue; - if ( iCatDelete ) + if (iCatDelete) { - NotifyObservers( ELmkEventCategoryDeleted ); + NotifyObservers(ELmkEventCategoryDeleted); iCatDelete = EFalse; } - else if(iCatUpdate) - { - NotifyObservers( ELmkEventCategoryUpdated ); + else if (iCatUpdate) + { + NotifyObservers(ELmkEventCategoryUpdated); iCatUpdate = EFalse; } - if(iItemsDeleted < iItemsToDelete) - { - PrepareForDeleteL(); - } - else - { - if(iWaitNote) - { - iWaitNote->ProcessFinishedL(); - iWaitNote = NULL; - } - } - return; - } // end of if ( aStatus == KErrNone ) + if (iItemsDeleted < iItemsToDelete) + { + PrepareForDeleteL(); + } + else + { + if (iWaitNote) + { + iWaitNote->ProcessFinishedL(); + iWaitNote = NULL; + } + } + return; + } // end of if ( aStatus == KErrNone ) - if ( iCount == ELmkStepOne || iCount == ELmkStepTwo ) - { - if (iOperationNotInUse == EFalse ) - { - NotifyObservers( ELmkEventItemAdditionComplete ); - } - else - { - if (iRequestFromFindBox) - { - NotifyObservers( ELmkEventFindListReady ); - } - else - { - NotifyObservers( ELmkEventListReady ); - } - } - iOperationNotInUse = EFalse; - } + if (iCount == ELmkStepOne || iCount == ELmkStepTwo) + { + if (iOperationNotInUse == EFalse) + { + NotifyObservers(ELmkEventItemAdditionComplete); + } + else + { + if (iRequestFromFindBox) + { + NotifyObservers(ELmkEventFindListReady); + } + else + { + NotifyObservers(ELmkEventListReady); + } + } + iRequestFromFindBox = EFalse; + iOperationNotInUse = EFalse; + } } else { // This is not this classes' operation - CLmkLmItemListProvider::HandleOperationL( aType, aProgress, aStatus); + CLmkLmItemListProvider::HandleOperationL(aType, aProgress, aStatus); } } @@ -432,87 +439,87 @@ // CLmkSearchedLmListProvider::HandleDatabaseEvent // --------------------------------------------------------- // -void CLmkSearchedLmListProvider::HandleDatabaseEvent( TPosLmEvent& aEvent ) +void CLmkSearchedLmListProvider::HandleDatabaseEvent(TPosLmEvent& aEvent) { iCatDelete = EFalse; - TBool needRefresh = ETrue; + TBool needRefresh = ETrue; - // check any items are selected to do operations like iconchanges or add to category. - if( iSelectedItemsCount > 0 - && iOperationCmd != ELmkCmdAddToCat - && iOperationCmd != ERemoveFromCat ) - { - iCount++; - if( iSelectedItemsCount == iCount ) - { - iSelectedItemsCount = 0; - iCount = 0; - } - needRefresh = EFalse; - } + // check any items are selected to do operations like iconchanges or add to category. + if (iSelectedItemsCount > 0 && iOperationCmd != ELmkCmdAddToCat + && iOperationCmd != ERemoveFromCat) + { + iCount++; + if (iSelectedItemsCount == iCount) + { + iSelectedItemsCount = 0; + iCount = 0; + } + needRefresh = EFalse; + } - switch ( aEvent.iEventType ) + switch (aEvent.iEventType) { - case EPosLmEventLandmarkUpdated: // lm icon changes, lm renaming - case EPosLmEventLandmarkUnknownChanges: // lm multiple deletion, lm add to category + case EPosLmEventLandmarkUpdated: // lm icon changes, lm renaming + case EPosLmEventLandmarkUnknownChanges: // lm multiple deletion, lm add to category case EPosLmEventUnknownChanges: case EPosLmEventLandmarkCreated: case EPosLmEventCategoryDeleted: case EPosLmEventCategoryUpdated: { iOperationNotInUse = EFalse; - if (aEvent.iEventType == EPosLmEventCategoryDeleted ) - { - iCatDelete = ETrue; - } - if (aEvent.iEventType == EPosLmEventCategoryUpdated ) - { - iCatUpdate = ETrue; - } + if (aEvent.iEventType == EPosLmEventCategoryDeleted) + { + iCatDelete = ETrue; + } + if (aEvent.iEventType == EPosLmEventCategoryUpdated) + { + iCatUpdate = ETrue; + } - if( needRefresh ) - { - if( iSearchAO ) - { - iSearchAO->StopOperation(); - delete iSearchAO; - iSearchAO = NULL; - } - iOperationNotInUse = EFalse; - TInt err = KErrNone; - do - { - TRAP( err, PrepareListL() ); - }while(err == KErrLocked); - if ( err ) - { - HandleError( err ); - } - } - else - { - NotifyObservers( ELmkEventListReady ); - } + if (needRefresh) + { + if (iSearchAO) + { + iSearchAO->StopOperation(); + delete iSearchAO; + iSearchAO = NULL; + } + iOperationNotInUse = EFalse; + TInt err = KErrNone; + do + { + TRAP( err, PrepareListL() ); + } + while (err == KErrLocked); + if (err) + { + HandleError(err); + } + } + else + { + NotifyObservers(ELmkEventListReady); + } break; } case EPosLmEventLandmarkDeleted: - { - TInt index = iIdArray.Find( aEvent.iLandmarkItemId ); - if( index != KErrNotFound && index < iIdArray.Count()) - { - iIdArray.Remove(index); - NotifyObservers( ELmkEventListReady ); - } - break; - } + { + TInt index = iIdArray.Find(aEvent.iLandmarkItemId); + if (index != KErrNotFound && index < iIdArray.Count()) + { + iIdArray.Remove(index); + NotifyObservers(ELmkEventListReady); + } + break; + } default: { // Not interesting event for this provider break; } } // Remember to call base class observer method too - CLmkLmItemListProvider::HandleDatabaseEvent( aEvent ); + CLmkLmItemListProvider::HandleDatabaseEvent(aEvent); } // --------------------------------------------------------- @@ -523,87 +530,86 @@ { iIdArray.Reset(); CPosLmItemIterator* iterator = iSearch->MatchIteratorL(); - CleanupStack::PushL( iterator ); + CleanupStack::PushL(iterator); iCount = iterator->NumOfItemsL(); - if ( iCount > 0 ) + if (iCount > 0) { // can only be called if there are some items - iterator->GetItemIdsL( iIdArray, 0, iCount ); // array is first reseted + iterator->GetItemIdsL(iIdArray, 0, iCount); // array is first reseted } - CleanupStack::PopAndDestroy( iterator ); + CleanupStack::PopAndDestroy(iterator); } // --------------------------------------------------------- // CLmkSearchedLmListProvider::RemoveLandmarksL // --------------------------------------------------------- // -void CLmkSearchedLmListProvider::RemoveLandmarksL(const RArray& aSelectedItems ) - { - iItemsToDelete = aSelectedItems.Count(); - iSelectedForDelete.Reset(); - for(TInt i=0;i& aSelectedItems) + { + iItemsToDelete = aSelectedItems.Count(); + iSelectedForDelete.Reset(); + for (TInt i = 0; i < iItemsToDelete; i++) + iSelectedForDelete.Append(aSelectedItems[i]); + iItemsDeleted = 0; + iIsRemoveLandmarks = ETrue; - if(iWaitNote) - { - delete iWaitNote; - iWaitNote = NULL; - } - PrepareForDeleteL(); - } + if (iWaitNote) + { + delete iWaitNote; + iWaitNote = NULL; + } + PrepareForDeleteL(); + } // --------------------------------------------------------- // CLmkSearchedLmListProvider::PrepareForDelete // --------------------------------------------------------- // void CLmkSearchedLmListProvider::PrepareForDeleteL() - { - RArray lmItemsChunk; - TInt count = iItemsDeleted; - if(iItemsToDelete > (iItemsDeleted + 10)) - { - iItemsDeleted = iItemsDeleted + 10; - } - else - { - iItemsDeleted = iItemsDeleted + (iItemsToDelete - iItemsDeleted); - } + { + RArray lmItemsChunk; + TInt count = iItemsDeleted; + if (iItemsToDelete > (iItemsDeleted + 10)) + { + iItemsDeleted = iItemsDeleted + 10; + } + else + { + iItemsDeleted = iItemsDeleted + (iItemsToDelete - iItemsDeleted); + } - for(TInt i=count;iRemoveCategoryFromLandmarksL( iCategoryId, lmItemsChunk ); - CleanupStack::PopAndDestroy();//mgr - } - User::LeaveIfNull( operation ); + CPosLmOperation* operation = NULL; + if (iType == MLmkAOOperationObserver::EDeleteLandmarks) + { + operation = iDb.RemoveLandmarksL(lmItemsChunk); + } + if (iType == MLmkAOOperationObserver::ERemoveCategory) + { + CPosLmCategoryManager* mgr = CPosLmCategoryManager::NewL(iDb); + CleanupStack::PushL(mgr); + operation = mgr->RemoveCategoryFromLandmarksL(iCategoryId, + lmItemsChunk); + CleanupStack::PopAndDestroy();//mgr + } + User::LeaveIfNull(operation); - CleanupStack::PushL( operation ); - iSearchAO = CLmkAOOperation::NewL( operation, - *this, - iType, - EFalse ); - CleanupStack::Pop( operation ); // ownership transferred + CleanupStack::PushL(operation); + iSearchAO = CLmkAOOperation::NewL(operation, *this, iType, EFalse); + CleanupStack::Pop(operation); // ownership transferred - if( iSearchAO ) + if (iSearchAO) { iSearchAO->StartOperation(); - if(!iWaitNote) + if (!iWaitNote) { iWaitNote = new (ELeave) CAknWaitDialog(NULL, ETrue); - if(!iWaitNote->ExecuteLD(R_LMK_PROCESSING_WAIT_NOTE)) + if (!iWaitNote->ExecuteLD(R_LMK_PROCESSING_WAIT_NOTE)) { iSearchAO->StopOperation(); delete iSearchAO; @@ -612,8 +618,8 @@ } } } - - lmItemsChunk.Close(); - } + + lmItemsChunk.Close(); + } // End of File diff -r 522cd55cc3d7 -r 3c271c9e6618 landmarksui/uicontrols/inc/CLmkEditorImpl.h --- a/landmarksui/uicontrols/inc/CLmkEditorImpl.h Tue Feb 02 00:16:03 2010 +0200 +++ b/landmarksui/uicontrols/inc/CLmkEditorImpl.h Fri Feb 19 22:45:00 2010 +0200 @@ -162,9 +162,8 @@ protected: // From MEikDialogPageObserver void HandleDialogPageEventL(TInt aEventID); - void HandlePointerEventL(const TPointerEvent& aPointerEvent); - #endif //RD_SCALABLE_UI_V2 + //from MEikDialogPageObserver void LineChangedL(TInt aControlId); @@ -206,9 +205,8 @@ * @param aLandmark, Null if create new * @param aAttributes */ - void - ConstructL(CPosLandmark* aLandmark, - TLmkEditorAttributes aAttributes); + void ConstructL(CPosLandmark* aLandmark, + TLmkEditorAttributes aAttributes); /** * By default Symbian 2nd phase constructor is private. @@ -227,6 +225,10 @@ * Context menu bar construction */ void ConstructContextMenuL(); + + /** + * Checks Landmarks Coordinate Data Is available or not. + */ TBool IsLandmarkDataEmptyL(CPosLandmark* aLandmark); /** @@ -292,9 +294,6 @@ CPosLandmark* aLandmark, MLmkFieldData* fieldData, TInt aPrevControlId, TInt aPos); - //Pops up info popup after 1 sec. - //void ShowMultipleCategoriesInfoPopupL(TBool aRefresh); - TBool ShowQueryIfLocationFieldsAlreadyFilledL(); TBool ValidateContentL(); @@ -382,7 +381,7 @@ /// Reference to database CPosLandmarkDatabase& iDb; - ///Ref: landmark sender + /// Ref: landmark sender CLmkSender& iSender; /// Ref: CPosLmPartialReadParameters @@ -394,13 +393,13 @@ /// Own: landmark UI utils CLmkUiUtils* iLmkUiUtils; - ///Own: + /// Own: CLmkFields* iLmkFields; - ///Own: + /// Own: RPointerArray iLabelArray; - ///Own: + /// Own: CLmkEditorFieldArray* iEditorFieldArray; TLmkEditorMode iEditorMode; @@ -430,7 +429,7 @@ TBool iJapaneseInputMode; CPosLandmark* iLandmark; - //Own: Pointer to map and navigation interface + // Own: Pointer to map and navigation interface CLmkMapNavigationInterface* iMapNavInterface; // Flag which indicates receive state of landmark editor dialog // Set to true for receive mode @@ -438,27 +437,27 @@ TLmkAppCmdId iMskCmdId; TInt iCurrentResourceId; - //It will be ETrue when coordinates has to be hidden. + // It will be ETrue when coordinates has to be hidden. TBool iIsHideCoordinate; - //It will be ETrue when help has to be hidden. + // It will be ETrue when help has to be hidden. TBool iIsHideHelp; - // To Handle Drag Pointer Event - TBool iIsDragging; - private: - //added data members - //holds the field type of the current focussed item in the dialog + // added data members + // holds the field type of the current focussed item in the dialog TUint iFieldTypeToFocus; - //Set true when editor dialog is launched from view dialog. + // Set true when editor dialog is launched from view dialog. TBool iIsEditing; TBool iBackspaceStartForWebAddressField; TBool iResetWebAddrSize; + CAknInfoPopupNoteController* iCatInfoPopupNote; - + // Own: + CLmkListProviderBase* iListProvider; + CLmkEditorImpl* iEditor; CLmkCentralRepository* iRepository; @@ -468,12 +467,13 @@ * Owns */ CLmkWaitDialogLauncher* iWaitDialogLauncher; + TBool iIsEndKey; + TBool iIsEditableField; // To check the ownership of iLandmark TBool iIsLmOwned; - // To Check category selector launched or not TBool iIsCategorySelctorOpen; }; diff -r 522cd55cc3d7 -r 3c271c9e6618 landmarksui/uicontrols/inc/CLmkPackageEditorImpl.h --- a/landmarksui/uicontrols/inc/CLmkPackageEditorImpl.h Tue Feb 02 00:16:03 2010 +0200 +++ b/landmarksui/uicontrols/inc/CLmkPackageEditorImpl.h Fri Feb 19 22:45:00 2010 +0200 @@ -102,8 +102,6 @@ protected: // From MEikDialogPageObserver void HandleDialogPageEventL(TInt aEventID); - void HandlePointerEventL(const TPointerEvent& aPointerEvent); - #endif //RD_SCALABLE_UI_V2 private: diff -r 522cd55cc3d7 -r 3c271c9e6618 landmarksui/uicontrols/src/CLmkAppLmSelectorImpl.cpp --- a/landmarksui/uicontrols/src/CLmkAppLmSelectorImpl.cpp Tue Feb 02 00:16:03 2010 +0200 +++ b/landmarksui/uicontrols/src/CLmkAppLmSelectorImpl.cpp Fri Feb 19 22:45:00 2010 +0200 @@ -639,7 +639,7 @@ TLocality loc; TBool isValid = (KErrNone == aLandmark->GetPosition( loc ) ); isValid &= !Math::IsNaN( loc.Latitude() ) && !Math::IsNaN( loc.Longitude() ); - return isValid; + return !isValid; /* if ( !isValid ) diff -r 522cd55cc3d7 -r 3c271c9e6618 landmarksui/uicontrols/src/CLmkDlgPackageSelectorImpl.cpp --- a/landmarksui/uicontrols/src/CLmkDlgPackageSelectorImpl.cpp Tue Feb 02 00:16:03 2010 +0200 +++ b/landmarksui/uicontrols/src/CLmkDlgPackageSelectorImpl.cpp Fri Feb 19 22:45:00 2010 +0200 @@ -616,7 +616,7 @@ TLocality loc; TBool isValid = (KErrNone == aLandmark->GetPosition(loc)); isValid &= !Math::IsNaN(loc.Latitude()) && !Math::IsNaN(loc.Longitude()); - return isValid; + return !isValid; /* if (!isValid) { diff -r 522cd55cc3d7 -r 3c271c9e6618 landmarksui/uicontrols/src/CLmkEditorImpl.cpp --- a/landmarksui/uicontrols/src/CLmkEditorImpl.cpp Tue Feb 02 00:16:03 2010 +0200 +++ b/landmarksui/uicontrols/src/CLmkEditorImpl.cpp Fri Feb 19 22:45:00 2010 +0200 @@ -1,20 +1,20 @@ /* -* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: This file contains the methods implementing the core -* functionality of landmarks editor -* -*/ + * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: This file contains the methods implementing the core + * functionality of landmarks editor + * + */ // INCLUDE FILES #include @@ -77,30 +77,30 @@ #include "LmkEditorFieldFactory.h" #include #include +#include "Debug.h" // CONSTANTS /// Unnamed namespace for local definitions -namespace { - //const TInt KMaxCatCntForInfoPopUp (3); - const TInt KHOffsetCatInfoPopup ( 100 ); - const TInt KVOffsetCatInfoPopup ( 30 ); - //const TInt KMinCatLenForInfoPopUp ( 11 ); - //const TInt KMaxCatSizeForInfoPopUp ( 135 ); - #if defined(_DEBUG) -_LIT( KPanicMsg, "CLmkEditorImpl"); +namespace + { + const TInt KHOffsetCatInfoPopup(100); + const TInt KVOffsetCatInfoPopup(30); +#if defined(_DEBUG) + _LIT( KPanicMsg, "CLmkEditorImpl"); -void Panic( TPanicCode aReason ) - { - User::Panic( KPanicMsg, aReason ); - } - #endif -} // namespace + void Panic(TPanicCode aReason) + { + User::Panic(KPanicMsg, aReason); + } +#endif + } // namespace // ================= LOCAL FUNCTIONS ======================= static void CleanupArray(TAny* aArray) { - ( static_cast*>( aArray ) )->ResetAndDestroy(); + (static_cast*> (aArray))->ResetAndDestroy(); } + // ============================ MEMBER FUNCTIONS =============================== // ----------------------------------------------------------------------------- @@ -109,16 +109,10 @@ // might leave. // ----------------------------------------------------------------------------- // -CLmkEditorImpl::CLmkEditorImpl( - CPosLandmarkDatabase& aDb, - CLmkSender& aSender, - TLmkEditorMode aEditorMode ) - : iDb( aDb ), - iSender( aSender ), - iEditorMode( aEditorMode ), - iIsEditing(EFalse), - iResetWebAddrSize(ETrue), - iIsCategorySelctorOpen(EFalse) +CLmkEditorImpl::CLmkEditorImpl(CPosLandmarkDatabase& aDb, + CLmkSender& aSender, TLmkEditorMode aEditorMode) : + iDb(aDb), iSender(aSender), iEditorMode(aEditorMode), iIsEditing(EFalse), + iResetWebAddrSize(ETrue), iIsCategorySelctorOpen(EFalse) { } @@ -127,28 +121,24 @@ // Symbian 2nd phase constructor can leave. // ----------------------------------------------------------------------------- // -void CLmkEditorImpl::ConstructL( - TPosLmItemId aLandmarkId, - TLmkEditorAttributes aAttributes ) +void CLmkEditorImpl::ConstructL(TPosLmItemId aLandmarkId, + TLmkEditorAttributes aAttributes) { + DEBUG( CLmkEditorImpl::ConstructL Editing/Viewing Existing Landmark with LandmarkId ) CommonConstructL(aAttributes); - - iLandmark = iDb.ReadLandmarkLC(aLandmarkId); - - iLmkFields = CLmkFields::NewL( iLabelArray, - iDb, - aAttributes, - aLandmarkId, - iLandmark , - iJapaneseInputMode); + iLandmark = iDb.ReadLandmarkLC(aLandmarkId); + iLmkFields = CLmkFields::NewL(iLabelArray, iDb, aAttributes, aLandmarkId, + iLandmark, iJapaneseInputMode); ChangeContextImageL(); - iEditorFieldArray = CLmkEditorFieldArray::NewL( *iLmkFields, *this ); + iEditorFieldArray = CLmkEditorFieldArray::NewL(*iLmkFields, *this); CleanupStack::Pop(iLandmark); - - if(iLandmark) - { - iIsLmOwned = ETrue; - } + if (iLandmark) + { + iIsLmOwned = ETrue; + } + iListProvider = LmkListProviderFactory::CreateProviderL( iDb, ELandmarkSelector ); + iListProvider->AddObserverL( *this ); + iListProvider->InitializeL(); } // ----------------------------------------------------------------------------- @@ -156,46 +146,35 @@ // Symbian 2nd phase constructor can leave. // ----------------------------------------------------------------------------- // -void CLmkEditorImpl::ConstructL( - CPosLandmark* aLandmark, - TLmkEditorAttributes aAttributes ) +void CLmkEditorImpl::ConstructL(CPosLandmark* aLandmark, + TLmkEditorAttributes aAttributes) { + DEBUG( CLmkEditorImpl::ConstructL Editing/Viewing Existing Landmark with Landmark Object ); CommonConstructL(aAttributes); - - iLmkFields = CLmkFields::NewL( iLabelArray, - iDb, - aAttributes, - aLandmark->LandmarkId(), - aLandmark, - iJapaneseInputMode ); + iLmkFields = CLmkFields::NewL(iLabelArray, iDb, aAttributes, + aLandmark->LandmarkId(), aLandmark, iJapaneseInputMode); iLandmark = aLandmark; - ChangeContextImageL(); - iEditorFieldArray = CLmkEditorFieldArray::NewL( *iLmkFields, *this ); + iEditorFieldArray = CLmkEditorFieldArray::NewL(*iLmkFields, *this); } // ----------------------------------------------------------------------------- // CLmkEditorImpl::ConstructL // Symbian 2nd phase constructor can leave. +// Empty Landmark Editor // ----------------------------------------------------------------------------- // -void CLmkEditorImpl::ConstructL( - TPosLmItemId* aLandmarkId, - CPosLandmark* aLandmark, - TLmkEditorAttributes aAttributes ) +void CLmkEditorImpl::ConstructL(TPosLmItemId* aLandmarkId, + CPosLandmark* aLandmark, TLmkEditorAttributes aAttributes) { + DEBUG( CLmkEditorImpl::ConstructL Empty Landmarks Editor Construction ); CommonConstructL(aAttributes); - - iLmkFields = CLmkFields::NewL( iLabelArray, - iDb, - aAttributes, - *aLandmarkId, - aLandmark, - iJapaneseInputMode ); - iLandmarkItemId = aLandmarkId; - iLandmark = aLandmark; + iLmkFields = CLmkFields::NewL(iLabelArray, iDb, aAttributes, + *aLandmarkId, aLandmark, iJapaneseInputMode); + iLandmarkItemId = aLandmarkId; + iLandmark = aLandmark; ChangeContextImageL(); - iEditorFieldArray = CLmkEditorFieldArray::NewL( *iLmkFields, *this ); + iEditorFieldArray = CLmkEditorFieldArray::NewL(*iLmkFields, *this); } // ----------------------------------------------------------------------------- @@ -204,20 +183,21 @@ // void CLmkEditorImpl::CommonConstructL(TLmkEditorAttributes& aAttributes) { - iLandmarkItemId = NULL; // Set to NULL by default. Use only where needed. + DEBUG( CLmkEditorImpl::CommonConstructL Start ) + iLandmarkItemId = NULL; // Set to NULL by default. Use only where needed. iLmkUiUtils = CLmkUiUtils::NewL(); iLmkUiUtils->ReadLmkUiResourceFileL(); - CAknForm::ConstructL( R_LMK_EDITOR_MENUBAR ); + CAknForm::ConstructL(R_LMK_EDITOR_MENUBAR); iLmkUiUtils->StoreNaviPaneL(); // store old navi pane iLmkUiUtils->CreateDefaultNaviPaneL(); // For setting Japanese input mode CAknSettingCache& cache = CAknEnv::Static()->SettingCache(); - TLanguage currentLanguage = cache.InputLanguage(); - if ( currentLanguage == ELangJapanese ) - { - iJapaneseInputMode = ETrue; - } + TLanguage currentLanguage = cache.InputLanguage(); + if (currentLanguage == ELangJapanese) + { + iJapaneseInputMode = ETrue; + } else { iJapaneseInputMode = EFalse; @@ -229,33 +209,35 @@ iLmkGoToURLCmd = CLmkGoToURLCmd::NewL(); // Launching Call UI iLmkCallCmd = CLmkCallCmd::NewL(); - iLmkCallCmd->AttachMenuPaneL( R_LMK_EDITOR_CALL_SUBMENU, R_LMK_EDITOR_AIW_INTEREST); - // Create AIW interest - iLmkCallCmd->AttachInterestL( R_LMK_EDITOR_AIW_INTEREST ); - // By default enable map and navigation feature + iLmkCallCmd->AttachMenuPaneL(R_LMK_EDITOR_CALL_SUBMENU, + R_LMK_EDITOR_AIW_INTEREST); + // Create AIW interest + iLmkCallCmd->AttachInterestL(R_LMK_EDITOR_AIW_INTEREST); + // By default enable map and navigation feature iMapNavFeature = ETrue; - iMapNavInterface = CLmkMapNavigationInterface::NewL( iDb); + iMapNavInterface = CLmkMapNavigationInterface::NewL(iDb); iCatInfoPopupNote = NULL; - iRepository = CLmkCentralRepository::NewL( KLocSystemofMeasurements,this); + iRepository = CLmkCentralRepository::NewL(KLocSystemofMeasurements, this); // Create the wait dialog launcher iWaitDialogLauncher = CLmkWaitDialogLauncher::NewL(); iWaitDialogLauncher->SetObserver(this); iIsLmOwned = EFalse; - + // Check if the Coordinates has to be hidden - CheckHideCoordinateL(); - - if( iIsHideCoordinate ) + CheckHideCoordinateL(); + + if (iIsHideCoordinate) { - aAttributes&= ~CLmkEditorDlg::ELmkLatitude; - aAttributes&= ~CLmkEditorDlg::ELmkLongitude; - aAttributes&= ~CLmkEditorDlg::ELmkPositionAccuracy; - aAttributes&= ~CLmkEditorDlg::ELmkAltitude; - aAttributes&= ~CLmkEditorDlg::ELmkAltitudeAccuracy; + aAttributes &= ~CLmkEditorDlg::ELmkLatitude; + aAttributes &= ~CLmkEditorDlg::ELmkLongitude; + aAttributes &= ~CLmkEditorDlg::ELmkPositionAccuracy; + aAttributes &= ~CLmkEditorDlg::ELmkAltitude; + aAttributes &= ~CLmkEditorDlg::ELmkAltitudeAccuracy; } + DEBUG( CLmkEditorImpl::CommonConstructL End ) } // ----------------------------------------------------------------------------- @@ -263,18 +245,15 @@ // Two-phased constructor. // ----------------------------------------------------------------------------- // -EXPORT_C CLmkEditorImpl* CLmkEditorImpl::NewL( - CPosLandmarkDatabase& aDb, - CLmkSender& aSender, - TLmkEditorAttributes aAttributes, - TLmkEditorMode aEditorMode, - TPosLmItemId aLandmarkId ) +EXPORT_C CLmkEditorImpl* CLmkEditorImpl::NewL(CPosLandmarkDatabase& aDb, + CLmkSender& aSender, TLmkEditorAttributes aAttributes, + TLmkEditorMode aEditorMode, TPosLmItemId aLandmarkId) { - CLmkEditorImpl* self = - new( ELeave ) CLmkEditorImpl( aDb, aSender, aEditorMode ); + CLmkEditorImpl* self = new (ELeave) CLmkEditorImpl(aDb, aSender, + aEditorMode); - CleanupStack::PushL( self ); - self->ConstructL( aLandmarkId, aAttributes ); + CleanupStack::PushL(self); + self->ConstructL(aLandmarkId, aAttributes); CleanupStack::Pop(); //self return self; } @@ -284,18 +263,15 @@ // Two-phased constructor. // ----------------------------------------------------------------------------- // -EXPORT_C CLmkEditorImpl* CLmkEditorImpl::NewL( - CPosLandmarkDatabase& aDb, - CLmkSender& aSender, - TLmkEditorAttributes aAttributes, - TLmkEditorMode aEditorMode, - CPosLandmark* aLandmark ) +EXPORT_C CLmkEditorImpl* CLmkEditorImpl::NewL(CPosLandmarkDatabase& aDb, + CLmkSender& aSender, TLmkEditorAttributes aAttributes, + TLmkEditorMode aEditorMode, CPosLandmark* aLandmark) { - CLmkEditorImpl* self = - new( ELeave ) CLmkEditorImpl( aDb, aSender, aEditorMode ); + CLmkEditorImpl* self = new (ELeave) CLmkEditorImpl(aDb, aSender, + aEditorMode); - CleanupStack::PushL( self ); - self->ConstructL( aLandmark, aAttributes ); + CleanupStack::PushL(self); + self->ConstructL(aLandmark, aAttributes); CleanupStack::Pop(); //self return self; } @@ -305,19 +281,16 @@ // Two-phased constructor. // ----------------------------------------------------------------------------- // -EXPORT_C CLmkEditorImpl* CLmkEditorImpl::NewL( - CPosLandmarkDatabase& aDb, - CLmkSender& aSender, - TLmkEditorAttributes aAttributes, - TLmkEditorMode aEditorMode, - TPosLmItemId* aLandmarkId, - CPosLandmark* aLandmark ) +EXPORT_C CLmkEditorImpl* CLmkEditorImpl::NewL(CPosLandmarkDatabase& aDb, + CLmkSender& aSender, TLmkEditorAttributes aAttributes, + TLmkEditorMode aEditorMode, TPosLmItemId* aLandmarkId, + CPosLandmark* aLandmark) { - CLmkEditorImpl* self = - new( ELeave ) CLmkEditorImpl( aDb, aSender, aEditorMode ); + CLmkEditorImpl* self = new (ELeave) CLmkEditorImpl(aDb, aSender, + aEditorMode); - CleanupStack::PushL( self ); - self->ConstructL( aLandmarkId, aLandmark, aAttributes ); + CleanupStack::PushL(self); + self->ConstructL(aLandmarkId, aLandmark, aAttributes); CleanupStack::Pop(); //self return self; } @@ -329,11 +302,11 @@ CLmkEditorImpl::~CLmkEditorImpl() { delete iWaitDialogLauncher; - - CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); - cba->RemoveCommandObserver(KMskCommandPos); - - if( iLmkUiUtils ) + + CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); + cba->RemoveCommandObserver(KMskCommandPos); + + if (iLmkUiUtils) { iLmkUiUtils->SetOldContextIcon(); iLmkUiUtils->RestoreOldTitlePane(); @@ -355,27 +328,33 @@ delete iLmkGoToURLCmd; delete iLmkCallCmd; iMapNavInterface->Release(); - delete iCatInfoPopupNote; - delete iRepository; - if(iIsLmOwned && iLandmark) - delete iLandmark; + delete iCatInfoPopupNote; + + if(iListProvider) + { + iListProvider->RemoveObserver(*this); + delete iListProvider; + } + + delete iRepository; + if (iIsLmOwned && iLandmark) + delete iLandmark; } // ----------------------------------------------------------------------------- // CLmkEditorImpl::SetMopParent // ----------------------------------------------------------------------------- // -EXPORT_C void CLmkEditorImpl::SetMopParent( - MObjectProvider* aParent ) +EXPORT_C void CLmkEditorImpl::SetMopParent(MObjectProvider* aParent) { - CCoeControl::SetMopParent( aParent ); + CCoeControl::SetMopParent(aParent); } // ----------------------------------------------------------------------------- // CLmkEditorImpl::SetHelpContext // ----------------------------------------------------------------------------- // -EXPORT_C void CLmkEditorImpl::SetHelpContext( TCoeHelpContext aContext ) +EXPORT_C void CLmkEditorImpl::SetHelpContext(TCoeHelpContext aContext) { iHelpContext = aContext; } @@ -386,19 +365,19 @@ // EXPORT_C TInt CLmkEditorImpl::ExecuteLD() { - CleanupStack::PushL( this ); + CleanupStack::PushL(this); AttachAIWMenuInterestL(); CleanupStack::Pop();//this if (iEditorMode == CLmkEditorDlg::ELmkEditor) - { - iIsEditing = ETrue; - return CAknForm::ExecuteLD( R_LMK_EDITOR_DIALOG ); - } + { + iIsEditing = ETrue; + return CAknForm::ExecuteLD(R_LMK_EDITOR_DIALOG); + } else // viewer/receive state of editor - { - iIsEditing = EFalse; - return CAknForm::ExecuteLD( R_LMK_VIEWER_DIALOG ); - } + { + iIsEditing = EFalse; + return CAknForm::ExecuteLD(R_LMK_VIEWER_DIALOG); + } } // ----------------------------------------------------------------------------- @@ -406,198 +385,201 @@ // ----------------------------------------------------------------------------- // EXPORT_C void CLmkEditorImpl::DisableMapAndNavigationMenuOptions() - { - iMapNavFeature = EFalse; - } + { + iMapNavFeature = EFalse; + } // ----------------------------------------------------------------------------- // CLmkEditorImpl::DynInitMenuPaneL // ----------------------------------------------------------------------------- // -void CLmkEditorImpl::DynInitMenuPaneL( - TInt aResourceId, - CEikMenuPane* aMenuPane ) +void CLmkEditorImpl::DynInitMenuPaneL(TInt aResourceId, + CEikMenuPane* aMenuPane) { - switch( aResourceId ) + switch (aResourceId) { case R_AVKON_FORM_MENUPANE: { - CAknForm::DynInitMenuPaneL( aResourceId, aMenuPane ); + CAknForm::DynInitMenuPaneL(aResourceId, aMenuPane); TBool isLandmarkDataEmpty = EFalse; TBool dimClearPos = ETrue; - // Disable Map and Navigation feature when opted not to show - if( !iMapNavFeature ) - { - isLandmarkDataEmpty = ETrue; - } - else - { - isLandmarkDataEmpty = ArePositionFieldEmptyL(); - } - - if( isLandmarkDataEmpty ) - { - // delete the show on map & Navigate To options - aMenuPane->DeleteMenuItem( ELmkShowOnMapPlaceHolder ); - aMenuPane->DeleteMenuItem( ELmkNavigateToPlaceHolder ); - } - else if( IsEditable() ) - { - // delete the Navigate To option for editor - aMenuPane->DeleteMenuItem( ELmkNavigateToPlaceHolder ); - } + // Disable Map and Navigation feature when opted not to show + if (!iMapNavFeature) + { + isLandmarkDataEmpty = ETrue; + } + else if (iLandmark && iIsHideCoordinate) + { + isLandmarkDataEmpty = IsLandmarkDataEmptyL(iLandmark); + } + else + { + isLandmarkDataEmpty = ArePositionFieldEmptyL(); + } - if( IsEditable() ) - { - dimClearPos = ArePositionFieldEmptyL(); - } - - if( dimClearPos || iIsHideCoordinate) - { - aMenuPane->SetItemDimmed( ELmkCmdClearPosInfo, ETrue ); - } + if (isLandmarkDataEmpty) + { + // delete the show on map & Navigate To options + aMenuPane->DeleteMenuItem(ELmkShowOnMapPlaceHolder); + aMenuPane->DeleteMenuItem(ELmkNavigateToPlaceHolder); + } + else if (IsEditable()) + { + // delete the Navigate To option for editor + aMenuPane->DeleteMenuItem(ELmkNavigateToPlaceHolder); + } - if( iMapNavFeature ) - { - iMapNavInterface->AttachMenuPaneL( aMenuPane, R_LMK_EDITOR_MENU, ELmkCmdMnNav ); - } + if (IsEditable()) + { + dimClearPos = ArePositionFieldEmptyL(); + } + + if (dimClearPos || iIsHideCoordinate) + { + aMenuPane->SetItemDimmed(ELmkCmdClearPosInfo, ETrue); + } + + if (iMapNavFeature) + { + iMapNavInterface->AttachMenuPaneL(aMenuPane, + R_LMK_EDITOR_MENU, ELmkCmdMnNav); + } // Send menu is handled by the sender: - if ( FeatureManager::FeatureSupported( KFeatureIdLandmarksConverter ) ) - { - aMenuPane->SetItemDimmed(ELmkCmdSendDummy, EFalse); - iSender.DisplaySendMenuL( *aMenuPane, 1 ); - } - else - { - aMenuPane->SetItemDimmed(ELmkCmdSendDummy, ETrue); - } + if (FeatureManager::FeatureSupported(KFeatureIdLandmarksConverter)) + { + aMenuPane->SetItemDimmed(ELmkCmdSendDummy, EFalse); + iSender.DisplaySendMenuL(*aMenuPane, 1); + } + else + { + aMenuPane->SetItemDimmed(ELmkCmdSendDummy, ETrue); + } - if ( FeatureManager::FeatureSupported( KFeatureIdLocationFrameworkCore )) - { - aMenuPane->SetItemDimmed( ELmkCmdCurrentLocation,!IsEditable()); - } - else - { - aMenuPane->SetItemDimmed( ELmkCmdCurrentLocation, ETrue ); - } + if (FeatureManager::FeatureSupported( + KFeatureIdLocationFrameworkCore)) + { + aMenuPane->SetItemDimmed(ELmkCmdCurrentLocation, + !IsEditable()); + } + else + { + aMenuPane->SetItemDimmed(ELmkCmdCurrentLocation, ETrue); + } - if ( FeatureManager::FeatureSupported( KFeatureIdHelp )&& - !iIsHideHelp ) - { - aMenuPane->SetItemDimmed( EAknCmdHelp, EFalse ); - } - else - { - aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue ); - } + if (FeatureManager::FeatureSupported(KFeatureIdHelp) + && !iIsHideHelp) + { + aMenuPane->SetItemDimmed(EAknCmdHelp, EFalse); + } + else + { + aMenuPane->SetItemDimmed(EAknCmdHelp, ETrue); + } //only in edit mode - aMenuPane->SetItemDimmed( ELmkCmdSelectCategories, !IsEditable() ); - aMenuPane->SetItemDimmed( ELmkCmdChangeIcon, !IsEditable() ); - + aMenuPane->SetItemDimmed(ELmkCmdSelectCategories, !IsEditable()); + aMenuPane->SetItemDimmed(ELmkCmdChangeIcon, !IsEditable()); //additional commands always dimmed in this class: - aMenuPane->SetItemDimmed( ELmkCmdSaveLm, ETrue ); + aMenuPane->SetItemDimmed(ELmkCmdSaveLm, ETrue); // Only in view mode - aMenuPane->SetItemDimmed( ELmkCmdEditLm, IsEditable() ); - //allways dimmed - aMenuPane->SetItemDimmed( EAknFormCmdEdit, ETrue ); - aMenuPane->SetItemDimmed( EAknFormCmdSave, ETrue ); - aMenuPane->SetItemDimmed( EAknFormCmdLabel, ETrue ); - aMenuPane->SetItemDimmed( EAknFormCmdAdd, ETrue ); - aMenuPane->SetItemDimmed( EAknFormCmdDelete, ETrue ); - aMenuPane->SetItemDimmed( ELmkCmdCategories, ETrue ); - aMenuPane->SetItemDimmed( ELmkCmdEditTextLm, ETrue ); + aMenuPane->SetItemDimmed(ELmkCmdEditLm, IsEditable()); + //allways dimmed + aMenuPane->SetItemDimmed(EAknFormCmdEdit, ETrue); + aMenuPane->SetItemDimmed(EAknFormCmdSave, ETrue); + aMenuPane->SetItemDimmed(EAknFormCmdLabel, ETrue); + aMenuPane->SetItemDimmed(EAknFormCmdAdd, ETrue); + aMenuPane->SetItemDimmed(EAknFormCmdDelete, ETrue); + aMenuPane->SetItemDimmed(ELmkCmdCategories, ETrue); + aMenuPane->SetItemDimmed(ELmkCmdEditTextLm, ETrue); - if(IsEditable()) - { - aMenuPane->SetItemDimmed( ELmkCmdCall, ETrue ); - aMenuPane->SetItemDimmed( ELmkCmdGoToUrl, ETrue ); - } - else - { - MLmkFieldData* field = iLmkFields->GetField(EPhoneNumber); - if(field) - { - TInt id = field->UniqueFieldIdentity(); - MLmkEditorField* control = iEditorFieldArray->Find( id ); - if ((!control) || GetFieldTextLengthL( *control ) <= 0 ) - { - aMenuPane->SetItemDimmed( ELmkCmdCall, ETrue ); - } - - MLmkFieldData* field2 = iLmkFields->GetField(EWebAddress); - if( field2 ) + if (IsEditable()) + { + aMenuPane->SetItemDimmed(ELmkCmdCall, ETrue); + aMenuPane->SetItemDimmed(ELmkCmdGoToUrl, ETrue); + } + else + { + MLmkFieldData* field = iLmkFields->GetField(EPhoneNumber); + if (field) + { + TInt id = field->UniqueFieldIdentity(); + MLmkEditorField* control = iEditorFieldArray->Find(id); + if ((!control) || GetFieldTextLengthL(*control) <= 0) + { + aMenuPane->SetItemDimmed(ELmkCmdCall, ETrue); + } + + MLmkFieldData* field2 = iLmkFields->GetField(EWebAddress); + if (field2) { TInt id2 = field2->UniqueFieldIdentity(); - control = iEditorFieldArray->Find( id2 ); - if ( (!control) || GetFieldTextLengthL( *control ) <= 0 ) + control = iEditorFieldArray->Find(id2); + if ((!control) || GetFieldTextLengthL(*control) <= 0) { - aMenuPane->SetItemDimmed( ELmkCmdGoToUrl, ETrue ); + aMenuPane->SetItemDimmed(ELmkCmdGoToUrl, ETrue); } } - } - } + } + } break; } case R_SENDUI_MENU: // Dynamically created send ui menu { // Send menu is handled by the sender: - if ( FeatureManager::FeatureSupported( KFeatureIdLandmarksConverter ) ) - { - iSender.DisplaySendCascadeMenuL( *aMenuPane ); - } + if (FeatureManager::FeatureSupported(KFeatureIdLandmarksConverter)) + { + iSender.DisplaySendCascadeMenuL(*aMenuPane); + } break; } - case R_LMK_EDITOR_CONTEXT_MENU: - { - MLmkEditorField* field = - iEditorFieldArray->Find( IdOfFocusControl() ); - TUint type = field->LandmarkItemField().FieldType(); - - if ( type != EPhoneNumber ) - { - aMenuPane->SetItemDimmed( ELmkEditMenuAiwId, ETrue ); - } - if ( type != EWebAddress ) - { - aMenuPane->SetItemDimmed( ELmkCmdGoToUrl, ETrue ); - } + case R_LMK_EDITOR_CONTEXT_MENU: + { + MLmkEditorField* field = iEditorFieldArray->Find( + IdOfFocusControl()); + TUint type = field->LandmarkItemField().FieldType(); - if ( type == EPhoneNumber ) - { - if ( GetFieldTextLengthL( *field ) <= 0 ) - { - aMenuPane->SetItemDimmed( ELmkEditMenuAiwId, ETrue ); - } - } - if ( type == EWebAddress ) - { - if ( GetFieldTextLengthL( *field ) <= 0 ) - { - aMenuPane->SetItemDimmed( ELmkCmdGoToUrl, ETrue ); - } - } - break; - } + if (type != EPhoneNumber) + { + aMenuPane->SetItemDimmed(ELmkEditMenuAiwId, ETrue); + } + if (type != EWebAddress) + { + aMenuPane->SetItemDimmed(ELmkCmdGoToUrl, ETrue); + } + if (type == EPhoneNumber) + { + if (GetFieldTextLengthL(*field) <= 0) + { + aMenuPane->SetItemDimmed(ELmkEditMenuAiwId, ETrue); + } + } + if (type == EWebAddress) + { + if (GetFieldTextLengthL(*field) <= 0) + { + aMenuPane->SetItemDimmed(ELmkCmdGoToUrl, ETrue); + } + } + break; + } case R_LMK_EDITOR_CALL_SUBMENU: - { - // Initialize the AIW menu service - iLmkCallCmd->InitializeMenuPaneL( - *aMenuPane, - aResourceId, - ELmkCmdLast // Must not overlap with the other menu ids! - ); + { + // Initialize the AIW menu service + // Must not overlap with other menu ids + iLmkCallCmd->InitializeMenuPaneL(*aMenuPane, aResourceId, + ELmkCmdLast); break; - } + } default: { break; } } - iMapNavInterface->HandleMenuOperationL(aResourceId, aMenuPane, ELmkCmdMnNav); + iMapNavInterface->HandleMenuOperationL(aResourceId, aMenuPane, + ELmkCmdMnNav); } // ----------------------------------------------------------------------------- @@ -610,116 +592,118 @@ TLocality loc; TBool isValid = (KErrNone == aLandmark->GetPosition(loc)); isValid &= !Math::IsNaN(loc.Latitude()) && !Math::IsNaN(loc.Longitude()); - return isValid; - -/* if (!isValid) - { - // verify that destination landmark has address info - TPositionFieldId fieldId = aLandmark->FirstPositionFieldId(); - while (fieldId != EPositionFieldNone) - { - if (fieldId > EPositionFieldAddressCapabilitiesBegin && fieldId - < EPositionFieldBuildingTelephone) - { - TPtrC field; - aLandmark->GetPositionField(fieldId, field); - if (field.Length()) - { - isValid = ETrue; - break; - } - } - fieldId = aLandmark->NextPositionFieldId(fieldId); - } - } - return !isValid;*/ + return !isValid; + + /* if (!isValid) + { + // verify that destination landmark has address info + TPositionFieldId fieldId = aLandmark->FirstPositionFieldId(); + while (fieldId != EPositionFieldNone) + { + if (fieldId > EPositionFieldAddressCapabilitiesBegin && fieldId + < EPositionFieldBuildingTelephone) + { + TPtrC field; + aLandmark->GetPositionField(fieldId, field); + if (field.Length()) + { + isValid = ETrue; + break; + } + } + fieldId = aLandmark->NextPositionFieldId(fieldId); + } + } + return !isValid;*/ } // ----------------------------------------------------------------------------- // CLmkEditorImpl::ProcessCommandL // ----------------------------------------------------------------------------- // -void CLmkEditorImpl::ProcessCommandL( TInt aCommandId ) +void CLmkEditorImpl::ProcessCommandL(TInt aCommandId) { + DEBUG1( CLmkEditorImpl::ProcessCommandL aCommandId=%d, aCommandId ); // Hide the context sensitive menu here HideMenu(); iContextMenuBar->StopDisplayingMenuBar(); - CAknDialog::ProcessCommandL( aCommandId ); + CAknDialog::ProcessCommandL(aCommandId); TInt aiwCmd = iMapNavInterface->GetServiceCmdByMenuCmd(aCommandId); // Handles Map and Navigation commands - if(KAiwCmdNone != aiwCmd) - { - // Landmark array to pass to M&N interface - RPointerArray lmkArray; - switch(aiwCmd) - { - case KAiwCmdMnShowMap: - { - CPosLandmark* landmark = GetCurrentEditedLandmarkL(); - lmkArray.Append(landmark); - CleanupStack::PushL( TCleanupItem( CleanupArray, &lmkArray ) ); - iMapNavInterface->ShowLandmarksOnMapL(lmkArray, aCommandId, - CLmkMapNavigationInterface::EByLmkView); - CleanupStack::PopAndDestroy(); //lmkArray - break; - } - case KAiwCmdMnNavigateTo: - { - CPosLandmark* landmark = GetCurrentEditedLandmarkL(); - lmkArray.Append(landmark); - CleanupStack::PushL( TCleanupItem( CleanupArray, &lmkArray ) ); - iMapNavInterface->NavigateToLandmarkL(lmkArray[0],aCommandId); - CleanupStack::PopAndDestroy(); //lmkArray - break; - } - } - lmkArray.Reset(); - return; - } - switch ( aCommandId ) + if (KAiwCmdNone != aiwCmd) + { + // Landmark array to pass to M&N interface + RPointerArray lmkArray; + switch (aiwCmd) + { + case KAiwCmdMnShowMap: + { + CPosLandmark* landmark = GetCurrentEditedLandmarkL(); + lmkArray.Append(landmark); + CleanupStack::PushL(TCleanupItem(CleanupArray, &lmkArray)); + iMapNavInterface->ShowLandmarksOnMapL(lmkArray, aCommandId, + CLmkMapNavigationInterface::EByLmkView); + CleanupStack::PopAndDestroy(); //lmkArray + break; + } + case KAiwCmdMnNavigateTo: + { + CPosLandmark* landmark = GetCurrentEditedLandmarkL(); + lmkArray.Append(landmark); + CleanupStack::PushL(TCleanupItem(CleanupArray, &lmkArray)); + iMapNavInterface->NavigateToLandmarkL(lmkArray[0], aCommandId); + CleanupStack::PopAndDestroy(); //lmkArray + break; + } + } + lmkArray.Reset(); + return; + } + switch (aCommandId) { case EAknCmdHelp: { - HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), - static_cast( - iCoeEnv->AppUi() )->AppHelpContextL() ); + HlpLauncher::LaunchHelpApplicationL( + iEikonEnv->WsSession(), + static_cast (iCoeEnv->AppUi())->AppHelpContextL()); break; } - // these all are same: save & exit + // these all are same: save & exit case EAknSoftkeyBack: case EAknSoftkeyExit: case EEikCmdExit: case EAknCmdExit: { - CAknForm::OkToExitL( aCommandId ); + CAknForm::OkToExitL(aCommandId); iLmkUiUtils->RestoreOldNaviPaneL(); CEikAppUi* appUi = iEikonEnv->EikAppUi(); // Close this dialog first delete this; // Exit application - static_cast(appUi)->ProcessCommandL(aCommandId); + static_cast (appUi)->ProcessCommandL( + aCommandId); break; } case ELmkCmdDeleteLm: { - if ( LmkNotes::LandmarkConfirmationQueryL( iEikonEnv ) ) + if (LmkNotes::LandmarkConfirmationQueryL(iEikonEnv)) { iLmkFields->DeleteLandmarkL(); iLmkUiUtils->RestoreOldNaviPaneL(); iIsEditing = EFalse; - delete this; + delete this; } break; } case ELmkCmdSelectCategories: { - if(!iIsCategorySelctorOpen) - { - iIsCategorySelctorOpen = ETrue; - SelectCategoriesCmdL(); - } + if (!iIsCategorySelctorOpen) + { + iIsCategorySelctorOpen = ETrue; + SelectCategoriesCmdL(); + } break; } case ELmkCmdChangeIcon: @@ -744,13 +728,13 @@ case ELmkCmdSendVia10: case ELmkCmdSend: { - if ( !IsNameFieldEmptyL() ) + if (!IsNameFieldEmptyL()) { // Obtain the current landmark object CPosLandmark* lmk = GetCurrentEditedLandmarkL(); - CleanupStack::PushL( lmk ); + CleanupStack::PushL(lmk); iSender.SendSingleLandmarkL(*lmk); - CleanupStack::PopAndDestroy( lmk ); + CleanupStack::PopAndDestroy(lmk); } else { @@ -759,92 +743,92 @@ break; } case ELmkCmdGoToUrl: - { - // Get URL field - MLmkFieldData* field = iLmkFields->GetField(EWebAddress); - if(field) - { - TInt id = field->UniqueFieldIdentity(); - MLmkEditorField* control = iEditorFieldArray->Find( id ); - if(control) - { - HBufC* fieldText = control->ControlTextL(); - CleanupStack::PushL( fieldText ); - TPtr urlPtr = fieldText->Des(); - if ( urlPtr.Length() > 0 ) - { - iLmkGoToURLCmd->LaunchBrowserL( urlPtr ); - } - CleanupStack::PopAndDestroy( fieldText ); - } - } - break; - } + { + // Get URL field + MLmkFieldData* field = iLmkFields->GetField(EWebAddress); + if (field) + { + TInt id = field->UniqueFieldIdentity(); + MLmkEditorField* control = iEditorFieldArray->Find(id); + if (control) + { + HBufC* fieldText = control->ControlTextL(); + CleanupStack::PushL(fieldText); + TPtr urlPtr = fieldText->Des(); + if (urlPtr.Length() > 0) + { + iLmkGoToURLCmd->LaunchBrowserL(urlPtr); + } + CleanupStack::PopAndDestroy(fieldText); + } + } + break; + } case ELmkCmdEditLm: - { - if(!iIsEditing) - { - LaunchLmkEditorL(); - } - break; - } + { + if (!iIsEditing) + { + LaunchLmkEditorL(); + } + break; + } case ELmkCmdCall: - case ELmkCmdLast: - { - MLmkFieldData* field = iLmkFields->GetField(EPhoneNumber); - if(field) - { - TInt id = field->UniqueFieldIdentity(); - MLmkEditorField* control = iEditorFieldArray->Find( id ); - if(control) - { - HBufC* fieldText = control->ControlTextL(); - CleanupStack::PushL( fieldText ); - if ( fieldText && fieldText->Length() > 0 ) - { - //Check if any active character or not - TPtr ptr = fieldText->Des(); - ptr.Trim(); - if (ptr.Length() > 0) - { - //modified for 3.2, since command is not coming - //from menu item, hence need to pass diff command. - //this code needs some more modification to make it - //genericly work for all the commands. - iLmkCallCmd->ExecuteAIWCallCmdL( ELmkCmdCall, ptr ); - } - } - CleanupStack::PopAndDestroy( fieldText ); - } - } - break; - } + case ELmkCmdLast: + { + MLmkFieldData* field = iLmkFields->GetField(EPhoneNumber); + if (field) + { + TInt id = field->UniqueFieldIdentity(); + MLmkEditorField* control = iEditorFieldArray->Find(id); + if (control) + { + HBufC* fieldText = control->ControlTextL(); + CleanupStack::PushL(fieldText); + if (fieldText && fieldText->Length() > 0) + { + //Check if any active character or not + TPtr ptr = fieldText->Des(); + ptr.Trim(); + if (ptr.Length() > 0) + { + //modified for 3.2, since command is not coming + //from menu item, hence need to pass diff command. + //this code needs some more modification to make it + //genericly work for all the commands. + iLmkCallCmd->ExecuteAIWCallCmdL(ELmkCmdCall, ptr); + } + } + CleanupStack::PopAndDestroy(fieldText); + } + } + break; + } case ELmkCmdShow: - { - MLmkEditorField* field = - iEditorFieldArray->Find( IdOfFocusControl() ); - TUint type = field->LandmarkItemField().FieldType(); - if (type == ECategories ) - { - if(iCalegorySelectionFlag) // Receive mode - { - CategoriesCmdFromXmlL(); - } - else - { - CategoriesCmdL(); // View mode - } - } - break; - } + { + MLmkEditorField* field = iEditorFieldArray->Find( + IdOfFocusControl()); + TUint type = field->LandmarkItemField().FieldType(); + if (type == ECategories) + { + if (iCalegorySelectionFlag) // Receive mode + { + CategoriesCmdFromXmlL(); + } + else + { + CategoriesCmdL(); // View mode + } + } + break; + } case ELmkCmdClearPosInfo: - { - ClearPositionInfoL(); - break; - } + { + ClearPositionInfoL(); + break; + } default: { - CAknForm::ProcessCommandL( aCommandId ); + CAknForm::ProcessCommandL(aCommandId); break; } } @@ -854,20 +838,20 @@ // CLmkEditorImpl::HandleControlStateChangeL // ----------------------------------------------------------------------------- // -void CLmkEditorImpl::HandleControlStateChangeL( TInt aControlId ) +void CLmkEditorImpl::HandleControlStateChangeL(TInt aControlId) { - MLmkEditorField* changedField = iEditorFieldArray->Find( aControlId ); - if ( changedField ) + MLmkEditorField* changedField = iEditorFieldArray->Find(aControlId); + if (changedField) { - if ( changedField->LandmarkItemField().IsTitleField() ) + if (changedField->LandmarkItemField().IsTitleField()) { HBufC* title = changedField->ControlTextL(); - CleanupStack::PushL( title ); - if ( !title ) + CleanupStack::PushL(title); + if (!title) { title = HBufC::New(0); } - iLmkUiUtils->ChangeTitlePaneL( title ); + iLmkUiUtils->ChangeTitlePaneL(title); CleanupStack::Pop(); //title } } @@ -879,16 +863,16 @@ // void CLmkEditorImpl::DoNotSaveFormDataL() { - if ( !iIsEndKey ) - { - LmkNotes::InformationNoteL( iEikonEnv, R_LMK_EMPTY_LANDMARK_NAME_NOTE ); - } + if (!iIsEndKey) + { + LmkNotes::InformationNoteL(iEikonEnv, R_LMK_EMPTY_LANDMARK_NAME_NOTE); + } MLmkFieldData* field = iLmkFields->GetField(EName); - if( field ) + if (field) { TInt id = field->UniqueFieldIdentity(); - TryChangeFocusL(id); - } + TryChangeFocusL(id); + } CAknForm::SetInitialCurrentLine(); } @@ -896,22 +880,22 @@ // CLmkEditorImpl::GetHelpContext // ----------------------------------------------------------------------------- // -void CLmkEditorImpl::GetHelpContext( TCoeHelpContext& aContext ) const +void CLmkEditorImpl::GetHelpContext(TCoeHelpContext& aContext) const { - if ( iHelpContext.iContext.Length() > 0 ) + if (iHelpContext.iContext.Length() > 0) { aContext.iContext = iHelpContext.iContext; aContext.iMajor = iHelpContext.iMajor; } - else if ( iEditorMode == CLmkEditorDlg::ELmkViewer ) + else if (iEditorMode == CLmkEditorDlg::ELmkViewer) { aContext.iContext = KLM_HLP_LM_VIEWER; - aContext.iMajor = TUid::Uid( KLmkAppUID3 ); + aContext.iMajor = TUid::Uid(KLmkAppUID3); } else { aContext.iContext = KLM_HLP_LM_EDITOR; - aContext.iMajor = TUid::Uid( KLmkAppUID3 ); + aContext.iMajor = TUid::Uid(KLmkAppUID3); } } @@ -919,142 +903,87 @@ // CLmkEditorImpl::OfferKeyEventL // ----------------------------------------------------------------------------- // -TKeyResponse CLmkEditorImpl::OfferKeyEventL( const TKeyEvent& aKeyEvent, - TEventCode aType ) +TKeyResponse CLmkEditorImpl::OfferKeyEventL(const TKeyEvent& aKeyEvent, + TEventCode aType) { - /** - * By def, dialog opens in view mode - * selecting 'edit' option from (either from context menu/options menu) - * to edit landmark fields - * - */ + /** + * By def, dialog opens in view mode + * selecting 'edit' option from (either from context menu/options menu) + * to edit landmark fields + * + */ if (IsEditable()) - { - //always dimmed for the editor - DimmMiddleSoftKey(); - } - if ( aKeyEvent.iCode == EKeyOK ) - { - MLmkEditorField* field = - iEditorFieldArray->Find( IdOfFocusControl() ); - TUint type = field->LandmarkItemField().FieldType(); - // check the editor mode - if (IsEditable()) // edit mode - { - if ( type == ECategory || type == ECategories ) - { - if(!iIsCategorySelctorOpen) - { - iIsCategorySelctorOpen = ETrue; - SelectCategoriesCmdL(); - } + { + //always dimmed for the editor + DimmMiddleSoftKey(); + } + else if (aKeyEvent.iCode == EKeyBackspace) + { + if (!IsEditable() && iIsLmkReceiveMode == EFalse) + { + ProcessCommandL(ELmkCmdDeleteLm); + return EKeyWasConsumed; + } + } + else if (aKeyEvent.iCode == EKeyPhoneEnd) + { + iIsEndKey = ETrue; + OkToExitL(EAknSoftkeyDone); + } + else // for 'sendkey' handling + { + if (aKeyEvent.iCode == EKeyPhoneSend && (!IsEditable()) + && (!Layout_Meta_Data::IsPenEnabled())) + { + // Get Landmark's telephone number + TPosLmItemId lmId = iLmkFields->LandmarkId(); + CPosLandmark* landmark = iDb.ReadLandmarkLC(lmId); + // Get phone num field + if (landmark->IsPositionFieldAvailable( + ELmkPositionFieldPhoneNumber)) + { + TPtrC telnumPtr; + if ((landmark->GetPositionField(ELmkPositionFieldPhoneNumber, + telnumPtr) == KErrNone) && (telnumPtr.Length() > 0)) + { + iLmkCallCmd->ExecuteAIWCallCmdL(ELmkCmdCall, telnumPtr); + } + else + { + // Get name + TPtrC lmkNamePtr; + if (landmark->GetLandmarkName(lmkNamePtr) == KErrNone) + { + LmkNotes::InformationNotewithTextL(iEikonEnv, + R_LMK_NOTE_NO_NUMBER_TO_NAME, lmkNamePtr); + } + } + } + CleanupStack::PopAndDestroy(landmark); + } + } - return EKeyWasConsumed; - } - } - else - {// view or receive mode - if ( type == ECategory || type == ECategories ) - { - if(iCalegorySelectionFlag) // Receive mode - { - CategoriesCmdFromXmlL(); - return EKeyWasConsumed; - } - else - { - CategoriesCmdL(); // View mode - return EKeyWasConsumed; - } - } - else // focus is on any other landmark field - { - if ( !iCalegorySelectionFlag )// No context menu for receive mode - { - if(!iIsEditing) - { - LaunchLmkEditorL(); - return EKeyWasConsumed; - } -/* - //Launch context sensitive menu bar here - if ( iContextMenuBar ) - { - iContextMenuBar->TryDisplayMenuBarL(); - return EKeyWasConsumed; - } -*/ - } - } - } - } - else if( aKeyEvent.iCode == EKeyBackspace ) - { - if( !IsEditable() && iIsLmkReceiveMode == EFalse ) - { - ProcessCommandL( ELmkCmdDeleteLm ); - return EKeyWasConsumed; - } - } - else if ( aKeyEvent.iCode == EKeyPhoneEnd ) - { - iIsEndKey = ETrue; - OkToExitL(EAknSoftkeyDone); - } - else // for 'sendkey' handling - { - if ( aKeyEvent.iCode == EKeyPhoneSend && (!IsEditable()) && (!Layout_Meta_Data::IsPenEnabled()) ) - { - // Get Landmark's telephone number - TPosLmItemId lmId = iLmkFields->LandmarkId(); - CPosLandmark* landmark = iDb.ReadLandmarkLC(lmId); - // Get phone num field - if (landmark->IsPositionFieldAvailable( - ELmkPositionFieldPhoneNumber) ) - { - TPtrC telnumPtr; - if ( (landmark->GetPositionField( - ELmkPositionFieldPhoneNumber, - telnumPtr ) == KErrNone) && (telnumPtr.Length() > 0 )) - { - iLmkCallCmd->ExecuteAIWCallCmdL( ELmkCmdCall,telnumPtr ); - } - else - { - // Get name - TPtrC lmkNamePtr; - if ( landmark->GetLandmarkName ( lmkNamePtr ) == KErrNone ) - { - LmkNotes::InformationNotewithTextL( iEikonEnv, - R_LMK_NOTE_NO_NUMBER_TO_NAME, - lmkNamePtr); - } - } - } - CleanupStack::PopAndDestroy(landmark); - } - } + if (aType == EEventKey && (aKeyEvent.iCode == EKeyEnter + || aKeyEvent.iScanCode == EStdKeyEnter)) + { + TBool isCategoryField = EFalse; + MLmkEditorField* field = iEditorFieldArray->Find(IdOfFocusControl()); + TUint type = field->LandmarkItemField().FieldType(); + + if (type == ECategory || type == ECategories) + isCategoryField = ETrue; - if ( aType == EEventKey && ( aKeyEvent.iCode == EKeyEnter || aKeyEvent.iScanCode == EStdKeyEnter )) - { - TBool isCategoryField = EFalse; - MLmkEditorField* field = iEditorFieldArray->Find( IdOfFocusControl() ); - TUint type = field->LandmarkItemField().FieldType(); - - if ( type == ECategory || type == ECategories ) - isCategoryField = ETrue; - - // check the editor mode and category field focus - if ( IsEditable() == EFalse || isCategoryField ) - { - TKeyEvent enterKeyEvent( aKeyEvent ); - enterKeyEvent.iCode = EKeyOK; - CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); - return cba->OfferKeyEventL( enterKeyEvent, aType ); - } - } - - TKeyResponse response= CAknForm::OfferKeyEventL( aKeyEvent, aType ); + // check the editor mode and category field focus + if (IsEditable() == EFalse || isCategoryField) + { + TKeyEvent enterKeyEvent(aKeyEvent); + enterKeyEvent.iCode = EKeyOK; + CEikButtonGroupContainer* cba = + CEikButtonGroupContainer::Current(); + return cba->OfferKeyEventL(enterKeyEvent, aType); + } + } + TKeyResponse response = CAknForm::OfferKeyEventL(aKeyEvent, aType); return response; } @@ -1062,74 +991,74 @@ // CLmkEditorImpl::NotifyL // ----------------------------------------------------------------------------- // -void CLmkEditorImpl::NotifyL( const TInt aStatus ) - { +void CLmkEditorImpl::NotifyL(const TInt aStatus) + { // Stop the running wait dialog - TInt buttonId = iWaitDialogLauncher->StopWaitDialogL(); - if( EEikBidCancel != buttonId ) - { - switch( aStatus ) - { + TInt buttonId = iWaitDialogLauncher->StopWaitDialogL(); + if (EEikBidCancel != buttonId) + { + switch (aStatus) + { case KErrNone: case KPositionPartialUpdate: { - if(iLocationService) - { - TPosition position = iLocationService->CurrentPosition(); - SetCurrentLocationL( position ); - } + if (iLocationService) + { + TPosition position = iLocationService->CurrentPosition(); + SetCurrentLocationL(position); + } break; } default: { break; } - } - } + } + } delete iLocationService; iLocationService = NULL; - } + } // ----------------------------------------------------------------------------- // CLmkEditorImpl::NotifyErrorL // ----------------------------------------------------------------------------- // -void CLmkEditorImpl::NotifyErrorL( TInt aErrorCode ) +void CLmkEditorImpl::NotifyErrorL(TInt aErrorCode) { - // Stop the running wait dialog - TInt buttonId = iWaitDialogLauncher->StopWaitDialogL(); + TInt buttonId = iWaitDialogLauncher->StopWaitDialogL(); delete iLocationService; iLocationService = NULL; - if( EEikBidCancel != buttonId ) - { - switch( aErrorCode ) - { - case KPositionQualityLoss: - case KErrTimedOut: - case KErrNotFound: // No PSY selected. - case KErrUnknown: - case KErrCancel: - case KErrArgument: - default: - // The above errors are because of location request failures - // Ask user to retry location request - { - if ( LmkNotes::MessageQueryWithLinkL(iEikonEnv,R_LMK_MSG_QUERY_HEADING_PANE_TEXT, - R_LMK_CONF_RETRY_LOCATION_REQUEST,R_LMK_REQUEST_FAIL_MORE_INFO, - MessageQueryCallBack) ) - { - if( iLocationService ) - { - delete iLocationService; - iLocationService = NULL; - } - CurrentLocationCmdL(); - } - } - } + if (EEikBidCancel != buttonId) + { + switch (aErrorCode) + { + case KPositionQualityLoss: + case KErrTimedOut: + case KErrNotFound: // No PSY selected. + case KErrUnknown: + case KErrCancel: + case KErrArgument: + default: + // The above errors are because of location request failures + // Ask user to retry location request + { + if (LmkNotes::MessageQueryWithLinkL(iEikonEnv, + R_LMK_MSG_QUERY_HEADING_PANE_TEXT, + R_LMK_CONF_RETRY_LOCATION_REQUEST, + R_LMK_REQUEST_FAIL_MORE_INFO, MessageQueryCallBack)) + { + if (iLocationService) + { + delete iLocationService; + iLocationService = NULL; + } + CurrentLocationCmdL(); + } + } + } } } @@ -1137,24 +1066,24 @@ // CLmkEditorImpl::CreateCustomControlL // ----------------------------------------------------------------------------- // -SEikControlInfo CLmkEditorImpl::CreateCustomControlL( TInt /*aControlType*/ ) +SEikControlInfo CLmkEditorImpl::CreateCustomControlL(TInt /*aControlType*/) { SEikControlInfo ctrl; ctrl.iControl = NULL; ctrl.iTrailerTextId = 0; ctrl.iFlags = 0; /*switch( aControlType ) - { - case EDistanceEditorType: - { - ctrl.iControl = new(ELeave) CLmkDistanceEditor(); - break; - } - default: - { - break; - } - }*/ + { + case EDistanceEditorType: + { + ctrl.iControl = new(ELeave) CLmkDistanceEditor(); + break; + } + default: + { + break; + } + }*/ return ctrl; } @@ -1162,11 +1091,10 @@ // CLmkEditorImpl::ConvertCustomControlTypeToBaseControlType // ---------------------------------------------------- // -MEikDialogPageObserver::TFormControlTypes -CLmkEditorImpl::ConvertCustomControlTypeToBaseControlType( - TInt aControlType ) const +MEikDialogPageObserver::TFormControlTypes CLmkEditorImpl::ConvertCustomControlTypeToBaseControlType( + TInt aControlType) const { - switch( aControlType ) + switch (aControlType) { case EDistanceEditorType: { @@ -1188,14 +1116,13 @@ void CLmkEditorImpl::PreLayoutDynInitL() { CAknForm::PreLayoutDynInitL(); - // When adding fields the form must be editable: - //SetEditableL(ETrue); + SetEditableL(ETrue); if (iCalegorySelectionFlag && iCategoryNames.Count() >= 1) iEditorFieldArray->SetCategoryName(iCategoryNames[0]); iEditorFieldArray->CreateFieldsFromLmkL(); - //SetEditableL(EFalse); - //CAknForm::SetInitialCurrentLine(); + SetEditableL(EFalse); + CAknForm::SetInitialCurrentLine(); } // ----------------------------------------------------------------------------- @@ -1205,82 +1132,80 @@ void CLmkEditorImpl::PostLayoutDynInitL() { CAknForm::PostLayoutDynInitL(); - - MLmkFieldData* fields = iLmkFields->GetField( EName ); - if ( fields ) + MLmkFieldData* fields = iLmkFields->GetField(EName); + if (fields) { - TPtrC name = fields->TextData(); - + TPtrC name = fields->TextData(); //ChangeTitle HBufC* title = name.Alloc(); - CleanupStack::PushL( title ); + CleanupStack::PushL(title); iLmkUiUtils->StoreTitlePaneL(); // save old title pane - iLmkUiUtils->ChangeTitlePaneL( title ); //take ownership - CleanupStack::Pop( title ); //title + iLmkUiUtils->ChangeTitlePaneL(title); //take ownership + CleanupStack::Pop(title); //title } - SetEditableL( iEditorMode == CLmkEditorDlg::ELmkEditor ); + SetEditableL(iEditorMode == CLmkEditorDlg::ELmkEditor); CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); - cba->UpdateCommandObserverL(KMskCommandPos,*this); + cba->UpdateCommandObserverL(KMskCommandPos, *this); if (!IsEditable()) - { - AddMskCommandL(R_LM_MSK_EDIT,ELmkCmdEditLm); - } - else - { - //only for editor - DimmMiddleSoftKey(); - if (iFieldTypeToFocus == ECategory || iFieldTypeToFocus == ECategories) - { - AddMskCommandL(R_LM_MSK_EDIT,ELmkCmdSelectCategories); - } - } + { + AddMskCommandL(R_LM_MSK_EDIT, ELmkCmdEditLm); + } + else + { + //only for editor + DimmMiddleSoftKey(); + if (iFieldTypeToFocus == ECategory || iFieldTypeToFocus + == ECategories) + { + AddMskCommandL(R_LM_MSK_EDIT, ELmkCmdSelectCategories); + } + } } // ----------------------------------------------------------------------------- // CLmkEditorImpl::OkToExitL // ----------------------------------------------------------------------------- // -TBool CLmkEditorImpl::OkToExitL( TInt aKeyCode ) +TBool CLmkEditorImpl::OkToExitL(TInt aKeyCode) { + DEBUG( CLmkEditorImpl::OkToExitL start ); TBool ret = EFalse; - switch ( aKeyCode ) + switch (aKeyCode) { - case EAknSoftkeyDone: - { - if ( IsEditable() ) + case EAknSoftkeyDone: + { + if (IsEditable()) { - if ( iEditorFieldArray->AreAllFieldsEmptyL() ) + if (iEditorFieldArray->AreAllFieldsEmptyL()) { - - if( iLandmark && iIsHideCoordinate ) - { - TLocality locality; - iLandmark->GetPosition( locality ); - if( !Math::IsNaN( locality.Latitude() )) - { - DoNotSaveFormDataL(); - iIsEndKey = EFalse; - // Stay back in the editor mode - break; - } - } - + if (iLandmark && iIsHideCoordinate) + { + TLocality locality; + iLandmark->GetPosition(locality); + if (!Math::IsNaN(locality.Latitude())) + { + DoNotSaveFormDataL(); + iIsEndKey = EFalse; + // Stay back in the editor mode + break; + } + } TRAPD(err,CPosLandmark* landmark = iDb.ReadLandmarkLC(iLmkFields->LandmarkId());CleanupStack::PopAndDestroy( landmark )); if (err == KErrNotFound) { - // The Landmark is not in the database.Dont save the - // landmark. Just return - // Don't save when all landmark fields are empty - iLmkUiUtils->RestoreOldNaviPaneL(); - ret = ETrue; + // The Landmark is not in the database.Dont save the + // landmark. Just return + // Don't save when all landmark fields are empty + iLmkUiUtils->RestoreOldNaviPaneL(); + ret = ETrue; } else { // The landmark is in the database. Hence, confirm // from the user whether he wants to delete the // landmark - if ( LmkNotes::LandmarkConfirmationQueryL( iEikonEnv ) ) + if (LmkNotes::LandmarkConfirmationQueryL(iEikonEnv)) { iLmkFields->DeleteLandmarkL(); iLmkUiUtils->RestoreOldNaviPaneL(); @@ -1296,30 +1221,30 @@ } else { - if(!ValidateContentL()) - { - ret = EFalse; - return ret; - } - else + if (!ValidateContentL()) { + ret = EFalse; + return ret; + } + else + { /** - * Do not save landmark if disc space is not - * enough - */ + * Do not save landmark if disc space is not + * enough + */ TRAPD( err, iEditorFieldArray->SaveFieldsL() ); - if ( err == KErrDiskFull ) + if (err == KErrDiskFull) { ret = EFalse; - LmkNotes::OutOfMemoryNoteL( iEikonEnv ); + LmkNotes::OutOfMemoryNoteL(iEikonEnv); delete this; return ret; } - if ( iLandmarkItemId ) - { - *iLandmarkItemId = iLmkFields->LandmarkId(); - } + if (iLandmarkItemId) + { + *iLandmarkItemId = iLmkFields->LandmarkId(); + } iLmkUiUtils->RestoreOldNaviPaneL(); ret = ETrue; } @@ -1335,10 +1260,11 @@ default: break; } - if ( !ret ) + if (!ret) { - ret = CAknForm::OkToExitL( aKeyCode ); + ret = CAknForm::OkToExitL(aKeyCode); } + DEBUG1( CLmkEditorImpl::OkToExitL start ret=%d,ret ); return ret; } @@ -1346,78 +1272,74 @@ // CLmkEditorImpl::CreateLineL // ----------------------------------------------------------------------------- // -CCoeControl* CLmkEditorImpl::CreateLineL( - const TDesC& aCaption, - TInt aControlId, - TInt aControlType ) - { - return CreateLineByTypeL( - aCaption, aControlId, aControlType, NULL ); - } +CCoeControl* CLmkEditorImpl::CreateLineL(const TDesC& aCaption, + TInt aControlId, TInt aControlType) + { + return CreateLineByTypeL(aCaption, aControlId, aControlType, NULL); + } // ----------------------------------------------------------------------------- // CLmkEditorImpl::LineControl // ----------------------------------------------------------------------------- // -CEikCaptionedControl* CLmkEditorImpl::LineControl( TInt aControlId ) const - { - return Line( aControlId ); - } +CEikCaptionedControl* CLmkEditorImpl::LineControl(TInt aControlId) const + { + return Line(aControlId); + } // ----------------------------------------------------------------------------- // CLmkEditorImpl::DeleteControl // ----------------------------------------------------------------------------- // -void CLmkEditorImpl::DeleteControl( TInt aControlId ) - { - DeleteLine( aControlId ); - } +void CLmkEditorImpl::DeleteControl(TInt aControlId) + { + DeleteLine(aControlId); + } // ----------------------------------------------------------------------------- // CLmkEditorImpl::TryChangeFocusL // ----------------------------------------------------------------------------- // -void CLmkEditorImpl::TryChangeFocusL( TInt aControlId ) - { - if ( ControlOrNull( aControlId ) ) - { - TryChangeFocusToL( aControlId ); - } - } +void CLmkEditorImpl::TryChangeFocusL(TInt aControlId) + { + if (ControlOrNull(aControlId)) + { + TryChangeFocusToL(aControlId); + } + } // ----------------------------------------------------------------------------- // CLmkEditorImpl::SetCurrentLineCaptionL // ----------------------------------------------------------------------------- // -void CLmkEditorImpl::SetCurrentLineCaptionL( - TInt aControlId, - const TDesC& aText ) - { - CEikCaptionedControl* ctl = Line(aControlId); - if (ctl) - { - ctl->SetCaptionL(aText); - ctl->DrawDeferred(); - } - } +void CLmkEditorImpl::SetCurrentLineCaptionL(TInt aControlId, + const TDesC& aText) + { + CEikCaptionedControl* ctl = Line(aControlId); + if (ctl) + { + ctl->SetCaptionL(aText); + ctl->DrawDeferred(); + } + } // ----------------------------------------------------------------------------- // CLmkEditorImpl::Control // ----------------------------------------------------------------------------- // -CCoeControl* CLmkEditorImpl::Control( TInt aControlId ) const - { - return ControlOrNull( aControlId ); - } +CCoeControl* CLmkEditorImpl::Control(TInt aControlId) const + { + return ControlOrNull(aControlId); + } // ----------------------------------------------------------------------------- // CLmkEditorImpl::SetEditableL // ----------------------------------------------------------------------------- // -void CLmkEditorImpl::SetEditableL( TBool aState ) - { - CAknForm::SetEditableL( aState ); - } +void CLmkEditorImpl::SetEditableL(TBool aState) + { + CAknForm::SetEditableL(aState); + } // ----------------------------------------------------------------------------- // CLmkEditorImpl::Database @@ -1433,49 +1355,50 @@ // ----------------------------------------------------------------------------- // CPosLandmark* CLmkEditorImpl::GetCurrentEditedLandmarkL() - { - iEditorFieldArray->SaveFieldsToBufferL(); - CArrayPtrFlat& fieldArray = iLmkFields->Fields(); - TInt count( fieldArray.Count() ); - CPosLandmark* lmk = NULL; - if( iLandmark ) - { - HBufC8* lmBuf = PosLandmarkSerialization::PackL( *iLandmark ); - CleanupStack::PushL( lmBuf ); - lmk = PosLandmarkSerialization::UnpackL( lmBuf->Des() ); - CleanupStack::PopAndDestroy( lmBuf ); - } - else - { - lmk = CPosLandmark::NewL(); - } + { + iEditorFieldArray->SaveFieldsToBufferL(); + CArrayPtrFlat& fieldArray = iLmkFields->Fields(); + TInt count(fieldArray.Count()); + CPosLandmark* lmk = NULL; + if (iLandmark) + { + HBufC8* lmBuf = PosLandmarkSerialization::PackL(*iLandmark); + CleanupStack::PushL(lmBuf); + lmk = PosLandmarkSerialization::UnpackL(lmBuf->Des()); + CleanupStack::PopAndDestroy(lmBuf); + } + else + { + lmk = CPosLandmark::NewL(); + } - TBool isPosFieldPresent=EFalse; - - TLocationData locationData; // to store editor position data + TBool isPosFieldPresent = EFalse; + + TLocationData locationData; // to store editor position data //Position data - TLocality locality = TLocality(); // empty locality + TLocality locality = TLocality(); // empty locality - locationData.iLatitude = locality.Latitude(); - locationData.iLongitude = locality.Longitude(); - locationData.iAltitude = locality.Altitude(); - locationData.iHorizontalAccuracy = locality.HorizontalAccuracy(); - locationData.iVerticalAccuracy = locality.VerticalAccuracy(); - - for ( TInt i = 0; i < count; i++ ) + locationData.iLatitude = locality.Latitude(); + locationData.iLongitude = locality.Longitude(); + locationData.iAltitude = locality.Altitude(); + locationData.iHorizontalAccuracy = locality.HorizontalAccuracy(); + locationData.iVerticalAccuracy = locality.VerticalAccuracy(); + + for (TInt i = 0; i < count; i++) { - switch( fieldArray[i]->FieldType() ) + switch (fieldArray[i]->FieldType()) { case EName: { - lmk->SetLandmarkNameL( fieldArray[i]->TextData() ); + lmk->SetLandmarkNameL(fieldArray[i]->TextData()); HBufC* path = fieldArray[i]->IconPath(); - if ( path && path->Length() > 0 && - fieldArray[i]->IconId() != KErrNotFound ) + if (path && path->Length() > 0 && fieldArray[i]->IconId() + != KErrNotFound) { // Get the default Mask index - lmk->SetIconL( *path, fieldArray[i]->IconId() , KLmkDefaultId+1); + lmk->SetIconL(*path, fieldArray[i]->IconId(), + KLmkDefaultId + 1); } break; @@ -1485,31 +1408,30 @@ { //Add categories to landmark RArray& categories = - fieldArray[i]->Categories(); - TInt Tcount( categories.Count() ); - for ( TInt j=0; j < Tcount; j++ ) + fieldArray[i]->Categories(); + TInt Tcount(categories.Count()); + for (TInt j = 0; j < Tcount; j++) { - lmk->AddCategoryL( categories[j] ); + lmk->AddCategoryL(categories[j]); } break; } - case EDescription: - { - lmk->SetLandmarkDescriptionL( fieldArray[i]->TextData() ); - break; - } - //these all are same + case EDescription: + { + lmk->SetLandmarkDescriptionL(fieldArray[i]->TextData()); + break; + } + //these all are same case EStreet: case EPostCode: case ECity: case EStateProvince: case ECountry: - case EPhoneNumber: - case EWebAddress: + case EPhoneNumber: + case EWebAddress: { - lmk->SetPositionFieldL( - fieldArray[i]->PositionFieldId(), - fieldArray[i]->TextData() ); + lmk->SetPositionFieldL(fieldArray[i]->PositionFieldId(), + fieldArray[i]->TextData()); break; } case ELatitude: @@ -1526,8 +1448,7 @@ } case EPositionAccuracy: { - locationData.iHorizontalAccuracy = - fieldArray[i]->FloatData(); + locationData.iHorizontalAccuracy = fieldArray[i]->FloatData(); break; } case EAltitude: @@ -1547,46 +1468,44 @@ } } - if( isPosFieldPresent ) + if (isPosFieldPresent) { // remove the old values to set new values lmk->RemoveLandmarkAttributes(CPosLandmark::EPosition); - if (!Math::IsNaN(locationData.iLatitude) && - !Math::IsNaN(locationData.iLongitude)) + if (!Math::IsNaN(locationData.iLatitude) && !Math::IsNaN( + locationData.iLongitude)) { if (!Math::IsNaN(locationData.iAltitude)) { - locality.SetCoordinate( - locationData.iLatitude, - locationData.iLongitude, - locationData.iAltitude); + locality.SetCoordinate(locationData.iLatitude, + locationData.iLongitude, locationData.iAltitude); if (!Math::IsNaN(locationData.iVerticalAccuracy)) { - if( locationData.iVerticalAccuracy > 0 ) - locality.SetVerticalAccuracy(locationData.iVerticalAccuracy); + if (locationData.iVerticalAccuracy > 0) + locality.SetVerticalAccuracy( + locationData.iVerticalAccuracy); } } else { - locality.SetCoordinate( - locationData.iLatitude, - locationData.iLongitude); + locality.SetCoordinate(locationData.iLatitude, + locationData.iLongitude); } if (!Math::IsNaN(locationData.iHorizontalAccuracy)) { - if( locationData.iHorizontalAccuracy > 0 ) - locality.SetHorizontalAccuracy(locationData.iHorizontalAccuracy); + if (locationData.iHorizontalAccuracy > 0) + locality.SetHorizontalAccuracy( + locationData.iHorizontalAccuracy); } // save position if at least lat/lon are entered - lmk->SetPositionL(locality); + lmk->SetPositionL(locality); } } - return lmk; - } + } // ----------------------------------------------------------------------------- // CLmkEditorImpl::CreateLabelArrayL @@ -1595,15 +1514,15 @@ void CLmkEditorImpl::CreateLabelArrayL() { - if ( iJapaneseInputMode ) - { - // Display in Japanese order - CreateLabelArrayForJapaneseModeL(); - } - else - { // Normal mode - CreateLabelArrayForNormalModeL(); - } + if (iJapaneseInputMode) + { + // Display in Japanese order + CreateLabelArrayForJapaneseModeL(); + } + else + { // Normal mode + CreateLabelArrayForNormalModeL(); + } } // ----------------------------------------------------------------------------- @@ -1611,90 +1530,88 @@ // ----------------------------------------------------------------------------- // void CLmkEditorImpl::CreateLabelArrayForNormalModeL() - { - CreateLabelL( R_LMK_NAME_LABEL, EName ); - CreateLabelL( R_LMK_CATEGORY_LABEL, ECategory ); - CreateLabelL( R_LMK_CATEGORIES_LABEL, ECategories ); - CreateLabelL( R_LMK_DESCRIPTION_LABEL, EDescription ); - CreateLabelL( R_LMK_STREET_LABEL, EStreet ); - CreateLabelL( R_LMK_POST_CODE_LABEL, EPostCode ); - CreateLabelL( R_LMK_CITY_LABEL, ECity ); - CreateLabelL( R_LMK_STATE_PROVINCE_LABEL, EStateProvince ); - CreateLabelL( R_LMK_COUNTRY_LABEL, ECountry ); - CreateLabelL( R_LMK_PHONE_NUMBER_LABEL, EPhoneNumber ); - CreateLabelL( R_LMK_WEB_ADDRESS_LABEL, EWebAddress ); - CreateLabelL( R_LMK_LATITUDE_LABEL, ELatitude ); - CreateLabelL( R_LMK_LONGITUDE_LABEL, ELongitude ); - CreateLabelL( R_LMK_POSITION_ACCURACY_LABEL, EPositionAccuracy ); - CreateLabelL( R_LMK_ALTITUDE_LABEL, EAltitude ); - CreateLabelL( R_LMK_ALTITUDE_ACCURACY_LABEL, EAltitudeAccuracy ); - } + { + CreateLabelL(R_LMK_NAME_LABEL, EName); + CreateLabelL(R_LMK_CATEGORY_LABEL, ECategory); + CreateLabelL(R_LMK_CATEGORIES_LABEL, ECategories); + CreateLabelL(R_LMK_DESCRIPTION_LABEL, EDescription); + CreateLabelL(R_LMK_STREET_LABEL, EStreet); + CreateLabelL(R_LMK_POST_CODE_LABEL, EPostCode); + CreateLabelL(R_LMK_CITY_LABEL, ECity); + CreateLabelL(R_LMK_STATE_PROVINCE_LABEL, EStateProvince); + CreateLabelL(R_LMK_COUNTRY_LABEL, ECountry); + CreateLabelL(R_LMK_PHONE_NUMBER_LABEL, EPhoneNumber); + CreateLabelL(R_LMK_WEB_ADDRESS_LABEL, EWebAddress); + CreateLabelL(R_LMK_LATITUDE_LABEL, ELatitude); + CreateLabelL(R_LMK_LONGITUDE_LABEL, ELongitude); + CreateLabelL(R_LMK_POSITION_ACCURACY_LABEL, EPositionAccuracy); + CreateLabelL(R_LMK_ALTITUDE_LABEL, EAltitude); + CreateLabelL(R_LMK_ALTITUDE_ACCURACY_LABEL, EAltitudeAccuracy); + } // ----------------------------------------------------------------------------- // CLmkEditorImpl::CreateLabelArrayForJapaneseModeL() // ----------------------------------------------------------------------------- // void CLmkEditorImpl::CreateLabelArrayForJapaneseModeL() - { - CreateLabelL( R_LMK_NAME_LABEL, ENameJapaneseMode); - CreateLabelL( R_LMK_CATEGORY_LABEL, ECategoryJapaneseMode ); - CreateLabelL( R_LMK_CATEGORIES_LABEL, ECategoriesJapaneseMode ); - CreateLabelL( R_LMK_DESCRIPTION_LABEL, EDescriptionJapaneseMode ); - CreateLabelL( R_LMK_POST_CODE_LABEL, EPostCodeJapaneseMode ); - CreateLabelL( R_LMK_STATE_PROVINCE_LABEL, EStateProvinceJapaneseMode ); - CreateLabelL( R_LMK_CITY_LABEL, ECityJapaneseMode ); - CreateLabelL( R_LMK_STREET_LABEL, EStreetJapaneseMode ); - CreateLabelL( R_LMK_COUNTRY_LABEL, ECountryJapaneseMode ); - CreateLabelL( R_LMK_PHONE_NUMBER_LABEL, EPhoneNumberJapaneseMode ); - CreateLabelL( R_LMK_WEB_ADDRESS_LABEL, EWebAddressJapaneseMode ); - CreateLabelL( R_LMK_LATITUDE_LABEL, ELatitudeJapaneseMode ); - CreateLabelL( R_LMK_LONGITUDE_LABEL, ELongitudeJapaneseMode ); - CreateLabelL( R_LMK_POSITION_ACCURACY_LABEL, EPositionAccuracyJapaneseMode ); - CreateLabelL( R_LMK_ALTITUDE_LABEL, EAltitudeJapaneseMode ); - CreateLabelL( R_LMK_ALTITUDE_ACCURACY_LABEL, EAltitudeAccuracyJapaneseMode ); - } + { + CreateLabelL(R_LMK_NAME_LABEL, ENameJapaneseMode); + CreateLabelL(R_LMK_CATEGORY_LABEL, ECategoryJapaneseMode); + CreateLabelL(R_LMK_CATEGORIES_LABEL, ECategoriesJapaneseMode); + CreateLabelL(R_LMK_DESCRIPTION_LABEL, EDescriptionJapaneseMode); + CreateLabelL(R_LMK_POST_CODE_LABEL, EPostCodeJapaneseMode); + CreateLabelL(R_LMK_STATE_PROVINCE_LABEL, EStateProvinceJapaneseMode); + CreateLabelL(R_LMK_CITY_LABEL, ECityJapaneseMode); + CreateLabelL(R_LMK_STREET_LABEL, EStreetJapaneseMode); + CreateLabelL(R_LMK_COUNTRY_LABEL, ECountryJapaneseMode); + CreateLabelL(R_LMK_PHONE_NUMBER_LABEL, EPhoneNumberJapaneseMode); + CreateLabelL(R_LMK_WEB_ADDRESS_LABEL, EWebAddressJapaneseMode); + CreateLabelL(R_LMK_LATITUDE_LABEL, ELatitudeJapaneseMode); + CreateLabelL(R_LMK_LONGITUDE_LABEL, ELongitudeJapaneseMode); + CreateLabelL(R_LMK_POSITION_ACCURACY_LABEL, EPositionAccuracyJapaneseMode); + CreateLabelL(R_LMK_ALTITUDE_LABEL, EAltitudeJapaneseMode); + CreateLabelL(R_LMK_ALTITUDE_ACCURACY_LABEL, EAltitudeAccuracyJapaneseMode); + } // ----------------------------------------------------------------------------- // CLmkEditorImpl::CreateLabelL // ----------------------------------------------------------------------------- // -void CLmkEditorImpl::CreateLabelL( TInt iResourceId, TInt iPos ) +void CLmkEditorImpl::CreateLabelL(TInt iResourceId, TInt iPos) { - HBufC* label = iCoeEnv->AllocReadResourceL( iResourceId ); - CleanupStack::PushL( label ); - User::LeaveIfError( iLabelArray.Insert( label, iPos ) ); + HBufC* label = iCoeEnv->AllocReadResourceL(iResourceId); + CleanupStack::PushL(label); + User::LeaveIfError(iLabelArray.Insert(label, iPos)); CleanupStack::Pop(); //label } - // ----------------------------------------------------------------------------- // CLmkEditorImpl::IsNameFieldEmptyL // ----------------------------------------------------------------------------- // TBool CLmkEditorImpl::IsNameFieldEmptyL() { - const MLmkEditorField* field = &iEditorFieldArray->FieldAt( 0 ); + const MLmkEditorField* field = &iEditorFieldArray->FieldAt(0); HBufC* fieldText = field->ControlTextL(); - TBool ret( ETrue ); - if ( fieldText && fieldText->Length() > 0 ) + TBool ret(ETrue); + if (fieldText && fieldText->Length() > 0) { - //Check if any active character or not - TPtr16 ptr = fieldText->Des(); - ptr.Trim(); - if (ptr.Length() == 0) - { - ret = ETrue; - } - else - { - ret = EFalse; - } + //Check if any active character or not + TPtr16 ptr = fieldText->Des(); + ptr.Trim(); + if (ptr.Length() == 0) + { + ret = ETrue; + } + else + { + ret = EFalse; + } } delete fieldText; return ret; } - // ----------------------------------------------------------------------------- // CLmkEditorImpl::ValidateContentL() // ----------------------------------------------------------------------------- @@ -1702,49 +1619,50 @@ TBool CLmkEditorImpl::ValidateContentL() { TBool result = ETrue; - if(IsFieldEmptyL( ELatitude ) && !IsFieldEmptyL( ELongitude )) - { - LmkNotes::InformationNoteL( iEikonEnv,R_LMK_ERROR_CHECK_NOTE ); + if (IsFieldEmptyL(ELatitude) && !IsFieldEmptyL(ELongitude)) + { + LmkNotes::InformationNoteL(iEikonEnv, R_LMK_ERROR_CHECK_NOTE); DoNotSaveDataL(ELatitude); - result = EFalse; - } - else if (!IsFieldEmptyL( ELatitude ) && IsFieldEmptyL( ELongitude )) - { - LmkNotes::InformationNoteL( iEikonEnv, R_LMK_ERROR_CHECK_NOTE ); + result = EFalse; + } + else if (!IsFieldEmptyL(ELatitude) && IsFieldEmptyL(ELongitude)) + { + LmkNotes::InformationNoteL(iEikonEnv, R_LMK_ERROR_CHECK_NOTE); + DoNotSaveDataL(ELongitude); + result = EFalse; + } + else if (IsFieldEmptyL(ELatitude) && !IsFieldEmptyL(EPositionAccuracy)) + { + LmkNotes::InformationNoteL(iEikonEnv, R_LMK_ERROR_POS_ACC_CHECK_NOTE); + DoNotSaveDataL(ELatitude); + result = EFalse; + } + else if (IsFieldEmptyL(ELongitude) && !IsFieldEmptyL(EPositionAccuracy)) + { + LmkNotes::InformationNoteL(iEikonEnv, R_LMK_ERROR_POS_ACC_CHECK_NOTE); DoNotSaveDataL(ELongitude); - result = EFalse; - } - else if(IsFieldEmptyL( ELatitude ) && !IsFieldEmptyL( EPositionAccuracy )) - { - LmkNotes::InformationNoteL( iEikonEnv, R_LMK_ERROR_POS_ACC_CHECK_NOTE ); - DoNotSaveDataL(ELatitude); - result = EFalse; - } - else if (IsFieldEmptyL( ELongitude ) && !IsFieldEmptyL( EPositionAccuracy )) - { - LmkNotes::InformationNoteL( iEikonEnv, R_LMK_ERROR_POS_ACC_CHECK_NOTE ); - DoNotSaveDataL(ELongitude); - result = EFalse; - } - else if (IsFieldEmptyL( EAltitude ) && !IsFieldEmptyL( EAltitudeAccuracy )) - { - LmkNotes::InformationNoteL( iEikonEnv, R_LMK_ERROR_ALT_ACC_CHECK_NOTE ); + result = EFalse; + } + else if (IsFieldEmptyL(EAltitude) && !IsFieldEmptyL(EAltitudeAccuracy)) + { + LmkNotes::InformationNoteL(iEikonEnv, R_LMK_ERROR_ALT_ACC_CHECK_NOTE); DoNotSaveDataL(EAltitude); - result = EFalse; - } - else if ((IsFieldEmptyL( ELatitude ) || IsFieldEmptyL( ELongitude )) && !IsFieldEmptyL( EAltitude )) - { - LmkNotes::InformationNoteL( iEikonEnv, R_LMK_ERROR_ALTITUDE_CHECK_NOTE ); + result = EFalse; + } + else if ((IsFieldEmptyL(ELatitude) || IsFieldEmptyL(ELongitude)) + && !IsFieldEmptyL(EAltitude)) + { + LmkNotes::InformationNoteL(iEikonEnv, R_LMK_ERROR_ALTITUDE_CHECK_NOTE); DoNotSaveDataL(ELatitude); - result = EFalse; - } + result = EFalse; + } else if (IsInvalidUriL()) - { - LmkNotes::InformationNoteL( iEikonEnv, R_LMK_ERROR_URL_ILLEGAL_NOTE ); + { + LmkNotes::InformationNoteL(iEikonEnv, R_LMK_ERROR_URL_ILLEGAL_NOTE); DoNotSaveDataL(EWebAddress); - result = EFalse; - } - else if ( IsNameFieldEmptyL() ) + result = EFalse; + } + else if (IsNameFieldEmptyL()) { DoNotSaveFormDataL(); iIsEndKey = EFalse; @@ -1759,61 +1677,61 @@ // ----------------------------------------------------------------------------- // TBool CLmkEditorImpl::IsFieldEmptyL(const TUint16 aFieldType) - { - TInt fldId; - MLmkFieldData* field = iLmkFields->GetField(aFieldType); - if(field) - { - fldId = field->UniqueFieldIdentity(); - } + { + TInt fldId; + MLmkFieldData* field = iLmkFields->GetField(aFieldType); + if (field) + { + fldId = field->UniqueFieldIdentity(); + } else { return EFalse; } - MLmkEditorField* fld = iEditorFieldArray->Find(fldId ); - if(!fld) - { - return ETrue; - } - - TReal val; - switch(aFieldType) - { - case ELatitude: - case ELongitude: - { - val = fld->FieldValue(); - } - break; - case EPositionAccuracy: - case EAltitudeAccuracy: - case EAltitude: - { - val = fld->FieldValue(); - } - break; - } - return Math::IsNaN(val); - } + MLmkEditorField* fld = iEditorFieldArray->Find(fldId); + if (!fld) + { + return ETrue; + } + TReal val; + switch (aFieldType) + { + case ELatitude: + case ELongitude: + { + val = fld->FieldValue(); + } + break; + case EPositionAccuracy: + case EAltitudeAccuracy: + case EAltitude: + { + val = fld->FieldValue(); + } + break; + } + return Math::IsNaN(val); + } // ----------------------------------------------------------------------------- // CLmkEditorImpl::DoNotSaveDataL() // ----------------------------------------------------------------------------- // void CLmkEditorImpl::DoNotSaveDataL(const TUint16 aFieldType) - { - if( iIsEditing ) - { - MLmkFieldData* fields = iLmkFields->GetField(aFieldType); - if(fields) - { - TInt id = fields->UniqueFieldIdentity(); - TryChangeFocusL(id); - } - } + { + if (iIsEditing) + { + MLmkFieldData* fields = iLmkFields->GetField(aFieldType); + if (fields) + { + TInt id = fields->UniqueFieldIdentity(); + TryChangeFocusL(id); + } + } } + // ----------------------------------------------------------------------------- // CLmkEditorImpl::OkToExitL // ----------------------------------------------------------------------------- @@ -1821,14 +1739,13 @@ TBool CLmkEditorImpl::OkToExitL() { TBool result = ETrue; - - if ( iEditorFieldArray->AreAllFieldsEmptyL() ) + if (iEditorFieldArray->AreAllFieldsEmptyL()) { iLmkFields->DeleteLandmarkL(); } else { - if ( IsNameFieldEmptyL() ) + if (IsNameFieldEmptyL()) { DoNotSaveFormDataL(); result = EFalse; @@ -1836,20 +1753,19 @@ else { TRAPD( err, iEditorFieldArray->SaveFieldsL() ); - if ( err == KErrDiskFull ) + if (err == KErrDiskFull) { result = EFalse; - LmkNotes::OutOfMemoryNoteL( iEikonEnv ); + LmkNotes::OutOfMemoryNoteL(iEikonEnv); delete this; return result; } - if ( iLandmarkItemId ) - { - *iLandmarkItemId = iLmkFields->LandmarkId(); - } + if (iLandmarkItemId) + { + *iLandmarkItemId = iLmkFields->LandmarkId(); + } } } - return result; } @@ -1859,32 +1775,31 @@ // void CLmkEditorImpl::SelectCategoriesCmdL() { - if(iCatInfoPopupNote) - { - iCatInfoPopupNote->HideInfoPopupNote(); - } - MLmkFieldData* fields = iLmkFields->GetField( ECategory ); - if ( !fields ) + if (iCatInfoPopupNote) { - fields = iLmkFields->GetField( ECategories ); + iCatInfoPopupNote->HideInfoPopupNote(); } - - if ( fields ) + MLmkFieldData* fields = iLmkFields->GetField(ECategory); + if (!fields) + { + fields = iLmkFields->GetField(ECategories); + } + if (fields) { CLmkDlgCategorySelectorImpl* dlg = CLmkDlgCategorySelectorImpl::NewL( - iDb, ETrue ); - CleanupStack::PushL( dlg ); - dlg->SetEmptyDlgLabel(R_LMK_EMPTY_NO_CATEGORIES ,R_LMK_GUIDE_CREATE_LANDMARK); + iDb, ETrue); + CleanupStack::PushL(dlg); + dlg->SetEmptyDlgLabel(R_LMK_EMPTY_NO_CATEGORIES, + R_LMK_GUIDE_CREATE_LANDMARK); RArray& categories = fields->Categories(); - if ( dlg->ExecuteL( categories ) ) + if (dlg->ExecuteL(categories)) { - iEditorFieldArray->UpdateFieldsL( ECategory ); - iEditorFieldArray->UpdateFieldsL( ECategories ); + iEditorFieldArray->UpdateFieldsL(ECategory); + iEditorFieldArray->UpdateFieldsL(ECategories); } - CleanupStack::PopAndDestroy( dlg ); + CleanupStack::PopAndDestroy(dlg); iIsCategorySelctorOpen = EFalse; DrawNow(); - // ShowMultipleCategoriesInfoPopupL(ETrue); } } @@ -1894,25 +1809,23 @@ // void CLmkEditorImpl::CurrentLocationCmdL() { - if(ShowQueryIfLocationFieldsAlreadyFilledL()) - { - return; - } - HBufC* srvName = StringLoader::LoadLC( - R_LMK_SERVICE_RULE_NAME, - const_cast< CCoeEnv *>( iCoeEnv )); + if (ShowQueryIfLocationFieldsAlreadyFilledL()) + { + return; + } + HBufC* srvName = StringLoader::LoadLC(R_LMK_SERVICE_RULE_NAME, + const_cast (iCoeEnv)); iLocationService = CLmkLocationService::NewL(*srvName); - CleanupStack::PopAndDestroy( srvName ); //srvName - iLocationService->SetObserver( *this ); + CleanupStack::PopAndDestroy(srvName); //srvName + iLocationService->SetObserver(*this); iLocationService->LocationRequestL(); - TRAPD( error, iWaitDialogLauncher->StartWaitDialogL()); - if( error ) + if (error) { delete iLocationService; iLocationService = NULL; - User::Leave( error ); + User::Leave(error); } } @@ -1923,47 +1836,49 @@ void CLmkEditorImpl::ChangeIconCmdL() { TInt lSelectedIconIndex(0); - CLmkIconMapDialog* dialog = new(ELeave) CLmkIconMapDialog( lSelectedIconIndex ); + CLmkIconMapDialog* dialog = new (ELeave) CLmkIconMapDialog( + lSelectedIconIndex); MLmkFieldData* nameField; - if (dialog->ExecuteLD(R_LMK_ICON_TABLE_DIALOG) ) + if (dialog->ExecuteLD(R_LMK_ICON_TABLE_DIALOG)) { // icon file also contains masks, therefore 2* - TInt iconIndex = 2*lSelectedIconIndex; - RFs fs; - User::LeaveIfError(fs.Connect()); - CleanupClosePushL( fs ); + TInt iconIndex = 2 * lSelectedIconIndex; + RFs fs; + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); - if ( SysUtil::DiskSpaceBelowCriticalLevelL( &fs, sizeof( CPosLandmark ), EDriveC ) ) - { - CleanupStack::PopAndDestroy(); // fs - User::LeaveNoMemory(); - } - else - { - nameField = iLmkFields->GetField( EName ); + if (SysUtil::DiskSpaceBelowCriticalLevelL(&fs, sizeof(CPosLandmark), + EDriveC)) + { + CleanupStack::PopAndDestroy(); // fs + User::LeaveNoMemory(); + } + else + { + nameField = iLmkFields->GetField(EName); TFileName* iconFile = CLmkUiUtils::LmkUiIconFileLC(); - if( nameField && iconFile ) - { - nameField->SetIconId( iconIndex + EMbmLmkuiQgn_prop_lm_transport); - nameField->SetIconPathL( *iconFile ); - + if (nameField && iconFile) + { + nameField->SetIconId(iconIndex + + EMbmLmkuiQgn_prop_lm_transport); + nameField->SetIconPathL(*iconFile); + //Update context icon - CEikImage* image = new(ELeave) CEikImage(); - CleanupStack::PushL( image ); - image->CreatePictureFromFileL( *iconFile, - nameField->IconId(), - iconIndex + EMbmLmkuiQgn_prop_lm_transport_mask); - - iLmkUiUtils->UpdateContextIconL( image ); - + CEikImage* image = new (ELeave) CEikImage(); + CleanupStack::PushL(image); + image->CreatePictureFromFileL(*iconFile, nameField->IconId(), + iconIndex + EMbmLmkuiQgn_prop_lm_transport_mask); + + iLmkUiUtils->UpdateContextIconL(image); + // Added for appending Icon to Name label - CLmkUiUtils::ChangeLmNameLabelIconL (*this, *nameField); + CLmkUiUtils::ChangeLmNameLabelIconL(*this, *nameField); CleanupStack::Pop(); //image CleanupStack::PopAndDestroy();//iconFile DrawNow(); } - } - CleanupStack::PopAndDestroy(); // fs + } + CleanupStack::PopAndDestroy(); // fs } } @@ -1973,101 +1888,82 @@ // void CLmkEditorImpl::CategoriesCmdL() { - MLmkFieldData* categoryField = iLmkFields->GetField( ECategories ); - if ( !categoryField ) + MLmkFieldData* categoryField = iLmkFields->GetField(ECategories); + if (!categoryField) { - categoryField = iLmkFields->GetField( ECategory ); - if ( !categoryField ) + return; + } + RArray categories = categoryField->Categories(); + TInt count(categories.Count()); + + HBufC* catName; + // show the category list in a message query + HBufC* message = HBufC::NewLC((KPosLmMaxCategoryNameLength * count) + 1); + TPtr msgPtr = message->Des(); + CDesC16ArrayFlat* desArr = new (ELeave) CDesC16ArrayFlat(count); + CleanupStack::PushL(desArr); + // fill up the array with category´s names from the engine. + for (TInt i = 0; i < count; i++) + { + catName = CLmkDbUtils::CategoryNameL(iDb, categories[i]); + CleanupStack::PushL(catName); + desArr->AppendL(catName->Des()); + CleanupStack::PopAndDestroy(catName); //name + } + desArr->Sort(); + for (TInt i = 0; i < count; i++) + { + msgPtr.Append((*desArr)[i]); + if (i != (count - 1)) { - return; + msgPtr.Append(_L("\n")); } } - else - { - RArray categories = categoryField->Categories(); - TInt count( categories.Count() ); - - // Do not launch the popup for displaying one category name - if (count <=1 ) - { - //Launch context sensitive menu bar here - if ( iContextMenuBar ) - { - iContextMenuBar->TryDisplayMenuBarL(); - } - return; - } - - HBufC* catName; - // show the category list in a message query - HBufC* message = HBufC::NewLC( (KPosLmMaxCategoryNameLength * count) + 1); - TPtr msgPtr = message->Des(); - CDesC16ArrayFlat* desArr = new (ELeave) CDesC16ArrayFlat(count); - CleanupStack::PushL(desArr); - // fill up the array with category´s names from the engine. - for ( TInt i = 0; i < count; i++ ) - { - catName = CLmkDbUtils::CategoryNameL( iDb, categories[i] ); - CleanupStack::PushL( catName ); - desArr->AppendL(catName->Des()); - CleanupStack::PopAndDestroy( catName ); //name - } - desArr->Sort(); - for ( TInt i = 0; i < count; i++ ) - { - msgPtr.Append((*desArr)[i]); - if ( i != ( count - 1 ) ) - { - msgPtr.Append(_L("\n")); - } - } - LmkNotes::MessageQueryL( iEikonEnv, msgPtr, count ); - CleanupStack::Pop();//desArr - delete desArr; - CleanupStack::PopAndDestroy( message ); //message - } + LmkNotes::MessageQueryL(iEikonEnv, msgPtr, count); + CleanupStack::Pop();//desArr + delete desArr; + CleanupStack::PopAndDestroy(message); //message } // ----------------------------------------------------------------------------- // CLmkEditorImpl::SetCurrentLocationL // ----------------------------------------------------------------------------- // -void CLmkEditorImpl::SetCurrentLocationL( const TPosition& aPosition ) +void CLmkEditorImpl::SetCurrentLocationL(const TPosition& aPosition) { - MLmkFieldData* latitude = iLmkFields->GetField( ELatitude ); - if(latitude) - { - latitude->SetTReal( aPosition.Latitude() ); + MLmkFieldData* latitude = iLmkFields->GetField(ELatitude); + if (latitude) + { + latitude->SetTReal(aPosition.Latitude()); - MLmkFieldData* longitude = iLmkFields->GetField( ELongitude ); - if(longitude) - longitude->SetTReal( aPosition.Longitude() ); - } + MLmkFieldData* longitude = iLmkFields->GetField(ELongitude); + if (longitude) + longitude->SetTReal(aPosition.Longitude()); + } - MLmkFieldData* altitude = iLmkFields->GetField( EAltitude ); - if(altitude) - { - altitude->SetTReal( aPosition.Altitude() ); - } + MLmkFieldData* altitude = iLmkFields->GetField(EAltitude); + if (altitude) + { + altitude->SetTReal(aPosition.Altitude()); + } - MLmkFieldData* horizontalAccuracy = - iLmkFields->GetField( EPositionAccuracy ); - if(horizontalAccuracy) - { - horizontalAccuracy->SetTReal( aPosition.HorizontalAccuracy() ); - } + MLmkFieldData* horizontalAccuracy = iLmkFields->GetField( + EPositionAccuracy); + if (horizontalAccuracy) + { + horizontalAccuracy->SetTReal(aPosition.HorizontalAccuracy()); + } - MLmkFieldData* verticalAccuracy = - iLmkFields->GetField( EAltitudeAccuracy ); - if(verticalAccuracy) - { - verticalAccuracy->SetTReal( aPosition.VerticalAccuracy() ); - } - - TRAP_IGNORE(iLandmark->SetPositionL(aPosition)); - - iEditorFieldArray->UpdateFieldsL( EAllEditorItems ); - + MLmkFieldData* verticalAccuracy = iLmkFields->GetField(EAltitudeAccuracy); + if (verticalAccuracy) + { + verticalAccuracy->SetTReal(aPosition.VerticalAccuracy()); + } + + TRAP_IGNORE(iLandmark->SetPositionL(aPosition)); + + iEditorFieldArray->UpdateFieldsL(EAllEditorItems); + DrawNow(); } @@ -2077,36 +1973,35 @@ // void CLmkEditorImpl::ChangeContextImageL() { - MLmkFieldData* nameField = iLmkFields->GetField( EName ); - if( nameField ) + MLmkFieldData* nameField = iLmkFields->GetField(EName); + if (nameField) { - CEikImage* image = new(ELeave) CEikImage(); - CleanupStack::PushL( image ); + CEikImage* image = new (ELeave) CEikImage(); + CleanupStack::PushL(image); TFileName* defaultIconFile = CLmkUiUtils::LmkUiIconFileLC(); // No need to add iconFile to cleanupstack since it is a member variable from CLmkFieldData class HBufC *iconFile = nameField->IconPath(); TInt err = KErrNotFound; CFbsBitmap* bitmap; CFbsBitmap* mask; - if ( nameField->IconId() != KErrNotFound ) + if (nameField->IconId() != KErrNotFound) { TRAP(err,AknIconUtils::CreateIconL( bitmap, mask, - *iconFile, nameField->IconId(), - nameField->IconId()+1 );); + *iconFile, nameField->IconId(), + nameField->IconId()+1 );); } // If the Icon File doesn't exist the CreateIconL in the if statement above will // Leave with KErrNotFound in which case the default Icon should be loaded. // Also when the Landmarks itself doesn't have a valid Icon, the default Icon is // loaded. - if ( err != KErrNone ) + if (err != KErrNone) { - AknIconUtils::CreateIconL( bitmap, mask, - *defaultIconFile, KLmkDefaultId, - KLmkDefaultId+1 ); + AknIconUtils::CreateIconL(bitmap, mask, *defaultIconFile, + KLmkDefaultId, KLmkDefaultId + 1); } - image->SetBitmap( bitmap ); - image->SetMask( mask ); - iLmkUiUtils->SwapNewContextIconL( image ); + image->SetBitmap(bitmap); + image->SetMask(mask); + iLmkUiUtils->SwapNewContextIconL(image); CleanupStack::PopAndDestroy(); //defaultIconFile CleanupStack::Pop(); //image } @@ -2117,25 +2012,27 @@ // ---------------------------------------------------------------------------- // void CLmkEditorImpl::AttachAIWMenuInterestL() - { - if(iMapNavFeature) - { - iMapNavInterface->AttachAIWInterestL(R_LMK_EDITOR_MENU, R_LMK_EDITOR_AIW_INTEREST_SHOWONMAP); - if (iEditorMode != CLmkEditorDlg::ELmkEditor) - { - iMapNavInterface->AttachAIWInterestL(R_LMK_EDITOR_MENU, R_LMK_EDITOR_AIW_INTEREST_NAVIGATETO); - } - } - } + { + if (iMapNavFeature) + { + iMapNavInterface->AttachAIWInterestL(R_LMK_EDITOR_MENU, + R_LMK_EDITOR_AIW_INTEREST_SHOWONMAP); + if (iEditorMode != CLmkEditorDlg::ELmkEditor) + { + iMapNavInterface->AttachAIWInterestL(R_LMK_EDITOR_MENU, + R_LMK_EDITOR_AIW_INTEREST_NAVIGATETO); + } + } + } // ----------------------------------------------------------------------------- // CLmkEditorImpl::HandleResourceChange() // ----------------------------------------------------------------------------- // -void CLmkEditorImpl::HandleResourceChange (TInt aType) - { - CAknForm::HandleResourceChange(aType); - } +void CLmkEditorImpl::HandleResourceChange(TInt aType) + { + CAknForm::HandleResourceChange(aType); + } // ----------------------------------------------------------------------------- // CLmkEditorImpl::CategoriesCmdFromXmlL @@ -2144,32 +2041,33 @@ void CLmkEditorImpl::CategoriesCmdFromXmlL() { TInt count = iCategoryNames.Count(); - if ( count <= 1 ) + if (count <= 1) { return; } CDesC16ArrayFlat* desArr = new (ELeave) CDesC16ArrayFlat(count); CleanupStack::PushL(desArr); - // fill up the array with category´s names from the engine. - for ( TInt i = 0; i < count; i++ ) + // fill up the array with category´s names from the engine. + for (TInt i = 0; i < count; i++) { - desArr->AppendL(iCategoryNames[i]); - } + desArr->AppendL(iCategoryNames[i]); + } - desArr->Sort(); - // show the category list in a message query - HBufC* message = HBufC::NewLC((KPosLmMaxCategoryNameLength * iCategoryNames.Count()) + 1); - TPtr msgPtr = message->Des(); - for ( TInt i = 0; i < count; i++ ) - { + desArr->Sort(); + // show the category list in a message query + HBufC* message = HBufC::NewLC((KPosLmMaxCategoryNameLength + * iCategoryNames.Count()) + 1); + TPtr msgPtr = message->Des(); + for (TInt i = 0; i < count; i++) + { msgPtr.Append((*desArr)[i]); - if ( i != ( count - 1 )) - { - msgPtr.Append(_L("\n")); - } - } - LmkNotes::MessageQueryL( iEikonEnv, msgPtr, count ); - CleanupStack::PopAndDestroy( 2 ); //message ,desArr + if (i != (count - 1)) + { + msgPtr.Append(_L("\n")); + } + } + LmkNotes::MessageQueryL(iEikonEnv, msgPtr, count); + CleanupStack::PopAndDestroy(2); //message ,desArr } // ----------------------------------------------------------------------------- @@ -2178,432 +2076,409 @@ // void CLmkEditorImpl::ConstructContextMenuL() { - CEikMenuBar* newMenuBar = new(ELeave) CEikMenuBar(); - CleanupStack::PushL(newMenuBar); - newMenuBar->ConstructL(this, NULL, R_LMK_EDITOR_CONTEXT_MENUBAR); - iEikonEnv->EikAppUi()->AddToStackL(newMenuBar, ECoeStackPriorityMenu, ECoeStackFlagRefusesFocus); - iContextMenuBar = newMenuBar; - CleanupStack::Pop(newMenuBar); + CEikMenuBar* newMenuBar = new (ELeave) CEikMenuBar(); + CleanupStack::PushL(newMenuBar); + newMenuBar->ConstructL(this, NULL, R_LMK_EDITOR_CONTEXT_MENUBAR); + iEikonEnv->EikAppUi()->AddToStackL(newMenuBar, ECoeStackPriorityMenu, + ECoeStackFlagRefusesFocus); + iContextMenuBar = newMenuBar; + CleanupStack::Pop(newMenuBar); } // ----------------------------------------------------------------------------- // CLmkEditorImpl::GetFieldTextLengthL // ----------------------------------------------------------------------------- // -TInt CLmkEditorImpl::GetFieldTextLengthL( MLmkEditorField& afield) - { - HBufC* fieldText = afield.ControlTextL(); - TInt fieldLen (0); - if ( fieldText ) - { - if ( fieldText->Length() > 0) - {// Remove any blank spaces if any - TPtr16 ptr = fieldText->Des(); - ptr.Trim(); - fieldLen = ptr.Length(); - } - } - delete fieldText; - return fieldLen; - } +TInt CLmkEditorImpl::GetFieldTextLengthL(MLmkEditorField& afield) + { + HBufC* fieldText = afield.ControlTextL(); + TInt fieldLen(0); + if (fieldText) + { + if (fieldText->Length() > 0) + {// Remove any blank spaces if any + TPtr16 ptr = fieldText->Des(); + ptr.Trim(); + fieldLen = ptr.Length(); + } + } + delete fieldText; + return fieldLen; + } // ----------------------------------------------------------------------------- // CLmkEditorImpl::UpdateViewDlgL // ----------------------------------------------------------------------------- // void CLmkEditorImpl::UpdateViewDlgL() - { - - CPosLandmark* landmark; - TInt id = iLmkFields->LandmarkId(); - landmark = iDb.ReadLandmarkLC(id); - TLocality locality; - landmark->GetPosition(locality); + { + DEBUG( CLmkEditorImpl::UpdateViewDlgL start ) + CPosLandmark* landmark; + TInt id = iLmkFields->LandmarkId(); + landmark = iDb.ReadLandmarkLC(id); + TLocality locality; + landmark->GetPosition(locality); TRAP_IGNORE(iLandmark->SetPositionL(locality)); - CArrayPtrFlat& fieldArray = iLmkFields->Fields(); - CArrayPtrFlat& editorFieldArray = - iEditorFieldArray->GetFieldArray(); - TInt count = fieldArray.Count(); - TInt postn = KErrNotFound; - TInt ctrlid = KErrNotFound; - for (TInt i(0);iFieldType(); - MLmkEditorField* fld = iEditorFieldArray->Find(fieldArray[i]->UniqueFieldIdentity(),&postn,&ctrlid); + CArrayPtrFlat& fieldArray = iLmkFields->Fields(); + CArrayPtrFlat& editorFieldArray = + iEditorFieldArray->GetFieldArray(); + TInt count = fieldArray.Count(); + TInt postn = KErrNotFound; + TInt ctrlid = KErrNotFound; + for (TInt i(0); i < count; i++) + { + TUint fieldType = fieldArray[i]->FieldType(); + MLmkEditorField* fld = iEditorFieldArray->Find( + fieldArray[i]->UniqueFieldIdentity(), &postn, &ctrlid); - switch(fieldType) - { - case EName: - { - UpdateNameEditorControlL(fld,landmark,fieldArray[i]); - break; - } - case ECategory: - case ECategories: - { - UpdateCategoryEditorControlL( fld, fieldArray[i],ctrlid,postn,*landmark); - break; - } - case EDescription: - { - UpdateDesEditorControlL(fld,landmark,fieldArray[i],ctrlid,postn); - break; - } - //these all are same - case EStreet: - case EPostCode: - case ECity: - case EStateProvince: - case ECountry: - case EPhoneNumber: - case EWebAddress: - { - UpdateTextEditorControlL(fld,landmark,fieldArray[i], - fieldType,ctrlid,postn); - break; - } - case ELatitude: - { - UpdateCoordinateEditorControlL(fld,fieldArray[i], - locality.Latitude(), - ctrlid,postn); - break; - } - case ELongitude: - { - UpdateCoordinateEditorControlL(fld,fieldArray[i], - locality.Longitude(), - ctrlid,postn); - break; - } - case EPositionAccuracy: - { - UpdateNumberEditorControlL(fld,fieldArray[i], - locality.HorizontalAccuracy(),ctrlid,postn); - break; - } - case EAltitude: - { - UpdateNumberEditorControlL(fld,fieldArray[i], - locality.Altitude(),ctrlid,postn); - break; - } - case EAltitudeAccuracy: - { - UpdateNumberEditorControlL(fld,fieldArray[i], - locality.VerticalAccuracy(),ctrlid,postn); - break; - } - default: - { - break; - } - } - } - iEditorFieldArray->UpdateFieldsL(); - CleanupStack::PopAndDestroy( landmark ); - DrawNow(); - if(!IsEditable()) - { - //only for landmarks viewer - UpdateMskOnArrowMoveForViewerL(); - //ShowMultipleCategoriesInfoPopupL(ETrue); - } - } + switch (fieldType) + { + case EName: + { + UpdateNameEditorControlL(fld, landmark, fieldArray[i]); + break; + } + case ECategory: + case ECategories: + { + UpdateCategoryEditorControlL(fld, fieldArray[i], ctrlid, + postn, *landmark); + break; + } + case EDescription: + { + UpdateDesEditorControlL(fld, landmark, fieldArray[i], ctrlid, + postn); + break; + } + //these all are same + case EStreet: + case EPostCode: + case ECity: + case EStateProvince: + case ECountry: + case EPhoneNumber: + case EWebAddress: + { + UpdateTextEditorControlL(fld, landmark, fieldArray[i], + fieldType, ctrlid, postn); + break; + } + case ELatitude: + { + UpdateCoordinateEditorControlL(fld, fieldArray[i], + locality.Latitude(), ctrlid, postn); + break; + } + case ELongitude: + { + UpdateCoordinateEditorControlL(fld, fieldArray[i], + locality.Longitude(), ctrlid, postn); + break; + } + case EPositionAccuracy: + { + UpdateNumberEditorControlL(fld, fieldArray[i], + locality.HorizontalAccuracy(), ctrlid, postn); + break; + } + case EAltitude: + { + UpdateNumberEditorControlL(fld, fieldArray[i], + locality.Altitude(), ctrlid, postn); + break; + } + case EAltitudeAccuracy: + { + UpdateNumberEditorControlL(fld, fieldArray[i], + locality.VerticalAccuracy(), ctrlid, postn); + break; + } + default: + { + break; + } + } + } + iEditorFieldArray->UpdateFieldsL(); + CleanupStack::PopAndDestroy(landmark); + DrawNow(); + if (!IsEditable()) + { + //only for landmarks viewer + UpdateMskOnArrowMoveForViewerL(); + } + DEBUG( CLmkEditorImpl::UpdateViewDlgL End ) + } + // ----------------------------------------------------------------------------- // CLmkEditorImpl::ActivateL // ----------------------------------------------------------------------------- // void CLmkEditorImpl::ActivateL() - { - if (iEditorMode == CLmkEditorDlg::ELmkEditor - && iIsEditing) - { - MLmkFieldData* fields = iLmkFields->GetField(iFieldTypeToFocus); - if(fields) - { - TInt id = fields->UniqueFieldIdentity(); - TryChangeFocusL(id); - if (iFieldTypeToFocus == ECategories || iFieldTypeToFocus == ECategory) - { - // ShowMultipleCategoriesInfoPopupL(EFalse); - } - } - } - CCoeControl::ActivateL(); - } + { + if (iEditorMode == CLmkEditorDlg::ELmkEditor && iIsEditing) + { + MLmkFieldData* fields = iLmkFields->GetField(iFieldTypeToFocus); + if (fields) + { + TInt id = fields->UniqueFieldIdentity(); + TryChangeFocusL(id); + } + } + CCoeControl::ActivateL(); + } + // ----------------------------------------------------------------------------- // CLmkEditorImpl::UpdateTextEditorControlL // ----------------------------------------------------------------------------- // -void CLmkEditorImpl::UpdateTextEditorControlL - (MLmkEditorField* aEditorField, - CPosLandmark* aLandmark, - MLmkFieldData* fieldData, - TUint aFiledType, - TInt aPrevControlId, - TInt aPos - ) - { +void CLmkEditorImpl::UpdateTextEditorControlL(MLmkEditorField* aEditorField, + CPosLandmark* aLandmark, MLmkFieldData* fieldData, TUint aFiledType, + TInt aPrevControlId, TInt aPos) + { + TPositionFieldId fieldId = EPositionFieldNone; + switch (aFiledType) + { + case EStreet: + fieldId = EPositionFieldStreet; + break; + case EPostCode: + fieldId = EPositionFieldPostalCode; + break; + case ECity: + fieldId = EPositionFieldCity; + break; + case EStateProvince: + fieldId = EPositionFieldState; + break; + case ECountry: + fieldId = EPositionFieldCountry; + break; + case EPhoneNumber: + fieldId = ELmkPositionFieldPhoneNumber; + break; + case EWebAddress: + fieldId = ELmkPositionFieldWebAddress; + break; + } + TPtrC text; + if (aLandmark->GetPositionField(fieldId, text) == KErrNone) + { + if (IsEditable() && text.Length() == 0 && aFiledType == EWebAddress) + { + //return if web address field and field is empty and its an editor + return; + } + fieldData->SetTextL(text); + if (!IsEditable()) + { + aEditorField = AddOrDeleteLineL(aEditorField, fieldData, + aPrevControlId, fieldData->UniqueFieldIdentity(), aPos); + } + if (aEditorField) + { + //now modify the text for display + CLmkEditorTextField* field = + static_cast (aEditorField); + HBufC* buff = HBufC::NewLC(text.Length()); + TPtr dispTxt = buff->Des(); + if (!IsEditable()) + { + TPtr des1 = CLmkFields::RemoveEnterCharacter(text); + dispTxt.Copy(des1); + } + else + { + dispTxt.Copy(text); + } + if (aFiledType == EWebAddress) + { + TInt position; + if ((position = field->IsWebUrlProtocolPreFixedL(dispTxt)) + != KErrNotFound) + { + field->TrimPrefixesFromWebUrlL(dispTxt, position + 1); + } + } + TPtrC ptr; + ptr.Set(dispTxt); + field->SetControlTextL(ptr); + CleanupStack::PopAndDestroy(buff); + } + } + } - TPositionFieldId fieldId = EPositionFieldNone; - switch(aFiledType) - { - case EStreet: - fieldId = EPositionFieldStreet; - break; - case EPostCode: - fieldId = EPositionFieldPostalCode ; - break; - case ECity: - fieldId = EPositionFieldCity; - break; - case EStateProvince: - fieldId = EPositionFieldState; - break; - case ECountry: - fieldId = EPositionFieldCountry; - break; - case EPhoneNumber: - fieldId = ELmkPositionFieldPhoneNumber; - break; - case EWebAddress: - fieldId = ELmkPositionFieldWebAddress; - break; - } - TPtrC text; - if ( aLandmark->GetPositionField( - fieldId, text ) == KErrNone ) - { - if (IsEditable() && text.Length() == 0 && aFiledType == EWebAddress) - { - //return if web address field and field is empty and its an editor - return; - } - fieldData->SetTextL(text); - if(!IsEditable()) - { - aEditorField = AddOrDeleteLineL( aEditorField,fieldData,aPrevControlId, - fieldData->UniqueFieldIdentity(), aPos); - } - if(aEditorField) - { - //now modify the text for display - CLmkEditorTextField* field = static_cast(aEditorField); - HBufC* buff = HBufC::NewLC(text.Length()); - TPtr dispTxt = buff->Des(); - if(!IsEditable()) - { - TPtr des1 = CLmkFields::RemoveEnterCharacter( text ); - dispTxt.Copy(des1); - } - else - { - dispTxt.Copy(text); - } - if(aFiledType == EWebAddress) - { - TInt position; - if((position = field->IsWebUrlProtocolPreFixedL(dispTxt))!= - KErrNotFound) - { - field->TrimPrefixesFromWebUrlL( dispTxt, position +1 ); - } - } - TPtrC ptr; - ptr.Set(dispTxt); - field->SetControlTextL(ptr); - CleanupStack::PopAndDestroy( buff ); - } - - } - } // ----------------------------------------------------------------------------- // CLmkEditorImpl::UpdateDesEditorControlL // ----------------------------------------------------------------------------- // -void CLmkEditorImpl::UpdateDesEditorControlL - (MLmkEditorField* aEditorField, - CPosLandmark* aLandmark, - MLmkFieldData* fieldData, - TInt aPrevControlId, - TInt aPos - ) - { - TPtrC text; - aLandmark->GetLandmarkDescription(text); - fieldData->SetTextL(text); - TPtrC dispTxt; - if(!IsEditable()) - { - TPtr des1 = CLmkFields::RemoveEnterCharacter( text ); - dispTxt.Set(des1); - aEditorField = AddOrDeleteLineL( aEditorField,fieldData,aPrevControlId, - fieldData->UniqueFieldIdentity(), aPos); - } - else - { - dispTxt.Set(text); - } - CLmkEditorTextField* field = static_cast(aEditorField); - if(aEditorField) - { - field->Control()->SetTextL(&dispTxt); - field->Control()->DrawDeferred(); - } - } +void CLmkEditorImpl::UpdateDesEditorControlL(MLmkEditorField* aEditorField, + CPosLandmark* aLandmark, MLmkFieldData* fieldData, + TInt aPrevControlId, TInt aPos) + { + TPtrC text; + aLandmark->GetLandmarkDescription(text); + fieldData->SetTextL(text); + TPtrC dispTxt; + if (!IsEditable()) + { + TPtr des1 = CLmkFields::RemoveEnterCharacter(text); + dispTxt.Set(des1); + aEditorField = AddOrDeleteLineL(aEditorField, fieldData, + aPrevControlId, fieldData->UniqueFieldIdentity(), aPos); + } + else + { + dispTxt.Set(text); + } + CLmkEditorTextField* field = + static_cast (aEditorField); + if (aEditorField) + { + field->Control()->SetTextL(&dispTxt); + field->Control()->DrawDeferred(); + } + } + // ----------------------------------------------------------------------------- // CLmkEditorImpl::UpdateCategoryEditorControlL // ----------------------------------------------------------------------------- // -void CLmkEditorImpl::UpdateCategoryEditorControlL - ( - MLmkEditorField* aEditorField, - MLmkFieldData* fieldData, - TInt aPrevControlId, - TInt aPos, - CPosLandmark& aLandmark - ) - { - RArray& categories = fieldData->Categories(); +void CLmkEditorImpl::UpdateCategoryEditorControlL( + MLmkEditorField* aEditorField, MLmkFieldData* fieldData, + TInt aPrevControlId, TInt aPos, CPosLandmark& aLandmark) + { + RArray& categories = fieldData->Categories(); aLandmark.GetCategoriesL(categories); - TInt count( categories.Count() ); + TInt count(categories.Count()); - if ( count <= 1 ) + if (count <= 1) { - fieldData->SetFieldType( ECategory ); + fieldData->SetFieldType(ECategory); } else { - fieldData->SetFieldType( ECategories ); + fieldData->SetFieldType(ECategories); } - if(!IsEditable()) - { - aEditorField = AddOrDeleteLineL( aEditorField,fieldData,aPrevControlId, - fieldData->UniqueFieldIdentity(), aPos); - } - } + if (!IsEditable()) + { + aEditorField = AddOrDeleteLineL(aEditorField, fieldData, + aPrevControlId, fieldData->UniqueFieldIdentity(), aPos); + } + } + // ----------------------------------------------------------------------------- // CLmkEditorImpl::UpdateCoordinateEditorControlL // ----------------------------------------------------------------------------- // -void CLmkEditorImpl::UpdateCoordinateEditorControlL - ( - MLmkEditorField* aEditorField, - MLmkFieldData* fieldData, - TReal aValue, - TInt aPrevControlId, - TInt aPos - ) - { - fieldData->SetTReal( aValue ); - if(!IsEditable()) - { - aEditorField = AddOrDeleteLineL( aEditorField,fieldData,aPrevControlId, - fieldData->UniqueFieldIdentity(), aPos); - } - } +void CLmkEditorImpl::UpdateCoordinateEditorControlL( + MLmkEditorField* aEditorField, MLmkFieldData* fieldData, + TReal aValue, TInt aPrevControlId, TInt aPos) + { + fieldData->SetTReal(aValue); + if (!IsEditable()) + { + aEditorField = AddOrDeleteLineL(aEditorField, fieldData, + aPrevControlId, fieldData->UniqueFieldIdentity(), aPos); + } + } + // ----------------------------------------------------------------------------- // CLmkEditorImpl::UpdateNumberEditorControlL // ----------------------------------------------------------------------------- // -void CLmkEditorImpl::UpdateNumberEditorControlL - ( - MLmkEditorField* aEditorField, - MLmkFieldData* fieldData, - TReal32 aValue, - TInt aPrevControlId, - TInt aPos - ) - { - fieldData->SetTReal( aValue ); +void CLmkEditorImpl::UpdateNumberEditorControlL( + MLmkEditorField* aEditorField, MLmkFieldData* fieldData, + TReal32 aValue, TInt aPrevControlId, TInt aPos) + { + fieldData->SetTReal(aValue); - if(!IsEditable()) - { - aEditorField = AddOrDeleteLineL( aEditorField,fieldData,aPrevControlId, - fieldData->UniqueFieldIdentity(), aPos); - } - } + if (!IsEditable()) + { + aEditorField = AddOrDeleteLineL(aEditorField, fieldData, + aPrevControlId, fieldData->UniqueFieldIdentity(), aPos); + } + } // ----------------------------------------------------------------------------- // CLmkEditorImpl::UpdateNameEditorControl // ----------------------------------------------------------------------------- // -void CLmkEditorImpl::UpdateNameEditorControlL - ( - MLmkEditorField* aEditorField, - CPosLandmark* aLandmark, - MLmkFieldData* fieldData - ) - { - - if( aEditorField && aLandmark && fieldData ) - { - //name field icon updation - TInt iconIden = -1; - TInt iconMaskIndex = -1; - TPtrC iconFile; - CLmkEditorTextField* field = static_cast(aEditorField); - if( aLandmark->GetIcon( iconFile, iconIden, iconMaskIndex ) && field ) - { - if( iconIden > 0 ) - { - fieldData->SetIconId( iconIden ); - fieldData->SetIconPathL( iconFile ); - CEikImage* image = new( ELeave ) CEikImage(); - CleanupStack::PushL( image ); - image->CreatePictureFromFileL( iconFile, - iconIden, iconMaskIndex ); - iLmkUiUtils->UpdateContextIconL( image ); - CLmkUiUtils::ChangeLmNameLabelIconL ( *this, *fieldData ); - CleanupStack::Pop(); //image - field->CaptionedControl()->DrawDeferred(); - } - //text control updation - TPtrC text; - aLandmark->GetLandmarkName( text ); - TPtrC dispTxt; - if( !IsEditable() ) - { - TPtr des1 = CLmkFields::RemoveEnterCharacter( text ); - dispTxt.Set(des1); - } - else - { - dispTxt.Set(text); - } - field->Control()->SetTextL( &dispTxt ); - fieldData->SetTextL( text ); - HBufC* buff = dispTxt.AllocL(); - iLmkUiUtils->ChangeTitlePaneL( buff ); - field->Control()->DrawDeferred(); - } - } - } +void CLmkEditorImpl::UpdateNameEditorControlL(MLmkEditorField* aEditorField, + CPosLandmark* aLandmark, MLmkFieldData* fieldData) + { + if (aEditorField && aLandmark && fieldData) + { + //name field icon updation + TInt iconIden = -1; + TInt iconMaskIndex = -1; + TPtrC iconFile; + CLmkEditorTextField* field = + static_cast (aEditorField); + if (aLandmark->GetIcon(iconFile, iconIden, iconMaskIndex) && field) + { + if (iconIden > 0) + { + fieldData->SetIconId(iconIden); + fieldData->SetIconPathL(iconFile); + CEikImage* image = new (ELeave) CEikImage(); + CleanupStack::PushL(image); + image->CreatePictureFromFileL(iconFile, iconIden, + iconMaskIndex); + iLmkUiUtils->UpdateContextIconL(image); + CLmkUiUtils::ChangeLmNameLabelIconL(*this, *fieldData); + CleanupStack::Pop(); //image + field->CaptionedControl()->DrawDeferred(); + } + //text control updation + TPtrC text; + aLandmark->GetLandmarkName(text); + TPtrC dispTxt; + if (!IsEditable()) + { + TPtr des1 = CLmkFields::RemoveEnterCharacter(text); + dispTxt.Set(des1); + } + else + { + dispTxt.Set(text); + } + field->Control()->SetTextL(&dispTxt); + fieldData->SetTextL(text); + HBufC* buff = dispTxt.AllocL(); + iLmkUiUtils->ChangeTitlePaneL(buff); + field->Control()->DrawDeferred(); + } + } + } // ----------------------------------------------------------------------------- // CLmkEditorImpl::SetFieldTypeToFocusInEditMode // ----------------------------------------------------------------------------- // void CLmkEditorImpl::SetFieldTypeToFocusInEditMode(TUint aFieldType) - { - iFieldTypeToFocus = aFieldType; - } + { + iFieldTypeToFocus = aFieldType; + } + // ----------------------------------------------------------------------------- // CLmkEditorImpl::IsDlgEditing // ----------------------------------------------------------------------------- // TBool CLmkEditorImpl::IsDlgEditing() - { - return iIsEditing; - } + { + return iIsEditing; + } + // ----------------------------------------------------------------------------- // CLmkEditorImpl::SetDlgEditing // ----------------------------------------------------------------------------- // -void CLmkEditorImpl::SetDlgEditing(TBool aEditing) - { - iIsEditing = aEditing; - } +void CLmkEditorImpl::SetDlgEditing(TBool aEditing) + { + iIsEditing = aEditing; + } + // ----------------------------------------------------------------------------- // CLmkEditorImpl::SetDlgEditing // ----------------------------------------------------------------------------- @@ -2612,454 +2487,224 @@ { return iEditorMode; } + // ----------------------------------------------------------------------------- // CLmkEditorImpl::UpdateMskOnArrowMoveForViewerL // ----------------------------------------------------------------------------- // void CLmkEditorImpl::UpdateMskOnArrowMoveForViewerL() - { - TBool cmdAdded = EFalse; - MLmkEditorField* field = - iEditorFieldArray->Find( IdOfFocusControl() ); - TUint type = field->LandmarkItemField().FieldType(); - switch(type) - { - case ECategories: - { - AddMskCommandL(R_LM_MSK_SHOW,ELmkCmdShow); - cmdAdded = ETrue; - break; - } - case EPhoneNumber: - { - HBufC* fieldText = field->ControlTextL(); - CleanupStack::PushL( fieldText ); - if ( fieldText && fieldText->Length() > 0 ) - { - AddMskCommandL(R_LM_MSK_CALL,ELmkCmdLast); - cmdAdded = ETrue; - } - CleanupStack::PopAndDestroy( fieldText ); - break; - } - case EWebAddress: - { - HBufC* fieldText = field->ControlTextL(); - CleanupStack::PushL( fieldText ); - if ( fieldText && fieldText->Length() > 0 ) - { - AddMskCommandL(R_LM_MSK_BROWSE,ELmkCmdGoToUrl); - cmdAdded = ETrue; - } - CleanupStack::PopAndDestroy( fieldText ); - break; - } - default: - { - //nothing - break; - } - } - if (!cmdAdded) - { - AddMskCommandL(R_LM_MSK_EDIT,ELmkCmdEditLm); - } - } + { + TBool cmdAdded = EFalse; + MLmkEditorField* field = iEditorFieldArray->Find(IdOfFocusControl()); + TUint type = field->LandmarkItemField().FieldType(); + switch (type) + { + case ECategories: + { + AddMskCommandL(R_LM_MSK_SHOW, ELmkCmdShow); + cmdAdded = ETrue; + break; + } + case EPhoneNumber: + { + HBufC* fieldText = field->ControlTextL(); + CleanupStack::PushL(fieldText); + if (fieldText && fieldText->Length() > 0) + { + AddMskCommandL(R_LM_MSK_CALL, ELmkCmdLast); + cmdAdded = ETrue; + } + CleanupStack::PopAndDestroy(fieldText); + break; + } + case EWebAddress: + { + HBufC* fieldText = field->ControlTextL(); + CleanupStack::PushL(fieldText); + if (fieldText && fieldText->Length() > 0) + { + AddMskCommandL(R_LM_MSK_BROWSE, ELmkCmdGoToUrl); + cmdAdded = ETrue; + } + CleanupStack::PopAndDestroy(fieldText); + break; + } + default: + { + //nothing + break; + } + } + if (!cmdAdded) + { + AddMskCommandL(R_LM_MSK_EDIT, ELmkCmdEditLm); + } + } // ----------------------------------------------------------------------------- // CLmkEditorImpl::AddMskCommandL // ----------------------------------------------------------------------------- // -void CLmkEditorImpl::AddMskCommandL(TInt aResourceId, - TLmkAppCmdId aCommandId) - { +void CLmkEditorImpl::AddMskCommandL(TInt aResourceId, TLmkAppCmdId aCommandId) + { + HBufC* mskTxt = NULL; + mskTxt = StringLoader::LoadLC(aResourceId, iEikonEnv); + CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); + cba->RemoveCommandFromStack(KMskCommandPos, iMskCmdId); + iMskCmdId = aCommandId; + iCurrentResourceId = aResourceId; + cba->AddCommandToStackL(KMskCommandPos, iMskCmdId, mskTxt->Des()); + cba->MakeCommandVisible(iMskCmdId, ETrue); + CleanupStack::PopAndDestroy(mskTxt); + } - HBufC* mskTxt = NULL; - mskTxt = StringLoader::LoadLC( aResourceId, iEikonEnv ); - CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); - cba->RemoveCommandFromStack(KMskCommandPos,iMskCmdId); - iMskCmdId = aCommandId; - iCurrentResourceId = aResourceId; - cba->AddCommandToStackL(KMskCommandPos,iMskCmdId,mskTxt->Des()); - cba->MakeCommandVisible(iMskCmdId,ETrue); - CleanupStack::PopAndDestroy( mskTxt ); - } // ----------------------------------------------------------------------------- // CLmkEditorImpl::AddMskCommandL // ----------------------------------------------------------------------------- // void CLmkEditorImpl::DimmMiddleSoftKey() - { - /*This is required, since there was an error, - where the menu item appears if there are not items - in the lis, after pressing the middle key.Hence, if - dummy msk is added to the resource, it fixes the error, - now this dummy button needs to be disabled.Check the - dialog resource in editor.rss*/ - CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); - cba->MakeCommandVisible(EAknSoftkeyContextOptions,EFalse); - } - - -// ----------------------------------------------------------------------------- -// CLmkEditorImpl::ShowMultipleCategoriesInfoPopupL -// ----------------------------------------------------------------------------- -// - /*void CLmkEditorImpl::ShowMultipleCategoriesInfoPopupL(TBool aRefresh) { - if (iCatInfoPopupNote && aRefresh) - { - delete iCatInfoPopupNote; - iCatInfoPopupNote = NULL; - } - - if (!iCatInfoPopupNote) - { - - if(!IsCategoryField()) - { - return; - } - MLmkFieldData* categoryField = iLmkFields->GetField( ECategories ); - if ( !categoryField ) - { - categoryField = iLmkFields->GetField( ECategory ); - if ( !categoryField ) - { - return; - } - } - RArray categories = categoryField->Categories(); - - // This function is also called from message viewer, where the - // landmarks object is populated from xml file instead of db, - // hence the category id's will be dummy and must not be used, - // to get the category name, instead, get the category names - // from the xml file (iCategoryNames). - - TInt count( categories.Count() ); - TBool isNotFromMessageViewer(EFalse); - count = iCategoryNames.Count(); - if ( count == 0 ) // hack to determine from where the call coming. - { - //not called from message viewer - isNotFromMessageViewer = ETrue; - count = categories.Count(); - } - // Do not launch the popup for displaying one category name - if (count <=1 ) - { - return; - } - - // ==================================================================== - // Get Font for Formatting the infoPopUp strings - // ==================================================================== - - // Get parameter and table limits for popup preview text window - TAknLayoutScalableParameterLimits limits = - AknLayoutScalable_Avkon::popup_preview_text_window_ParamLimits(); - - TAknLayoutScalableTableLimits tableLimits = - AknLayoutScalable_Avkon::popup_preview_text_window_t_Limits(); - - // Get layout rects - TRect rectScreen = iAvkonAppUi->ApplicationRect(); - TInt mainPaneVariety = Layout_Meta_Data::IsLandscapeOrientation() ? 4 : 1; - - TAknWindowLineLayout lineLayout = - AknLayoutScalable_Avkon::main_pane( mainPaneVariety ).LayoutLine(); - TAknLayoutRect layoutRect; - layoutRect.LayoutRect(rectScreen, lineLayout); - TRect rectMainPane = layoutRect.Rect(); - - // Use first variety to be able to get the font for text parsing - TInt index = 0; - if ( Layout_Meta_Data::IsLandscapeOrientation() ) - { - index += 5; - } - TInt firstVariety = Min( Max( index, limits.FirstVariety() ), limits.LastVariety() ); - - TAknWindowLineLayout lineLayout2 = - AknLayoutScalable_Avkon::main_pane( mainPaneVariety ).LayoutLine(); - TAknLayoutRect layoutRect2; - layoutRect2.LayoutRect(rectScreen, lineLayout2); - TRect rectPopupWindow = layoutRect2.Rect(); - - TInt firstIndex = tableLimits.FirstIndex(); - TInt firstLineVariety = AknLayoutScalable_Avkon:: - popup_preview_text_window_t_ParamLimits( firstIndex ).FirstVariety(); - - TAknTextLineLayout popupTextLayout = - AknLayoutScalable_Avkon::popup_preview_text_window_t( - firstIndex, firstLineVariety ); - - TAknLayoutText layoutText; - layoutText.LayoutText( rectPopupWindow, popupTextLayout ); - TRect rectText = layoutText.TextRect(); - - TInt infoPopupWidth = KMaxCatSizeForInfoPopUp; - TInt infoPopupLength = KMinCatLenForInfoPopUp; - - if(rectText.Height() > 25) - { - infoPopupWidth = KMaxCatSizeForInfoPopUp + 80; - } - else if(rectText.Height() > 23) - { - infoPopupWidth = KMaxCatSizeForInfoPopUp + 55; - } - else if(rectText.Height() > 16) - { - infoPopupWidth = KMaxCatSizeForInfoPopUp + 10; - infoPopupLength++; - } - - // Prepare font to format the popupInfo string - const CFont *font = layoutText.Font(); - - // =================================================================== - // =================================================================== - - HBufC* catName = NULL; - // show the category list in a message query - HBufC* message = HBufC::NewLC( (KPosLmMaxCategoryNameLength * count) + 1); - TPtr msgPtr = message->Des(); - CDesC16ArrayFlat* desArr = new (ELeave) CDesC16ArrayFlat(count); - CleanupStack::PushL(desArr); - // fill up the array with category´s names from the engine. - for ( TInt i = 0; i < count; i++ ) - { - if ( !isNotFromMessageViewer ) - { - catName = HBufC::NewL( KPosLmMaxCategoryNameLength + 1); - catName->Des().Copy(iCategoryNames[i]); - } - else - { - catName = CLmkDbUtils::CategoryNameL( iDb, categories[i] ); - } - CleanupStack::PushL( catName ); - - TPtr des = catName->Des(); - - TInt textWidth = font->TextWidthInPixels( des ); - TInt textLength = des.Length(); - - // check the length of category name string to format for InfoPopUp. - if(textLength > infoPopupLength && textWidth > infoPopupWidth) - { - - // set the string as per KMinCatLenForInfoPopUp - if(textLength > infoPopupLength + 9) - { - textLength = infoPopupLength + 9; - des = des.Mid(0, textLength); - } - - textWidth = font->TextWidthInPixels( des ); - - for(TInt ctr=textLength; ctr >= (infoPopupLength-1);ctr--) - { - des = des.Mid(0, ctr); - textWidth = font->TextWidthInPixels( des ); - if(textWidth <= infoPopupWidth) - { - break; - } - } - - // loading the "..." string - HBufC* endString = StringLoader::LoadLC(R_LM_EDITOR_MANY_CATEGORIES); - - // appending the "..." string at end - des.Append(endString->Des()); - - // appendig formatted string into category string array - desArr->AppendL(des); - CleanupStack::PopAndDestroy(endString); // endString - } - else - { - desArr->AppendL(des); - } - CleanupStack::PopAndDestroy( catName ); //name - } - desArr->Sort(); - HBufC* catTxt = NULL; - - for ( TInt i = 0; i < desArr->Count(); i++ ) - { - if (i KMaxCatCntForInfoPopUp) - { - - catTxt = StringLoader::LoadLC( R_LM_EDITOR_MANY_CATEGORIES, iEikonEnv ); - msgPtr.Append(catTxt->Des()); - CleanupStack::PopAndDestroy(catTxt );//catTxt - } - TPoint pt1; - iCatInfoPopupNote = LmkNotes::ShowDelayedInfoPopupL(msgPtr,pt1); - UpdateCatInfoNotePosition(); - iCatInfoPopupNote->ShowInfoPopupNote(); - CleanupStack::Pop();//desArr - delete desArr; - CleanupStack::PopAndDestroy( message ); //message - } - else - { - UpdateCatInfoNotePosition(); - iCatInfoPopupNote->ShowInfoPopupNote(); - } + /*This is required, since there was an error, + where the menu item appears if there are not items + in the lis, after pressing the middle key.Hence, if + dummy msk is added to the resource, it fixes the error, + now this dummy button needs to be disabled.Check the + dialog resource in editor.rss*/ + CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); + cba->MakeCommandVisible(EAknSoftkeyContextOptions, EFalse); } -*/ // ----------------------------------------------------------------------------- // CLmkEditorImpl::ShowQueryIfLocationFieldsAlreadyFilledL // ----------------------------------------------------------------------------- // TBool CLmkEditorImpl::ShowQueryIfLocationFieldsAlreadyFilledL() - { - TBool result = EFalse; + { + TBool result = EFalse; TRealX lati; lati.SetNaN(); TRealX longi; longi.SetNaN(); MLmkFieldData* lat = iLmkFields->GetField(ELatitude); - if(lat) - { + if (lat) + { //get latitude control id TInt id = lat->UniqueFieldIdentity(); - MLmkEditorField* latcontrol = iEditorFieldArray->Find( id ); + MLmkEditorField* latcontrol = iEditorFieldArray->Find(id); //get latitude control current text lati = static_cast(latcontrol)->FieldValue(); MLmkFieldData* lon = iLmkFields->GetField(ELongitude); - if(lon) + if (lon) { //get longitude control id id = lon->UniqueFieldIdentity(); - MLmkEditorField* longcontrol = iEditorFieldArray->Find( id ); + MLmkEditorField* longcontrol = iEditorFieldArray->Find(id); //get longitude control current text longi = static_cast(longcontrol)->FieldValue(); } if ( (!lati.IsNaN()) && (!longi.IsNaN())) { - if ( !LmkNotes::ShowOwerriteLocationQueryL( iEikonEnv ) ) + if (!LmkNotes::ShowOwerriteLocationQueryL(iEikonEnv)) { result = ETrue; } } - } - return result; - } + } + return result; + } // ----------------------------------------------------------------------------- // CLmkEditorImpl::IsInvalidUriL // ----------------------------------------------------------------------------- // TBool CLmkEditorImpl::IsInvalidUriL() - { - TBool ret = EFalse; - MLmkFieldData* fields = iLmkFields->GetField( EWebAddress ); - if(fields) - { - MLmkEditorField* fld = iEditorFieldArray->Find(fields->UniqueFieldIdentity()); - if(fld) - { - HBufC* webaddr = HBufC::NewLC(KMaxBufferLen); - CLmkEditorTextField* field = static_cast(fld); - TPtr ptr = webaddr->Des(); - field->Control()->GetText(ptr); - ret = UriUtils::HasInvalidChars(ptr); - CleanupStack::PopAndDestroy();//webaddr - } - } - return ret; - } + { + TBool ret = EFalse; + MLmkFieldData* fields = iLmkFields->GetField(EWebAddress); + if (fields) + { + MLmkEditorField* fld = iEditorFieldArray->Find( + fields->UniqueFieldIdentity()); + if (fld) + { + HBufC* webaddr = HBufC::NewLC(KMaxBufferLen); + CLmkEditorTextField* field = + static_cast (fld); + TPtr ptr = webaddr->Des(); + field->Control()->GetText(ptr); + ret = UriUtils::HasInvalidChars(ptr); + CleanupStack::PopAndDestroy();//webaddr + } + } + return ret; + } // ----------------------------------------------------------------------------- // CLmkEditorImpl::HandleListProviderEvent // ----------------------------------------------------------------------------- // -void CLmkEditorImpl::HandleListProviderEvent(TLmkListProviderEventType /*aEvent*/ ) - { - TRAPD(err,CPosLandmark* landmark = iDb.ReadLandmarkLC(iLmkFields->LandmarkId());CleanupStack::PopAndDestroy( landmark )); +void CLmkEditorImpl::HandleListProviderEvent(TLmkListProviderEventType /*aEvent*/) + { + TRAPD(err,CPosLandmark* landmark = iDb.ReadLandmarkLC(iLmkFields->LandmarkId());CleanupStack::PopAndDestroy( landmark )); if (err == KErrNotFound) { TRAP_IGNORE(DeleteSelfL()); } - else - { - //update the landmark viewer/editor - TRAP_IGNORE(UpdateViewDlgL()); - } - } + else + { + //update the landmark viewer/editor + TRAP_IGNORE(UpdateViewDlgL()); + } + } // ----------------------------------------------------------------------------- // CLmkEditorImpl::HandleListProviderError // ----------------------------------------------------------------------------- // -void CLmkEditorImpl::HandleListProviderError( TInt /*aError*/ ) - { - //if error do nothing - } +void CLmkEditorImpl::HandleListProviderError(TInt /*aError*/) + { + //if error do nothing + } // ----------------------------------------------------------------------------- // CLmkEditorImpl::LaunchLmkEditorL // ----------------------------------------------------------------------------- // void CLmkEditorImpl::LaunchLmkEditorL() - { - CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); - cba->RemoveCommandFromStack( KMskCommandPos, iMskCmdId ); + { + CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); + cba->RemoveCommandFromStack(KMskCommandPos, iMskCmdId); // Launch editor - TLmkEditorAttributes attributeFlags( CLmkEditorDlg::ELmkAll ); - // Check if the Landmark is alreayd present in the database. Incase, - // a landmark is associated with the editor and if it is not - // added to the Database, then the viewer would be launched with - // the lanmark content - if( KPosLmNullItemId == iLmkFields->LandmarkId() && iLandmark ) + TLmkEditorAttributes attributeFlags(CLmkEditorDlg::ELmkAll); + // Check if the Landmark is alreayd present in the database. Incase, + // a landmark is associated with the editor and if it is not + // added to the Database, then the viewer would be launched with + // the lanmark content + if (KPosLmNullItemId == iLmkFields->LandmarkId() && iLandmark) { - iEditor = CLmkEditorImpl::NewL( iDb, - iSender, - attributeFlags, - CLmkEditorDlg::ELmkEditor, - iLandmark ); + iEditor = CLmkEditorImpl::NewL(iDb, iSender, attributeFlags, + CLmkEditorDlg::ELmkEditor, iLandmark); } else { - iEditor = CLmkEditorImpl::NewL( iDb, - iSender, - attributeFlags, - CLmkEditorDlg::ELmkEditor, - iLmkFields->LandmarkId() ); + iEditor = CLmkEditorImpl::NewL(iDb, iSender, attributeFlags, + CLmkEditorDlg::ELmkEditor, iLmkFields->LandmarkId()); } - - MLmkEditorField* field = iEditorFieldArray->Find( IdOfFocusControl() ); - iFieldTypeToFocus = field->LandmarkItemField().FieldType(); - iEditor->SetFieldTypeToFocusInEditMode( iFieldTypeToFocus ); - iEditor->SetDlgEditing( ETrue ); + MLmkEditorField* field = iEditorFieldArray->Find(IdOfFocusControl()); + iFieldTypeToFocus = field->LandmarkItemField().FieldType(); + iEditor->SetFieldTypeToFocusInEditMode(iFieldTypeToFocus); + iEditor->SetDlgEditing(ETrue); iIsEditing = ETrue; - if( !iMapNavFeature ) - { - iEditor->DisableMapAndNavigationMenuOptions(); - } + if (!iMapNavFeature) + { + iEditor->DisableMapAndNavigationMenuOptions(); + } iEditor->ExecuteLD(); - iEditor->SetDlgEditing( EFalse ); + iEditor->SetDlgEditing(EFalse); iIsEditing = EFalse; TInt err = KErrNone; TRAP( err, CPosLandmark* landmark = iDb.ReadLandmarkLC( iLmkFields->LandmarkId() ); CleanupStack::PopAndDestroy( landmark ) ); @@ -3069,386 +2714,118 @@ delete this; return; } - AddMskCommandL( iCurrentResourceId, iMskCmdId ); - } + AddMskCommandL(iCurrentResourceId, iMskCmdId); + } // ----------------------------------------------------------------------------- // CLmkEditorImpl::DeleteSelfL // ----------------------------------------------------------------------------- // void CLmkEditorImpl::DeleteSelfL() - { - iLmkUiUtils->RestoreOldNaviPaneL(); - if(iEditor) - { - //delete only editor,if editor instance is present, - //viewer will be deleted in ProcessCommandL, where - //editor was created. - delete iEditor; - iEditor = NULL; - } + { + iLmkUiUtils->RestoreOldNaviPaneL(); + if (iEditor) + { + //delete only editor,if editor instance is present, + //viewer will be deleted in ProcessCommandL, where + //editor was created. + delete iEditor; + iEditor = NULL; + } else - { - delete this; - } - } + { + delete this; + } + } // ----------------------------------------------------------------------------- // CLmkEditorImpl::HandleCentralRepositoryChangeL() // ----------------------------------------------------------------------------- // void CLmkEditorImpl::HandleCentralRepositoryChangeL() - { - //change unit for position accuracy - MLmkFieldData* fldData = iLmkFields->GetField( EPositionAccuracy ); - if(fldData) - { - TInt id1 = fldData->UniqueFieldIdentity(); - CLmkEditorNumberField* field = static_cast(iEditorFieldArray->Find( id1 )); - if(field) - field->HandleUnitChangeL(); - } + { + //change unit for position accuracy + MLmkFieldData* fldData = iLmkFields->GetField(EPositionAccuracy); + if (fldData) + { + TInt id1 = fldData->UniqueFieldIdentity(); + CLmkEditorNumberField* field = + static_cast (iEditorFieldArray->Find( + id1)); + if (field) + field->HandleUnitChangeL(); + } - //change altitude unit - MLmkFieldData* fldData1 = iLmkFields->GetField( EAltitude ); - if(fldData1) - { - TInt id2 = fldData1->UniqueFieldIdentity(); - CLmkEditorNumberField* field1 = static_cast(iEditorFieldArray->Find( id2 )); - if(field1) - field1->HandleUnitChangeL(); - } + //change altitude unit + MLmkFieldData* fldData1 = iLmkFields->GetField(EAltitude); + if (fldData1) + { + TInt id2 = fldData1->UniqueFieldIdentity(); + CLmkEditorNumberField* field1 = + static_cast (iEditorFieldArray->Find( + id2)); + if (field1) + field1->HandleUnitChangeL(); + } - //change altitude accuracy unit - MLmkFieldData* fldData2 = iLmkFields->GetField( EAltitudeAccuracy ); - if(fldData2) - { - TInt id3 = fldData2->UniqueFieldIdentity(); - CLmkEditorNumberField* field2 = static_cast(iEditorFieldArray->Find( id3 )); - if(field2) - field2->HandleUnitChangeL(); - } - } + //change altitude accuracy unit + MLmkFieldData* fldData2 = iLmkFields->GetField(EAltitudeAccuracy); + if (fldData2) + { + TInt id3 = fldData2->UniqueFieldIdentity(); + CLmkEditorNumberField* field2 = + static_cast (iEditorFieldArray->Find( + id3)); + if (field2) + field2->HandleUnitChangeL(); + } + } // ----------------------------------------------------------------------------- // CLmkEditorImpl::UpdateCatInfoNotePosition() // ----------------------------------------------------------------------------- // void CLmkEditorImpl::UpdateCatInfoNotePosition() - { - //this is only to set the position of the - //cat info note. - if(iCatInfoPopupNote && IsCategoryField()) - { - CEikCaptionedControl* tmpline = CurrentLine(); - TPoint pt1 = tmpline->PositionRelativeToScreen(); - pt1.iX+=KHOffsetCatInfoPopup; - pt1.iY+=KVOffsetCatInfoPopup; - iCatInfoPopupNote->SetPositionAndAlignment(pt1,EHLeftVTop); - } - } + { + //this is only to set the position of the + //cat info note. + if (iCatInfoPopupNote && IsCategoryField()) + { + CEikCaptionedControl* tmpline = CurrentLine(); + TPoint pt1 = tmpline->PositionRelativeToScreen(); + pt1.iX += KHOffsetCatInfoPopup; + pt1.iY += KVOffsetCatInfoPopup; + iCatInfoPopupNote->SetPositionAndAlignment(pt1, EHLeftVTop); + } + } // ----------------------------------------------------------------------------- // CLmkEditorImpl::IsCategoryField() // ----------------------------------------------------------------------------- // TBool CLmkEditorImpl::IsCategoryField() - { - //to check whether the current focussed field is a - //category field. - TBool result = ETrue; - MLmkEditorField* field = - iEditorFieldArray->Find( IdOfFocusControl() ); - TUint type = field->LandmarkItemField().FieldType(); - if(type != ECategories && type != ECategory) - { - result = EFalse; - } - return result; - } - + { + //to check whether the current focussed field is a + //category field. + TBool result = ETrue; + MLmkEditorField* field = iEditorFieldArray->Find(IdOfFocusControl()); + TUint type = field->LandmarkItemField().FieldType(); + if (type != ECategories && type != ECategory) + { + result = EFalse; + } + return result; + } #ifdef RD_SCALABLE_UI_V2 // ----------------------------------------------------------------------------- // CLmkEditorImpl::HandleDialogPageEventL // ----------------------------------------------------------------------------- // - -void CLmkEditorImpl::HandleDialogPageEventL(TInt /*aEventID*/) - { - /* - if(IsEditable()) - { - //editor - HandleEditorCommandL(); - } - */ - } - -#endif //RD_SCALABLE_UI_V2 - -// ----------------------------------------------------------------------------- -// CLmkEditorImpl::LineChangedL -// ----------------------------------------------------------------------------- -// - -void CLmkEditorImpl::LineChangedL(TInt /*aControlId*/) - { - - //hide the category info pop-up if active - if(iCatInfoPopupNote) - { - iCatInfoPopupNote->HideInfoPopupNote(); - } - MLmkEditorField* field = iEditorFieldArray->Find( IdOfFocusControl() ); - __ASSERT_DEBUG( field, Panic( KLmkPanicNullMember ) ); - TUint type = field->LandmarkItemField().FieldType(); - if (IsEditable()) - { - //editor - if ( type == ECategory || type == ECategories ) - { - AddMskCommandL(R_LM_MSK_EDIT,ELmkCmdSelectCategories); - } - else - { - CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); - cba->MakeCommandVisible(iMskCmdId,EFalse); - } - } - else - { - //viewer - UpdateMskOnArrowMoveForViewerL(); - } - if ( type == ECategory || type == ECategories ) - { - // ShowMultipleCategoriesInfoPopupL(IdOfFocusControl()); - } - - } - -// ----------------------------------------------------------------------------- -// CLmkEditorImpl::ClearPositionInfoL() -// ----------------------------------------------------------------------------- -// -void CLmkEditorImpl::ClearPositionInfoL() - { - //clear latitude - MLmkFieldData* lat = iLmkFields->GetField(ELatitude); - if(lat) - { - TInt id = lat->UniqueFieldIdentity(); - MLmkEditorField* latcontrol = iEditorFieldArray->Find( id ); - if(latcontrol) - { - latcontrol->ResetL(); - } - } - //clear longitude - MLmkFieldData* lon = iLmkFields->GetField(ELongitude); - if(lon) - { - TInt id = lon->UniqueFieldIdentity(); - MLmkEditorField* longcontrol = iEditorFieldArray->Find( id ); - if(longcontrol) - { - longcontrol->ResetL(); - } - } - //clear position accuracy - MLmkFieldData* fldData = iLmkFields->GetField( EPositionAccuracy ); - if(fldData) - { - TInt id1 = fldData->UniqueFieldIdentity(); - CLmkEditorNumberField* field = static_cast(iEditorFieldArray->Find( id1 )); - if(field) - { - field->ResetL(); - } - } - //clear altitude - MLmkFieldData* fldData1 = iLmkFields->GetField( EAltitude ); - if(fldData1) - { - TInt id2 = fldData1->UniqueFieldIdentity(); - CLmkEditorNumberField* field1 = static_cast(iEditorFieldArray->Find( id2 )); - if(field1) - { - field1->ResetL(); - } - } - //clear altitude accuracy - MLmkFieldData* fldData2 = iLmkFields->GetField( EAltitudeAccuracy ); - if(fldData2) - { - TInt id3 = fldData2->UniqueFieldIdentity(); - CLmkEditorNumberField* field2 = static_cast(iEditorFieldArray->Find( id3 )); - if(field2) - { - field2->ResetL(); - } - } - - DrawNow(); - - } - -// ----------------------------------------------------------------------------- -// CLmkEditorImpl::ArePositionFieldEmptyL() -// ----------------------------------------------------------------------------- -// -TBool CLmkEditorImpl::ArePositionFieldEmptyL() - { - return (IsFieldEmptyL( ELatitude ) && IsFieldEmptyL( ELongitude ) && IsFieldEmptyL( EAltitude ) - && IsFieldEmptyL( EAltitudeAccuracy ) && IsFieldEmptyL( EPositionAccuracy)) ? ETrue : EFalse; - } - -#ifdef RD_SCALABLE_UI_V2 -// ----------------------------------------------------------------------------- -// CLmkEditorImpl::HandleEditorCommandL() -// ----------------------------------------------------------------------------- -// -void CLmkEditorImpl::HandleEditorCommandL() - { - MLmkEditorField* field = iEditorFieldArray->Find( IdOfFocusControl() ); - __ASSERT_DEBUG( field, Panic( KLmkPanicNullMember ) ); - - TUint type = field->LandmarkItemField().FieldType(); - switch(type) - { - case ECategories: - case ECategory: - { - ProcessCommandL( ELmkCmdSelectCategories ); - break; - } - } - } -#endif //RD_SCALABLE_UI_V2 - -// ----------------------------------------------------------------------------- -// CLmkAppLmItemSelectorImpl::HandleDialogDismissed -// ----------------------------------------------------------------------------- -// -void CLmkEditorImpl::HandleDialogDismissed( TInt aButtonId ) - { - if( EEikBidCancel == aButtonId ) - { - delete iLocationService; - iLocationService = NULL; - } - } -// ----------------------------------------------------------------------------- -// CLmkEditorImpl::InsertLineL() -// ----------------------------------------------------------------------------- -// -MLmkEditorField* CLmkEditorImpl::InsertLineL( MLmkFieldData* aFieldData, - TInt aPrevControlId) - { - MLmkEditorField* editorField = NULL; - //data present, but control not present - TryChangeFocusL(aPrevControlId); - editorField = LmkEditorFieldFactory::CreateFieldL( - *aFieldData, *this ); - CleanupStack::PushL( editorField ); - if ( editorField ) - { - editorField->SetEditableL(EFalse); - iEditorFieldArray->GetFieldArray().AppendL( editorField ); - editorField->ActivateL(); - } - CleanupStack::Pop(); //editorField - return editorField; - } - -// ----------------------------------------------------------------------------- -// CLmkEditorImpl::DeleteLineL() -// ----------------------------------------------------------------------------- -// -void CLmkEditorImpl::DeleteLineL( MLmkEditorField* aEditorField, - TInt aCtrlId , TInt aPos) - { - //data not present but control present - //iEditorFieldArray->GetFieldArray().Delete( aPos-1 ); - iEditorFieldArray->GetFieldArray().Delete( aPos ); - delete aEditorField; - aEditorField=NULL; - DeleteLine(aCtrlId); - } - -// ----------------------------------------------------------------------------- -// CLmkEditorImpl::AddOrDeleteLineL() -// ----------------------------------------------------------------------------- -// -MLmkEditorField* CLmkEditorImpl::AddOrDeleteLineL( MLmkEditorField* aEditorField, - MLmkFieldData* aFieldData , - TInt aPrevControlId, - TInt aCtrlId , TInt aPos) - { - TBool valPresent = iEditorFieldArray->CheckIfFieldIsEmpty(*aFieldData); - - if(valPresent && !aEditorField) - { - aEditorField = InsertLineL( aFieldData, aPrevControlId); - } - else if(!valPresent && aEditorField) - { - DeleteLineL(aEditorField, aCtrlId,aPos); - aEditorField = NULL; - } - return aEditorField; - } - -// ----------------------------------------------------------------------------- -// CLmkEditorImpl::MessageQueryCallBack() -// ----------------------------------------------------------------------------- -// -TInt CLmkEditorImpl::MessageQueryCallBack( TAny* /*aPtr*/ ) - { - TInt result = KErrNone; - CEikonEnv* env = CEikonEnv::Static(); - TRAP_IGNORE(result = LmkNotes::GenericMessageQueryL(env,R_LMK_REQUEST_FAIL_INFO_TEXT, - R_LMK_MSG_QUERY_HEADING_PANE_TEXT)); - return result; - } - -// --------------------------------------------------------- -// CLmkEditorImpl::CheckHideCoordinateL() -// --------------------------------------------------------- -// -void CLmkEditorImpl::CheckHideCoordinateL() - { - TInt coordinateSettingValue = ELocCoordinatesNotHidden; - TInt helpSettingValue = ELocHelpNotHidden; - CRepository* repository = CRepository::NewL( TUid::Uid( KCRUidLocLocalVariation) ); - CleanupStack::PushL( repository ); - User::LeaveIfError( repository->Get( KLocHideCoordinates, - coordinateSettingValue )); - User::LeaveIfError( repository->Get( KLocHideHelp, - helpSettingValue )); - CleanupStack::PopAndDestroy( repository ); - - if( ELocCoordinatesHidden == coordinateSettingValue ) - iIsHideCoordinate = ETrue; - else - iIsHideCoordinate = EFalse; - - if( ELocHelpHidden == helpSettingValue ) - iIsHideHelp = ETrue; - else - iIsHideHelp = EFalse; - - } - -// --------------------------------------------------------- -// CLmkEditorImpl::HandlePointerEventL() -// --------------------------------------------------------- -// -void CLmkEditorImpl::HandlePointerEventL(const TPointerEvent& aPointerEvent) +void CLmkEditorImpl::HandleDialogPageEventL(TInt aEventID) { - if (aPointerEvent.iType == TPointerEvent::EButton1Up && iIsDragging - == EFalse) + CAknForm::HandleDialogPageEventL(aEventID); + if (aEventID == MEikDialogPageObserver::EDialogPageTapped) { MLmkEditorField* field = iEditorFieldArray->Find(IdOfFocusControl()); TUint type = field->LandmarkItemField().FieldType(); @@ -3467,7 +2844,7 @@ } else {// view or receive mode - if (type == ECategory || type == ECategories) + if (type == ECategories) { if (iCalegorySelectionFlag) // Receive mode { @@ -3490,21 +2867,258 @@ } } } + } + +#endif //RD_SCALABLE_UI_V2 +// ----------------------------------------------------------------------------- +// CLmkEditorImpl::LineChangedL +// ----------------------------------------------------------------------------- +// + +void CLmkEditorImpl::LineChangedL(TInt /*aControlId*/) + { + //hide the category info pop-up if active + if (iCatInfoPopupNote) + { + iCatInfoPopupNote->HideInfoPopupNote(); + } + MLmkEditorField* field = iEditorFieldArray->Find(IdOfFocusControl()); + __ASSERT_DEBUG( field, Panic( KLmkPanicNullMember ) ); + TUint type = field->LandmarkItemField().FieldType(); + if (IsEditable()) + { + //editor + if (type == ECategory || type == ECategories) + { + AddMskCommandL(R_LM_MSK_EDIT, ELmkCmdSelectCategories); + } + else + { + CEikButtonGroupContainer* cba = + CEikButtonGroupContainer::Current(); + cba->MakeCommandVisible(iMskCmdId, EFalse); + } + } else { - CAknForm::HandlePointerEventL(aPointerEvent); + //viewer + UpdateMskOnArrowMoveForViewerL(); + } + } - if (aPointerEvent.iType == TPointerEvent::EButton1Down) +// ----------------------------------------------------------------------------- +// CLmkEditorImpl::ClearPositionInfoL() +// ----------------------------------------------------------------------------- +// +void CLmkEditorImpl::ClearPositionInfoL() + { + //clear latitude + MLmkFieldData* lat = iLmkFields->GetField(ELatitude); + if (lat) + { + TInt id = lat->UniqueFieldIdentity(); + MLmkEditorField* latcontrol = iEditorFieldArray->Find(id); + if (latcontrol) + { + latcontrol->ResetL(); + } + } + //clear longitude + MLmkFieldData* lon = iLmkFields->GetField(ELongitude); + if (lon) + { + TInt id = lon->UniqueFieldIdentity(); + MLmkEditorField* longcontrol = iEditorFieldArray->Find(id); + if (longcontrol) + { + longcontrol->ResetL(); + } + } + //clear position accuracy + MLmkFieldData* fldData = iLmkFields->GetField(EPositionAccuracy); + if (fldData) + { + TInt id1 = fldData->UniqueFieldIdentity(); + CLmkEditorNumberField* field = + static_cast (iEditorFieldArray->Find( + id1)); + if (field) { - iIsDragging = EFalse; + field->ResetL(); + } + } + //clear altitude + MLmkFieldData* fldData1 = iLmkFields->GetField(EAltitude); + if (fldData1) + { + TInt id2 = fldData1->UniqueFieldIdentity(); + CLmkEditorNumberField* field1 = + static_cast (iEditorFieldArray->Find( + id2)); + if (field1) + { + field1->ResetL(); } + } + //clear altitude accuracy + MLmkFieldData* fldData2 = iLmkFields->GetField(EAltitudeAccuracy); + if (fldData2) + { + TInt id3 = fldData2->UniqueFieldIdentity(); + CLmkEditorNumberField* field2 = + static_cast (iEditorFieldArray->Find( + id3)); + if (field2) + { + field2->ResetL(); + } + } + DrawNow(); + } - if (aPointerEvent.iType == TPointerEvent::EDrag) +// ----------------------------------------------------------------------------- +// CLmkEditorImpl::ArePositionFieldEmptyL() +// ----------------------------------------------------------------------------- +// +TBool CLmkEditorImpl::ArePositionFieldEmptyL() + { + return (IsFieldEmptyL(ELatitude) && IsFieldEmptyL(ELongitude) + && IsFieldEmptyL(EAltitude) && IsFieldEmptyL(EAltitudeAccuracy) + && IsFieldEmptyL(EPositionAccuracy)) ? ETrue : EFalse; + } + +#ifdef RD_SCALABLE_UI_V2 +// ----------------------------------------------------------------------------- +// CLmkEditorImpl::HandleEditorCommandL() +// ----------------------------------------------------------------------------- +// +void CLmkEditorImpl::HandleEditorCommandL() + { + MLmkEditorField* field = iEditorFieldArray->Find(IdOfFocusControl()); + __ASSERT_DEBUG( field, Panic( KLmkPanicNullMember ) ); + + TUint type = field->LandmarkItemField().FieldType(); + switch (type) + { + case ECategories: + case ECategory: { - iIsDragging = ETrue; + ProcessCommandL(ELmkCmdSelectCategories); + break; } } } +#endif //RD_SCALABLE_UI_V2 +// ----------------------------------------------------------------------------- +// CLmkAppLmItemSelectorImpl::HandleDialogDismissed +// ----------------------------------------------------------------------------- +// +void CLmkEditorImpl::HandleDialogDismissed(TInt aButtonId) + { + if (EEikBidCancel == aButtonId) + { + delete iLocationService; + iLocationService = NULL; + } + } + +// ----------------------------------------------------------------------------- +// CLmkEditorImpl::InsertLineL() +// ----------------------------------------------------------------------------- +// +MLmkEditorField* CLmkEditorImpl::InsertLineL(MLmkFieldData* aFieldData, + TInt aPrevControlId) + { + MLmkEditorField* editorField = NULL; + //data present, but control not present + TryChangeFocusL(aPrevControlId); + editorField = LmkEditorFieldFactory::CreateFieldL(*aFieldData, *this); + CleanupStack::PushL(editorField); + if (editorField) + { + editorField->SetEditableL(EFalse); + iEditorFieldArray->GetFieldArray().AppendL(editorField); + editorField->ActivateL(); + } + CleanupStack::Pop(); //editorField + return editorField; + } + +// ----------------------------------------------------------------------------- +// CLmkEditorImpl::DeleteLineL() +// ----------------------------------------------------------------------------- +// +void CLmkEditorImpl::DeleteLineL(MLmkEditorField* aEditorField, TInt aCtrlId, + TInt aPos) + { + //data not present but control present + //iEditorFieldArray->GetFieldArray().Delete( aPos-1 ); + iEditorFieldArray->GetFieldArray().Delete(aPos); + delete aEditorField; + aEditorField = NULL; + DeleteLine(aCtrlId); + } + +// ----------------------------------------------------------------------------- +// CLmkEditorImpl::AddOrDeleteLineL() +// ----------------------------------------------------------------------------- +// +MLmkEditorField* CLmkEditorImpl::AddOrDeleteLineL( + MLmkEditorField* aEditorField, MLmkFieldData* aFieldData, + TInt aPrevControlId, TInt aCtrlId, TInt aPos) + { + TBool valPresent = iEditorFieldArray->CheckIfFieldIsEmpty(*aFieldData); + if (valPresent && !aEditorField) + { + aEditorField = InsertLineL(aFieldData, aPrevControlId); + } + else if (!valPresent && aEditorField) + { + DeleteLineL(aEditorField, aCtrlId, aPos); + aEditorField = NULL; + } + return aEditorField; + } + +// ----------------------------------------------------------------------------- +// CLmkEditorImpl::MessageQueryCallBack() +// ----------------------------------------------------------------------------- +// +TInt CLmkEditorImpl::MessageQueryCallBack(TAny* /*aPtr*/) + { + TInt result = KErrNone; + CEikonEnv* env = CEikonEnv::Static(); + TRAP_IGNORE(result = LmkNotes::GenericMessageQueryL(env,R_LMK_REQUEST_FAIL_INFO_TEXT, + R_LMK_MSG_QUERY_HEADING_PANE_TEXT)); + return result; + } + +// --------------------------------------------------------- +// CLmkEditorImpl::CheckHideCoordinateL() +// --------------------------------------------------------- +// +void CLmkEditorImpl::CheckHideCoordinateL() + { + TInt coordinateSettingValue = ELocCoordinatesNotHidden; + TInt helpSettingValue = ELocHelpNotHidden; + CRepository* repository = CRepository::NewL(TUid::Uid( + KCRUidLocLocalVariation)); + CleanupStack::PushL(repository); + User::LeaveIfError(repository->Get(KLocHideCoordinates, + coordinateSettingValue)); + User::LeaveIfError(repository->Get(KLocHideHelp, helpSettingValue)); + CleanupStack::PopAndDestroy(repository); + + if (ELocCoordinatesHidden == coordinateSettingValue) + iIsHideCoordinate = ETrue; + else + iIsHideCoordinate = EFalse; + + if (ELocHelpHidden == helpSettingValue) + iIsHideHelp = ETrue; + else + iIsHideHelp = EFalse; + } // End of File diff -r 522cd55cc3d7 -r 3c271c9e6618 landmarksui/uicontrols/src/CLmkPackageEditorImpl.cpp --- a/landmarksui/uicontrols/src/CLmkPackageEditorImpl.cpp Tue Feb 02 00:16:03 2010 +0200 +++ b/landmarksui/uicontrols/src/CLmkPackageEditorImpl.cpp Fri Feb 19 22:45:00 2010 +0200 @@ -11,7 +11,8 @@ * * Contributors: * - * Description: LandmarksUi Package viewer implementation + * Description: LandmarksUi Package viewer implementation + * For Received Landmark * */ @@ -57,8 +58,8 @@ CLmkEditorImpl(aDb, aSender, CLmkEditorDlg::ELmkViewer), // viewing only mode! iParser(aParser), iItemIndex(aItemIndex) { - TCoeHelpContext help(TUid::Uid( KLmkMsgViewerAppUID3), - KLM_HLP_RECEIVED_LM); + TCoeHelpContext + help(TUid::Uid(KLmkMsgViewerAppUID3), KLM_HLP_RECEIVED_LM); SetHelpContext(help); } @@ -137,91 +138,92 @@ // CLmkPackageEditorImpl::DynInitMenuPaneL // ----------------------------------------------------------------------------- // -void CLmkPackageEditorImpl::DynInitMenuPaneL( - TInt aResourceId, - CEikMenuPane* aMenuPane ) +void CLmkPackageEditorImpl::DynInitMenuPaneL(TInt aResourceId, + CEikMenuPane* aMenuPane) { - switch( aResourceId ) + switch (aResourceId) { case R_AVKON_FORM_MENUPANE: { - CAknForm::DynInitMenuPaneL( aResourceId, aMenuPane ); + CAknForm::DynInitMenuPaneL(aResourceId, aMenuPane); // delete the show on map & Navigate To options - aMenuPane->DeleteMenuItem( ELmkShowOnMapPlaceHolder ); - aMenuPane->DeleteMenuItem( ELmkNavigateToPlaceHolder ); - - aMenuPane->SetItemDimmed( ELmkCmdSendDummy, ETrue); - aMenuPane->SetItemDimmed( ELmkCmdSaveLm, ETrue ); - - if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) && - !iIsHideHelp ) - { - aMenuPane->SetItemDimmed( EAknCmdHelp, EFalse ); - } - else - { - aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue ); - } + aMenuPane->DeleteMenuItem(ELmkShowOnMapPlaceHolder); + aMenuPane->DeleteMenuItem(ELmkNavigateToPlaceHolder); + + aMenuPane->SetItemDimmed(ELmkCmdSendDummy, ETrue); + aMenuPane->SetItemDimmed(ELmkCmdSaveLm, ETrue); - DimmMenuItemsL(aMenuPane); + if (FeatureManager::FeatureSupported(KFeatureIdHelp) + && !iIsHideHelp) + { + aMenuPane->SetItemDimmed(EAknCmdHelp, EFalse); + } + else + { + aMenuPane->SetItemDimmed(EAknCmdHelp, ETrue); + } - //always dimmed - aMenuPane->SetItemDimmed( EAknFormCmdEdit, ETrue ); - aMenuPane->SetItemDimmed( EAknFormCmdSave, ETrue ); - aMenuPane->SetItemDimmed( EAknFormCmdLabel, ETrue ); - aMenuPane->SetItemDimmed( EAknFormCmdAdd, ETrue ); - aMenuPane->SetItemDimmed( EAknFormCmdDelete, ETrue ); + DimmMenuItemsL(aMenuPane); + + //always dimmed + aMenuPane->SetItemDimmed(EAknFormCmdEdit, ETrue); + aMenuPane->SetItemDimmed(EAknFormCmdSave, ETrue); + aMenuPane->SetItemDimmed(EAknFormCmdLabel, ETrue); + aMenuPane->SetItemDimmed(EAknFormCmdAdd, ETrue); + aMenuPane->SetItemDimmed(EAknFormCmdDelete, ETrue); break; } case R_SENDUI_MENU: // Dynamically created send ui menu { - if ( FeatureManager::FeatureSupported( KFeatureIdLandmarksConverter ) ) - { - iSender.DisplaySendCascadeMenuL( *aMenuPane ); - } + if (FeatureManager::FeatureSupported(KFeatureIdLandmarksConverter)) + { + iSender.DisplaySendCascadeMenuL(*aMenuPane); + } break; } case R_LMK_EDITOR_MENU: - { - TBool hideMN=EFalse; - if( iIsHideCoordinate ) + { + TBool hideMN = EFalse; + if (iIsHideCoordinate) { - if(IsLandmarkDataEmptyL(iLandmark)) + if (IsLandmarkDataEmptyL(iLandmark)) { hideMN = ETrue; } - } - else if( ArePositionFieldEmptyL() ) + } + else if (ArePositionFieldEmptyL()) { hideMN = ETrue; } - - if( hideMN ) + + if (hideMN) { // delete the show on map & Navigate To options - aMenuPane->DeleteMenuItem( ELmkShowOnMapPlaceHolder ); - aMenuPane->DeleteMenuItem( ELmkNavigateToPlaceHolder ); + aMenuPane->DeleteMenuItem(ELmkShowOnMapPlaceHolder); + aMenuPane->DeleteMenuItem(ELmkNavigateToPlaceHolder); } - iMapNavInterface->AttachMenuPaneL(aMenuPane, R_LMK_EDITOR_MENU, ELmkCmdMnNav); + iMapNavInterface->AttachMenuPaneL(aMenuPane, R_LMK_EDITOR_MENU, + ELmkCmdMnNav); // Send menu is handled by the sender: - if ( FeatureManager::FeatureSupported( KFeatureIdLandmarksConverter ) ) - { - aMenuPane->SetItemDimmed(ELmkCmdSendDummy, EFalse); + if (FeatureManager::FeatureSupported(KFeatureIdLandmarksConverter)) + { + aMenuPane->SetItemDimmed(ELmkCmdSendDummy, EFalse); // Use default "Send" item text from SendUI - iSender.DisplaySendMenuL( *aMenuPane, 1); - } - DimmMenuItemsL(aMenuPane); - break; - } + iSender.DisplaySendMenuL(*aMenuPane, 1); + } + DimmMenuItemsL(aMenuPane); + break; + } default: { break; } } - iMapNavInterface->HandleMenuOperationL(aResourceId, aMenuPane, ELmkCmdMnNav); + iMapNavInterface->HandleMenuOperationL(aResourceId, aMenuPane, + ELmkCmdMnNav); } // ----------------------------------------------------------------------------- @@ -258,6 +260,8 @@ } case EAknSoftkeyContextOptions: { + iContextMenuBar->SetContextMenuTitleResourceId( + R_LMK_MSGVIEWER_CONTEXT_MENUBAR); iContextMenuBar->TryDisplayContextMenuBarL(); break; } @@ -377,6 +381,7 @@ CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); EnableMskMenuL(); } + // ---------------------------------------------------- // CLmkPackageEditorImpl::DimmMenuItems // ---------------------------------------------------- @@ -402,32 +407,16 @@ // CLmkPackageEditorImpl::HandleDialogPageEventL // ----------------------------------------------------------------------------- // -void CLmkPackageEditorImpl::HandleDialogPageEventL(TInt /*aEventID*/) +void CLmkPackageEditorImpl::HandleDialogPageEventL(TInt aEventID) { - // No Impl - } - -// ----------------------------------------------------------------------------- -// CLmkPackageEditorImpl::HandlePointerEventL -// ----------------------------------------------------------------------------- -// -void CLmkPackageEditorImpl::HandlePointerEventL( const TPointerEvent& aPointerEvent ) - { - CAknForm::HandlePointerEventL(aPointerEvent); - - if (aPointerEvent.iType == TPointerEvent::EButton1Up && iIsDragging - == EFalse) + CAknForm::HandleDialogPageEventL(aEventID); + if (aEventID == MEikDialogPageObserver::EDialogPageTapped) { - iContextMenuBar->TryDisplayContextMenuBarL(); - } - if (aPointerEvent.iType == TPointerEvent::EButton1Down) - { - iIsDragging = EFalse; - } - if (aPointerEvent.iType == TPointerEvent::EDrag) - { - iIsDragging = ETrue; + iContextMenuBar->SetContextMenuTitleResourceId( + R_LMK_MSGVIEWER_CONTEXT_MENUBAR); + iContextMenuBar->TryDisplayContextMenuBarL(); } } #endif//RD_SCALABLE_UI_V2 + // End of File diff -r 522cd55cc3d7 -r 3c271c9e6618 landmarksui/uicontrols/src/CLmkSelectorDialog.cpp --- a/landmarksui/uicontrols/src/CLmkSelectorDialog.cpp Tue Feb 02 00:16:03 2010 +0200 +++ b/landmarksui/uicontrols/src/CLmkSelectorDialog.cpp Fri Feb 19 22:45:00 2010 +0200 @@ -1,28 +1,19 @@ /* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: LandmarksUi Content File - -* -*/ - - - - - - - - - + * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: LandmarksUi Content File - + * + */ // INCLUDE FILES #include #include @@ -509,36 +500,36 @@ // ----------------------------------------------------------------------------- // void CLmkSelectorDialog::SetCbaResourceAndCommandId(TInt aaDlgResourceId) - { - switch(aaDlgResourceId) - { - case R_LMK_SELECTOR_OK_BACK_DLG://R_AVKON_SOFTKEYS_OK_BACK - case R_LMK_SELECTOR_OK_BACK_MULTI_DLG://R_AVKON_SOFTKEYS_OK_BACK - { - iCbaResourceId = R_LMK_SELECTOR_SOFTKEYS_OK_BACK_OK; - iMskCmdId = EAknSoftkeyOk; - break; - } - case R_LMK_CATEGORY_SELECTOR_OK_CANCEL_MULTI_DLG://r_lmk_catsel_softkeys_done_cancel - { - iCbaResourceId = R_LMK_SELECTOR_SOFTKEYS_DONE_CANCEL_DONE; - iMskCmdId = EAknSoftkeyDone; - break; - } - case R_LMK_SELECTOR_OPEN_CANCEL_DLG://r_lmk_softkeys_open(ok)_cancel - { - iCbaResourceId = R_LMK_SELECTOR_SOFTKEYS_OPEN_CANCEL_OPEN; - iMskCmdId = EAknSoftkeyOk; - break; - } - case R_LMK_SELECTOR_OK_CANCEL_DLG://R_AVKON_SOFTKEYS_OK_CANCEL - case R_LMK_SELECTOR_OK_CANCEL_MULTI_DLG://R_AVKON_SOFTKEYS_OK_CANCEL - iCbaResourceId = R_LMK_SELECTOR_SOFTKEYS_OK_CANCEL_OK; - iMskCmdId = EAknSoftkeyOk; - default: - break; - } - } + { + switch (aaDlgResourceId) + { + case R_LMK_SELECTOR_OK_BACK_DLG: + case R_LMK_SELECTOR_OK_BACK_MULTI_DLG: + { + iCbaResourceId = R_AVKON_SOFTKEYS_BACK; + iMskCmdId = EAknSoftkeyOk; + break; + } + case R_LMK_CATEGORY_SELECTOR_OK_CANCEL_MULTI_DLG: + { + iCbaResourceId = R_AVKON_SOFTKEYS_CANCEL; + iMskCmdId = EAknSoftkeyDone; + break; + } + case R_LMK_SELECTOR_OPEN_CANCEL_DLG: + { + iCbaResourceId = R_AVKON_SOFTKEYS_CANCEL; + iMskCmdId = EAknSoftkeyOk; + break; + } + case R_LMK_SELECTOR_OK_CANCEL_DLG: + case R_LMK_SELECTOR_OK_CANCEL_MULTI_DLG: + iCbaResourceId = R_AVKON_SOFTKEYS_CANCEL; + iMskCmdId = EAknSoftkeyOk; + default: + break; + } + } // ----------------------------------------------------------------------------- // CLmkSelectorDialog::SetDlgEmptyResource() diff -r 522cd55cc3d7 -r 3c271c9e6618 landmarksui/uicontrols/src/clmkmapnavigationinterface.cpp --- a/landmarksui/uicontrols/src/clmkmapnavigationinterface.cpp Tue Feb 02 00:16:03 2010 +0200 +++ b/landmarksui/uicontrols/src/clmkmapnavigationinterface.cpp Fri Feb 19 22:45:00 2010 +0200 @@ -578,7 +578,7 @@ TLocality loc; TBool isValid = (KErrNone == aLandmark.GetPosition( loc ) ); isValid &= !Math::IsNaN( loc.Latitude() ) && !Math::IsNaN( loc.Longitude() ); - return isValid; + return !isValid; /* if ( !isValid ) {