Opened 12 years ago

Last modified 7 years ago

#1208 new enhancement

Adding a "Query"-icon (easy)

Reported by: humdinger Owned by: stippi
Priority: normal Milestone: R1
Component: Applications/Mail Version: R1/pre-alpha1
Keywords: Cc: scorbett@…
Blocked By: Blocking: #3318
Has a Patch: no Platform: All

Description

Something more useful than the "Inbox" and "Mail"-icons IMO: A "Query"-icon with a dropdown-arrow besides it. Clicking it results in a dropdown menu offering a number of queries, that can be defined in ~/config/settings/Mail/Queries. A few will be predefined there: "Same Sender", "Same Recipient", "Same Subject". Maybe more.

Those open of course the respective queries. [Borat: Nice!]

Attachments (2)

20070816 - Ticket 1208.diff (8.2 KB) - added by anxiety 11 years ago.
Diff file, needs to be reviewed.
Mail - Query Toolbar Icon.diff (2.4 KB) - added by anxiety 10 years ago.

Download all attachments as: .zip

Change History (23)

comment:1 Changed 12 years ago by humdinger

Oh, and an "Edit Template..." entry like the "New" thing of Tracker that jumps right to ~/config/settings/Mail/Queries to add your own thang.

comment:2 Changed 12 years ago by wkornewald

Summary: Adding a "Query"-iconAdding a "Query"-icon (easy)

Changed 11 years ago by anxiety

Attachment: 20070816 - Ticket 1208.diff added

Diff file, needs to be reviewed.

comment:3 Changed 11 years ago by anxiety

This code could definitely use some reviewing. Any takers?

comment:4 Changed 11 years ago by axeld

Owner: changed from axeld to stippi

comment:5 Changed 11 years ago by stippi

anxiety,

I have reviewed and applied your patch here locally. I have found one problem in your code which you might be interested in:

char* copyOfString = (char*)malloc(bString.Length()); sprintf(copyOfString, "%s", bString.String());

... will overwrite one byte of memory. bString.Length() returns the length of the string _excluding_ the byte necessary for the null termination. I guess sprintf() will write the byte anyways. So correct would be to allocate Length() + 1 bytes. Even easier is using strdup() though.

The rest of your patch was fine. Thanks for the contribution! What's your real name I want to add you to Contributors.

comment:6 Changed 11 years ago by axeld

Cc: anxiety added

Any news from this?

comment:7 Changed 11 years ago by stippi

Could someone explain to me how this is "supposed" to work? Am I creating the correct kind of queries? Is it too late in the day and my brain too tired?

comment:8 in reply to:  7 Changed 11 years ago by humdinger

Replying to stippi:

Could someone explain to me how this is "supposed" to work? Am I creating the correct kind of queries? Is it too late in the day and my brain too tired?

I'm not sure you refer to your code so far or the principle in general from a user's perspective. If it's the latter...

The Mail app should use the queries defined in /boot/home/mail/queries and fill out the search strings with the according ones of the current email.

So, the template query "Same Sender" would look like this: ((MAIL:from=="*[tT][eE][sS][tT]*")&&(BEOS:TYPE=="text/x-email"))

When invoking the menu "Query|Same Sender", Mail would replace the search string (or strings when someone created a query template with more than one attribute to search) with the MAIL:from attribute of the current email file.

The same for "Same Subject", replacing MAIL:subject. And "Same Recipient" (only really useful when composing a mail or opening one from your Sent folder, since for anything else you'll yourself be the recipient... :) ), replacing MAIL:to

Selecting "Edit Queries..." (which IMO should be renamed to "Create new Query...) should open the folder /boot/home/mail/queries and a "Find..." query window set to "E-Mail by Attribute". Then you can save your new query template via drag&drop. Existing queries are altered as usual by invoking them and choosing "Edit Query" (Alt-E) from its menu.

I like the submenu approach in the Query menu (though that doesn't work right now, does it?). You can quickly open an email from there directly. There should be sanity checks if your query would have hundreds of results though... Maybe an entry after 20 items called "...more..." that would do the same thing as if you clicked on the parent menu entry, e.g. "Same Sender", which should open the query result window.

Question is: How do you display the results in the submenu? If you query for Same Sender, showing the queried attribute "FROM" wouldn't make sense. I'd all be the Same Sender, of course... Here, the subject would be informative. Vice versa with Same Subject, where the sender (FROM) would be nice... I guess we'd have to settle on the ugly filename. If we don't special-case the above two queries. Or we forget about the submenu and just open the query result window.

This is getting long. I apologise and will elaborate if you need more opinion :)

Changed 10 years ago by anxiety

comment:9 Changed 10 years ago by anxiety

Cc: anxiety removed

Uploaded a patch to implement the query toolbar button and popup menu. Still needs a new icon, I set it to reuse the Mail button icon.

I still haven't had a chance to test this with actual mail so I really have no idea if it even works.

I'll work on humdinger's suggestion next but it may be a bit more then I can do. Perhaps those should be split off into new tickets?

comment:10 Changed 10 years ago by koki

Cc: kokitomare@… added

Is the queries icon supposed to be present in the Mail app? I ask because I am running hrev27056 and I don't see it (I do see there is a Queries menu though, though I am not sure if it was there before or not).

comment:11 Changed 10 years ago by anxiety

I don't believe the patch to add the icon to the toolbar has been reviewed and committed yet... you should still be able to access the same functionality through the menu if you're interested.

comment:12 in reply to:  11 ; Changed 10 years ago by koki

Replying to anxiety:

you should still be able to access the same functionality through the menu if you're interested.

I just noticed that. However, accessing queries from the Queries menu doesn't work. Is this feature not implemented yet, or is this a bug and should I file a separate bug report in that case?

comment:13 in reply to:  12 ; Changed 10 years ago by anxiety

Replying to koki:

I just noticed that. However, accessing queries from the Queries menu doesn't work. Is this feature not implemented yet, or is this a bug and should I file a separate bug report in that case?

My guess is that, by default, you don't have mail/queries folder and/or any queries in it. This feature still needs to be developed more, such as finishing humdinger's suggestions and creating a few sample queries. Hmm, maybe I have time to do that right now. :)

comment:14 in reply to:  13 Changed 10 years ago by koki

Replying to anxiety:

My guess is that, by default, you don't have mail/queries folder and/or any queries in it.

I do; I placed an email query (known to run from Tracker) in the...

/boot/home/mail/queries

...folder to test this.

This feature still needs to be developed more, such as finishing humdinger's suggestions and creating a few sample queries. Hmm, maybe I have time to do that right now. :)

That would be nice. ;)

comment:15 Changed 9 years ago by humdinger

The Query menu still doesn't work, or I'm using it wrong.
I've tried putting a query with ((MAIL:from=="**")&&(BEOS:TYPE=="text/x-email") into ~/mail/queries. It appears in Mail's query menu, but is empty. I tried as a Query filetype and also as Query-Template. No go.

Anyone interested in finishing this feature. It would be really cool! Basically, the "" of (MAIL:from=="") has to be replaced with the from-field of the currently opened mail.

comment:16 Changed 9 years ago by tegaru

Cc: scorbett@… added

comment:17 Changed 8 years ago by scottmc

Has a Patch: set

comment:18 Changed 8 years ago by humdinger

Blocking: 3318 added

(In #3318) This is a duplicate of #1208 which I'd love to see solved... I looked at the code, but I'm too dumb to make the necessary changes... :)

comment:19 Changed 8 years ago by humdinger

A "slightly" more ambitious approach is described in #5141.

comment:20 Changed 7 years ago by mmlr

As is, the patch doesn't seem to work so I'm removing the flag. Also #5141 would obsolete this patch/ticket if implemented.

comment:21 Changed 7 years ago by mmlr

Has a Patch: unset
Note: See TracTickets for help on using tickets.