Changes

Jump to: navigation, search

User:Jminta/Account Manager Notes

2,903 bytes removed, 14:23, 25 January 2008
this part was a dumb idea
nsIPropertyBag onShutdown();
};
</pre>
 
=== msgIFolderTreeService ===
The <code>msgIFolderTreeService</code> handles the display of data-sources within the main TB window. Front-end callers should use this service's methods to create their displays, since temporary data-sources may have been created.
 
Proposed interfaces:
<pre>
[scriptable, uuid(xxx)]
interface msgIFolderTreeService : nsISupports {
/**
* Adds a new source that this service should query in building the folder
* tree. Also fires a notification that a new source has been registered so
* that other displays can update themselves.
*
* @param source the new source to query for display information
*
* @note Each data-source must re-add themselves on startup.
*/
void addDataSource(in msgIFolderItem source);
 
/**
* Removes a previously added source of display data.
*
* @param source the data source to remove
*/
void removeDataSource(in msgIFolderItem source);
};
 
/**
* This interface should be implemented by any data-source wishing to be shown
* in the folder-tree or otherwise displayed in the main TB window.
*/
[scriptable, uuid(xxx)]
interface msgIFolderTreeItem : nsISupports {
void getChildren();
void onSelected();
readonly attribute AString displayText;
//xxx icon
//xxx styling
void addObserver()
void removeObserver()
};
</pre>
 
==== code snippets ====
The current "account manager" UI would do something like the following to create a new mail account.
<pre>
var acct = Cc["acct-contractid"].createInstance(Ci.msgIDataSource);
acct.email = "foo@bar.com"
acct.server = whateverObject;
var ds = Cc["data-store-contract-id"].getService(Ci.msgIDataStore);
ds.registerDataSource("acct-contractid", acct);
var folderDisplay = Cc["folder-display-contract-id"].getService(Ci.msgIFolderTreeService);
folderDisplay.addDataSource(acct);
</pre>
The previously mentioned temporary data-sources (like feed preview) would omit the two lines dealing with "ds".
 
Notice that this allows several new degrees of flexibility. First, a non-account can register with the folder service.
<pre>
var calendarDataSource = {
getChildren: function() { return calendarManager.getCalendars({}); },
onSelected: function() {
// toggle into calendar view
},
// blah blah rest of interface
};
 
var folderDisplay = Cc["folder-display-contract-id"].getService(Ci.msgIFolderTreeService);
folderDisplay.addDataSource(calendarDataSource);
</pre>
 
A session-store service (preserving emails being composed during crash) can register.
<pre>
var crashStore = {
initialize: function(aId, aProps) {
var savedDataFile = aProps.getProperty("fileurl");
//reload data
},
onShutdown: function() { return {"fileurl": this._fileurl}; }
};
var ds = Cc["data-store-contract-id"].getService(Ci.msgIDataStore);
ds.registerDataSource("crash-contractid", crashStore);
</pre>
289
edits

Navigation menu