Revision: 7218
http://svn.sourceforge.net/mahogany/?rev=7218&view=rev
Author: vadz
Date: 2007-04-02 09:22:36 -0700 (Mon, 02 Apr 2007)
Log Message:
-----------
use wxFD_XXX constants instead of deprecated wxXXX ones; added convenient
wrappers wxPSave/LoadExistingFileSelector
Modified Paths:
--------------
trunk/M/include/wx/persctrl.h
trunk/M/src/adb/AdbDialogs.cpp
trunk/M/src/adb/AdbFrame.cpp
trunk/M/src/gui/wxBrowseButton.cpp
trunk/M/src/gui/wxComposeView.cpp
trunk/M/src/gui/wxMDialogs.cpp
trunk/M/src/gui/wxMIMETreeDialog.cpp
trunk/M/src/gui/wxTemplateDialog.cpp
trunk/M/src/gui/wxTextDialog.cpp
trunk/M/src/mail/MailFolderCmn.cpp
Modified: trunk/M/include/wx/persctrl.h
===================================================================
--- trunk/M/include/wx/persctrl.h 2007-03-22 00:19:39 UTC (rev 7217)
+++ trunk/M/include/wx/persctrl.h 2007-04-02 16:22:36 UTC (rev 7218)
@@ -31,6 +31,7 @@
# include <wx/radiobox.h>
#endif // USE_PCH
+#include <wx/filedlg.h>
#include <wx/notebook.h>
#include <wx/splitter.h>
#include <wx/listctrl.h>
@@ -724,16 +725,48 @@
wxFILEDLG_USE_FILENAME = 0x2000 // don't override with config setting
};
-extern WXDLLMAYEXP wxString wxPFileSelector(const wxString& configPath,
- const wxString& title,
- const wxChar *defpath = NULL,
- const wxChar *defname = NULL,
- const wxChar *extension = NULL,
- const wxChar *filter = NULL,
- int flags = 0,
- wxWindow *parent = NULL,
- wxConfigBase *config = NULL);
+extern WXDLLMAYEXP wxString
+wxPFileSelector(const wxString& configPath,
+ const wxString& title,
+ const wxChar *defpath = NULL,
+ const wxChar *defname = NULL,
+ const wxChar *extension = NULL,
+ const wxChar *filter = NULL,
+ int flags = 0,
+ wxWindow *parent = NULL,
+ wxConfigBase *config = NULL);
+// convenient wrappers for wxPFileSelector to use when loading/saving files
+inline wxString
+wxPLoadExistingFileSelector(wxWindow *parent,
+ const wxString& configPath,
+ const wxString& title,
+ const wxChar *defpath = NULL,
+ const wxChar *defname = NULL,
+ const wxChar *extension = NULL,
+ const wxChar *filter = NULL,
+ wxConfigBase *config = NULL)
+{
+ return wxPFileSelector(configPath, title, defpath, defname, extension,
+ filter, wxFD_OPEN | wxFD_FILE_MUST_EXIST,
+ parent, config);
+}
+
+inline wxString
+wxPSaveFileSelector(wxWindow *parent,
+ const wxString& configPath,
+ const wxString& title,
+ const wxChar *defpath = NULL,
+ const wxChar *defname = NULL,
+ const wxChar *extension = NULL,
+ const wxChar *filter = NULL,
+ wxConfigBase *config = NULL)
+{
+ return wxPFileSelector(configPath, title, defpath, defname, extension,
+ filter, wxFD_SAVE | wxFD_OVERWRITE_PROMPT,
+ parent, config);
+}
+
// return the number of filenames selected, the filenames themselves are in
// the array passed by reference
extern WXDLLMAYEXP size_t wxPFilesSelector(wxArrayString& filenames,
Modified: trunk/M/src/adb/AdbDialogs.cpp
===================================================================
--- trunk/M/src/adb/AdbDialogs.cpp 2007-03-22 00:19:39 UTC (rev 7217)
+++ trunk/M/src/adb/AdbDialogs.cpp 2007-04-02 16:22:36 UTC (rev 7218)
@@ -583,13 +583,11 @@
wxLog::GetActiveTarget()->Flush();
}
- filename = wxPFileSelector
+ filename = wxPLoadExistingFileSelector
(
+ frame,
_T("AdbImportFile"),
- _("Please select source address book file"),
- NULL, NULL, NULL, NULL,
- wxOPEN | wxFILE_MUST_EXIST,
- frame
+ _("Please select source address book file")
);
}
Modified: trunk/M/src/adb/AdbFrame.cpp
===================================================================
--- trunk/M/src/adb/AdbFrame.cpp 2007-03-22 00:19:39 UTC (rev 7217)
+++ trunk/M/src/adb/AdbFrame.cpp 2007-04-02 16:22:36 UTC (rev 7218)
@@ -2182,7 +2182,7 @@
_T("M.adb"),
_T("adb"),
_("Address books (*.adb)|*.adb|All files (*.*)|*.*"),
- bDoCreate ? 0 : wxFILE_MUST_EXIST,
+ bDoCreate ? 0 : wxFD_FILE_MUST_EXIST,
this
);
@@ -2279,16 +2279,15 @@
}
// ask the user for the file name
- wxString filename = wxPFileSelector
+ wxString filename = wxPSaveFileSelector
(
+ this,
ADB_CONFIG_PATH _T("/AdbVCardFile"),
_("Choose the name of vCard file"),
READ_APPCONFIG_TEXT(MP_USERDIR),
_T("vcard.vcf"),
_T("vcf"),
- _("vCard files (*.vcf)|*.vcf|All files (*.*)|*.*"),
- 0,
- this
+ _("vCard files (*.vcf)|*.vcf|All files (*.*)|*.*")
);
if ( !!filename )
{
@@ -2326,16 +2325,15 @@
}
// choose the file
- wxString filename = wxPFileSelector
+ wxString filename = wxPLoadExistingFileSelector
(
+ this,
ADB_CONFIG_PATH _T("/AdbVCardFile"),
_("Choose the name of vCard file"),
READ_APPCONFIG_TEXT(MP_USERDIR),
_T("vcard.vcf"),
_T("vcf"),
- _("vCard files (*.vcf)|*.vcf|All files (*.*)|*.*"),
- wxFILE_MUST_EXIST,
- this
+ _("vCard files (*.vcf)|*.vcf|All files (*.*)|*.*")
);
if ( !!filename )
@@ -2757,10 +2755,7 @@
wxPTextEntry *text,
int *where,
int *how)
- : wxDialog(parent, -1, _("Find address book entry"),
- wxDefaultPosition,
- wxDefaultSize,
- wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL)
+ : wxDialog(parent, -1, _("Find address book entry"))
{
// init member vars
// ----------------
@@ -2925,10 +2920,7 @@
wxADBCreateDialog::wxADBCreateDialog(wxWindow *parent,
const wxString& strName,
bool bGroup)
- : wxDialog(parent, -1, _("Create a new entry/group"),
- wxDefaultPosition,
- wxDefaultSize,
- wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL),
+ : wxDialog(parent, -1, _("Create a new entry/group")),
m_strName(strName), m_bGroup(bGroup)
{
const wxChar *label = _("&New entry/group name:");
Modified: trunk/M/src/gui/wxBrowseButton.cpp
===================================================================
--- trunk/M/src/gui/wxBrowseButton.cpp 2007-03-22 00:19:39 UTC (rev 7217)
+++ trunk/M/src/gui/wxBrowseButton.cpp 2007-04-02 16:22:36 UTC (rev 7218)
@@ -152,9 +152,9 @@
wxString strLastDir, strLastFile, strLastExt, strPath = GetText();
wxSplitPath(strPath, &strLastDir, &strLastFile, &strLastExt);
- long style = m_open ? wxOPEN : wxSAVE | wxOVERWRITE_PROMPT;
+ long style = m_open ? wxFD_OPEN : wxFD_SAVE | wxFD_OVERWRITE_PROMPT;
if ( m_existingOnly )
- style |= wxFILE_MUST_EXIST;
+ style |= wxFD_FILE_MUST_EXIST;
wxFileDialog dialog(GetFrame(this), wxEmptyString,
strLastDir, strLastFile,
Modified: trunk/M/src/gui/wxComposeView.cpp
===================================================================
--- trunk/M/src/gui/wxComposeView.cpp 2007-03-22 00:19:39 UTC (rev 7217)
+++ trunk/M/src/gui/wxComposeView.cpp 2007-04-02 16:22:36 UTC (rev 7218)
@@ -2982,11 +2982,14 @@
{
wxString pattern;
pattern << _("vCard files (*.vcf)|*.vcf") << _T('|') <<
wxGetTranslation(wxALL_FILES);
- filename = wxPFileSelector(_T("vcard"),
- _("Choose vCard file"),
- NULL, _T("vcard.vcf"), NULL,
- pattern,
- 0, this);
+ filename = wxPLoadExistingFileSelector
+ (
+ this,
+ "vcard",
+ _("Choose vCard file"),
+ NULL, _T("vcard.vcf"), NULL,
+ pattern
+ );
}
else
{
@@ -3380,14 +3383,12 @@
case WXMENU_COMPOSE_LOADTEXT:
{
- String filename = wxPFileSelector
+ String filename = wxPLoadExistingFileSelector
(
+ this,
_T("MsgInsertText"),
_("Please choose a file to insert."),
- NULL, _T("dead.letter"), NULL,
- wxGetTranslation(wxALL_FILES),
- wxOPEN | wxFILE_MUST_EXIST,
- this
+ NULL, _T("dead.letter"), NULL
);
if ( filename.empty() )
@@ -3409,14 +3410,12 @@
case WXMENU_COMPOSE_SAVETEXT:
if(m_editor->FinishWork())
{
- String filename = wxPFileSelector
+ String filename = wxPSaveFileSelector
(
+ this,
_T("MsgSaveText"),
_("Choose file to append message to"),
- NULL, _T("dead.letter"), NULL,
- wxGetTranslation(wxALL_FILES),
- wxSAVE,
- this
+ NULL, _T("dead.letter"), NULL
);
if ( filename.empty() )
@@ -4047,7 +4046,7 @@
_("Please choose files to insert."),
NULL, _T("dead.letter"), NULL,
wxGetTranslation(wxALL_FILES),
- wxOPEN | wxFILE_MUST_EXIST,
+ wxFD_OPEN | wxFD_FILE_MUST_EXIST,
this
);
for ( size_t n = 0; n < nFiles; n++ )
Modified: trunk/M/src/gui/wxMDialogs.cpp
===================================================================
--- trunk/M/src/gui/wxMDialogs.cpp 2007-03-22 00:19:39 UTC (rev 7217)
+++ trunk/M/src/gui/wxMDialogs.cpp 2007-04-02 16:22:36 UTC (rev 7218)
@@ -380,10 +380,7 @@
const wxString& strConfigPath,
const wxString& strDefault,
bool passwordflag)
- : wxDialog(parent, -1, wxString(M_TITLE_PREFIX) + strCaption,
- wxDefaultPosition,
- wxDefaultSize,
- wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL)
+ : wxDialog(parent, -1, wxString(M_TITLE_PREFIX) + strCaption)
{
// text is the default value normally read from config and it may be
// overriden by strDefault parameter if it is not empty
@@ -980,13 +977,16 @@
switch ( ev.GetId() )
{
case wxID_OPEN:
- m_FileName = wxPFileSelector(_T("FolderDialogFile"),
- _("Mahogany: Please choose a folder
file"),
- NULL, NULL, NULL, NULL,
- m_flags & MDlg_Folder_Open
- ? wxOPEN | wxFILE_MUST_EXIST
- : wxSAVE,
- this);
+ m_FileName = wxPFileSelector
+ (
+ "FolderDialogFile",
+ _("Mahogany: Please choose a folder file"),
+ NULL, NULL, NULL, NULL,
+ m_flags & MDlg_Folder_Open
+ ? wxFD_OPEN | wxFD_FILE_MUST_EXIST
+ : wxFD_SAVE | wxFD_OVERWRITE_PROMPT,
+ this
+ );
if ( !!m_FileName )
{
// folder (file) chosen
@@ -1497,10 +1497,13 @@
xface = m_Button->GetFile();
path = xface.BeforeLast('/');
file = xface.AfterLast('/');
- newface = wxPFileSelector(GetProfile()->GetName() +
_T("/xfacefilerequester"),
- _("Please pick an image file"),
- path, file, NULL,
- NULL, 0, this);
+ newface = wxPLoadExistingFileSelector
+ (
+ this,
+ GetProfile()->GetName() + _T("/xfacefilerequester"),
+ _("Please pick an image file"),
+ path, file, NULL
+ );
m_Button->SetFile(newface);
}
m_Button->Enable(m_Checkbox->GetValue() != 0);
Modified: trunk/M/src/gui/wxMIMETreeDialog.cpp
===================================================================
--- trunk/M/src/gui/wxMIMETreeDialog.cpp 2007-03-22 00:19:39 UTC (rev
7217)
+++ trunk/M/src/gui/wxMIMETreeDialog.cpp 2007-04-02 16:22:36 UTC (rev
7218)
@@ -410,18 +410,13 @@
String filename;
if ( needToAsk )
{
- filename = wxPFileSelector
+ filename = wxPSaveFileSelector
(
+ this,
_T("MimeSave"),
_("Attachment has a name of existing file,\n"
"please choose another one:"),
- dir, // default path
- NULL, // default name
- NULL, // default ext
- NULL, // default filter
- wxSAVE |
- wxOVERWRITE_PROMPT,
- this
+ dir // default path
);
if ( filename.empty() )
Modified: trunk/M/src/gui/wxTemplateDialog.cpp
===================================================================
--- trunk/M/src/gui/wxTemplateDialog.cpp 2007-03-22 00:19:39 UTC (rev
7217)
+++ trunk/M/src/gui/wxTemplateDialog.cpp 2007-04-02 16:22:36 UTC (rev
7218)
@@ -342,11 +342,12 @@
case TemplatePopupMenuItem::File:
// choose the file (can't be more specific in messages because we
// don't really know what is it for...)
- value = wxPFileSelector(_T("TemplateFile"),
- _("Please choose a file"),
- NULL, NULL, NULL, NULL,
- wxOPEN | wxFILE_MUST_EXIST,
- this);
+ value = wxPLoadExistingFileSelector
+ (
+ this,
+ "TemplateFile",
+ _("Please choose a file")
+ );
if ( !value )
{
// user cancelled
Modified: trunk/M/src/gui/wxTextDialog.cpp
===================================================================
--- trunk/M/src/gui/wxTextDialog.cpp 2007-03-22 00:19:39 UTC (rev 7217)
+++ trunk/M/src/gui/wxTextDialog.cpp 2007-04-02 16:22:36 UTC (rev 7218)
@@ -248,13 +248,11 @@
// save the text controls contents to file
void MTextDialog::OnSave(wxCommandEvent&)
{
- String filename = wxPFileSelector
+ String filename = wxPSaveFileSelector
(
+ this,
_T("RawText"),
- _("Mahogany: Please choose where to save the text"),
- NULL, NULL, NULL, NULL,
- wxSAVE | wxOVERWRITE_PROMPT,
- this
+ _("Mahogany: Please choose where to save the text")
);
if ( !filename.empty() )
{
Modified: trunk/M/src/mail/MailFolderCmn.cpp
===================================================================
--- trunk/M/src/mail/MailFolderCmn.cpp 2007-03-22 00:19:39 UTC (rev 7217)
+++ trunk/M/src/mail/MailFolderCmn.cpp 2007-04-02 16:22:36 UTC (rev 7218)
@@ -695,14 +695,11 @@
if ( fileName.empty() )
{
// ask the user
- fileName = wxPFileSelector
+ fileName = wxPSaveFileSelector
(
+ parent,
_T("MsgSave"),
- _("Choose file to save message to"),
- NULL, NULL, NULL,
- _("All files (*.*)|*.*"),
- wxSAVE | wxOVERWRITE_PROMPT,
- parent
+ _("Choose file to save message to")
);
if ( fileName.empty() )
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates