Opened 18 years ago

Closed 6 years ago

Last modified 5 years ago

#1208 closed enhancement (duplicate)

Adding a "Query"-icon (easy)

Reported by: humdinger Owned by: stippi
Priority: normal Milestone:
Component: Applications/Mail Version: R1/pre-alpha1
Keywords: Cc: scorbett@…
Blocked By: #5141 Blocking: #3318
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 17 years ago.
Diff file, needs to be reviewed.
Mail - Query Toolbar Icon.diff (2.4 KB ) - added by anxiety 16 years ago.

Download all attachments as: .zip

Change History (25)

comment:1 by humdinger, 18 years ago

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 by wkornewald, 18 years ago

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

by anxiety, 17 years ago

Attachment: 20070816 - Ticket 1208.diff added

Diff file, needs to be reviewed.

comment:3 by anxiety, 17 years ago

This code could definitely use some reviewing. Any takers?

comment:4 by axeld, 17 years ago

Owner: changed from axeld to stippi

comment:5 by stippi, 17 years ago

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 by axeld, 17 years ago

Cc: anxiety added

Any news from this?

comment:7 by stippi, 17 years ago

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?

in reply to:  7 comment:8 by humdinger, 17 years ago

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 :)

by anxiety, 16 years ago

comment:9 by anxiety, 16 years ago

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 by koki, 16 years ago

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 by anxiety, 16 years ago

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.

in reply to:  11 ; comment:12 by koki, 16 years ago

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?

in reply to:  12 ; comment:13 by anxiety, 16 years ago

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. :)

in reply to:  13 comment:14 by koki, 16 years ago

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 by humdinger, 15 years ago

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 by tegaru, 15 years ago

Cc: scorbett@… added

comment:17 by scottmc, 14 years ago

patch: 01

comment:18 by humdinger, 14 years ago

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 by humdinger, 14 years ago

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

comment:20 by mmlr, 13 years ago

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 by mmlr, 13 years ago

patch: 10

comment:22 by waddlesplash, 6 years ago

Blocked By: 5141 added
Resolution: duplicate
Status: newclosed

The first part of #5141 has already been implemented, so it seems that approach is being taken instead of this one.

comment:23 by nielx, 5 years ago

Milestone: R1

Remove milestone for tickets with status = closed and resolution != fixed

Note: See TracTickets for help on using tickets.