зеркало из https://github.com/mozilla/pjs.git
Enabling the filepicker on Windows CE. NPODB. Bug 297683. r/sr=dveditz
This commit is contained in:
Родитель
364b2b8ea9
Коммит
532721699a
|
@ -68,9 +68,9 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(ChildWindow)
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboard)
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboard)
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardHelper)
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardHelper)
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsNativeThemeWin)
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsNativeThemeWin)
|
||||||
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFilePicker)
|
||||||
|
|
||||||
#ifndef WINCE
|
#ifndef WINCE
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFilePicker)
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSound)
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSound)
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragService)
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragService)
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBidiKeyboard)
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBidiKeyboard)
|
||||||
|
@ -101,11 +101,11 @@ static const nsModuleComponentInfo components[] =
|
||||||
NS_CLIPBOARDHELPER_CID,
|
NS_CLIPBOARDHELPER_CID,
|
||||||
"@mozilla.org/widget/clipboardhelper;1",
|
"@mozilla.org/widget/clipboardhelper;1",
|
||||||
nsClipboardHelperConstructor },
|
nsClipboardHelperConstructor },
|
||||||
#ifndef WINCE
|
|
||||||
{ "File Picker",
|
{ "File Picker",
|
||||||
NS_FILEPICKER_CID,
|
NS_FILEPICKER_CID,
|
||||||
"@mozilla.org/filepicker;1",
|
"@mozilla.org/filepicker;1",
|
||||||
nsFilePickerConstructor },
|
nsFilePickerConstructor },
|
||||||
|
#ifndef WINCE
|
||||||
{ "Sound",
|
{ "Sound",
|
||||||
NS_SOUND_CID,
|
NS_SOUND_CID,
|
||||||
// "@mozilla.org/widget/sound/win;1"
|
// "@mozilla.org/widget/sound/win;1"
|
||||||
|
|
|
@ -83,6 +83,7 @@ CPPSRCS = \
|
||||||
nsDataObjCollection.cpp \
|
nsDataObjCollection.cpp \
|
||||||
nsClipboard.cpp \
|
nsClipboard.cpp \
|
||||||
nsNativeThemeWin.cpp \
|
nsNativeThemeWin.cpp \
|
||||||
|
nsFilePicker.cpp \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
ifneq ($(OS_ARCH), WINCE)
|
ifneq ($(OS_ARCH), WINCE)
|
||||||
|
@ -92,7 +93,6 @@ CPPSRCS += \
|
||||||
nsDragService.cpp \
|
nsDragService.cpp \
|
||||||
nsImageClipboard.cpp \
|
nsImageClipboard.cpp \
|
||||||
nsBidiKeyboard.cpp \
|
nsBidiKeyboard.cpp \
|
||||||
nsFilePicker.cpp \
|
|
||||||
nsSound.cpp \
|
nsSound.cpp \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -88,6 +88,7 @@ nsFilePicker::~nsFilePicker()
|
||||||
//
|
//
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef WINCE
|
||||||
int CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
|
int CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
|
||||||
{
|
{
|
||||||
if (uMsg == BFFM_INITIALIZED)
|
if (uMsg == BFFM_INITIALIZED)
|
||||||
|
@ -99,9 +100,9 @@ int CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpDa
|
||||||
nsCRT::free(filePath);
|
nsCRT::free(filePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
NS_IMETHODIMP nsFilePicker::ShowW(PRInt16 *aReturnVal)
|
NS_IMETHODIMP nsFilePicker::ShowW(PRInt16 *aReturnVal)
|
||||||
{
|
{
|
||||||
|
@ -132,6 +133,8 @@ NS_IMETHODIMP nsFilePicker::ShowW(PRInt16 *aReturnVal)
|
||||||
|
|
||||||
mUnicodeFile.Truncate();
|
mUnicodeFile.Truncate();
|
||||||
|
|
||||||
|
#ifndef WINCE
|
||||||
|
|
||||||
if (mMode == modeGetFolder) {
|
if (mMode == modeGetFolder) {
|
||||||
PRUnichar dirBuffer[MAX_PATH+1];
|
PRUnichar dirBuffer[MAX_PATH+1];
|
||||||
wcsncpy(dirBuffer, initialDir.get(), MAX_PATH);
|
wcsncpy(dirBuffer, initialDir.get(), MAX_PATH);
|
||||||
|
@ -169,7 +172,9 @@ NS_IMETHODIMP nsFilePicker::ShowW(PRInt16 *aReturnVal)
|
||||||
CoTaskMemFree(list);
|
CoTaskMemFree(list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
#endif // WINCE
|
||||||
|
{
|
||||||
|
|
||||||
OPENFILENAMEW ofn;
|
OPENFILENAMEW ofn;
|
||||||
memset(&ofn, 0, sizeof(ofn));
|
memset(&ofn, 0, sizeof(ofn));
|
||||||
|
@ -218,7 +223,9 @@ NS_IMETHODIMP nsFilePicker::ShowW(PRInt16 *aReturnVal)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef WINCE
|
||||||
try {
|
try {
|
||||||
|
#endif
|
||||||
if (mMode == modeOpen) {
|
if (mMode == modeOpen) {
|
||||||
// FILE MUST EXIST!
|
// FILE MUST EXIST!
|
||||||
ofn.Flags |= OFN_FILEMUSTEXIST;
|
ofn.Flags |= OFN_FILEMUSTEXIST;
|
||||||
|
@ -256,6 +263,7 @@ NS_IMETHODIMP nsFilePicker::ShowW(PRInt16 *aReturnVal)
|
||||||
else {
|
else {
|
||||||
NS_ASSERTION(0, "unsupported mode");
|
NS_ASSERTION(0, "unsupported mode");
|
||||||
}
|
}
|
||||||
|
#ifndef WINCE
|
||||||
}
|
}
|
||||||
catch(...) {
|
catch(...) {
|
||||||
MessageBox(ofn.hwndOwner,
|
MessageBox(ofn.hwndOwner,
|
||||||
|
@ -264,6 +272,7 @@ NS_IMETHODIMP nsFilePicker::ShowW(PRInt16 *aReturnVal)
|
||||||
MB_ICONERROR);
|
MB_ICONERROR);
|
||||||
result = PR_FALSE;
|
result = PR_FALSE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (result == PR_TRUE) {
|
if (result == PR_TRUE) {
|
||||||
// Remember what filter type the user selected
|
// Remember what filter type the user selected
|
||||||
|
|
Загрузка…
Ссылка в новой задаче