Keypirinha / SDK

Keypirinha's Software Development Kit (SDK)
http://keypirinha.com
Other
43 stars 6 forks source link

Enhancement request: custom action description / label #2

Closed DrorHarari closed 5 years ago

DrorHarari commented 5 years ago

I have a plugin which let one call/email people (based on Outlook or VCF export). When I type CALL SOLER I get the options below:

image

As can be seen, I have multiple call options which are to different numbers but becasue they are all the same action, their description is also the same, e.g.. "Call the mobile number".

I am looking for a way to have the option to customize the action label when it is displayed, like:

image

I assume that this can be implemented with an optional method the plugin would implement that would get the targe, bag and action and would return an alternate string or None to keep the default.

polyvertex commented 5 years ago

The way they are designed for now, actions really are meant to be static branching for the on_execute method of your plugin. But the data to be processed must remain in the item itself. All of it.

However, this does not prevent you from adding an extra search step that will list all kinds of "pseudo-actions" to be associated with contact's item. This actually allows more flexibility that way since, for instance, you may parse contact's phone numbers at search time to know if they point to mobile phones, in which case you would add an extra pseudo-action item to "Text" your contact.

PS: this issue belongs to the Keypirinha/Keypirinha repository, not here!

DrorHarari commented 5 years ago

Thanks @polyvertex - so you say I can get this functionality by populating the next level options with the text I want and then use the default action taking a hint from the text or from something I placed in the bag?

polyvertex commented 5 years ago

I do not know the implementation details of your plugin but from what you described, it seems it would not be such a bad idea to allow for a last search step for more flexibility and potential future features.

I do not know from where you get contacts data but I think you should keep the data stored in the items objects to a minimum. Items should holds only references to the actual data. Typically ID numbers to a database and a type of action eventually. The real data being centralized, items remaining just pointers to it.

DrorHarari commented 5 years ago

Thanks, I take it as confirmation. BTW, I take the contact data either from an ActiveDirectory export or from a Google Contacts export. I don't store anything more than a pointer in the items.