agendainterface/agendautil/src/agendautil_p.cpp
changeset 81 ce92091cbd61
parent 70 a5ed90760192
child 83 5aadd1120515
equal deleted inserted replaced
75:7ac58b2aae6f 81:ce92091cbd61
  1270 
  1270 
  1271 			// Get the CalEntry equivalent of the entry.
  1271 			// Get the CalEntry equivalent of the entry.
  1272 			CCalEntry* calEntry = iCalEntryView->FetchL(entry.id());
  1272 			CCalEntry* calEntry = iCalEntryView->FetchL(entry.id());
  1273 
  1273 
  1274 			if (calEntry) {
  1274 			if (calEntry) {
       
  1275 				CleanupStack::PushL(calEntry);
  1275 				// Get all the entries with same global Uid.
  1276 				// Get all the entries with same global Uid.
  1276 				RPointerArray<CCalEntry> entries;
  1277 				RPointerArray<CCalEntry> entries;
  1277 				CleanupResetAndDestroyPushL(entries);
  1278 				CleanupResetAndDestroyPushL(entries);
  1278 				iCalEntryView->FetchL(calEntry->UidL(), entries);
  1279 				iCalEntryView->FetchL(calEntry->UidL(), entries);
  1279 				parentEntry = createAgendaEntryFromCalEntry(*entries[0]);
  1280 				parentEntry = createAgendaEntryFromCalEntry(*entries[0]);
  1280 				CleanupStack::PopAndDestroy(&entries);
  1281 				CleanupStack::PopAndDestroy(&entries);
       
  1282 				CleanupStack::PopAndDestroy(calEntry);
  1281 			}
  1283 			}
  1282 	)
  1284 	)
  1283 
  1285 
  1284 	// Return the parent entry.
  1286 	// Return the parent entry.
  1285 	return parentEntry;
  1287 	return parentEntry;
  1948 				static_cast<AgendaAttendee::StatusType>(
  1950 				static_cast<AgendaAttendee::StatusType>(
  1949 						calAttendees[i]->StatusL()));
  1951 						calAttendees[i]->StatusL()));
  1950 		entry.addAttendee(attendee);
  1952 		entry.addAttendee(attendee);
  1951 	}
  1953 	}
  1952 
  1954 
       
  1955 // TODO: Right now we are not adding category to agendaEntry.
       
  1956 // Will be handled later when we have some usecase with category.
       
  1957 /*
  1953 	// Categories.
  1958 	// Categories.
  1954 	const RPointerArray<CCalCategory> calCategories = calEntry.CategoryListL();
  1959 	const RPointerArray<CCalCategory>& calCategories = calEntry.CategoryListL();
  1955 
  1960 
  1956 	for (int i = 0; i < calCategories.Count(); i++) {
  1961 	for (int i = 0; i < calCategories.Count(); i++) {
  1957 		AgendaCategory category;
  1962 		AgendaCategory category;
  1958 		CCalCategory::TCalCategoryType categoryType =
  1963 		CCalCategory::TCalCategoryType categoryType =
  1959 				calCategories[i]->Category();
  1964 				calCategories[i]->Category();
  1965 		}
  1970 		}
  1966 		category.setCategory(
  1971 		category.setCategory(
  1967 				static_cast<AgendaCategory::CategoryType>(categoryType));
  1972 				static_cast<AgendaCategory::CategoryType>(categoryType));
  1968 		entry.addCategory(category);
  1973 		entry.addCategory(category);
  1969 	}
  1974 	}
  1970 
  1975 */
  1971 	// Id.
  1976 	// Id.
  1972 	entry.d->m_id = calEntry.LocalUidL();
  1977 	entry.d->m_id = calEntry.LocalUidL();
  1973 
  1978 
  1974 	// Alarm.
  1979 	// Alarm.
  1975 	CCalAlarm* calAlarm = calEntry.AlarmL();
  1980 	CCalAlarm* calAlarm = calEntry.AlarmL();
  2253 
  2258 
  2254 			for (int i = 0; i < attendees.count(); i++) {
  2259 			for (int i = 0; i < attendees.count(); i++) {
  2255 				CCalAttendee* attendee = CCalAttendee::NewL(
  2260 				CCalAttendee* attendee = CCalAttendee::NewL(
  2256 						TPtrC(reinterpret_cast<const TUint16*>(
  2261 						TPtrC(reinterpret_cast<const TUint16*>(
  2257 								attendees.at(i).address().utf16())));
  2262 								attendees.at(i).address().utf16())));
  2258 				CleanupStack::PushL(attendee);
       
  2259 				attendee->SetCommonNameL(
  2263 				attendee->SetCommonNameL(
  2260 						TPtrC(reinterpret_cast<const TUint16*>(
  2264 						TPtrC(reinterpret_cast<const TUint16*>(
  2261 								attendees.at(i).commonName().utf16())));
  2265 								attendees.at(i).commonName().utf16())));
  2262 				attendee->SetResponseRequested(
  2266 				attendee->SetResponseRequested(
  2263 						attendees.at(i).responseRequested());
  2267 						attendees.at(i).responseRequested());
  2264 				attendee->SetRoleL(static_cast<CCalAttendee::TCalRole>(
  2268 				attendee->SetRoleL(static_cast<CCalAttendee::TCalRole>(
  2265 						attendees.at(i).role()));
  2269 						attendees.at(i).role()));
  2266 				attendee->SetStatusL(static_cast<CCalAttendee::TCalStatus>(
  2270 				attendee->SetStatusL(static_cast<CCalAttendee::TCalStatus>(
  2267 						attendees.at(i).status()));
  2271 						attendees.at(i).status()));
  2268 				entry.AddAttendeeL(attendee);
  2272 				entry.AddAttendeeL(attendee);
  2269 				CleanupStack::PopAndDestroy(attendee);
       
  2270 			}
  2273 			}
  2271 	)
  2274 	)
  2272 	return (iError == KErrNone);
  2275 	return (iError == KErrNone);
  2273 }
  2276 }
  2274 
  2277 
  2286 				AgendaCategory::CategoryType type = categories.at(i).category();
  2289 				AgendaCategory::CategoryType type = categories.at(i).category();
  2287 				if (type != AgendaCategory::ExtendedCategory) {
  2290 				if (type != AgendaCategory::ExtendedCategory) {
  2288 					CCalCategory* category = CCalCategory::NewL(
  2291 					CCalCategory* category = CCalCategory::NewL(
  2289 							static_cast<CCalCategory::TCalCategoryType>(type));
  2292 							static_cast<CCalCategory::TCalCategoryType>(type));
  2290 					entry.AddCategoryL(category);
  2293 					entry.AddCategoryL(category);
  2291 					delete category;
       
  2292 				} else {
  2294 				} else {
  2293 					TPtrC categoryName = TPtrC(reinterpret_cast<const TUint16*>(
  2295 					TPtrC categoryName = TPtrC(reinterpret_cast<const TUint16*>(
  2294 							categories.at(i).extendedCategoryName().utf16()));
  2296 							categories.at(i).extendedCategoryName().utf16()));
  2295 					CCalCategory* category = CCalCategory::NewL(categoryName);
  2297 					CCalCategory* category = CCalCategory::NewL(categoryName);
  2296 					entry.AddCategoryL(category);
  2298 					entry.AddCategoryL(category);
  2297 					delete category;
       
  2298 				}
  2299 				}
  2299 			}
  2300 			}
  2300 	)
  2301 	)
  2301 	return (iError == KErrNone);
  2302 	return (iError == KErrNone);
  2302 }
  2303 }