After sending my patch, I read the instructions on how to make diffs.
Please forgive me :)
This patch is made with CVS and should make you happy.
David
Index: src/af/xap/unix/xap_UnixFrame.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/xap/unix/xap_UnixFrame.cpp,v
retrieving revision 1.83
diff -u -r1.83 xap_UnixFrame.cpp
--- src/af/xap/unix/xap_UnixFrame.cpp 2000/06/20 06:35:32 1.83
+++ src/af/xap/unix/xap_UnixFrame.cpp 2000/07/19 15:12:36
@@ -20,6 +20,7 @@
#include <gtk/gtk.h>
#include <stdio.h>
#include <stdlib.h>
+#include <sys/stat.h>
#include "ut_types.h"
#include "ut_debugmsg.h"
@@ -631,17 +632,23 @@
UT_Bool XAP_UnixFrame::openURL(const char * szURL)
{
- // TODO : FIX THIS. Find a better way to search for
- // TODO : other browsers on your machine.
-
- // Try to connect to a running Netscape, if not, start new one
-
- char execstring[4096];
-
- g_snprintf(execstring, 4096, "netscape -remote openURL\\(%s\\) "
- "|| netscape %s &", szURL, szURL);
+ char execstring[4096];
+ struct stat * statbuf = (struct stat *) malloc(sizeof(struct stat));
+ if (!stat("/opt/gnome/bin/gnome-help-browser", statbuf) ||
+!stat("/usr/local/bin/gnome-help-browser", statbuf) ||
+!stat("/usr/bin/gnome-help-browser", statbuf))
+ {
+ g_snprintf(execstring, 4096, "gnome-help-browser %s &", szURL);
+ }
+ else if (!stat("/opt/kde/bin/kdehelp", statbuf) ||
+!stat("/usr/local/kde/bin/kdehelp", statbuf) || !stat("/usr/local/bin/kdehelp",
+statbuf) || !stat("/usr/bin/kdehelp", statbuf))
+ {
+ g_snprintf(execstring, 4096, "kdehelp %s &", szURL);
+ }
+ else
+ {
+ // Try to connect to a running Netscape, if not, start new one
+ g_snprintf(execstring, 4096, "netscape -remote openURL\\(%s\\) ||
+netscape %s &", szURL, szURL);
+ }
system(execstring);
-
+ FREEP(statbuf);
return UT_FALSE;
}
Index: src/wp/ap/xp/ap_EditMethods.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/xp/ap_EditMethods.cpp,v
retrieving revision 1.217
diff -u -r1.217 ap_EditMethods.cpp
--- src/wp/ap/xp/ap_EditMethods.cpp 2000/07/07 18:10:48 1.217
+++ src/wp/ap/xp/ap_EditMethods.cpp 2000/07/19 15:13:22
@@ -311,6 +311,11 @@
static EV_EditMethod_Fn dlgMoreWindows;
static EV_EditMethod_Fn dlgAbout;
+ static EV_EditMethod_Fn helpContents;
+ static EV_EditMethod_Fn helpIndex;
+ static EV_EditMethod_Fn helpSearch;
+ static EV_EditMethod_Fn helpCheckVer;
+ static EV_EditMethod_Fn helpAboutOS;
static EV_EditMethod_Fn newWindow;
static EV_EditMethod_Fn cycleWindows;
@@ -592,6 +597,11 @@
EV_EditMethod(NF(dlgMoreWindows), 0, ""),
EV_EditMethod(NF(dlgAbout), 0, ""),
+ EV_EditMethod(NF(helpContents), 0, ""),
+ EV_EditMethod(NF(helpIndex), 0, ""),
+ EV_EditMethod(NF(helpSearch), 0, ""),
+ EV_EditMethod(NF(helpCheckVer), 0, ""),
+ EV_EditMethod(NF(helpAboutOS), 0, ""),
EV_EditMethod(NF(newWindow), 0, ""),
EV_EditMethod(NF(cycleWindows), 0, ""),
@@ -1541,6 +1551,68 @@
s_doAboutDlg(pFrame, XAP_DIALOG_ID_ABOUT);
return UT_TRUE;
+}
+
+UT_Bool _helpOpenURL(AV_View* pAV_View, const char* helpURL)
+{
+ XAP_Frame * pFrame = (XAP_Frame *) pAV_View->getParentData();
+ UT_ASSERT(pFrame);
+ pFrame->openURL(helpURL);
+ return UT_TRUE;
+}
+
+UT_Bool _helpLocalizeAndOpenURL(AV_View* pAV_View, UT_Bool bLocal, const char*
+pathBeforeLang, const char* pathAfterLang)
+{
+ XAP_Frame * pFrame = (XAP_Frame *) pAV_View->getParentData();
+ UT_ASSERT(pFrame);
+ XAP_App * pApp = pFrame->getApp();
+ UT_ASSERT(pApp);
+ XAP_Prefs * pPrefs = pApp->getPrefs();
+ UT_ASSERT(pPrefs);
+
+ const char * abiSuiteLibDir = pApp->getAbiSuiteLibDir();
+ const XML_Char * abiSuiteLocString = NULL;
+ char * helpURL = (char *)malloc(512);
+ pPrefs->getPrefsValue(AP_PREF_KEY_StringSet, &abiSuiteLocString);
+ if (bLocal)
+ {
+ UT_ASSERT(strlen(abiSuiteLibDir) + strlen(pathBeforeLang) +
+strlen(abiSuiteLocString) + strlen(pathAfterLang) < 509);
+ helpURL = UT_catPathname(UT_catPathname(UT_catPathname(abiSuiteLibDir,
+pathBeforeLang), abiSuiteLocString), pathAfterLang);
+ }
+ else
+ {
+ UT_ASSERT(strlen(pathBeforeLang) + strlen(abiSuiteLocString) +
+strlen(pathAfterLang) < 510);
+ helpURL = UT_catPathname(UT_catPathname(pathBeforeLang,
+abiSuiteLocString), pathAfterLang);
+ }
+
+ UT_Bool bRetBuf = _helpOpenURL(pAV_View, helpURL);
+ FREEP(helpURL);
+ return bRetBuf;
+}
+
+Defun1(helpContents)
+{
+ return _helpLocalizeAndOpenURL(pAV_View, UT_TRUE, "AbiWord/help",
+"contents.html");
+}
+
+Defun1(helpIndex)
+{
+ return _helpLocalizeAndOpenURL(pAV_View, UT_TRUE, "AbiWord/help",
+"index.html");
+}
+
+Defun1(helpCheckVer)
+{
+ return _helpOpenURL(pAV_View,
+"http://www.abisource.com/users/check_version.phtml?"); // + version number
+}
+
+Defun1(helpSearch)
+{
+ return _helpOpenURL(pAV_View, "http://www.abisource.com/users/search.html");
+}
+
+Defun1(helpAboutOS)
+{
+ return _helpLocalizeAndOpenURL(pAV_View, UT_TRUE, "AbiWord/help",
+"aboutos.html");
}
Defun1(cycleWindows)
Index: src/wp/ap/xp/ap_Menu_ActionSet.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/xp/ap_Menu_ActionSet.cpp,v
retrieving revision 1.27
diff -u -r1.27 ap_Menu_ActionSet.cpp
--- src/wp/ap/xp/ap_Menu_ActionSet.cpp 2000/04/15 12:35:17 1.27
+++ src/wp/ap/xp/ap_Menu_ActionSet.cpp 2000/07/19 15:13:26
@@ -156,7 +156,12 @@
_s(AP_MENU_ID_WINDOW_MORE, 0,1,0, "dlgMoreWindows", NULL,
ap_GetLabel_WindowMore);
_s(AP_MENU_ID_HELP, 1,0,0, NULL,
NULL, NULL);
+ _s(AP_MENU_ID_HELP_CONTENTS, 0,0,0, "helpContents",
+ NULL, ap_GetLabel_Contents);
+ _s(AP_MENU_ID_HELP_INDEX, 0,0,0, "helpIndex",
+ NULL, ap_GetLabel_Index);
+ _s(AP_MENU_ID_HELP_CHECKVER, 0,0,0, "helpCheckVer",
+ NULL, ap_GetLabel_Checkver);
+ _s(AP_MENU_ID_HELP_SEARCH, 0,0,0, "helpSearch",
+ NULL, ap_GetLabel_Search);
_s(AP_MENU_ID_HELP_ABOUT, 0,1,0, "dlgAbout",
NULL, ap_GetLabel_About);
+ _s(AP_MENU_ID_HELP_ABOUTOS, 0,0,0, "helpAboutOS",
+ NULL, ap_GetLabel_AboutOS);
_s(AP_MENU_ID_SPELL_SUGGEST_1, 0,0,0, "spellSuggest_1",
ap_GetState_Suggest, ap_GetLabel_Suggest);
_s(AP_MENU_ID_SPELL_SUGGEST_2, 0,0,0, "spellSuggest_2",
ap_GetState_Suggest, ap_GetLabel_Suggest);
Index: src/wp/ap/xp/ap_Menu_Functions.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/xp/ap_Menu_Functions.cpp,v
retrieving revision 1.29
diff -u -r1.29 ap_Menu_Functions.cpp
--- src/wp/ap/xp/ap_Menu_Functions.cpp 2000/05/18 06:10:07 1.29
+++ src/wp/ap/xp/ap_Menu_Functions.cpp 2000/07/19 15:13:29
@@ -100,6 +100,115 @@
return NULL;
}
+Defun_EV_GetMenuItemComputedLabel_Fn(ap_GetLabel_Contents)
+{
+ // Compute the menu label for the _help_contents item.
+
+ UT_ASSERT(pFrame);
+ XAP_App * pApp = pFrame->getApp();
+ UT_ASSERT(pApp);
+ UT_ASSERT(pLabel);
+
+ UT_ASSERT(id == AP_MENU_ID_HELP_CONTENTS);
+
+ const char * szFormat = pLabel->getMenuLabel();
+ static char buf[128];
+
+ const char * szAppName = pApp->getApplicationName();
+
+ sprintf(buf,szFormat,szAppName);
+ return buf;
+
+ return NULL;
+}
+
+Defun_EV_GetMenuItemComputedLabel_Fn(ap_GetLabel_Index)
+{
+ // Compute the menu label for the _help_index item.
+
+ UT_ASSERT(pFrame);
+ XAP_App * pApp = pFrame->getApp();
+ UT_ASSERT(pApp);
+ UT_ASSERT(pLabel);
+
+ UT_ASSERT(id == AP_MENU_ID_HELP_INDEX);
+
+ const char * szFormat = pLabel->getMenuLabel();
+ static char buf[128];
+
+ const char * szAppName = pApp->getApplicationName();
+
+ sprintf(buf,szFormat,szAppName);
+ return buf;
+
+ return NULL;
+}
+
+Defun_EV_GetMenuItemComputedLabel_Fn(ap_GetLabel_Search)
+{
+ // Compute the menu label for the _help_search item.
+
+ UT_ASSERT(pFrame);
+ XAP_App * pApp = pFrame->getApp();
+ UT_ASSERT(pApp);
+ UT_ASSERT(pLabel);
+
+ UT_ASSERT(id == AP_MENU_ID_HELP_SEARCH);
+
+ const char * szFormat = pLabel->getMenuLabel();
+ static char buf[128];
+
+ const char * szAppName = pApp->getApplicationName();
+
+ sprintf(buf,szFormat,szAppName);
+ return buf;
+
+ return NULL;
+}
+
+Defun_EV_GetMenuItemComputedLabel_Fn(ap_GetLabel_AboutOS)
+{
+ // Compute the menu label for the about OS help item.
+
+ UT_ASSERT(pFrame);
+ XAP_App * pApp = pFrame->getApp();
+ UT_ASSERT(pApp);
+ UT_ASSERT(pLabel);
+
+ UT_ASSERT(id == AP_MENU_ID_HELP_ABOUTOS);
+
+ const char * szFormat = pLabel->getMenuLabel();
+ static char buf[128];
+
+ const char * szAppName = pApp->getApplicationName();
+
+ sprintf(buf,szFormat,szAppName);
+ return buf;
+
+ return NULL;
+}
+
+Defun_EV_GetMenuItemComputedLabel_Fn(ap_GetLabel_Checkver)
+{
+ // Compute the menu label for the about the check version item.
+
+ UT_ASSERT(pFrame);
+ XAP_App * pApp = pFrame->getApp();
+ UT_ASSERT(pApp);
+ UT_ASSERT(pLabel);
+
+ UT_ASSERT(id == AP_MENU_ID_HELP_CHECKVER);
+
+ const char * szFormat = pLabel->getMenuLabel();
+ static char buf[128];
+
+ const char * szAppName = pApp->getApplicationName();
+
+ sprintf(buf,szFormat,szAppName);
+ return buf;
+
+ return NULL;
+}
/*****************************************************************/
/*****************************************************************/
Index: src/wp/ap/xp/ap_Menu_Functions.h
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/xp/ap_Menu_Functions.h,v
retrieving revision 1.11
diff -u -r1.11 ap_Menu_Functions.h
--- src/wp/ap/xp/ap_Menu_Functions.h 1999/10/15 07:53:58 1.11
+++ src/wp/ap/xp/ap_Menu_Functions.h 2000/07/19 15:13:30
@@ -46,6 +46,11 @@
Defun_EV_GetMenuItemComputedLabel_Fn(ap_GetLabel_Window);
Defun_EV_GetMenuItemComputedLabel_Fn(ap_GetLabel_WindowMore);
Defun_EV_GetMenuItemComputedLabel_Fn(ap_GetLabel_About);
+Defun_EV_GetMenuItemComputedLabel_Fn(ap_GetLabel_Contents);
+Defun_EV_GetMenuItemComputedLabel_Fn(ap_GetLabel_Checkver);
+Defun_EV_GetMenuItemComputedLabel_Fn(ap_GetLabel_Search);
+Defun_EV_GetMenuItemComputedLabel_Fn(ap_GetLabel_AboutOS);
+Defun_EV_GetMenuItemComputedLabel_Fn(ap_GetLabel_Index);
Defun_EV_GetMenuItemComputedLabel_Fn(ap_GetLabel_Suggest);
#endif /* AP_MENU_FUNCTIONS_H */
Index: src/wp/ap/xp/ap_Menu_Id.h
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/xp/ap_Menu_Id.h,v
retrieving revision 1.17
diff -u -r1.17 ap_Menu_Id.h
--- src/wp/ap/xp/ap_Menu_Id.h 2000/02/17 18:38:07 1.17
+++ src/wp/ap/xp/ap_Menu_Id.h 2000/07/19 15:13:31
@@ -129,7 +129,12 @@
AP_MENU_ID_WINDOW_MORE,
AP_MENU_ID_HELP,
+ AP_MENU_ID_HELP_CONTENTS,
+ AP_MENU_ID_HELP_INDEX,
+ AP_MENU_ID_HELP_CHECKVER,
+ AP_MENU_ID_HELP_SEARCH,
AP_MENU_ID_HELP_ABOUT,
+ AP_MENU_ID_HELP_ABOUTOS,
AP_MENU_ID_SPELL_SUGGEST_1, // _suggest_1 thru _suggest_9 must be
contiguous
AP_MENU_ID_SPELL_SUGGEST_2,
Index: src/wp/ap/xp/ap_Menu_LabelSet_de-DE.h
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/xp/ap_Menu_LabelSet_de-DE.h,v
retrieving revision 1.9
diff -u -r1.9 ap_Menu_LabelSet_de-DE.h
--- src/wp/ap/xp/ap_Menu_LabelSet_de-DE.h 2000/06/12 22:33:14 1.9
+++ src/wp/ap/xp/ap_Menu_LabelSet_de-DE.h 2000/07/19 15:13:34
@@ -129,7 +129,14 @@
MenuLabel(AP_MENU_ID_WINDOW_MORE, "&Mehr Fenster",
"Liste aller Fenster zeigen")
MenuLabel(AP_MENU_ID_HELP, "&Hilfe",
NULL)
- MenuLabel(AP_MENU_ID_HELP_ABOUT, "&�ber %s",
"Programminformation, Verion und Copyright anzeigen")
+ MenuLabel(AP_MENU_ID_HELP_CONTENTS, "&Inhalt", "Inhalt der
+Hilfe anzeigen (lokal)")
+ MenuLabel(AP_MENU_ID_HELP_INDEX, "&Benutzerhandbuch",
+ "Benutzerhandbuch anzeigen (lokal)")
+ MenuLabel(AP_MENU_ID_HELP_CHECKVER, "&Version",
+"Versionsnummer anzeigen (WWW)")
+ MenuLabel(AP_MENU_ID_HELP_SEARCH, "In der Hilfe &suchen",
+"Aufrufen der Suchseite (WWW)")
+ MenuLabel(AP_MENU_ID_HELP_ABOUT, "&�ber %s",
+ "Programminformation, Version und Copyright anzeigen")
+ MenuLabel(AP_MENU_ID_HELP_ABOUTOS, "�ber &Open Source",
+"Informationen �ber Open Source anzeigen (lokal)")
+
+
MenuLabel(AP_MENU_ID_SPELL_SUGGEST_1, "%s",
"�ndere in diesen Vorschlag")
MenuLabel(AP_MENU_ID_SPELL_SUGGEST_2, "%s",
"�ndere in diesen Vorschlag")
Index: src/wp/ap/xp/ap_Menu_LabelSet_en-US.h
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/xp/ap_Menu_LabelSet_en-US.h,v
retrieving revision 1.27
diff -u -r1.27 ap_Menu_LabelSet_en-US.h
--- src/wp/ap/xp/ap_Menu_LabelSet_en-US.h 2000/07/06 23:42:09 1.27
+++ src/wp/ap/xp/ap_Menu_LabelSet_en-US.h 2000/07/19 15:13:37
@@ -127,8 +127,13 @@
MenuLabel(AP_MENU_ID_WINDOW_9, "&9 %s",
"Raise this window")
MenuLabel(AP_MENU_ID_WINDOW_MORE, "&More Windows", "Show
full list of windows")
- MenuLabel(AP_MENU_ID_HELP, "&Help",
NULL)
- MenuLabel(AP_MENU_ID_HELP_ABOUT, "&About %s",
"Display program information, version number, and copyright")
+ MenuLabel(AP_MENU_ID_HELP, "&Help", NULL)
+ MenuLabel(AP_MENU_ID_HELP_CONTENTS, "Help &Contents",
+"Display Help Contents")
+ MenuLabel(AP_MENU_ID_HELP_INDEX, "Help &Index",
+"Display Help Index")
+ MenuLabel(AP_MENU_ID_HELP_CHECKVER, "Check &Version",
+"Display program version number")
+ MenuLabel(AP_MENU_ID_HELP_SEARCH, "&Search for Help",
+"Display program information, version number, and copyright")
+ MenuLabel(AP_MENU_ID_HELP_ABOUT, "&About %s",
+"Display program information, version number, and copyright")
+ MenuLabel(AP_MENU_ID_HELP_ABOUTOS, "About &Open Source",
+"Display information about Open Source")
MenuLabel(AP_MENU_ID_SPELL_SUGGEST_1, "%s",
"Change to this suggested spelling")
MenuLabel(AP_MENU_ID_SPELL_SUGGEST_2, "%s",
"Change to this suggested spelling")
@@ -143,6 +148,7 @@
MenuLabel(AP_MENU_ID_SPELL_ADD, "&Add",
"Add this word to the custom dictionary")
// ... add others here ...
+
MenuLabel(AP_MENU_ID__BOGUS2__, NULL,
NULL)
EndSet()
Index: src/wp/ap/xp/ap_Menu_Layouts_MainMenu.h
===================================================================
RCS file: /cvsroot/abi/src/wp/ap/xp/ap_Menu_Layouts_MainMenu.h,v
retrieving revision 1.18
diff -u -r1.18 ap_Menu_Layouts_MainMenu.h
--- src/wp/ap/xp/ap_Menu_Layouts_MainMenu.h 2000/07/06 23:42:09 1.18
+++ src/wp/ap/xp/ap_Menu_Layouts_MainMenu.h 2000/07/19 15:13:38
@@ -138,7 +138,13 @@
EndSubMenu()
BeginSubMenu(AP_MENU_ID_HELP)
- MenuItem(AP_MENU_ID_HELP_ABOUT)
- EndSubMenu()
+ MenuItem(AP_MENU_ID_HELP_CONTENTS)
+ MenuItem(AP_MENU_ID_HELP_INDEX)
+ MenuItem(AP_MENU_ID_HELP_CHECKVER)
+ MenuItem(AP_MENU_ID_HELP_SEARCH)
+ Separator()
+ MenuItem(AP_MENU_ID_HELP_ABOUT)
+ MenuItem(AP_MENU_ID_HELP_ABOUTOS)
+EndSubMenu()
EndLayout()