зеркало из https://github.com/mozilla/pjs.git
If you don't get an nsIFileWidget, don't just go ahead and call methods on it.
This commit is contained in:
Родитель
78190756bd
Коммит
9b1a2f8d7e
|
@ -154,25 +154,28 @@ void nsFileControlFrame::MouseClicked(nsIPresContext* aPresContext)
|
|||
textView->GetParent(parentView);
|
||||
nsIWidget* parentWidget = GetWindowTemp(parentView);
|
||||
|
||||
nsIFileWidget *fileWidget;
|
||||
|
||||
nsIFileWidget *fileWidget = nsnull;
|
||||
|
||||
nsString title("File Upload");
|
||||
nsComponentManager::CreateInstance(kCFileWidgetCID, nsnull, kIFileWidgetIID, (void**)&fileWidget);
|
||||
|
||||
nsString titles[] = {"all files"};
|
||||
nsString filters[] = {"*.*"};
|
||||
fileWidget->SetFilterList(1, titles, filters);
|
||||
if (fileWidget)
|
||||
{
|
||||
nsString titles[] = {"all files"};
|
||||
nsString filters[] = {"*.*"};
|
||||
fileWidget->SetFilterList(1, titles, filters);
|
||||
|
||||
fileWidget->Create(parentWidget, title, eMode_load, nsnull, nsnull);
|
||||
result = fileWidget->Show();
|
||||
fileWidget->Create(parentWidget, title, eMode_load, nsnull, nsnull);
|
||||
result = fileWidget->Show();
|
||||
|
||||
if (result) {
|
||||
PRUint32 size;
|
||||
nsString fileName;
|
||||
fileWidget->GetFile(fileName);
|
||||
textWidget->SetText(fileName,size);
|
||||
if (result) {
|
||||
PRUint32 size;
|
||||
nsString fileName;
|
||||
fileWidget->GetFile(fileName);
|
||||
textWidget->SetText(fileName,size);
|
||||
}
|
||||
NS_RELEASE(fileWidget);
|
||||
}
|
||||
NS_RELEASE(fileWidget);
|
||||
NS_RELEASE(parentWidget);
|
||||
NS_RELEASE(textWidget);
|
||||
NS_RELEASE(widget);
|
||||
|
|
|
@ -154,25 +154,28 @@ void nsFileControlFrame::MouseClicked(nsIPresContext* aPresContext)
|
|||
textView->GetParent(parentView);
|
||||
nsIWidget* parentWidget = GetWindowTemp(parentView);
|
||||
|
||||
nsIFileWidget *fileWidget;
|
||||
|
||||
nsIFileWidget *fileWidget = nsnull;
|
||||
|
||||
nsString title("File Upload");
|
||||
nsComponentManager::CreateInstance(kCFileWidgetCID, nsnull, kIFileWidgetIID, (void**)&fileWidget);
|
||||
|
||||
nsString titles[] = {"all files"};
|
||||
nsString filters[] = {"*.*"};
|
||||
fileWidget->SetFilterList(1, titles, filters);
|
||||
if (fileWidget)
|
||||
{
|
||||
nsString titles[] = {"all files"};
|
||||
nsString filters[] = {"*.*"};
|
||||
fileWidget->SetFilterList(1, titles, filters);
|
||||
|
||||
fileWidget->Create(parentWidget, title, eMode_load, nsnull, nsnull);
|
||||
result = fileWidget->Show();
|
||||
fileWidget->Create(parentWidget, title, eMode_load, nsnull, nsnull);
|
||||
result = fileWidget->Show();
|
||||
|
||||
if (result) {
|
||||
PRUint32 size;
|
||||
nsString fileName;
|
||||
fileWidget->GetFile(fileName);
|
||||
textWidget->SetText(fileName,size);
|
||||
if (result) {
|
||||
PRUint32 size;
|
||||
nsString fileName;
|
||||
fileWidget->GetFile(fileName);
|
||||
textWidget->SetText(fileName,size);
|
||||
}
|
||||
NS_RELEASE(fileWidget);
|
||||
}
|
||||
NS_RELEASE(fileWidget);
|
||||
NS_RELEASE(parentWidget);
|
||||
NS_RELEASE(textWidget);
|
||||
NS_RELEASE(widget);
|
||||
|
|
Загрузка…
Ссылка в новой задаче