Edit entries as default action (TB 91)

For discussing the Mozilla Calendar, Sunbird and Lightning projects.
ton85
Posts: 163
Joined: May 30th, 2005, 7:18 am

Re: Edit entries as default action (TB 91)

Post by ton85 »

morat wrote: I'm not sure how to change the default. I don't know how to synthesize a down keypress so the "Edit all occurrences" button is selected.

I tried to switch the label and accesskey and oncommand attributes for the two buttons, but that didn't work.
The code you posted doesn't appear to do anything differently.

Even if an "edit all" selection is not possible, are you saying it is not possible to replicate the action that is called by right click > Edit either ?
For non-recurring events, nothing will change, but for recurring events the dialog box appears asking what to edit.
morat
Posts: 6403
Joined: February 3rd, 2009, 6:29 pm

Re: Edit entries as default action (TB 91)

Post by morat »

I think I misread your "One small issue" post so disregard my last post.
ton85
Posts: 163
Joined: May 30th, 2005, 7:18 am

Re: Edit entries as default action (TB 91)

Post by ton85 »

morat wrote: I'm not sure how to change the default. I don't know how to synthesize a down keypress so the "Edit all occurrences" button is selected.
I noticed that when opening an event from the "find events" window, all recurring events are opened in "all occurrences" mode. If there was a way to figure out which code is run to open an event from that window, then this could be potentially be a solution.
ton85
Posts: 163
Joined: May 30th, 2005, 7:18 am

Re: Edit entries as default action (TB 91)

Post by ton85 »

ton85 wrote:
morat wrote: I'm not sure how to change the default. I don't know how to synthesize a down keypress so the "Edit all occurrences" button is selected.
I noticed that when opening an event from the "find events" window, all recurring events are opened in "all occurrences" mode. If there was a way to figure out which code is run to open an event from that window, then this could be potentially be a solution.
If anybody else is looking for a fix how to bring back the recurring events dialog when editing calendar events, the following solution works:
https://bugzilla.mozilla.org/show_bug.c ... 685007#c96

The downside is that this modification most likely will have to be reapplied every time Thunderbird is updated.
morat
Posts: 6403
Joined: February 3rd, 2009, 6:29 pm

Re: Edit entries as default action (TB 91)

Post by morat »

ton85 wrote:One small issue I noticed is that there isn't a dialog for recurring events that asks whether to edit all events or just this one. Personally, I think it should default to modifying all recurring entries, but I'm not sure if that's still possible with the new dialog structure introduced in TB 91.
ton85 wrote:Even if an "edit all" selection is not possible, are you saying it is not possible to replicate the action that is called by right click > Edit either? For non-recurring events, nothing will change, but for recurring events the dialog box appears asking what to edit.
I don't understand what you are asking.

First post you want to default to edit all occurrences which the events in the "Find Events" box already do. Second post you want to show the summary dialog with the type menu "Edit" button or maybe the "Edit Repeating Event" dialog which only shows when using the right click > Edit feature in the "Month" view for example.

Here is my understanding...

Screenshot
http://imgur.com/bQHtAlM

Alpha is a non-repeating event. Beta is a repeating event.

Post with code snippet: http://forums.mozillazine.org/viewtopic ... #p14901658

Before running the code snippet, double clicking the Beta event in the "Find Events" box opens the summary dialog with the "Edit" button.

Before running the code snippet, double clicking a particular Beta event in the "Month" view opens the summary dialog with the type menu "Edit" button. That menu has two choices...

* Edit only this occurrence
* Edit all occurrences

After running the code snippet, double clicking the Beta event in the "Find Events" box opens the edit event dialog directly. If I change the title for the Beta event, then all occurrences of the Beta event are changed. Notice the "Repeat:" menulist is enabled in the "all occurrences" mode in the edit event dialog.

After running the code snippet, double clicking a particular Beta event in the "Month" view opens the edit event dialog directly. If I change the title for the Beta event, then only this occurrence of the Beta event is changed. Notice the "Repeat:" menulist is disabled in the "only this occurrence" mode in the edit event dialog.

Thunderbird 102.0
Windows 10 Pro 21H2 32-bit
morat
Posts: 6403
Joined: February 3rd, 2009, 6:29 pm

Re: Edit entries as default action (TB 91)

Post by morat »

Here is a fix that opens the summary dialog with the type menu "Edit" button when double clicking a particular recurring event in the "Month" view. Otherwise, the fix works like the original code snippet.

Code: Select all

/* Thunderbird userChrome.js */

// tested with Thunderbird 102 only

(function () {
  if (location == "chrome://messenger/content/messenger.xhtml") {
    setTimeout(function () {
      try {
        openEventDialogForViewing = function (item) {
          function onDialogComplete(newItem, calendar, originalItem, listener, extresponse) {
            doTransaction("modify", newItem, calendar, originalItem, listener, extresponse);
          }
          var isRecurring = item.parentItem !== item;
          if (isRecurring) {
            openEventDialog(item, item.calendar, "view", onDialogComplete);
          } else {
            openEventDialog(item, item.calendar, "modify", onDialogComplete);
          }
        };
      } catch (e) {
        Components.utils.reportError(e);
      }
    }, 1000);
  }
})();
Original code snippet: http://forums.mozillazine.org/viewtopic ... #p14901658
ton85
Posts: 163
Joined: May 30th, 2005, 7:18 am

Re: Edit entries as default action (TB 91)

Post by ton85 »

morat wrote: I don't understand what you are asking.
I'll try to make it clearer.
All descriptions assume double-clicking on an event from the monthly calendar view.


Default TB 91+ behavior:
  • summary box with edit dialog for all calendar events :(.
Original solution provided:
  • non-recurring events open like in TB 78 :).
  • Recurring events are always opened for that particular occurrence only, as opposed to the entire series. :( In TB 78, that would be like selecting "this occurrence only".
  • The only way to "edit all occurrences" is to right click on a recurring event > Edit, which will bring back the TB 78 dialog.
Preferred solution:
  • Recurring events should open as "edit all occurrences" without asking. That's also how recurring events are opened from the "find events" window.
2nd best solution if preferred solution is not possible:
morat
Posts: 6403
Joined: February 3rd, 2009, 6:29 pm

Re: Edit entries as default action (TB 91)

Post by morat »

ton85 wrote:Preferred solution:
Here is a fix that opens the edit event dialog directly in the "all occurrences" mode when double clicking a particular recurring event in the "Month" view. Otherwise, the fix works like the original code snippet.

Code: Select all

/* Thunderbird userChrome.js */

// tested with Thunderbird 102 only

(function () {
  if (location == "chrome://messenger/content/messenger.xhtml") {
    setTimeout(function () {
      try {
        openEventDialogForViewing = function (item) {
          function onDialogComplete(newItem, calendar, originalItem, listener, extresponse) {
            doTransaction("modify", newItem, calendar, originalItem, listener, extresponse);
          }
          var isRecurring = item.parentItem !== item;
          if (isRecurring) {
            modifyEventWithDialog(item.parentItem, false);
          } else {
            openEventDialog(item, item.calendar, "modify", onDialogComplete);
          }
        };
      } catch (e) {
        Components.utils.reportError(e);
      }
    }, 1000);
  }
})();
Original code snippet: http://forums.mozillazine.org/viewtopic ... #p14901658

Reference
http://searchfox.org/comm-esr102/search ... Occurrence
http://searchfox.org/comm-esr102/search ... ccurrences
ton85
Posts: 163
Joined: May 30th, 2005, 7:18 am

Re: Edit entries as default action (TB 91)

Post by ton85 »

Fantastic! Working great.
Post Reply