landmarksui/uicontrols/src/LmkNotes.cpp
branchRCL_3
changeset 18 870918037e16
parent 0 522cd55cc3d7
equal deleted inserted replaced
17:1fc85118c3ae 18:870918037e16
       
     1 /*
       
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:    LandmarksUi Content File -    Provides landmarks note class methods.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 // INCLUDE FILES
       
    25 #include <aknmessagequerydialog.h>
       
    26 #include <StringLoader.h>
       
    27 #include <aknnotewrappers.h>
       
    28 #include <AknQueryDialog.h>
       
    29 #include <lmkui.rsg>
       
    30 #include <aknconsts.h>
       
    31 #include "LmkNotes.h"
       
    32 #include "LmkConsts.h"
       
    33 
       
    34 // ================= MEMBER FUNCTIONS =======================
       
    35 //-----------------------------------------------------------------------
       
    36 // LmkNotes::CategoryConfirmationQueryL
       
    37 // ----------------------------------------------------------------------------
       
    38 //
       
    39 EXPORT_C TInt LmkNotes::CategoryConfirmationQueryL( CEikonEnv* aEnv, const TInt aAmount )
       
    40     {
       
    41     HBufC* noteText = NULL;
       
    42 
       
    43     if ( aAmount > 1)
       
    44         {
       
    45         noteText = StringLoader::LoadLC( R_LMK_DELETE_CATEGORIES,
       
    46                                          aAmount, aEnv );
       
    47         }
       
    48     else
       
    49         {
       
    50         noteText = StringLoader::LoadLC( R_LMK_DELETE_CATEGORY, aEnv );
       
    51         }
       
    52 
       
    53     CAknQueryDialog* query =
       
    54         new( ELeave ) CAknQueryDialog( *noteText );
       
    55     TInt ret = query->ExecuteLD( R_LMK_QUERY );//*noteText );
       
    56 
       
    57     CleanupStack::PopAndDestroy(noteText); //noteText
       
    58     return ret;
       
    59     }
       
    60 
       
    61 //-----------------------------------------------------------------------
       
    62 // LmkNotes::LandmarkConfirmationQueryL
       
    63 // ----------------------------------------------------------------------------
       
    64 //
       
    65 EXPORT_C TInt LmkNotes::LandmarkConfirmationQueryL( CEikonEnv* aEnv, const TInt aAmount )
       
    66     {
       
    67     HBufC* noteText = NULL;
       
    68 
       
    69     if ( aAmount > 1 )
       
    70         {
       
    71         noteText = StringLoader::LoadLC( R_LMK_DELETE_LANDMARKS,
       
    72                                          aAmount, aEnv );
       
    73         }
       
    74     else
       
    75         {
       
    76         noteText = StringLoader::LoadLC( R_LMK_DELETE_LANDMARK, aEnv );
       
    77         }
       
    78 
       
    79     CAknQueryDialog* query =
       
    80         new( ELeave ) CAknQueryDialog( *noteText );
       
    81     TInt ret = query->ExecuteLD( R_LMK_QUERY );//*noteText );
       
    82 
       
    83     CleanupStack::PopAndDestroy(noteText); //noteText
       
    84     return ret;
       
    85     }
       
    86 
       
    87 //-----------------------------------------------------------------------
       
    88 // LmkNotes::InformationNoteL
       
    89 // ----------------------------------------------------------------------------
       
    90 //
       
    91 EXPORT_C void LmkNotes::InformationNoteL( CEikonEnv* aEnv, const TInt aResourceId )
       
    92     {
       
    93     HBufC* noteText = StringLoader::LoadLC( aResourceId, aEnv );
       
    94 
       
    95     CAknInformationNote* dialog =
       
    96         new( ELeave ) CAknInformationNote( R_AKN_INFORMATION_NOTE_WAIT );
       
    97     dialog->ExecuteLD( *noteText );
       
    98 
       
    99     CleanupStack::PopAndDestroy(noteText); //noteText
       
   100     }
       
   101 
       
   102 //-----------------------------------------------------------------------
       
   103 // LmkNotes::CategoryNameQueryL
       
   104 // ----------------------------------------------------------------------------
       
   105 //
       
   106 EXPORT_C TInt LmkNotes::CategoryNameQueryL( TDes& aDataText,
       
   107                                              const TInt aResourceId )
       
   108     {
       
   109     CAknTextQueryDialog* dlg = new( ELeave ) CAknTextQueryDialog(aDataText,
       
   110                                                     CAknQueryDialog::ENoTone);
       
   111     return dlg->ExecuteLD(aResourceId);
       
   112     }
       
   113 
       
   114 //-----------------------------------------------------------------------
       
   115 // LmkNotes::InformationNoteL
       
   116 // ----------------------------------------------------------------------------
       
   117 //
       
   118 EXPORT_C void LmkNotes::InformationNotewithTextL( CEikonEnv* aEnv,
       
   119            TInt aResourceId, TPtrC aTextPtr )
       
   120     {
       
   121     HBufC* noteText = StringLoader::LoadLC( aResourceId, aTextPtr, aEnv );
       
   122 
       
   123     CAknInformationNote* dialog =
       
   124         new( ELeave ) CAknInformationNote( R_AKN_INFORMATION_NOTE_WAIT );
       
   125     dialog->ExecuteLD( *noteText );
       
   126 
       
   127     CleanupStack::PopAndDestroy(noteText); //noteText
       
   128     }
       
   129 //-----------------------------------------------------------------------
       
   130 // LmkNotes::OutOfMemoryNoteL
       
   131 // ----------------------------------------------------------------------------
       
   132 //
       
   133 EXPORT_C void LmkNotes::OutOfMemoryNoteL( CEikonEnv* aEnv )
       
   134 	{
       
   135     HBufC* noteText = StringLoader::LoadL( R_LMK_MEMLO_NOT_ENOUGH_MEMORY, aEnv );
       
   136     CleanupStack::PushL(noteText);
       
   137     CAknErrorNote* dialog =
       
   138         new(ELeave)CAknErrorNote(ETrue);
       
   139     dialog->SetTone(CAknNoteDialog::EErrorTone);
       
   140     dialog->ExecuteLD( *noteText );
       
   141     CleanupStack::PopAndDestroy(noteText); //noteText
       
   142 	}
       
   143 //-----------------------------------------------------------------------
       
   144 // LmkNotes::MessageQueryL()
       
   145 // ----------------------------------------------------------------------------
       
   146 //
       
   147 EXPORT_C void LmkNotes::MessageQueryL( CEikonEnv* aEnv, TDes& aMsg, TInt aCount )
       
   148 	{
       
   149 	CAknMessageQueryDialog* dialog = new (ELeave) CAknMessageQueryDialog;
       
   150     HBufC* headerText;
       
   151     headerText =  StringLoader::LoadL(R_LMK_CATEGORIES_QUERY_PROMPT,
       
   152                                       aCount,
       
   153                                       aEnv );
       
   154     dialog->SetHeaderTextL(*headerText);
       
   155     delete headerText;
       
   156     dialog->SetMessageTextL( aMsg );
       
   157     dialog->ExecuteLD(R_LMK_MESSAGE_QUERY_DIALOG);
       
   158 	}
       
   159 //-----------------------------------------------------------------------
       
   160 // LmkNotes::AllLandmarksEmptyNoteL
       
   161 // ----------------------------------------------------------------------------
       
   162 //
       
   163 EXPORT_C void LmkNotes::AllLandmarksEmptyNoteL( CEikonEnv* aEnv )
       
   164 	{
       
   165     HBufC* noteText = StringLoader::LoadLC( R_LM_SHOW_ERROR_NO_COORDINATES, aEnv );
       
   166 
       
   167     CAknInformationNote* dialog =
       
   168         new( ELeave ) CAknInformationNote( R_AKN_ERROR_NOTE_WAIT );
       
   169     dialog->ExecuteLD( *noteText );
       
   170 
       
   171     CleanupStack::PopAndDestroy(noteText); //noteText
       
   172 	}
       
   173 
       
   174 //-----------------------------------------------------------------------
       
   175 // LmkNotes::LandmarksEmptyNoteL
       
   176 // ----------------------------------------------------------------------------
       
   177 //
       
   178 EXPORT_C void LmkNotes::LandmarksEmptyNoteL( CEikonEnv* aEnv, TPtrC aLandmarkName )
       
   179 	{
       
   180     HBufC* noteText = StringLoader::LoadLC( R_LM_SHOW_ERROR_NO_DATA,
       
   181     										aLandmarkName,
       
   182     										aEnv );
       
   183 
       
   184     CAknInformationNote* dialog =
       
   185         new( ELeave ) CAknInformationNote( R_AKN_ERROR_NOTE_WAIT );
       
   186     dialog->ExecuteLD( *noteText );
       
   187 
       
   188     CleanupStack::PopAndDestroy(noteText); //noteText
       
   189 	}
       
   190 
       
   191 //-----------------------------------------------------------------------
       
   192 // LmkNotes::CategoryEmptyNoteL
       
   193 // ----------------------------------------------------------------------------
       
   194 //
       
   195 EXPORT_C void LmkNotes::CategoryEmptyNoteL( CEikonEnv* aEnv, TPtrC aCategoryName )
       
   196 	{
       
   197     HBufC* noteText = StringLoader::LoadLC( R_LM_SHOW_ERROR_CATEGORY_NO_COORDINATES,
       
   198     										aCategoryName,
       
   199     										aEnv );
       
   200 
       
   201     CAknInformationNote* dialog =
       
   202         new( ELeave ) CAknInformationNote( R_AKN_ERROR_NOTE_WAIT );
       
   203     dialog->ExecuteLD( *noteText );
       
   204 
       
   205     CleanupStack::PopAndDestroy(noteText); //noteText
       
   206 	}
       
   207 
       
   208 //-----------------------------------------------------------------------
       
   209 // LmkNotes::CategoryEmptyNoteL
       
   210 // ----------------------------------------------------------------------------
       
   211 //
       
   212 EXPORT_C void LmkNotes::LandmarkInCategoryEmptyNoteL( CEikonEnv* aEnv, TPtrC aCategoryName, TPtrC aLandmark)
       
   213 	{
       
   214 	CPtrC16Array* array = new (ELeave) CPtrC16Array(2);
       
   215 	CleanupStack::PushL(array);
       
   216 	array->AppendL( aLandmark );
       
   217 	array->AppendL( aCategoryName );
       
   218 
       
   219     HBufC* noteText = StringLoader::LoadLC( R_LM_SELECT_FROM_MAP,
       
   220 											*array,
       
   221     										aEnv );
       
   222 
       
   223     CAknInformationNote* dialog =
       
   224         new( ELeave ) CAknInformationNote( R_AKN_ERROR_NOTE_WAIT );
       
   225     dialog->ExecuteLD( *noteText );
       
   226     CleanupStack::PopAndDestroy(2); //noteText, array
       
   227 	}
       
   228 
       
   229 //-----------------------------------------------------------------------
       
   230 // LmkNotes::ShowDelayedInfoPopupL
       
   231 // ----------------------------------------------------------------------------
       
   232 //
       
   233 
       
   234 EXPORT_C CAknInfoPopupNoteController* LmkNotes::ShowDelayedInfoPopupL( TDesC& aMsg,TPoint& /*aPosition*/ )
       
   235 	{
       
   236 	CAknInfoPopupNoteController*infopopup  = CAknInfoPopupNoteController::NewL ();
       
   237 	infopopup->SetTextL(aMsg);
       
   238 	return infopopup;
       
   239 
       
   240 	}
       
   241 
       
   242 //-----------------------------------------------------------------------
       
   243 // LmkNotes::ShowOwerriteLocationQueryL
       
   244 // ----------------------------------------------------------------------------
       
   245 //
       
   246 EXPORT_C TInt LmkNotes::ShowOwerriteLocationQueryL( CEikonEnv* aEnv )
       
   247 	{
       
   248     HBufC* noteText = NULL;
       
   249     noteText = StringLoader::LoadLC( R_LM_QUERY_EDITOR_REPLACE,aEnv);
       
   250     CAknQueryDialog* query =
       
   251         new( ELeave ) CAknQueryDialog( *noteText );
       
   252     TInt ret = query->ExecuteLD( R_LMK_QUERY );
       
   253 
       
   254     CleanupStack::PopAndDestroy(noteText); //noteText
       
   255     return ret;
       
   256 	}
       
   257 
       
   258 //-----------------------------------------------------------------------
       
   259 // LmkNotes::MessageQueryWithLinkL()
       
   260 // ----------------------------------------------------------------------------
       
   261 //
       
   262 EXPORT_C TInt LmkNotes::MessageQueryWithLinkL( CEikonEnv* aEnv, TInt aHeadingText,
       
   263 											   TInt aMsgQueryText, TInt aLinkText,
       
   264 											   TCallBack aCallBack)
       
   265 	{
       
   266     HBufC* headPaneText = StringLoader::LoadLC(
       
   267                       aHeadingText, ( aEnv ));
       
   268 
       
   269     HBufC* msgQueryText = StringLoader::LoadLC(
       
   270           aMsgQueryText, ( aEnv ));
       
   271 
       
   272 
       
   273     HBufC* linkText = StringLoader::LoadLC(
       
   274           aLinkText, ( aEnv ));
       
   275 
       
   276 	HBufC* msgQText = HBufC::NewLC ( msgQueryText->Length() +
       
   277 				 					 KNewLine().Length() +
       
   278 				 					 linkText->Length() ) ;
       
   279 
       
   280 	msgQText->Des().Copy(*msgQueryText);
       
   281     msgQText->Des().Append(KNewLine);
       
   282     msgQText->Des().Append(*linkText);
       
   283 
       
   284     CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(*msgQText);
       
   285 	dlg->PrepareLC(R_LMK_MESSAGE_QUERY_DIALOG2);
       
   286 	dlg->Heading()->SetTextL(*headPaneText);
       
   287 	dlg->SetLinkTextL(*linkText);
       
   288 	dlg->SetLink(aCallBack);
       
   289 	TInt result = dlg->RunLD();
       
   290 	CleanupStack::PopAndDestroy(4);
       
   291 	return result;
       
   292 	}
       
   293 
       
   294 //-----------------------------------------------------------------------
       
   295 // LmkNotes::GenericMessageQueryL()
       
   296 // ----------------------------------------------------------------------------
       
   297 //
       
   298 EXPORT_C TInt LmkNotes::GenericMessageQueryL( CEikonEnv* aEnv, TInt aMsgQueryText,
       
   299 											  TInt aHeadingText )
       
   300 	{
       
   301 	HBufC* msgQueryText = StringLoader::LoadLC(
       
   302           aMsgQueryText, ( aEnv ));
       
   303     HBufC* headPaneText = StringLoader::LoadLC(
       
   304                       aHeadingText, ( aEnv ));
       
   305 	CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(*msgQueryText);
       
   306     dlg->PrepareLC(R_LMK_MESSAGE_QUERY_DIALOG3);
       
   307     dlg->Heading()->SetTextL(*headPaneText);
       
   308 	TInt result = dlg->RunLD();
       
   309 	CleanupStack::PopAndDestroy(2);//msgQueryText,headPaneText
       
   310 	return result;
       
   311 	}
       
   312 // End of File