* Due to the vagaries of the mozilla RDF implementation, folders and * bookmark entries are handled differently. For Folders, we don't * create a nativeRDFNode at the outset. Rather, we just create the * properties table and stock it with the known keys, then wait for the * nativeRDFNode to be created en addBookmark. * The adding of bookmark folders is done through the RDF DoCommand * interface. The DoCommand interface creates the nsIRDFResource on * your behalf. We use an nsIRDFObserver to obtain the created resource * as the DoCommand executes. The following files are in this fix. A src_moz/wsRDFObserver.cpp A src_moz/wsRDFObserver.h M classes_spec/org/mozilla/webclient/BookmarkEntry.java M classes_spec/org/mozilla/webclient/test/EMWindow.java M classes_spec/org/mozilla/webclient/wrapper_native/BookmarkEntryImpl.java M classes_spec/org/mozilla/webclient/wrapper_native/BookmarksImpl.java M classes_spec/org/mozilla/webclient/wrapper_native/RDFTreeNode.java M src_moz/Makefile.win M src_moz/Makefile.in M src_moz/RDFActionEvents.cpp M src_moz/RDFActionEvents.h M src_moz/RDFTreeNode.cpp M src_moz/rdf_util.cpp M src_moz/rdf_util.h M src_moz/motif/NativeLoaderStub.cpp M src_share/jni_util.cpp M src_share/jni_util.h git-svn-id: svn://10.0.0.236/branches/JAVADEV_RTM_20001102@83504 18797224-902f-48f8-a5cc-f745e15eee43
113 lines
3.3 KiB
C++
113 lines
3.3 KiB
C++
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
*
|
|
* The contents of this file are subject to the Netscape Public
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
* except in compliance with the License. You may obtain a copy of
|
|
* the License at http://www.mozilla.org/NPL/
|
|
*
|
|
* Software distributed under the License is distributed on an "AS
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
* implied. See the License for the specific language governing
|
|
* rights and limitations under the License.
|
|
*
|
|
* The Original Code is mozilla.org code.
|
|
*
|
|
* The Initial Developer of the Original Code is Netscape
|
|
* Communications Corporation. Portions created by Netscape are
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
* Rights Reserved.
|
|
*
|
|
*
|
|
* Contributor(s): Ed Burns <edburns@acm.org>
|
|
*/
|
|
|
|
#include "wsRDFObserver.h"
|
|
|
|
#include "rdf_util.h"
|
|
|
|
#include "plstr.h" // for PL_strstr
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
// nsISupports implementation
|
|
|
|
NS_IMPL_ADDREF(wsRDFObserver)
|
|
NS_IMPL_RELEASE(wsRDFObserver)
|
|
|
|
NS_INTERFACE_MAP_BEGIN(wsRDFObserver)
|
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
|
NS_INTERFACE_MAP_ENTRY(nsIRDFObserver)
|
|
NS_INTERFACE_MAP_END
|
|
|
|
wsRDFObserver::wsRDFObserver()
|
|
{
|
|
NS_INIT_REFCNT();
|
|
}
|
|
|
|
wsRDFObserver::~wsRDFObserver() {}
|
|
|
|
// nsIRDFObserver implementation
|
|
|
|
NS_IMETHODIMP wsRDFObserver::OnAssert(nsIRDFDataSource *aDataSource,
|
|
nsIRDFResource *aSource,
|
|
nsIRDFResource *aProperty,
|
|
nsIRDFNode *aTarget)
|
|
{
|
|
nsresult rv;
|
|
nsCOMPtr<nsIRDFResource> nodeResource;
|
|
PRBool isContainer;
|
|
|
|
nodeResource = do_QueryInterface(aTarget);
|
|
if (nodeResource) {
|
|
rv = gRDFCU->IsContainer(gBookmarksDataSource, nodeResource,
|
|
&isContainer);
|
|
if (isContainer) {
|
|
folder = nodeResource;
|
|
}
|
|
}
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
nsIRDFResource *wsRDFObserver::getFolder()
|
|
{
|
|
return folder;
|
|
}
|
|
|
|
NS_IMETHODIMP wsRDFObserver::OnUnassert(nsIRDFDataSource *aDataSource,
|
|
nsIRDFResource *aSource,
|
|
nsIRDFResource *aProperty,
|
|
nsIRDFNode *aTarget)
|
|
{
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
NS_IMETHODIMP wsRDFObserver::OnChange(nsIRDFDataSource *aDataSource,
|
|
nsIRDFResource *aSource,
|
|
nsIRDFResource *aProperty,
|
|
nsIRDFNode *aOldTarget,
|
|
nsIRDFNode *aNewTarget)
|
|
{
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
NS_IMETHODIMP wsRDFObserver::OnMove(nsIRDFDataSource *aDataSource,
|
|
nsIRDFResource *aOldSource,
|
|
nsIRDFResource *aNewSource,
|
|
nsIRDFResource *aProperty,
|
|
nsIRDFNode *aTarget)
|
|
{
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
NS_IMETHODIMP wsRDFObserver::BeginUpdateBatch(nsIRDFDataSource *aDataSource)
|
|
{
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
NS_IMETHODIMP wsRDFObserver::EndUpdateBatch(nsIRDFDataSource *aDataSource)
|
|
{
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
|