Results 1 to 4 of 4

Thread: Adding a Mail Toolbar Button - problem keeping focus.

  1. #1
    Join Date
    Apr 2011
    Location
    Brazil/Sao Paulo
    Posts
    21
    Rep Power
    4

    Question Adding a Mail Toolbar Button - problem keeping focus.

    Hi guys,

    I followed the default guide to add a button to mail toolbar, as follow:

    Code:
    uspSuporte.prototype.initializeToolbar =
    function(app, toolbar, controller, viewId) {
    
        if (viewId == ZmId.VIEW_CONVLIST || viewId == ZmId.VIEW_TRAD) {
            // get the index of "View" menu so we can display the button after that
            var buttonIndex = 0;
            for (var i = 0; i < toolbar.opList.length; i++) {
                    if (toolbar.opList[i] == ZmOperation.VIEW_MENU) {
                            buttonIndex = i + 1;
                            break;
                    }
            }
    
            var buttonParams = {
                    text: this.getMessage("buttonName"),
                    tooltip: this.getMessage("tooltip"),
                    index: buttonIndex,
                    image: "suporteIcon"
            };
    
            // creates the button with an id and params containing the button details
            var button = toolbar.createOp("SUPPORT_BUTTON", buttonParams);
            button.addSelectionListener(new AjxListener(this, this._showForm));   
        }
    };
    This work great, until I clicked on the Inbox folder. After that, the button just "turn-off", to work again I have to reload zimbra. How I can fix it?

  2. #2
    Join Date
    Apr 2011
    Location
    Brazil/Sao Paulo
    Posts
    21
    Rep Power
    4

    Default

    Also, how can I put this button near the Search toolbar?

  3. #3
    Join Date
    Jul 2012
    Location
    Algiers
    Posts
    55
    Rep Power
    3

    Default

    Hi, you can change the button index to 1 to put it next to the mail button.

    As with the disabling problem I had the same issue with the contact form. I found a function in the API that gets called when a contact is edited, so I overloaded that function in my zimlet and activated the button like so (that function is onContactEdit) :

    Code:
    SugarBee.prototype.onContactEdit = function(view,contact,elementID){
        var toolbar = view.getController().getCurrentToolbar();
        toolbar.getButton("YourButtonIDHere").setEnabled(true);
    };
    I guess you can find a similar function in the API that gets called when you're editing a message. Take a look here : Zimlet JavaScript API Reference - ZmZimletBase


    Good luck !

  4. #4
    Join Date
    Apr 2011
    Location
    Brazil/Sao Paulo
    Posts
    21
    Rep Power
    4

    Default

    Thanks for the answer, ychauoche! I didn't find yet a similar function that do what I need on the mail App, but now I have something to look for!

    Also, I can use your solution in another zimlet that I'm going to develop here, two birds with a single stone!

Similar Threads

  1. Replies: 3
    Last Post: 11-28-2012, 08:08 AM
  2. Replies: 1
    Last Post: 05-15-2012, 10:25 PM
  3. Add another send button on the mail toolbar
    By berjos in forum Zimlets
    Replies: 4
    Last Post: 06-18-2010, 07:16 AM
  4. Replies: 1
    Last Post: 10-21-2009, 05:04 PM
  5. adding button to compose toolbar with a zimlet
    By sdouglass in forum Zimlets
    Replies: 1
    Last Post: 09-18-2006, 07:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •