Set conduit title field and created BrandName.rc for the product brand name. r=ssu, sr=sspitzer.

This commit is contained in:
cavin%netscape.com 2003-02-28 23:39:51 +00:00
Родитель 8d8065965b
Коммит eb1129c6bd
6 изменённых файлов: 71 добавлений и 28 удалений

Просмотреть файл

@ -151,7 +151,8 @@ ExportFunc long OpenConduit(PROGRESSFN pFn, CSyncProperties& rProps)
/////////////////////////////////////////////////////////////////////////////
ExportFunc long GetConduitName(char* pszName,WORD nLen)
{
pszName = CONDUIT_NAME;
strncpy(pszName,CONDUIT_NAME, nLen-1);
*(pszName+nLen-1) = '\0';
return 0;
}

Просмотреть файл

@ -0,0 +1,4 @@
STRINGTABLE DISCARDABLE
BEGIN
IDS_BRAND_NAME "Mozilla"
END

Просмотреть файл

@ -29,7 +29,6 @@ PALM_CDK_INC = $(PALM_CDK_DIR)/C++/Include
include $(DEPTH)/config/autoconf.mk
PROGRAM = PalmSyncInstall$(BIN_SUFFIX)
REQUIRES = $(ZLIB_REQUIRES)
RESFILE = PalmSyncInstall.res
USE_NON_MT_LIBS = 1
@ -44,11 +43,9 @@ LDFLAGS += /SUBSYSTEM:WINDOWS /MACHINE:i386
libs:: $(PROGRAM)
$(INSTALL) $(PROGRAM) $(DIST)/install
$(DIST)/install/nszip$(BIN_SUFFIX) $(DIST)/install/nsinstall$(BIN_SUFFIX)
install:: $(PROGRAM)
$(SYSINSTALL) $(IFLAGS2) $(PROGRAM) $(DESTDIR)$(mozappdir)/install
$(DIST)/install/$(PROGRAM) -g $(DESTDIR)$(mozappdir)/install/nszip$(BIN_SUFFIX) $(DESTDIR)$(mozappdir)/install/nsinstall$(BIN_SUFFIX)
clean clobber clobber_all realclean::
$(RM) $(DIST)/install/$(PROGRAM)

Просмотреть файл

@ -39,6 +39,7 @@
#include <windows.h>
#include <io.h>
#include <stdlib.h>
#include <stdio.h>
#include <tchar.h>
#include "CondMgr.h"
@ -70,6 +71,7 @@ typedef int (WINAPI *CmRemoveConduitByCreatorIDPtr)(const char *pCreator);
typedef int (WINAPI *CmRestoreHotSyncSettingsPtr)(BOOL bToDefaults);
typedef int (WINAPI *CmSetCreatorRemotePtr)(const char *pCreator, const TCHAR *pRemote);
typedef int (WINAPI *CmSetCreatorNamePtr)(const char *pCreator, const TCHAR *pConduitName);
typedef int (WINAPI *CmSetCreatorTitlePtr)(const char *pCreator, const TCHAR *pConduitTitle);
typedef int (WINAPI *CmSetCreatorPriorityPtr)(const char *pCreator, DWORD dwPriority);
typedef int (WINAPI *CmSetCreatorIntegratePtr)(const char *pCreator, DWORD dwIntegrate);
typedef int (WINAPI *CmSetCreatorValueDwordPtr)(const char *pCreator, TCHAR *pValue, DWORD dwValue);
@ -84,24 +86,46 @@ typedef int (WINAPI *mozDllRegisterServerPtr)(void);
typedef int (WINAPI *mozDllUnregisterServerPtr)(void);
// forward declaration
int InstallConduit();
int InstallConduit(HINSTANCE hInstance);
int UninstallConduit();
void ConstructMessage(HINSTANCE hInstance, DWORD dwMessageId, TCHAR *formattedMsg);
// Global vars
BOOL gWasHotSyncRunning = FALSE;
void ConstructMessage(HINSTANCE hInstance, DWORD dwMessageId, TCHAR *formattedMsg)
{
// Load brand name and the format string.
TCHAR brandName[MAX_LOADSTRING];
TCHAR formatString[MAX_LOADSTRING];
LoadString(hInstance, IDS_BRAND_NAME, brandName, MAX_LOADSTRING-1);
LoadString(hInstance, dwMessageId, formatString, MAX_LOADSTRING-1);
// A few msgs needs two brand name substitutions.
if ((dwMessageId == IDS_SUCCESS_INSTALL) ||
(dwMessageId == IDS_CONFIRM_INSTALL) ||
(dwMessageId == IDS_ERR_REGISTERING_MOZ_DLL))
_sntprintf(formattedMsg, MAX_LOADSTRING-1, formatString, brandName, brandName);
else
_sntprintf(formattedMsg, MAX_LOADSTRING-1, formatString, brandName);
formattedMsg[MAX_LOADSTRING-1]='\0';
}
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
TCHAR appTitle[128];
LoadString(hInstance, IDS_APP_TITLE, appTitle, MAX_LOADSTRING);
TCHAR appTitle[MAX_LOADSTRING];
TCHAR msgStr[MAX_LOADSTRING];
TCHAR msgStr[256];
int strResource=0;
int res=-1;
if(!strcmp(lpCmdLine,"/u")) // un-install
{
LoadString(hInstance, IDS_CONFIRM_UNINSTALL, msgStr, MAX_LOADSTRING);
ConstructMessage(hInstance, IDS_APP_TITLE_UNINSTALL, appTitle);
ConstructMessage(hInstance, IDS_CONFIRM_UNINSTALL, msgStr);
if (MessageBox(NULL, msgStr, appTitle, MB_YESNO) == IDYES)
{
res = UninstallConduit();
@ -118,17 +142,18 @@ int APIENTRY WinMain(HINSTANCE hInstance,
}
else if (!strcmp(lpCmdLine,"/s")) // silent install
{
res = InstallConduit();
res = InstallConduit(hInstance);
if(!res)
return TRUE; // success
return res;
}
else // install
{
LoadString(hInstance, IDS_CONFIRM_INSTALL, msgStr, MAX_LOADSTRING);
ConstructMessage(hInstance, IDS_APP_TITLE_INSTALL, appTitle);
ConstructMessage(hInstance, IDS_CONFIRM_INSTALL, msgStr);
if (MessageBox(NULL, msgStr, appTitle, MB_YESNO) == IDYES)
{
res = InstallConduit();
res = InstallConduit(hInstance);
if(!res)
res = IDS_SUCCESS_INSTALL;
}
@ -140,7 +165,8 @@ int APIENTRY WinMain(HINSTANCE hInstance,
if(res > IDS_ERR_MAX || res < IDS_ERR_GENERAL)
res = IDS_ERR_GENERAL;
LoadString(hInstance, res, msgStr, MAX_LOADSTRING);
ConstructMessage(hInstance, res, msgStr);
MessageBox(NULL, msgStr, appTitle, MB_OK);
return TRUE;
@ -361,7 +387,7 @@ int UnregisterMozPalmSyncDll()
}
// installs our Conduit
int InstallConduit()
int InstallConduit(HINSTANCE hInstance)
{
int dwReturnCode;
BOOL bHotSyncRunning = FALSE;
@ -416,6 +442,8 @@ int InstallConduit()
lpfnCmSetCreatorRemote = (CmSetCreatorRemotePtr) GetProcAddress(hConduitManagerDLL, "CmSetCreatorRemote");
CmSetCreatorNamePtr lpfnCmSetCreatorName;
lpfnCmSetCreatorName = (CmSetCreatorNamePtr) GetProcAddress(hConduitManagerDLL, "CmSetCreatorName");
CmSetCreatorTitlePtr lpfnCmSetCreatorTitle;
lpfnCmSetCreatorTitle = (CmSetCreatorTitlePtr) GetProcAddress(hConduitManagerDLL, "CmSetCreatorTitle");
CmSetCreatorPriorityPtr lpfnCmSetCreatorPriority;
lpfnCmSetCreatorPriority = (CmSetCreatorPriorityPtr) GetProcAddress(hConduitManagerDLL, "CmSetCreatorPriority");
CmSetCreatorIntegratePtr lpfnCmSetCreatorIntegrate;
@ -426,6 +454,7 @@ int InstallConduit()
if( (lpfnCmInstallCreator == NULL)
|| (lpfnCmSetCreatorRemote == NULL)
|| (lpfnCmSetCreatorName == NULL)
|| (lpfnCmSetCreatorTitle == NULL)
|| (lpfnCmSetCreatorPriority == NULL)
|| (lpfnCmSetCreatorIntegrate == NULL)
)
@ -461,13 +490,18 @@ int InstallConduit()
//free the library so that the existing AB Conduit is unloaded properly
FreeLibrary(hConduitManagerDLL);
FreeLibrary(hHsapiDLL);
return InstallConduit();
return InstallConduit(hInstance);
}
}
if( dwReturnCode == 0 )
{
dwReturnCode = (*lpfnCmSetCreatorName)(CREATOR, szConduitPath);
if( dwReturnCode != 0 ) return dwReturnCode;
TCHAR title[MAX_LOADSTRING];
// Construct conduit title (the one displayed in HotSync Mgr's Custom...list)..
ConstructMessage(hInstance, IDS_CONDUIT_TITLE, title);
dwReturnCode = (*lpfnCmSetCreatorTitle)(CREATOR, title);
if( dwReturnCode != 0 ) return dwReturnCode;
dwReturnCode = (*lpfnCmSetCreatorRemote)(CREATOR, REMOTE_DB);
if( dwReturnCode != 0 ) return dwReturnCode;
dwReturnCode = (*lpfnCmSetCreatorPriority)(CREATOR, CONDUIT_PRIORITY);

Просмотреть файл

@ -65,28 +65,32 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
STRINGTABLE DISCARDABLE
BEGIN
IDS_APP_TITLE "Mozilla PalmSync Install"
IDS_APP_TITLE_INSTALL "%s Address Book Palm Sync Install"
IDS_APP_TITLE_UNINSTALL "%s Address Book Palm Sync Uninstall"
IDS_CONDUIT_TITLE "%s Address Book"
IDC_PALMSYNCINSTALL "PALMSYNCINSTALL"
IDS_ERR_GENERAL "Error in installing the Mozilla Address Book Palm Sync Conduit"
IDS_ERR_LOADING_CONDMGR "Error in loading the Conduit Manager while installing the Mozilla Address Book Palm Sync Conduit"
IDS_ERR_GENERAL "Error in installing the %s Address Book Palm Sync Conduit"
IDS_ERR_LOADING_CONDMGR "Error in loading the Conduit Manager while installing the %s Address Book Palm Sync Conduit"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_ERR_HSAPI_NOT_FOUND "Could not find the HSAPI.dll while installing the Mozilla Address Book Palm Sync Conduit"
IDS_ERR_HSAPI_NOT_FOUND "Could not find the HSAPI.dll while installing the %s Address Book Palm Sync Conduit"
IDS_ERR_CONDUIT_NOT_FOUND
"Could not find the Mozilla Address Book Palm Sync Conduit to install"
"Could not find the %s Address Book Palm Sync Conduit to install"
IDS_ERR_HOTSYNC_IN_PROGRESS
"A Palm HotSync operation is in progress, let it complete first then install the Mozilla Address Book Palm Sync Conduit"
"A Palm HotSync operation is in progress, let it complete first then install the %s Address Book Palm Sync Conduit"
IDS_ERR_FINDING_INSTALL_DIR
"Could not find the directory to install the Mozilla Address Book Palm Sync Conduit."
IDS_SUCCESS_INSTALL "Mozilla Address Book Palm Sync Conduit has been successfully installed. Now when you do an HotSync operation from your Palm handheld device, the Address Book on the handheld will sync with Mozilla's Address Book."
IDS_SUCCESS_UNINSTALL "Mozilla Address Book Palm Sync Conduit has been successfully Uninstalled. The Palm Desktop configuration has been restored for you to enable synchronization of your Address Book on the handheld with Palm Desktop."
IDS_CONFIRM_INSTALL "Click Yes to Install the Mozilla Address Book PalmSync Conduit, which will enable address book synchronization between Mozilla Address Book and Palm handheld Address Book. Note this will replace the synchronization with Palm Desktop."
IDS_CONFIRM_UNINSTALL "Click Yes to Un-Install the Mozilla Address Book PalmSync Conduit. Note this will restore the synchronization with Palm Desktop."
"Could not find the directory to install the %s Address Book Palm Sync Conduit."
IDS_SUCCESS_INSTALL "%s Address Book Palm Sync was successfully installed. Using your Palm device, perform a HotSync operation to synchronize your Palm device's address book with your %s address book."
IDS_SUCCESS_UNINSTALL "%s Address Book Palm Sync was successfully uninstalled. Palm Desktop synchronization with your Palm device is now restored."
IDS_CONFIRM_INSTALL "You are about to synchronize your %s address book with your Palm device's address book. This will replace Palm Desktop synchronization with %s address book synchronization. Do you want to continue?"
IDS_CONFIRM_UNINSTALL "You are about to uninstall %s Address Book Palm Sync. This will restore Palm Desktop synchronization. Do you want to continue?"
IDS_ERR_REGISTERING_MOZ_DLL
"Failed to register the Mozilla's Palm Sync Support Proxy Dll while installing the Mozilla Address Book Palm Sync Conduit."
"Failed to register the %s's Palm Sync Support Proxy Dll while installing the %s Address Book Palm Sync Conduit."
END
#include "BrandName.rc"
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -36,7 +36,10 @@
*
* ***** END LICENSE BLOCK ***** */
#define IDS_APP_TITLE 103
#define IDS_APP_TITLE_INSTALL 103
#define IDS_APP_TITLE_UNINSTALL 104
#define IDS_CONDUIT_TITLE 105
#define IDS_BRAND_NAME 106
#define IDI_PALMSYNCINSTALL 107
#define IDI_SMALL 108
#define IDC_PALMSYNCINSTALL 109