Archived:Accessing data anywhere in application
In many situations, it is useful to have a method or a way to place data somewhere that could be accessed globally in the application. One of those ways is placing the global data in the Document class.
The Document class is the most appropriate place to keep the data which needs to be accessed from the whole application, according to the Document/View architecture. A global reference to the Document class instance if accessible through the AppUi's method Document(). This method has the following signature:
CEikDocument *Document() const;
This means that we should perform a cast on the result value to match our actual Document class, defined in the application. Now, here's how to access your Document instance:
// suppose your Document class is named as 'MyDocument'
MyDocument* doc = static_cast <MyDocument*> (CEikonEnv::Static()->EikAppUi()->Document() );
// now access your data
doc->myData = ... ;