You may simplify your code by checking directly the 'collapsed' property
of your toolbar RDF resource instead of walking through the whole
locastore db:
var tbId="chrome://browser/content/browser.xul#MyToolbar";
var isDisabled=DS.HasAssertion(
rdfService.GetResource(tbId),
rdfService.GetResource("collapsed"),
rdfService.GetLiteral("true"),
true
);
/mig
[EMAIL PROTECTED] wrote:
Hi,
First of all thanks to mig to give me idea light to local store....
I have finished the problem and i can now find whether my toolbar is
enabled or disabled. Here is the code if any one needs it any time...
Also please tell if I can make the code some more better.
function FindtoolbarInRdf()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"].
getService(Components.interfaces.nsIRDFService);
var DS = rdfService.GetDataSource('rdf:local-store');
DS =DS.QueryInterface(Components.interfaces.nsIRDFDataSource);
var all_res=DS.GetAllResources();
var t=" ";
for(var r=0; all_res.hasMoreElements(); r++)
{
var arcCursor;
if(t.length>5000)
break;
var res=all_res.getNext().QueryInterface(
Components.interfaces.nsIRDFResource);
var tool=res.Value;
//Here add your toolbar name
var b='chrome://browser/content/browser.xul#MyToolbar';
if(tool==b)
{
arcCursor = DS.ArcLabelsOut(res);
showArcs(res, arcCursor);
}
}
}
function showArcs(res, arcCursor)
{
var arcTargets;
var thisArc;
var rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"].
getService(Components.interfaces.nsIRDFService);
var DS = rdfService.GetDataSource('rdf:local-store');
DS =DS.QueryInterface(Components.interfaces.nsIRDFDataSource);
while(arcCursor.hasMoreElements())
{
thisArc = arcCursor.getNext().QueryInterface(
Components.interfaces.nsIRDFResource);
if(thisArc.Value=="collapsed")
{
arcTargets =DS.GetTargets( res, thisArc, true );
while(arcTargets.hasMoreElements())
{
thisTarget = arcTargets.getNext();
if (thisTarget instanceof
Components.interfaces.nsIRDFLiteral)
{
thisTarget.QueryInterface(
Components.interfaces.nsIRDFLiteral);
if(thisTarget.Value=="true")
alert('toolbar is disabled');
}
}
}
}
}
Thanks,
Vindy
[EMAIL PROTECTED] wrote:
Thanks a lot mig,
Let me try to do some thing with nsIRDFResource.
Thanks for ur fast replies
Vindys
Michel Gutierrez wrote:
As far as I understand, the toolbar is not disabled in the overlay. When
the toolbar is defined in the overlay, Firefox decides from its
localstore info whether the toolbar should be displayed.
You can access the localstore data programmatically using the RDF API
(nsIDatasource, nsIRDFResource, ...)
/mig
I saw the localstrore.rdf and found my extension with collapsed =true.
But is there a way to find programmically tht the toolbar is disabled
in my overlay.xul?
I m making a toolbar in mozilla firefox and right now i m struck in one
position. I want to know when my toolbar is disabled/enabled by right
clicking on toolbar and unticking my toolbar or by view -> toolbar.
I think you should be able to get this information from the localstore
database.
If your toolbar is disabled, you should have the property 'collapsed' of
your toolbar set to 'true'
Maybe there are better ways to do this.
_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom