Thread: Main Toolbar
View Single Post
  #8 (permalink)  
Old 01-22-2009, 06:44 PM
rrao rrao is offline
Zimbra Employee
 
Posts: 187
Default

It works for me since I wrote it . you just need to get the code that adds button on toolbars

Code:
com_zimbra_discover.prototype.initToolbarButton = function() {
	if (!appCtxt.get(ZmSetting.MAIL_ENABLED))
		this._toolbar = true;

	if (this._toolbar)
		return;
	// Add the discover Button to the conversation page
	var viewid = appCtxt.getAppViewMgr().getCurrentViewId();
	if(viewid == ZmId.VIEW_CONVLIST) {
		this._cnvController = AjxDispatcher.run("GetConvListController");
		this._cnvController._discover = this;
		if (!this._cnvController._toolbar) {
			// initialize the conv controller's toolbar
			this._cnvController._initializeToolBar();
		}
		this._toolbar = this._cnvController._toolbar.CLV;
	} else if(viewid == ZmId.VIEW_TRAD) {
		this._tradController = AjxDispatcher.run("GetTradController");
		this._tradController._discover = this;
		if (!this._tradController._toolbar) {
			// initialize the trad controller's toolbar
			this._tradController._initializeToolBar();
		}
		this._toolbar = this._tradController._toolbar.TV;
	}

	if(!this._toolbar)
		return;//dont add button

	var indx = this._toolbar.getItemCount() + 1;

	// Add button to toolbar
	if (!this._toolbar.getButton(com_zimbra_discover.discover)) {
		ZmMsg.discoverlabel = "discover!";
		ZmMsg.discovertip = "Opens websites based on topics of your choice";

		var btn = this._toolbar.createOp(
			com_zimbra_discover.discover,
		{
			text	: ZmMsg.discoverlabel,
			tooltip : ZmMsg.discovertip,
			index   :indx,
			image   : "dy-panelIcon"
		}
			);

		btn.addSelectionListener(new AjxListener(this, this.discBtnListener));
	}
};
__________________
Bugzilla - Wiki - Downloads - Before posting... Search!
Reply With Quote