зеркало из https://github.com/mozilla/gecko-dev.git
Fixed filewidget to use filespec. Fixed some input params to be const.
This commit is contained in:
Родитель
67ce487a0c
Коммит
99661eb83b
|
@ -105,24 +105,6 @@ NS_METHOD nsFileWidget::SetFilterList(PRUint32 aNumberOfFilters,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Get the file + path
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
NS_METHOD nsFileWidget::GetFile(nsString& aFile)
|
||||
{
|
||||
aFile.Truncate();
|
||||
if (mWidget) {
|
||||
gchar *fn = gtk_file_selection_get_filename(GTK_FILE_SELECTION(mWidget));
|
||||
aFile.Append(fn);
|
||||
// g_free(fn);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_METHOD nsFileWidget::GetFile(nsFileSpec& aFile)
|
||||
{
|
||||
if (mWidget) {
|
||||
|
@ -138,7 +120,7 @@ NS_METHOD nsFileWidget::GetFile(nsFileSpec& aFile)
|
|||
// Get the file + path
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsFileWidget::SetDefaultString(nsString& aString)
|
||||
NS_METHOD nsFileWidget::SetDefaultString(const nsString& aString)
|
||||
{
|
||||
if (mWidget) {
|
||||
char *fn = aString.ToNewCString();
|
||||
|
@ -155,7 +137,7 @@ NS_METHOD nsFileWidget::SetDefaultString(nsString& aString)
|
|||
// Set the display directory
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsFileWidget::SetDisplayDirectory(nsString& aDirectory)
|
||||
NS_METHOD nsFileWidget::SetDisplayDirectory(const nsFileSpec& aDirectory)
|
||||
{
|
||||
mDisplayDirectory = aDirectory;
|
||||
return NS_OK;
|
||||
|
@ -166,7 +148,7 @@ NS_METHOD nsFileWidget::SetDisplayDirectory(nsString& aDirectory)
|
|||
// Get the display directory
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsFileWidget::GetDisplayDirectory(nsString& aDirectory)
|
||||
NS_METHOD nsFileWidget::GetDisplayDirectory(nsFileSpec& aDirectory)
|
||||
{
|
||||
aDirectory = mDisplayDirectory;
|
||||
return NS_OK;
|
||||
|
@ -175,7 +157,7 @@ NS_METHOD nsFileWidget::GetDisplayDirectory(nsString& aDirectory)
|
|||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsFileWidget::Create(nsIWidget *aParent,
|
||||
nsString& aTitle,
|
||||
const nsString& aTitle,
|
||||
nsFileDlgMode aMode,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell,
|
||||
|
@ -220,7 +202,7 @@ nsFileWidget::OnDestroySignal(GtkWidget* aGtkWidget)
|
|||
}
|
||||
|
||||
nsFileDlgResults nsFileWidget::GetFile(nsIWidget *aParent,
|
||||
nsString &promptString,
|
||||
const nsString &promptString,
|
||||
nsFileSpec &theFileSpec)
|
||||
{
|
||||
Create(aParent, promptString, eMode_load, nsnull, nsnull);
|
||||
|
@ -234,7 +216,7 @@ nsFileDlgResults nsFileWidget::GetFile(nsIWidget *aParent,
|
|||
}
|
||||
|
||||
nsFileDlgResults nsFileWidget::GetFolder(nsIWidget *aParent,
|
||||
nsString &promptString,
|
||||
const nsString &promptString,
|
||||
nsFileSpec &theFileSpec)
|
||||
{
|
||||
Create(aParent, promptString, eMode_getfolder, nsnull, nsnull);
|
||||
|
@ -248,7 +230,7 @@ nsFileDlgResults nsFileWidget::GetFolder(nsIWidget *aParent,
|
|||
}
|
||||
|
||||
nsFileDlgResults nsFileWidget::PutFile(nsIWidget *aParent,
|
||||
nsString &promptString,
|
||||
const nsString &promptString,
|
||||
nsFileSpec &theFileSpec)
|
||||
{
|
||||
Create(aParent, promptString, eMode_save, nsnull, nsnull);
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
// nsIWidget interface
|
||||
|
||||
NS_IMETHOD Create(nsIWidget *aParent,
|
||||
nsString& aTitle,
|
||||
const nsString& aTitle,
|
||||
nsFileDlgMode aMode,
|
||||
nsIDeviceContext *aContext = nsnull,
|
||||
nsIAppShell *aAppShell = nsnull,
|
||||
|
@ -52,26 +52,25 @@ public:
|
|||
|
||||
// nsIFileWidget part
|
||||
virtual PRBool Show();
|
||||
NS_IMETHOD GetFile(nsString& aFile);
|
||||
NS_IMETHOD GetFile(nsFileSpec& aFile);
|
||||
NS_IMETHOD SetDefaultString(nsString& aFile);
|
||||
NS_IMETHOD SetDefaultString(const nsString& aFile);
|
||||
NS_IMETHOD SetFilterList(PRUint32 aNumberOfFilters,
|
||||
const nsString aTitles[],
|
||||
const nsString aFilters[]);
|
||||
|
||||
NS_IMETHOD GetDisplayDirectory(nsString& aDirectory);
|
||||
NS_IMETHOD SetDisplayDirectory(nsString& aDirectory);
|
||||
NS_IMETHOD GetDisplayDirectory(nsFileSpec& aDirectory);
|
||||
NS_IMETHOD SetDisplayDirectory(const nsFileSpec& aDirectory);
|
||||
|
||||
virtual nsFileDlgResults GetFile(nsIWidget *aParent,
|
||||
nsString &promptString,
|
||||
const nsString &promptString,
|
||||
nsFileSpec &theFileSpec);
|
||||
|
||||
virtual nsFileDlgResults GetFolder(nsIWidget *aParent,
|
||||
nsString &promptString,
|
||||
const nsString &promptString,
|
||||
nsFileSpec &theFileSpec);
|
||||
|
||||
virtual nsFileDlgResults PutFile(nsIWidget *aParent,
|
||||
nsString &promptString,
|
||||
const nsString &promptString,
|
||||
nsFileSpec &theFileSpec);
|
||||
|
||||
protected:
|
||||
|
@ -87,7 +86,7 @@ protected:
|
|||
const nsString* mTitles;
|
||||
const nsString* mFilters;
|
||||
nsString mDefault;
|
||||
nsString mDisplayDirectory;
|
||||
nsFileSpec mDisplayDirectory;
|
||||
};
|
||||
|
||||
#endif // nsFileWidget_h__
|
||||
|
|
|
@ -59,7 +59,7 @@ class nsFileWidget : public nsWindow, public nsIFileWidget
|
|||
// nsIWidget interface
|
||||
|
||||
NS_IMETHOD Create( nsIWidget *aParent,
|
||||
nsString& aTitle,
|
||||
const nsString& aTitle,
|
||||
nsFileDlgMode aMode,
|
||||
nsIDeviceContext *aContext = nsnull,
|
||||
nsIAppShell *aAppShell = nsnull,
|
||||
|
@ -68,8 +68,8 @@ class nsFileWidget : public nsWindow, public nsIFileWidget
|
|||
|
||||
// nsIFileWidget part
|
||||
virtual PRBool Show();
|
||||
NS_IMETHOD GetFile(nsString& aFile);
|
||||
NS_IMETHOD SetDefaultString(nsString& aString);
|
||||
NS_IMETHOD GetFile(nsFileSpec& aFile);
|
||||
NS_IMETHOD SetDefaultString(const nsString& aString);
|
||||
NS_IMETHOD SetFilterList(PRUint32 aNumberOfFilters,
|
||||
const nsString aTitles[],
|
||||
const nsString aFilters[]);
|
||||
|
|
|
@ -52,48 +52,43 @@ NS_METHOD nsFileWidget::SetFilterList(PRUint32 aNumberOfFilters,const nsString a
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsFileWidget::GetFile(nsString& aFile)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsFileWidget::GetFile(nsFileSpec& aFile)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsFileDlgResults nsFileWidget::GetFile(nsIWidget * aParent,
|
||||
nsString & promptString,
|
||||
const nsString & promptString,
|
||||
nsFileSpec & theFileSpec)
|
||||
{
|
||||
return nsFileDlgResults_OK;
|
||||
}
|
||||
|
||||
nsFileDlgResults nsFileWidget::GetFolder(nsIWidget * aParent,
|
||||
nsString & promptString,
|
||||
const nsString & promptString,
|
||||
nsFileSpec & theFileSpec)
|
||||
{
|
||||
return nsFileDlgResults_OK;
|
||||
}
|
||||
|
||||
nsFileDlgResults nsFileWidget::PutFile(nsIWidget * aParent,
|
||||
nsString & promptString,
|
||||
const nsString & promptString,
|
||||
nsFileSpec & theFileSpec)
|
||||
{
|
||||
return nsFileDlgResults_OK;
|
||||
|
||||
}
|
||||
NS_METHOD nsFileWidget::SetDefaultString(nsString& aString)
|
||||
NS_METHOD nsFileWidget::SetDefaultString(const nsString& aString)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsFileWidget::SetDisplayDirectory(nsString& aDirectory)
|
||||
NS_METHOD nsFileWidget::SetDisplayDirectory(const nsFileSpec& aDirectory)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsFileWidget::GetDisplayDirectory(nsString& aDirectory)
|
||||
NS_METHOD nsFileWidget::GetDisplayDirectory(nsFileSpec& aDirectory)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ class nsFileWidget : public nsIFileWidget
|
|||
// nsIWidget interface
|
||||
|
||||
NS_IMETHOD Create( nsIWidget *aParent,
|
||||
nsString& aTitle,
|
||||
const nsString& aTitle,
|
||||
nsFileDlgMode aMode,
|
||||
nsIDeviceContext *aContext = nsnull,
|
||||
nsIAppShell *aAppShell = nsnull,
|
||||
|
@ -48,21 +48,20 @@ class nsFileWidget : public nsIFileWidget
|
|||
|
||||
// nsIFileWidget part
|
||||
virtual PRBool Show();
|
||||
NS_IMETHOD GetFile(nsString& aFile);
|
||||
NS_IMETHOD GetFile(nsFileSpec& aFile);
|
||||
nsFileDlgResults GetFile(nsIWidget * aParent,
|
||||
nsString & promptString,
|
||||
const nsString & promptString,
|
||||
nsFileSpec & theFileSpec);
|
||||
nsFileDlgResults GetFolder(nsIWidget * aParent,
|
||||
nsString & promptString,
|
||||
const nsString & promptString,
|
||||
nsFileSpec & theFileSpec);
|
||||
nsFileDlgResults PutFile(nsIWidget * aParent,
|
||||
nsString & promptString,
|
||||
const nsString & promptString,
|
||||
nsFileSpec & theFileSpec);
|
||||
NS_IMETHOD SetDefaultString(nsString& aFile);
|
||||
NS_IMETHOD SetDefaultString(const nsString& aFile);
|
||||
NS_IMETHOD SetFilterList(PRUint32 aNumberOfFilters,const nsString aTitles[],const nsString aFilters[]);
|
||||
NS_IMETHOD GetDisplayDirectory(nsString& aDirectory);
|
||||
NS_IMETHOD SetDisplayDirectory(nsString& aDirectory);
|
||||
NS_IMETHOD GetDisplayDirectory(nsFileSpec& aDirectory);
|
||||
NS_IMETHOD SetDisplayDirectory(const nsFileSpec& aDirectory);
|
||||
protected:
|
||||
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче