mirror of
https://github.com/moparisthebest/davmail
synced 2025-01-05 10:47:59 -05:00
Caldav: apply date filter to tasks
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1856 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
cd8872b156
commit
a998621d42
@ -2519,7 +2519,7 @@ public abstract class ExchangeSession {
|
||||
*/
|
||||
public List<Event> getAllEvents(String folderPath) throws IOException {
|
||||
boolean caldavDisableTasks = Settings.getBooleanProperty("davmail.caldavDisableTasks");
|
||||
List<Event> results = searchEvents(folderPath, getCalendarItemCondition(caldavDisableTasks, getPastDelayCondition()));
|
||||
List<Event> results = searchEvents(folderPath, getCalendarItemCondition(caldavDisableTasks, getPastDelayCondition("dtstart")));
|
||||
|
||||
if (isMainCalendar(folderPath)) {
|
||||
// retrieve tasks from main tasks folder
|
||||
@ -2531,13 +2531,13 @@ public abstract class ExchangeSession {
|
||||
|
||||
protected abstract Condition getCalendarItemCondition(boolean excludeTasks, Condition dateCondition);
|
||||
|
||||
protected Condition getPastDelayCondition() {
|
||||
protected Condition getPastDelayCondition(String attribute) {
|
||||
int caldavPastDelay = Settings.getIntProperty("davmail.caldavPastDelay");
|
||||
Condition dateCondition = null;
|
||||
if (caldavPastDelay != 0) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.add(Calendar.DAY_OF_MONTH, -caldavPastDelay);
|
||||
dateCondition = gt("dtstart", formatSearchDate(cal.getTime()));
|
||||
dateCondition = gt(attribute, formatSearchDate(cal.getTime()));
|
||||
}
|
||||
return dateCondition;
|
||||
}
|
||||
@ -2597,7 +2597,8 @@ public abstract class ExchangeSession {
|
||||
* @throws IOException on error
|
||||
*/
|
||||
public List<Event> searchTasksOnly(String folderPath) throws IOException {
|
||||
return searchEvents(folderPath, not(isEqualTo("outlookmessageclass", "IPM.Appointment")));
|
||||
return searchEvents(folderPath, and(isEqualTo("outlookmessageclass", "IPM.Task"),
|
||||
or(isNull("datecompleted"), getPastDelayCondition("datecompleted"))));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user