Manage Bookmarks now works. You can click on links and the browser will go there.
git-svn-id: svn://10.0.0.236/trunk@121042 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -213,35 +213,6 @@ wsRDFGetChildAtEvent::handleEvent ()
|
||||
return (void *) result;
|
||||
} // handleEvent()
|
||||
|
||||
wsRDFGetChildCountEvent::wsRDFGetChildCountEvent(WebShellInitContext* yourInitContext,
|
||||
PRUint32 yourNativeRDFNode) :
|
||||
nsActionEvent(),
|
||||
mInitContext(yourInitContext), mNativeRDFNode(yourNativeRDFNode)
|
||||
{
|
||||
}
|
||||
|
||||
void *
|
||||
wsRDFGetChildCountEvent::handleEvent ()
|
||||
{
|
||||
if (!mInitContext) {
|
||||
return (void *) NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
JNIEnv *env = (JNIEnv *) JNU_GetEnv(gVm, JNI_VERSION);
|
||||
jint result = -1;
|
||||
PRInt32 count;
|
||||
nsresult rv;
|
||||
// PENDING(edburns): assert rdf_InitRDFUtils()
|
||||
nsCOMPtr<nsIRDFResource> parent = (nsIRDFResource *) mNativeRDFNode;
|
||||
|
||||
rv = rdf_getChildCount(parent, &count);
|
||||
if (NS_FAILED(rv)) {
|
||||
::util_ThrowExceptionToJava(env, "Exception: nativeGetChildCount: Can't get child count.");
|
||||
return nsnull;
|
||||
}
|
||||
result = (jint)count;
|
||||
return (void *) result;
|
||||
} // handleEvent()
|
||||
|
||||
wsRDFGetChildIndexEvent::wsRDFGetChildIndexEvent(WebShellInitContext* yourInitContext,
|
||||
PRUint32 yourNativeRDFNode,
|
||||
PRUint32 yourChildRDFNode) :
|
||||
@@ -270,113 +241,6 @@ wsRDFGetChildIndexEvent::handleEvent ()
|
||||
return (void *) result;
|
||||
} // handleEvent()
|
||||
|
||||
wsRDFToStringEvent::wsRDFToStringEvent(WebShellInitContext* yourInitContext,
|
||||
PRUint32 yourNativeRDFNode) :
|
||||
nsActionEvent(),
|
||||
mInitContext(yourInitContext), mNativeRDFNode(yourNativeRDFNode)
|
||||
{
|
||||
}
|
||||
|
||||
void *
|
||||
wsRDFToStringEvent::handleEvent ()
|
||||
{
|
||||
if (!mInitContext) {
|
||||
return (void *) NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
nsCOMPtr<nsIRDFResource> currentResource =
|
||||
(nsIRDFResource *) mNativeRDFNode;
|
||||
nsCOMPtr<nsIRDFNode> node;
|
||||
nsCOMPtr<nsIRDFLiteral> literal;
|
||||
jstring result = nsnull;
|
||||
PRBool isContainer = PR_FALSE;
|
||||
nsresult rv;
|
||||
const PRUnichar *textForNode = nsnull;
|
||||
JNIEnv *env = (JNIEnv *) JNU_GetEnv(gVm, JNI_VERSION);
|
||||
|
||||
rv = gRDFCU->IsContainer(gBookmarksDataSource, currentResource,
|
||||
&isContainer);
|
||||
if (NS_FAILED(rv)) {
|
||||
::util_ThrowExceptionToJava(env, "Exception: nativeToString: Can't tell if RDFResource is container.");
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
if (isContainer) {
|
||||
// It's a bookmarks folder
|
||||
rv = gBookmarksDataSource->GetTarget(currentResource,
|
||||
kNC_Name, PR_TRUE,
|
||||
getter_AddRefs(node));
|
||||
// get the name of the folder
|
||||
if (rv == 0) {
|
||||
// if so, make sure it's an nsIRDFLiteral
|
||||
rv = node->QueryInterface(NS_GET_IID(nsIRDFLiteral),
|
||||
getter_AddRefs(literal));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = literal->GetValueConst(&textForNode);
|
||||
}
|
||||
else {
|
||||
if (prLogModuleInfo) {
|
||||
PR_LOG(prLogModuleInfo, 3,
|
||||
("nativeToString: node is not an nsIRDFLiteral.\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// It's a bookmark or a Separator
|
||||
rv = gBookmarksDataSource->GetTarget(currentResource,
|
||||
kNC_URL, PR_TRUE,
|
||||
getter_AddRefs(node));
|
||||
// See if it has a Name
|
||||
if (0 != rv) {
|
||||
rv = gBookmarksDataSource->GetTarget(currentResource,
|
||||
kNC_Name, PR_TRUE,
|
||||
getter_AddRefs(node));
|
||||
}
|
||||
|
||||
if (0 == rv) {
|
||||
rv = node->QueryInterface(NS_GET_IID(nsIRDFLiteral),
|
||||
getter_AddRefs(literal));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// get the value of the literal
|
||||
rv = literal->GetValueConst(&textForNode);
|
||||
if (NS_FAILED(rv)) {
|
||||
if (prLogModuleInfo) {
|
||||
PR_LOG(prLogModuleInfo, 3,
|
||||
("nativeToString: node doesn't have a value.\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (prLogModuleInfo) {
|
||||
PR_LOG(prLogModuleInfo, 3,
|
||||
("nativeToString: node is not an nsIRDFLiteral.\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (prLogModuleInfo) {
|
||||
PR_LOG(prLogModuleInfo, 3,
|
||||
("nativeToString: node doesn't have a URL.\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nsnull != textForNode) {
|
||||
nsString * string = new nsString(textForNode);
|
||||
int length = 0;
|
||||
if (nsnull != string) {
|
||||
length = string->Length();
|
||||
}
|
||||
|
||||
result = ::util_NewString(env, (const jchar *) textForNode, length);
|
||||
}
|
||||
else {
|
||||
result = ::util_NewStringUTF(env, "");
|
||||
}
|
||||
|
||||
return (void *) result;
|
||||
} // handleEvent()
|
||||
|
||||
wsRDFInsertElementAtEvent::wsRDFInsertElementAtEvent(WebShellInitContext* yourInitContext,
|
||||
PRUint32 yourParentRDFNode,
|
||||
PRUint32 yourChildRDFNode,
|
||||
|
||||
Reference in New Issue
Block a user