Skip to content

Commit

Permalink
Go to the landmark by choosing from the list dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
baranovskiykonstantin committed Aug 1, 2021
1 parent 75a93bc commit 1f5891a
Show file tree
Hide file tree
Showing 12 changed files with 108 additions and 0 deletions.
4 changes: 4 additions & 0 deletions data/S60Maps.l01
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,7 @@
#define qtn_rename "Rename"
#define qtn_delete "Delete"
#define qtn_confirm_landmark_deletion "Delete \"%S\" landmark?"

// Added in develop

#define qtn_goto "Go to..."
4 changes: 4 additions & 0 deletions data/S60Maps.l04
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,7 @@ CHARACTER_SET UTF8
#define qtn_rename "Renombrar"
#define qtn_delete "Borrar"
#define qtn_confirm_landmark_deletion "Borrar \"%S\" marcador?"

// Added in develop

#define qtn_goto "Go to..."
4 changes: 4 additions & 0 deletions data/S60Maps.l103
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,7 @@ CHARACTER_SET UTF8
#define qtn_rename "Renomear"
#define qtn_delete "Apagar"
#define qtn_confirm_landmark_deletion "Apagar \"%S\" marcador?"

// Added in develop

#define qtn_goto "Go to..."
4 changes: 4 additions & 0 deletions data/S60Maps.l13
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,7 @@ CHARACTER_SET UTF8
#define qtn_rename "Renomear"
#define qtn_delete "Apagar"
#define qtn_confirm_landmark_deletion "Apagar \"%S\" marcador?"

// Added in develop

#define qtn_goto "Go to..."
4 changes: 4 additions & 0 deletions data/S60Maps.l16
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,7 @@ CHARACTER_SET UTF8
#define qtn_rename "Переименовать"
#define qtn_delete "Удалить"
#define qtn_confirm_landmark_deletion "Удалить ориентир \"%S\"?"

// Added in develop

#define qtn_goto "Перейти к..."
4 changes: 4 additions & 0 deletions data/S60Maps.l57
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,7 @@ CHARACTER_SET UTF8
#define qtn_rename "Rename"
#define qtn_delete "Delete"
#define qtn_confirm_landmark_deletion "Delete \"%S\" landmark?"

// Added in develop

#define qtn_goto "Go to..."
4 changes: 4 additions & 0 deletions data/S60Maps.l83
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,7 @@ CHARACTER_SET UTF8
#define qtn_rename "Rename"
#define qtn_delete "Delete"
#define qtn_confirm_landmark_deletion "Delete \"%S\" landmark?"

// Added in develop

#define qtn_goto "Go to..."
4 changes: 4 additions & 0 deletions data/S60Maps.l93
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,7 @@ CHARACTER_SET UTF8
#define qtn_rename "Перейменувати"
#define qtn_delete "Видалити"
#define qtn_confirm_landmark_deletion "Видалити орієнтир \"%S\"?"

// Added in develop

#define qtn_goto "Перейти до..."
26 changes: 26 additions & 0 deletions data/S60Maps.rss
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ RESOURCE MENU_PANE r_submenu_landmarks
{
command = EDeleteLandmark;
txt = qtn_delete;
},
MENU_ITEM
{
command = EGotoLandmark;
txt = qtn_goto;
}
};
}
Expand Down Expand Up @@ -320,6 +325,27 @@ RESOURCE DIALOG r_landmark_name_input_query
};
}

// List query dualog for landmarks
RESOURCE DIALOG r_landmarks_query_dialog
{
flags = EGeneralQueryFlags;
buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
items =
{
AVKON_LIST_QUERY_DLG_LINE
{
control = AVKON_LIST_QUERY_CONTROL
{
listtype = EAknCtSinglePopupMenuListBox;
listbox = AVKON_LIST_QUERY_LIST
{
};
heading = qtn_landmarks;
};
}
};
}



// -----------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions inc/S60Maps.hrh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ enum TS60MapsIds
ECreateLandmark,
ERenameLandmark,
EDeleteLandmark,
EGotoLandmark,

ESetTileProviderBase = 0x6500, // Start id for tile providers
ESetOsmStandardTileProvider = /*ESetTileProviderBase + 0*/ 0x6500 + 0,
Expand Down
1 change: 1 addition & 0 deletions inc/S60MapsAppUi.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ class CS60MapsAppUi : public CAknAppUi, public MAsyncFileManObserver,
void HandleCreateLandmarkL();
void HandleRenameLandmarkL();
void HandleDeleteLandmarkL();
void HandleGotoLandmarkL();

public:
inline const CSettings* Settings()
Expand Down
48 changes: 48 additions & 0 deletions src/S60MapsAppUi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,10 @@ void CS60MapsAppUi::HandleCommandL(TInt aCommand)
HandleDeleteLandmarkL();
break;

case EGotoLandmark:
HandleGotoLandmarkL();
break;

default:
Panic(ES60MapsUi);
break;
Expand Down Expand Up @@ -357,6 +361,10 @@ void CS60MapsAppUi::DynInitMenuPaneL(TInt aMenuID, CEikMenuPane* aMenuPane)
delete nearestLandmark;
aMenuPane->SetItemDimmed(ERenameLandmark, !isDisplayEditOrDeleteLandmark);
aMenuPane->SetItemDimmed(EDeleteLandmark, !isDisplayEditOrDeleteLandmark);
CPosLmItemIterator* landmarkIterator = iLandmarksDb->LandmarkIteratorL();
if (!(landmarkIterator && landmarkIterator->NumOfItemsL() > 0))
aMenuPane->SetItemDimmed(EGotoLandmark, ETrue);
delete landmarkIterator;
}
/*else
{
Expand Down Expand Up @@ -852,6 +860,46 @@ void CS60MapsAppUi::HandleDeleteLandmarkL()
CleanupStack::PopAndDestroy(landmark);
}

void CS60MapsAppUi::HandleGotoLandmarkL()
{
CDesCArraySeg* lmNameArray = new (ELeave) CDesCArraySeg(4);
CleanupStack::PushL(lmNameArray);
CArrayFixFlat<TPosLmItemId>* lmIdArray = new (ELeave) CArrayFixFlat<TPosLmItemId>(4);
CleanupStack::PushL(lmIdArray);
CPosLmItemIterator* lmIterator = iLandmarksDb->LandmarkIteratorL();
CleanupStack::PushL(lmIterator);

TPosLmItemId lmId;
lmId = lmIterator->NextL();
while (lmId != KPosLmNullItemId)
{
CPosLandmark* lm = iLandmarksDb->ReadLandmarkLC(lmId);
TPtrC lmName;
lm->GetLandmarkName(lmName);
lmNameArray->AppendL(lmName);
CleanupStack::PopAndDestroy(lm);
lmIdArray->AppendL(lmId);
lmId = lmIterator->NextL();
}

TInt chosenItem;
CAknListQueryDialog* dlg = new(ELeave) CAknListQueryDialog(&chosenItem);
dlg->PrepareLC(R_LANDMARKS_QUERY_DIALOG);
dlg->SetItemTextArray(lmNameArray);
dlg->SetOwnershipType(ELbmDoesNotOwnItemArray);
TInt answer = dlg->RunLD();
if (EAknSoftkeyOk == answer)
{
CPosLandmark* lm = iLandmarksDb->ReadLandmarkLC(lmIdArray->At(chosenItem));
TLocality pos;
lm->GetPosition(pos);
iAppView->Move(pos);
CleanupStack::PopAndDestroy(lm);
}

CleanupStack::PopAndDestroy(3, lmNameArray);
}

void CS60MapsAppUi::SendAppToBackground()
{
TApaTask task(iEikonEnv->WsSession());
Expand Down

0 comments on commit 1f5891a

Please sign in to comment.