Plugins that can have tabs should implement the IHaveTabs interface.

Tab classes concept



Each plugin can have one ore more tabs opened at the same time, and different tabs belonging to the same plugin could have different semantics and meaning. For example, a single IM plugin can provide two kinds of tabs: chat tab and service discovery tab. The different kinds of tabs in LeechCraft are called tab classes.

Tabs of different classes can have different semantics. For example, tabs of one class could be opened by the user, while another tabs can only be opened (spontaneously) by the plugin, while there could be only one tab of a third class.

Different tab classes may have different priorities. Priority defines what tab should be opened when user requests to open a new tab without specifying the exact tab class he wants. When user requests a new tab, but doesn’t specify its type (for example, just hits Ctrl+T), priorities of two tab classes are compared: the priority of the class of the current tab and the highest priority among all the tabs. If current priority plus some delta is higher than maximum one, a new instance of current tab class is opened, otherwise the tab with the highest priority is opened. For example, if web browser tab has priority of 80, text editor — 70 and search plugin — 60, and delta is 15, then if current tab is web browser or search plugin, the new tab will be a web browser tab (since 60 + 15 < 80), but if the current tab is text editor’s one, then the new tab will also be a text editor (70 + 15 > 80).

The tab classes are described by the TabClassInfo structure.

IHaveTabs methods



The list of available tab classes should be returned from the IHaveTabs::GetTabClasses () method. This method should return a list of LeechCraft::TabClassInfo structs.

When a tab has been requested by the user, the IHaveTabs::TabOpenRequested (const QByteArray&) method would be called, passing the ID of the corresponding tab class, which is the one of the IDs returned from IHaveTabs::GetTabClasses () (the LeechCraft::TabClassInfo::TabClass_ member).

There is also a bunch of signals that should be present in classes implementing the IHaveTabs interface:



The widget added by the addNewTab must implement ITabWidget.

The widget parameter of the last five signals should be the widget previously added by the addNewTab signal.

ITabWidget



Widgets added by IHaveTabs should implement ITabWidget interface (documented here). This interface has following functions:

Logical paths and tabs grouping



To group tabs, logical paths are used. That way Tab++, for example, groups the tabs from Poshuku belonging to the same domain. To use logical paths, just set the WidgetLogicalPath property on your tab widgets to a QString containing slash-separated hierarchical tree-like structure and update it as necessary. LeechCraft would take care of the rest. For example:

widget->setProperty ("WidgetLogicalPath", "somedomain.com/Sample Web Page Title");