Skip to content

Commit

Permalink
include current calendar in selection when moving recurrence
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-haeusler committed Jun 26, 2024
1 parent 0a00f53 commit 61fb87a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -764,8 +764,8 @@ protected void onQueryComplete(int token, Object cookie, Cursor cursor) {
// recurring event AND api level >= 30. enable changing calendars to synced
// calendars only, as we currently don't allow recurrence exceptions in local calendars
// and would lose them when moving the recurrence between calendars
selection = EditEventHelper.CALENDARS_WHERE_SYNCED_WRITEABLE_VISIBLE;
selectionArgs = null;
selection = EditEventHelper.CALENDARS_SELECTION_FOR_MOVING_RECURRENCE;
selectionArgs = new String[] { Long.toString(mModel.mCalendarId) };
} else {
// non recurring event. enable changing calendars to all calendars.
selection = EditEventHelper.CALENDARS_WHERE_WRITEABLE_VISIBLE;
Expand Down
20 changes: 16 additions & 4 deletions app/src/main/java/com/android/calendar/event/EditEventHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,22 @@ public class EditEventHelper {
static final String CALENDARS_WHERE_WRITEABLE_VISIBLE = Calendars.CALENDAR_ACCESS_LEVEL + ">="
+ Calendars.CAL_ACCESS_CONTRIBUTOR + " AND " + Calendars.VISIBLE + "=1";

static final String CALENDARS_WHERE_SYNCED_WRITEABLE_VISIBLE =
Calendars.CALENDAR_ACCESS_LEVEL + ">=" + Calendars.CAL_ACCESS_CONTRIBUTOR
+ " AND " + Calendars.VISIBLE + "=1"
+ " AND " + Calendars.ACCOUNT_TYPE + "!='" + CalendarContract.ACCOUNT_TYPE_LOCAL + "'";
/**
* Query to find all calendars to which a recurrence can be moved to.
* <p>
* This always includes the current calendar of the recurrence, as the current calendar must be
* displayed as a possible selection (for not moving the recurrence at all).
* <p>
* Argument placeholders:
* <ul>
* <li>arg 0: the id of the current calendar.
* </ul>
*/
static final String CALENDARS_SELECTION_FOR_MOVING_RECURRENCE =
"(" + Calendars._ID + "=?) OR ("
+ Calendars.CALENDAR_ACCESS_LEVEL + ">=" + Calendars.CAL_ACCESS_CONTRIBUTOR
+ " AND " + Calendars.VISIBLE + "=1"
+ " AND " + Calendars.ACCOUNT_TYPE + "!='" + CalendarContract.ACCOUNT_TYPE_LOCAL + "')";

static final String CALENDARS_WHERE = Calendars._ID + "=?";

Expand Down

0 comments on commit 61fb87a

Please sign in to comment.