Hi

I have one of those fancy keyboards with lots of extra buttons for mail / web applications. I'd like to be able to open my address book with one of those buttons, like I currently do for browser windows and my inbox.

I have a shell script that does the following:

#!/bin/sh
MOZILLA=/usr/X11R6/bin/mozilla
$MOZILLA -remote "xfeDoCommand (openAddressBook)" || $MOZILLA -addressbook &

Attached is a patch that works for me. Should I open a bugzilla entry if I want this patch to be committed?


diff -uBwr src.old/XRemoteService.cpp src/XRemoteService.cpp
--- src.old/XRemoteService.cpp Sat Oct 12 21:13:45 2002
+++ src/XRemoteService.cpp Sat Oct 12 21:04:29 2002
@@ -566,6 +566,13 @@
}

nsresult
+XRemoteService::GetAddressBookLocation(char **_retval)
+{
+ *_retval = nsCRT::strdup("chrome://messenger/content/addressbook/addressbook.xul");
+ return NS_OK;
+}
+
+nsresult
XRemoteService::GetMailLocation(char **_retval)
{
// get the mail chrome URL
@@ -858,6 +865,28 @@
else if (aArgument.EqualsIgnoreCase("composemessage")) {
nsCString tempString("mailto:";);
rv = OpenURL(tempString, nsnull, PR_FALSE);
+ }
+
+ // open the address book window
+ else if (aArgument.EqualsIgnoreCase("openaddressbook")) {
+ nsCOMPtr<nsIDOMWindowInternal> domWindow;
+
+ rv = FindWindow(NS_LITERAL_STRING("mail:addressbook").get(),
+ getter_AddRefs(domWindow));
+
+ if (NS_FAILED(rv)) return rv;
+
+ if (domWindow) domWindow->Focus();
+ else {
+ nsXPIDLCString addressBookLocation;
+
+ GetAddressBookLocation(getter_Copies(addressBookLocation));
+ if (!addressBookLocation) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIDOMWindow> newWindow;
+ rv = OpenChromeWindow(0, addressBookLocation, "chrome,all,dialog=no",
+ nsnull, getter_AddRefs(newWindow));
+ }
}

return rv;
diff -uBwr src.old/XRemoteService.h src/XRemoteService.h
--- src.old/XRemoteService.h Sat Oct 12 21:13:45 2002
+++ src/XRemoteService.h Sat Oct 12 17:57:02 2002
@@ -64,6 +64,7 @@
// get the primary browser chrome location
nsresult GetBrowserLocation(char **_retval);
nsresult GetMailLocation(char **_retval);
+ nsresult GetAddressBookLocation(char **_retval);

// remote command handlers
nsresult OpenURL(nsCString &aArgument,


Reply via email to