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

Edit entries as default action (TB 91)

Post by ton85 »

TB91 has a new summary dialog, that then requires an additional click to be able to get to the edit dialog (same dialog that shows up when first creating a new entry).
Is there a way to bypass that, so that it always goes straight to editing, just like in previous versions?
User avatar
WaltS48
Posts: 5141
Joined: May 7th, 2010, 9:38 am
Location: Pennsylvania, USA

Re: Edit entries as default action (TB 91)

Post by WaltS48 »

Right-click on the event or task and select Edit from the context menu.
Linux Desktop - AMD Athlon(tm) II X3 455 3.3GHz | 8.0GB RAM | GeForce GT 630
Windows Notebook - AMD A8 7410 2.2GHz | 6.0GB RAM | AMD Radeon R5
ton85
Posts: 163
Joined: May 30th, 2005, 7:18 am

Re: Edit entries as default action (TB 91)

Post by ton85 »

I was hoping for a double click and remove that summary dialog completely.
morat
Posts: 6403
Joined: February 3rd, 2009, 6:29 pm

Re: Edit entries as default action (TB 91)

Post by morat »

I can use a enter key press to open the event dialog directly.

AFAIK, there isn't a pref to force a double click to open the event dialog directly.

Reference
http://searchfox.org/comm-esr78/search? ... ventDialog
http://searchfox.org/comm-central/searc ... ventDialog
http://searchfox.org/comm-central/searc ... th=editing

TB78 uses mode="modify" on double click. TB91 uses mode="view" on double click.
DjNDB
Posts: 8
Joined: November 30th, 2004, 1:00 pm

Re: Edit entries as default action (TB 91)

Post by DjNDB »

I came here because this UI change drives me nuts. I use the calendar to store information related to each day within the description and add/edit items to an entry often. Maybe not an intended use, but it's a tool that worked well for me and has a search function. I wouldn't know what to replace it with without doing a bunch of software development and don't even want to think about migrating over a decade of entries.

I've been trying to get used to it for a few days, but I just get pissed off every time I do an edit, because I've been doing it multiple times daily for years and trained myself to easily "double click, copy/edit text, save and close" without friction.

Now I consistently double click, try to edit the text, realize I can't, get reminded of this pointless forced workflow change, and move the mouse over quite some distance to click the edit button annoyed.
That is not a healthy experience to have 10-15 times a day. I try to keep even little annoyances out of my life, since they add up in how we feel.

I hope I can figure out a way to change it, without having to compile and maintain my own build.
morat
Posts: 6403
Joined: February 3rd, 2009, 6:29 pm

Re: Edit entries as default action (TB 91)

Post by morat »

DjNDB wrote:I hope I can figure out a way to change it, without having to compile and maintain my own build.
You can overwrite the openEventDialogForViewing function using the userChromeJS extension. (for advanced users only)

Code: Select all

/* Thunderbird userChrome.js */

// Thunderbird 68 uses the messenger.xul page.
// Thunderbird 78 uses the messenger.xhtml page.
// Thunderbird 91 uses the messenger.xhtml page.

(function () {
  if (location == "chrome://messenger/content/messenger.xul" ||
      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);
          }
          openEventDialog(item, item.calendar, "modify", onDialogComplete);
        };
      } catch (e) {
        Components.utils.reportError(e);
      }
    }, 1000);
  }
})();
userChromeJS by jikamens (compatible with TB 68 and TB 78 and TB 91)
http://addons.thunderbird.net/thunderbird/addon/986610

Instructions:

1. install userChromeJS extension
2. close email client
3. create or edit the userChrome.js file in the chrome folder
4. open email client

I tested the code and it works, however, I'm not sure if the params are correct for the openEventDialog function.

Reference
http://searchfox.org/comm-central/searc ... ForViewing
http://searchfox.org/comm-central/searc ... tDialog%28
http://searchfox.org/comm-central/sourc ... ersion.txt
DjNDB
Posts: 8
Joined: November 30th, 2004, 1:00 pm

Re: Edit entries as default action (TB 91)

Post by DjNDB »

morat wrote:
DjNDB wrote:I hope I can figure out a way to change it, without having to compile and maintain my own build.
You can overwrite the openEventDialogForViewing function using the userChromeJS extension. (for advanced users only)
Thank you so much, it works perfectly. I am familiar with chrome modifications on Firefox but never needed them for Thunderbird until now.
I had no clue userchrome.js existed, and even then, it would have probably taken me hours of debugging to figure out where to change things.

I expect it to break at some point in the future, but then at least I will know where to start looking.
Karen-KISSWPW
Posts: 1
Joined: October 9th, 2021, 3:20 pm

Re: Edit entries as default action (TB 91)

Post by Karen-KISSWPW »

Thank you so much for this thread and the solution.

I change my calendar events on a daily basis too. The edit button wasn't even showing in my event windows (the windows were not big enough) so I couldn't see how to change the events at all!

This solution worked for me too.
Thanks morat.
morat
Posts: 6403
Joined: February 3rd, 2009, 6:29 pm

Re: Edit entries as default action (TB 91)

Post by morat »

You're welcome.
ton85
Posts: 163
Joined: May 30th, 2005, 7:18 am

Re: Edit entries as default action (TB 91)

Post by ton85 »

morat wrote: You can overwrite the openEventDialogForViewing function using the userChromeJS extension. (for advanced users only)
Do you happen to know how to toggle the "All day event" box by default?
It seems that a lot of folks who are irked by the edit button, would appreciate that change.
morat
Posts: 6403
Joined: February 3rd, 2009, 6:29 pm

Re: Edit entries as default action (TB 91)

Post by morat »

ton85 wrote:Do you happen to know how to toggle the "All day event" box by default?
Unfortunately, the userChromeJS addon doesn't support the New Event window, but you could add support by editing the manifest.json and experiments.js files in the .xpi file.

* manifest.json

Code: Select all

- "version": "1.0",
+ "version": "1.0.1",
* experiments.js

Code: Select all

+ urls.push("chrome://calendar/content/calendar-event-dialog.xhtml");
  // Adds a listener to detect new windows.
* <profile folder>\chrome\userChrome.js

Code: Select all

/* Thunderbird userChrome.js */

// tested with Thunderbird 91 only

(function () {
  if (location == "chrome://calendar/content/calendar-event-dialog.xhtml") {
    setTimeout(function () {
      var iframe = document.getElementById("calendar-item-panel-iframe");
      var win = iframe.contentWindow;
      if (win.document.getElementById("item-title").placeholder == "New Event" &&
          win.document.getElementById("item-title").value == "") {
        win.document.getElementById("event-all-day").click();
      }
    }, 1000);
  }
})();
If you are not an English user, then you would need to change the "New Event" string to another language.

Code: Select all

alert(cal.l10n.getCalString("newEventDialog")); // New Event
Reference
http://searchfox.org/comm-esr91/search?q=event-all-day
http://searchfox.org/comm-esr91/search?q=onUpdateAllDay

Sorry, I don't want to hack the userChromeJS addon for people.

I would test the script in the developer toolbox before hacking the userChromeJS addon.

Similar thread: http://forums.mozillazine.org/viewtopic ... &t=3071454
ton85
Posts: 163
Joined: May 30th, 2005, 7:18 am

Re: Edit entries as default action (TB 91)

Post by ton85 »

morat wrote: Unfortunately, the userChromeJS addon doesn't support the New Event window, but you could add support by editing the manifest.json and experiments.js files in the .xpi file.
Thank you!
Works like a charm!
ton85
Posts: 163
Joined: May 30th, 2005, 7:18 am

Re: Edit entries as default action (TB 91)

Post by ton85 »

morat wrote: You can overwrite the openEventDialogForViewing function using the userChromeJS extension. (for advanced users only)

Code: Select all

/* Thunderbird userChrome.js */

// Thunderbird 68 uses the messenger.xul page.
// Thunderbird 78 uses the messenger.xhtml page.
// Thunderbird 91 uses the messenger.xhtml page.

(function () {
  if (location == "chrome://messenger/content/messenger.xul" ||
      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);
          }
          openEventDialog(item, item.calendar, "modify", onDialogComplete);
        };
      } catch (e) {
        Components.utils.reportError(e);
      }
    }, 1000);
  }
})();
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.
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.
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.

Code: Select all

/* Thunderbird userChrome.js */

// tested with Thunderbird 102 only

(function () {
  if (location == "chrome://calendar/content/calendar-occurrence-prompt.xhtml") {
    setTimeout(function () {
      var a = document.getElementById("accept-occurrence-button"); // Edit only this occurrence
      var b = document.getElementById("accept-parent-button");     // Edit all occurrences
      var a_label     = a.getAttribute("label");
      var a_accesskey = a.getAttribute("accesskey");
      var a_oncommand = a.getAttribute("oncommand");
      var b_label     = b.getAttribute("label");
      var b_accesskey = b.getAttribute("accesskey");
      var b_oncommand = b.getAttribute("oncommand");
      a.setAttribute("label",     b_label);
      a.setAttribute("accesskey", b_accesskey);
      a.setAttribute("oncommand", b_oncommand);
      b.setAttribute("label",     a_label);
      b.setAttribute("accesskey", a_accesskey);
      b.setAttribute("oncommand", a_oncommand);
    }, 1000);
  }
})();
Reference
http://searchfox.org/comm-esr102/source ... ompt.xhtml
http://searchfox.org/comm-esr102/source ... -prompt.js
Post Reply