32 #include <CMessageData.h> // for CMessageData |
32 #include <CMessageData.h> // for CMessageData |
33 |
33 |
34 #include <commonphoneparser.h> // Phonenumber parser |
34 #include <commonphoneparser.h> // Phonenumber parser |
35 #include <SendUiConsts.h> // Mtm uids |
35 #include <SendUiConsts.h> // Mtm uids |
36 |
36 |
37 #include <FavouritesLimits.h> // KFavouritesMaxUrl |
|
38 #include <FavouritesItem.h> // for CBookmarkItem |
|
39 |
|
40 #include <FavouritesDb.h> |
|
41 |
|
42 #include <apgcli.h> // RApaLsSession for WMLBrowser launch |
37 #include <apgcli.h> // RApaLsSession for WMLBrowser launch |
43 #include <apgtask.h> |
38 #include <apgtask.h> |
44 |
39 |
45 #ifndef RD_VIRTUAL_PHONEBOOK |
40 #ifndef RD_VIRTUAL_PHONEBOOK |
46 #include <CPbkContactEngine.h> // Phonebook Engine |
41 #include <CPbkContactEngine.h> // Phonebook Engine |
54 |
49 |
55 #include "finditem.hrh" |
50 #include "finditem.hrh" |
56 #include <FindItemui.rsg> |
51 #include <FindItemui.rsg> |
57 #include <aknnotewrappers.h> |
52 #include <aknnotewrappers.h> |
58 |
53 |
59 // add to gallery related |
|
60 #include <AknCommonDialogs.h> |
|
61 |
|
62 #include <featmgr.h> |
54 #include <featmgr.h> |
63 |
55 |
64 #include <centralrepository.h> |
56 #include <centralrepository.h> |
65 #include <CommonUiInternalCRKeys.h> |
57 #include <CommonUiInternalCRKeys.h> |
66 |
58 |
67 #include <AiwCommon.hrh> |
59 #include <AiwCommon.hrh> |
68 #include <SchemeHandler.h> |
|
69 |
60 |
70 // Callback query |
61 // Callback query |
71 #include <aknlists.h> |
62 #include <aknlists.h> |
72 #include <aknPopup.h> |
63 #include <aknPopup.h> |
73 #include <StringLoader.h> |
64 #include <StringLoader.h> |
1175 // Scheme handler can handle this |
1164 // Scheme handler can handle this |
1176 } |
1165 } |
1177 |
1166 |
1178 void CFindItemMenu::AddToBookmarkL() |
1167 void CFindItemMenu::AddToBookmarkL() |
1179 { |
1168 { |
1180 // Create an item |
|
1181 CFavouritesItem* item = CFavouritesItem::NewLC(); |
|
1182 item->SetParentFolder( KFavouritesRootUid ); |
|
1183 item->SetType( CFavouritesItem::EItem ); |
|
1184 // Read default name from resources |
1169 // Read default name from resources |
1185 RConeResourceLoader ldr( *iCoeEnv ); |
1170 RConeResourceLoader ldr( *iCoeEnv ); |
1186 |
1171 |
1187 TFileName dialogResource( KDialogResourceName ); |
1172 TFileName dialogResource( KDialogResourceName ); |
1188 |
1173 |
1200 CAknTextQueryDialog* dlg = CAknTextQueryDialog::NewL( retName ); |
1185 CAknTextQueryDialog* dlg = CAknTextQueryDialog::NewL( retName ); |
1201 dlg->SetMaxLength( KMaxBookmarkNameLength ); |
1186 dlg->SetMaxLength( KMaxBookmarkNameLength ); |
1202 if ( !dlg->ExecuteLD( R_FINDITEM_BOOKMARK_QUERY_DIALOG ) ) |
1187 if ( !dlg->ExecuteLD( R_FINDITEM_BOOKMARK_QUERY_DIALOG ) ) |
1203 { |
1188 { |
1204 // User press cancel - do not add bookmark |
1189 // User press cancel - do not add bookmark |
1205 CleanupStack::PopAndDestroy( 3 ); // item, defaultName, resourceLoader |
1190 CleanupStack::PopAndDestroy( 2 ); // defaultName, resourceLoader |
1206 return; |
1191 return; |
1207 } |
1192 } |
1208 |
|
1209 item->SetNameL( retName ); |
|
1210 item->SetUrlL( iAutomaticFind->CurrentItemExt().iItemDescriptor->Des() ); |
|
1211 |
|
1212 RFavouritesSession sess; |
|
1213 RFavouritesDb db; |
|
1214 |
|
1215 User::LeaveIfError( sess.Connect() ); |
|
1216 CleanupClosePushL<RFavouritesSession>( sess ); |
|
1217 User::LeaveIfError( db.Open( sess, KBrowserBookmarks ) ); |
|
1218 CleanupClosePushL<RFavouritesDb>( db ); |
|
1219 |
|
1220 // add item |
|
1221 db.Add( *item, ETrue ); |
|
1222 // Close the database. |
|
1223 db.Close(); |
|
1224 |
1193 |
1225 HBufC* msgBuffer = iCoeEnv->AllocReadResourceLC( R_FINDITEM_BOOKMARK_SAVED ); |
1194 HBufC* msgBuffer = iCoeEnv->AllocReadResourceLC( R_FINDITEM_BOOKMARK_SAVED ); |
1226 CAknConfirmationNote* note = new (ELeave)CAknConfirmationNote( ETrue ); |
1195 CAknConfirmationNote* note = new (ELeave)CAknConfirmationNote( ETrue ); |
1227 note->ExecuteLD( *msgBuffer ); |
1196 note->ExecuteLD( *msgBuffer ); |
1228 |
1197 |
1229 CleanupStack::PopAndDestroy( 6 ); // item, db, sess, resourceLoader, |
1198 CleanupStack::PopAndDestroy( 3 ); // resourceLoader, |
1230 // defaultName, msgBuffer |
1199 // defaultName, msgBuffer |
1231 } |
1200 } |
1232 |
1201 |
1233 void CFindItemMenu::CreateContactCardL( TInt aCommandId ) |
1202 void CFindItemMenu::CreateContactCardL( TInt aCommandId ) |
1234 { |
1203 { |
1363 #endif // !RD_VIRTUAL_PHONEBOOK |
1332 #endif // !RD_VIRTUAL_PHONEBOOK |
1364 } |
1333 } |
1365 |
1334 |
1366 void CFindItemMenu::AddToGalleryL() |
1335 void CFindItemMenu::AddToGalleryL() |
1367 { |
1336 { |
1368 _LIT( KRamFileExtension,".ram" ); |
1337 //no need to do anything ,due to the remove of AknCommonDialogs |
1369 TFileName fileName; |
|
1370 iCoeEnv->ReadResourceL( fileName, R_FINDITEMMENU_DEFAULT_GALL_NAME ); |
|
1371 fileName.Append( KRamFileExtension ); |
|
1372 if ( AknCommonDialogs::RunSaveDlgLD( |
|
1373 fileName, R_MEMORY_SELECTION_LOCATIONS ) ) |
|
1374 { |
|
1375 CDesCArrayFlat* array = new (ELeave)CDesCArrayFlat( 1 ); |
|
1376 CleanupStack::PushL( array ); |
|
1377 array->AppendL( iAutomaticFind->CurrentItemExt().iItemDescriptor->Des() ); |
|
1378 TInt err = KErrNone; |
|
1379 if( !iMPEngineDllLoaded ) |
|
1380 { |
|
1381 LoadMPEngineApiL(); |
|
1382 } |
|
1383 err = iMPEngineApi->CreateNewLinkFileL( fileName, array, ETrue ); |
|
1384 CleanupStack::PopAndDestroy( 1 ); |
|
1385 |
|
1386 if ( err == KErrNone ) |
|
1387 { |
|
1388 // Show note |
|
1389 HBufC* msgBuffer = |
|
1390 iCoeEnv->AllocReadResourceLC( R_FINDITEMMENU_LINK_SAVED ); |
|
1391 CAknConfirmationNote* note = |
|
1392 new (ELeave) CAknConfirmationNote( ETrue ); |
|
1393 note->ExecuteLD( *msgBuffer ); |
|
1394 CleanupStack::PopAndDestroy(); // msgBuffer |
|
1395 } |
|
1396 } |
|
1397 } |
1338 } |
1398 |
1339 |
1399 EXPORT_C void CFindItemMenu::SetSenderDescriptorType( |
1340 EXPORT_C void CFindItemMenu::SetSenderDescriptorType( |
1400 CItemFinder::TItemType aType ) |
1341 CItemFinder::TItemType aType ) |
1401 { |
1342 { |
1562 return ETrue; |
1503 return ETrue; |
1563 } |
1504 } |
1564 |
1505 |
1565 void CFindItemMenu::LaunchGenericUriL() |
1506 void CFindItemMenu::LaunchGenericUriL() |
1566 { |
1507 { |
1567 if ( iSchemeHandler ) |
1508 |
1568 { |
|
1569 delete iSchemeHandler; |
|
1570 iSchemeHandler = 0; |
|
1571 } |
|
1572 iSchemeHandler = CSchemeHandler::NewL( iAutomaticFind->CurrentItemExt().iItemDescriptor->Des() ); |
|
1573 if ( iAutomaticFind->CurrentItemExt().iItemDescriptor->FindF( KRtspUrlAddress ) != KErrNotFound ) |
|
1574 { |
|
1575 iSchemeHandler->HandleUrlEmbeddedL(); |
|
1576 } |
|
1577 else |
|
1578 { |
|
1579 iSchemeHandler->HandleUrlStandaloneL(); |
|
1580 } |
|
1581 } |
1509 } |
1582 |
1510 |
1583 EXPORT_C void CFindItemMenu::SetCallbackNumber( const TDesC& aPhoneNumber ) |
1511 EXPORT_C void CFindItemMenu::SetCallbackNumber( const TDesC& aPhoneNumber ) |
1584 { |
1512 { |
1585 delete iCallbackNumber; |
1513 delete iCallbackNumber; |