Enabling the filepicker on Windows CE. NPODB. Bug 297683. r/sr=dveditz

This commit is contained in:
dougt%meer.net 2005-12-03 06:02:46 +00:00
Родитель 364b2b8ea9
Коммит 532721699a
3 изменённых файлов: 14 добавлений и 5 удалений

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

@ -68,9 +68,9 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(ChildWindow)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboard)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardHelper)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsNativeThemeWin)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFilePicker)
#ifndef WINCE
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFilePicker)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSound)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragService)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBidiKeyboard)
@ -101,11 +101,11 @@ static const nsModuleComponentInfo components[] =
NS_CLIPBOARDHELPER_CID,
"@mozilla.org/widget/clipboardhelper;1",
nsClipboardHelperConstructor },
#ifndef WINCE
{ "File Picker",
NS_FILEPICKER_CID,
"@mozilla.org/filepicker;1",
nsFilePickerConstructor },
#ifndef WINCE
{ "Sound",
NS_SOUND_CID,
// "@mozilla.org/widget/sound/win;1"

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

@ -83,6 +83,7 @@ CPPSRCS = \
nsDataObjCollection.cpp \
nsClipboard.cpp \
nsNativeThemeWin.cpp \
nsFilePicker.cpp \
$(NULL)
ifneq ($(OS_ARCH), WINCE)
@ -92,7 +93,6 @@ CPPSRCS += \
nsDragService.cpp \
nsImageClipboard.cpp \
nsBidiKeyboard.cpp \
nsFilePicker.cpp \
nsSound.cpp \
$(NULL)
endif

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

@ -88,6 +88,7 @@ nsFilePicker::~nsFilePicker()
//
//-------------------------------------------------------------------------
#ifndef WINCE
int CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
{
if (uMsg == BFFM_INITIALIZED)
@ -99,9 +100,9 @@ int CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpDa
nsCRT::free(filePath);
}
}
return 0;
}
#endif
NS_IMETHODIMP nsFilePicker::ShowW(PRInt16 *aReturnVal)
{
@ -132,6 +133,8 @@ NS_IMETHODIMP nsFilePicker::ShowW(PRInt16 *aReturnVal)
mUnicodeFile.Truncate();
#ifndef WINCE
if (mMode == modeGetFolder) {
PRUnichar dirBuffer[MAX_PATH+1];
wcsncpy(dirBuffer, initialDir.get(), MAX_PATH);
@ -169,7 +172,9 @@ NS_IMETHODIMP nsFilePicker::ShowW(PRInt16 *aReturnVal)
CoTaskMemFree(list);
}
}
else {
else
#endif // WINCE
{
OPENFILENAMEW ofn;
memset(&ofn, 0, sizeof(ofn));
@ -218,7 +223,9 @@ NS_IMETHODIMP nsFilePicker::ShowW(PRInt16 *aReturnVal)
}
}
#ifndef WINCE
try {
#endif
if (mMode == modeOpen) {
// FILE MUST EXIST!
ofn.Flags |= OFN_FILEMUSTEXIST;
@ -256,6 +263,7 @@ NS_IMETHODIMP nsFilePicker::ShowW(PRInt16 *aReturnVal)
else {
NS_ASSERTION(0, "unsupported mode");
}
#ifndef WINCE
}
catch(...) {
MessageBox(ofn.hwndOwner,
@ -264,6 +272,7 @@ NS_IMETHODIMP nsFilePicker::ShowW(PRInt16 *aReturnVal)
MB_ICONERROR);
result = PR_FALSE;
}
#endif
if (result == PR_TRUE) {
// Remember what filter type the user selected