Deleting Device Calender items through a client(application)
-
Hello friends,I am devloping an application which uses organizer apis,till now I am able to set the entries in the device calendar through my application,Now when i try to delete the entries which i set in the device calendar through my application,they get deleted but also the entries in the device calendar which are not set by mu application also get deleted so how shall i solve this issue.
below is my code which i have used to deleted calendar entries..@void ReminderForm::on_DeleteReminder_clicked()
{
QList<QOrganizerItemId> ids = m_manager->itemIds();
qDebug()<<ids;
if(ids.count()) {
m_remReq.setItemIds(ids);
m_remReq.setManager(m_manager);
m_remReq.start();
connect(&m_remReq, SIGNAL(stateChanged(QOrganizerAbstractRequest::State)),
this, SLOT(removeReqStateChanged(QOrganizerAbstractRequest::State)));}
}
void ReminderForm::removeReqStateChanged(QOrganizerAbstractRequest::State reqState)
{
if(QOrganizerAbstractRequest::ActiveState == reqState) {
// Request started. Show a progress or wait dialog
m_progressDlg = new QProgressDialog("Removing events..", "Cancel", 100, 100, this);
connect(m_progressDlg, SIGNAL(canceled()), &m_remReq, SLOT(cancel()));
m_progressDlg->show();
} else if (QOrganizerAbstractRequest::FinishedState == reqState ||
QOrganizerAbstractRequest::CanceledState == reqState) {
// Request finished or cancelled. Stop showing the progress dialog and refresh
m_progressDlg->hide();}
}
@regards
imrrk -
According to the official documentation of "the Organizer API":http://doc.qt.nokia.com/qtmobility-1.1.0/organizer.html you can retrieve the entry and after that to delete it using an instance of class "QOrganizerManager":http://doc.qt.nokia.com/qtmobility/qorganizermanager.html
In your case I guess you can delete an item like this:
@
m_manager->removeItem(ids[0]);
@
Please note that I have used id 0 just for an example. -
to save an item i have added these lines of code
@m_organizerEvent.setDisplayLabel(str);
m_organizerEvent.setDisplayLabel(str1);
m_organizerEvent.setStartDateTime(dtFromTime);
m_organizerEvent.setEndDateTime(dtToTime);
m_manager->saveItem(&m_organizerEvent);@so now to delete entries can be done like this
@void ReminderForm::on_DeleteReminder_clicked()
{QList<QOrganizerEvent> ids =m_manager->itemIds(); ids.removeAll(m_organizerEvent.id());
}
@regards
imrrk -
Hello friends..I am not able to delete only the application specific entries from the device calendar.when i delete the entries from the application,not only the application specific entries but also the device calendar entries gets deleted..so any help..
regards
imrrk