You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Tobias Bocanegra (JIRA)" <ji...@apache.org> on 2015/11/26 07:56:10 UTC

[jira] [Resolved] (CB-10087) OSX: facilitate easy preferences menu item handling

     [ https://issues.apache.org/jira/browse/CB-10087?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tobias Bocanegra resolved CB-10087.
-----------------------------------
       Resolution: Fixed
    Fix Version/s: Master

> OSX: facilitate easy preferences menu item handling
> ---------------------------------------------------
>
>                 Key: CB-10087
>                 URL: https://issues.apache.org/jira/browse/CB-10087
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: OSX
>    Affects Versions: Master
>            Reporter: Tobias Bocanegra
>            Assignee: Tobias Bocanegra
>             Fix For: Master
>
>
> currently it is not easy possible to capture the applications preferences menu item, except via the title, which is a bit unstable.
> either we define a tag value or a predefined action selector that can be detected. for example:
> {noformat}
> - (void) pluginInitialize {
>     [super pluginInitialize];
>     NSMenu* appMenu = self.viewController.window.menu;
>     NSMenu* mainMenu = [appMenu itemAtIndex:0].submenu;
>     bool found = false;
>     for (NSMenuItem* item in mainMenu.itemArray) {
>         if (item.action == @selector(onPreferences:)) {
>             // we simply adjust the target for the preferences menu item to this plugin instance
>             item.target = self;
>             found = true;
>             break;
>         }
>     }
>     if (!found) {
>         NSLog(@"Warning, didn't find preferences menu item.");
>     }
> }
> - (IBAction) onPreferences:(id) sender {
>     NSLog(@"onPreferences...");
> }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org