SF.net SVN: mahogany:[7564] trunk/M/src

[email protected] Sun, 29 Mar 2009 13:20:13 +0000
Newsgroups gmane.mail.mahogany.cvs
Message-ID <[email protected]>
Revision: 7564
          http://mahogany.svn.sourceforge.net/mahogany/?rev=7564&view=rev
Author:   vadz
Date:     2009-03-29 13:20:12 +0000 (Sun, 29 Mar 2009)

Log Message:
-----------
replace deprecated functions from wx/filefn.h with wxFileName method calls

Modified Paths:
--------------
    trunk/M/src/Python/PythonDll.cpp
    trunk/M/src/adb/AdbDialogs.cpp
    trunk/M/src/adb/ImportEudora.cpp
    trunk/M/src/classes/CacheFile.cpp
    trunk/M/src/classes/MApplication.cpp
    trunk/M/src/classes/MessageView.cpp
    trunk/M/src/gui/wxBrowseButton.cpp
    trunk/M/src/gui/wxComposeView.cpp
    trunk/M/src/gui/wxMApp.cpp
    trunk/M/src/gui/wxMDialogs.cpp
    trunk/M/src/gui/wxMFolderDialogs.cpp
    trunk/M/src/gui/wxMIMETreeDialog.cpp
    trunk/M/src/gui/wxllist.cpp
    trunk/M/src/modules/spam/HeadersFilter.cpp
    trunk/M/src/modules/viewflt/UUDecode.cpp
    trunk/M/src/util/upgrade.cpp
    trunk/M/src/wx/generic/persctrl.cpp

Modified: trunk/M/src/Python/PythonDll.cpp
===================================================================
--- trunk/M/src/Python/PythonDll.cpp	2009-03-29 13:06:23 UTC (rev 7563)
+++ trunk/M/src/Python/PythonDll.cpp	2009-03-29 13:20:12 UTC (rev 7564)
@@ -407,7 +407,7 @@
 #if defined(OS_WIN) && defined(DEBUG)
       // we must use debug version of Python DLL
       wxString path, name, ext;
-      wxSplitPath(pathDLL, &path, &name, &ext);
+      wxFileName::SplitPath(pathDLL, &path, &name, &ext);
       if ( name.Right(2).Lower() != _T("_d") )
          name += _T("_d");
       pathDLL = path + wxFILE_SEP_PATH + name + wxFILE_SEP_EXT + ext;

Modified: trunk/M/src/adb/AdbDialogs.cpp
===================================================================
--- trunk/M/src/adb/AdbDialogs.cpp	2009-03-29 13:06:23 UTC (rev 7563)
+++ trunk/M/src/adb/AdbDialogs.cpp	2009-03-29 13:20:12 UTC (rev 7564)
@@ -609,7 +609,7 @@
 
    // ask for the name of the ADB to import data in
    wxString adbname, ext;
-   wxSplitPath(filename, NULL, &adbname, &ext);
+   wxFileName::SplitPath(filename, NULL, &adbname, &ext);
    if ( !adbname )
    {
       // this means that the file starts with '.' in which case just take the

Modified: trunk/M/src/adb/ImportEudora.cpp
===================================================================
--- trunk/M/src/adb/ImportEudora.cpp	2009-03-29 13:06:23 UTC (rev 7563)
+++ trunk/M/src/adb/ImportEudora.cpp	2009-03-29 13:20:12 UTC (rev 7564)
@@ -282,7 +282,7 @@
 bool AdbEudoraImporter::CanImport(const String& filename)
 {
    wxString path, name, ext;
-   wxSplitPath(filename, &path, &name, &ext);
+   wxFileName::SplitPath(filename, &path, &name, &ext);
 
    if ( ext != "txt" )
    {

Modified: trunk/M/src/classes/CacheFile.cpp
===================================================================
--- trunk/M/src/classes/CacheFile.cpp	2009-03-29 13:06:23 UTC (rev 7563)
+++ trunk/M/src/classes/CacheFile.cpp	2009-03-29 13:20:12 UTC (rev 7564)
@@ -113,8 +113,7 @@
 {
    String filename = GetFileName();
 
-   String dirname;
-   wxSplitPath(filename, &dirname, NULL, NULL);
+   String dirname = wxFileName(filename).GetPath();
 
    if ( !wxDirExists(dirname) )
    {

Modified: trunk/M/src/classes/MApplication.cpp
===================================================================
--- trunk/M/src/classes/MApplication.cpp	2009-03-29 13:06:23 UTC (rev 7563)
+++ trunk/M/src/classes/MApplication.cpp	2009-03-29 13:20:12 UTC (rev 7564)
@@ -1117,7 +1117,7 @@
       if ( ::GetModuleFileName(NULL, wxStringBuffer(path, MAX_PATH), MAX_PATH) )
       {
          // get just the directory
-         wxSplitPath(path, &m_globalDir, NULL, NULL);
+         m_globalDir = wxFileName(path).GetPath();
       }
 #else
       #error "Don't know how to find program directory on this platform!"

Modified: trunk/M/src/classes/MessageView.cpp
===================================================================
--- trunk/M/src/classes/MessageView.cpp	2009-03-29 13:06:23 UTC (rev 7563)
+++ trunk/M/src/classes/MessageView.cpp	2009-03-29 13:20:12 UTC (rev 7564)
@@ -3201,8 +3201,8 @@
    msg->DecRef();
 #else // 1
    bool ok = false;
-   wxString filename;
-   if ( wxGetTempFileName("Mtemp", filename) )
+   wxString filename = wxFileName::CreateTempFileName("Mtemp");
+   if ( !filename.empty() )
    {
       if ( MimeSaveAsMessage(mimepart, filename) )
       {
@@ -3278,8 +3278,7 @@
       // extension.
       if ( !filenameOrig.empty() )
       {
-         wxString ext;
-         wxSplitPath(filenameOrig, NULL, NULL, &ext);
+         wxString ext = wxFileName(filenameOrig).GetExt();
 
          if ( !ext.empty() )
             fileType = mimeManager.GetFileTypeFromExtension(ext);
@@ -3303,8 +3302,8 @@
       return;
    }
 
-   String filename;
-   if ( !wxGetTempFileName("Mtemp", filename) )
+   String filename = wxFileName::CreateTempFileName("Mtemp");
+   if ( filename.empty() )
    {
       wxLogError(_("Failed to open the attachment."));
 
@@ -3312,8 +3311,7 @@
       return;
    }
 
-   wxString ext;
-   wxSplitPath(filenameOrig, NULL, NULL, &ext);
+   wxString ext = wxFileName(filenameOrig).GetExt();
 
    // get the standard extension for such files if there is no real one
    if ( fileType != NULL && ext.empty() )
@@ -3329,7 +3327,7 @@
    // extensions of the input file (case in point: WinZip), so try to choose a
    // correct one
    wxString path, name, extOld;
-   wxSplitPath(filename, &path, &name, &extOld);
+   wxFileName::SplitPath(filename, &path, &name, &extOld);
    if ( extOld != ext )
    {
       // Windows creates the temp file even if we didn't use it yet
@@ -3460,10 +3458,9 @@
    wxFileType *fileType = NULL;
    fileType = mimeManager.GetFileTypeFromMimeType(mimetype);
 
-   String filename = wxGetTempFileName("Mtemp");
+   String filename = wxFileName::CreateTempFileName("Mtemp");
 
-   wxString ext;
-   wxSplitPath(filenameOrig, NULL, NULL, &ext);
+   wxString ext = wxFileName(filenameOrig).GetExt();
    // get the standard extension for such files if there is no real one
    if ( fileType != NULL && !ext )
    {
@@ -3478,7 +3475,7 @@
    // extensions of the input file (case in point: WinZip), so try to choose a
    // correct one
    wxString path, name, extOld;
-   wxSplitPath(filename, &path, &name, &extOld);
+   wxFileName::SplitPath(filename, &path, &name, &extOld);
    if ( extOld != ext )
    {
       // Windows creates the temp file even if we didn't use it yet
@@ -3550,7 +3547,7 @@
       filename = mimepart->GetFilename();
 
       wxString path, name, ext;
-      wxSplitPath(filename, &path, &name, &ext);
+      wxFileName::SplitPath(filename, &path, &name, &ext);
 
       filename = wxPSaveFileSelector
                  (

Modified: trunk/M/src/gui/wxBrowseButton.cpp
===================================================================
--- trunk/M/src/gui/wxBrowseButton.cpp	2009-03-29 13:06:23 UTC (rev 7563)
+++ trunk/M/src/gui/wxBrowseButton.cpp	2009-03-29 13:20:12 UTC (rev 7564)
@@ -150,7 +150,7 @@
 {
    // get the last position
    wxString strLastDir, strLastFile, strLastExt, strPath = GetText();
-   wxSplitPath(strPath, &strLastDir, &strLastFile, &strLastExt);
+   wxFileName::SplitPath(strPath, &strLastDir, &strLastFile, &strLastExt);
 
    long style = m_open ? wxFD_OPEN : wxFD_SAVE | wxFD_OVERWRITE_PROMPT;
    if ( m_existingOnly )

Modified: trunk/M/src/gui/wxComposeView.cpp
===================================================================
--- trunk/M/src/gui/wxComposeView.cpp	2009-03-29 13:06:23 UTC (rev 7563)
+++ trunk/M/src/gui/wxComposeView.cpp	2009-03-29 13:20:12 UTC (rev 7564)
@@ -197,8 +197,7 @@
 // its extension)
 static wxString GetMimeTypeFromFilename(const wxString& filename)
 {
-   wxString strExt;
-   wxSplitPath(filename, NULL, NULL, &strExt);
+   wxString strExt = wxFileName(filename).GetExt();
 
    wxString strMimeType;
    wxMimeTypesManager& mimeManager = mApplication->GetMimeManager();
@@ -3926,8 +3925,7 @@
 {
    mc->SetMimeType(mimetype);
 
-   String ext;
-   wxSplitPath(mc->GetFileName(), NULL, NULL, &ext);
+   String ext = wxFileName(mc->GetFileName()).GetExt();
 
    wxIconManager *iconManager = mApplication->GetIconManager();
    wxIcon icon = iconManager->GetIconFromMimeType(mimetype, ext);

Modified: trunk/M/src/gui/wxMApp.cpp
===================================================================
--- trunk/M/src/gui/wxMApp.cpp	2009-03-29 13:06:23 UTC (rev 7563)
+++ trunk/M/src/gui/wxMApp.cpp	2009-03-29 13:20:12 UTC (rev 7564)
@@ -1081,8 +1081,7 @@
             ::GetModuleFileName(NULL, wxStringBuffer(strPath, MAX_PATH), MAX_PATH);
 
             // get just the path
-            wxString strDir;
-            wxSplitPath(strPath, &strDir, NULL, NULL);
+            wxString strDir = wxFileName(strPath).GetPath();
 
             // a special hack: when running M from the build dir, we really
             // want to look in the top level directory

Modified: trunk/M/src/gui/wxMDialogs.cpp
===================================================================
--- trunk/M/src/gui/wxMDialogs.cpp	2009-03-29 13:06:23 UTC (rev 7563)
+++ trunk/M/src/gui/wxMDialogs.cpp	2009-03-29 13:20:12 UTC (rev 7564)
@@ -1067,8 +1067,7 @@
    {
       // the name of the folder can't contain '/' and such, so take just the
       // name, not the full name as the folder name
-      wxString name;
-      wxSplitPath(m_FileName, NULL, &name, NULL);
+      wxString name = wxFileName(m_FileName).GetName();
 
       SafeDecRef(m_folder);
       m_folder = MFolder::CreateTempFile(name, m_FileName, 0);

Modified: trunk/M/src/gui/wxMFolderDialogs.cpp
===================================================================
--- trunk/M/src/gui/wxMFolderDialogs.cpp	2009-03-29 13:06:23 UTC (rev 7563)
+++ trunk/M/src/gui/wxMFolderDialogs.cpp	2009-03-29 13:20:12 UTC (rev 7564)
@@ -1224,10 +1224,8 @@
          // set the file name as the default folder name
          if ( objEvent == m_path )
          {
-            wxString name, fullname = m_path->GetValue();
-            wxSplitPath(fullname, NULL, &name, NULL);
-
-            if ( !fullname )
+            wxString fullname = m_path->GetValue();
+            if ( fullname.empty() )
             {
                // path has become empty (again), so allow setting it
                // automatically from the folder name
@@ -1240,7 +1238,7 @@
                m_userModifiedPath = true;
             }
 
-            SetFolderName(name);
+            SetFolderName(wxFileName(fullname).GetName());
          }
          break;
 

Modified: trunk/M/src/gui/wxMIMETreeDialog.cpp
===================================================================
--- trunk/M/src/gui/wxMIMETreeDialog.cpp	2009-03-29 13:06:23 UTC (rev 7563)
+++ trunk/M/src/gui/wxMIMETreeDialog.cpp	2009-03-29 13:20:12 UTC (rev 7564)
@@ -321,8 +321,8 @@
    }
 
    // copy them to a temp file
-   wxString filename;
-   if ( !wxGetTempFileName(_T("Mtemp"), filename) )
+   wxString filename = wxFileName::CreateTempFileName("Mtemp");
+   if ( filename.empty() )
    {
       wxLogError(_("Failed to save messages to temporary file."));
 

Modified: trunk/M/src/gui/wxllist.cpp
===================================================================
--- trunk/M/src/gui/wxllist.cpp	2009-03-29 13:06:23 UTC (rev 7563)
+++ trunk/M/src/gui/wxllist.cpp	2009-03-29 13:20:12 UTC (rev 7564)
@@ -425,7 +425,7 @@
 {
    /* Exports icon through a temporary file. */
 
-   wxString file = wxGetTempFileName(_T("wxloexport"));
+   wxString file = wxFileName::CreateTempFileName(_T("wxloexport"));
 
    ostr << (int) WXLO_TYPE_ICON << '\n'
         << file << '\n';

Modified: trunk/M/src/modules/spam/HeadersFilter.cpp
===================================================================
--- trunk/M/src/modules/spam/HeadersFilter.cpp	2009-03-29 13:06:23 UTC (rev 7563)
+++ trunk/M/src/modules/spam/HeadersFilter.cpp	2009-03-29 13:20:12 UTC (rev 7564)
@@ -625,8 +625,7 @@
    if ( filename.empty() )
       return false;
 
-   String ext;
-   wxSplitPath(filename, NULL, NULL, &ext);
+   const String ext = wxFileName(filename).GetExt();
 
    // FIXME: make configurable
    static wxSortedArrayString extsExe;

Modified: trunk/M/src/modules/viewflt/UUDecode.cpp
===================================================================
--- trunk/M/src/modules/viewflt/UUDecode.cpp	2009-03-29 13:06:23 UTC (rev 7563)
+++ trunk/M/src/modules/viewflt/UUDecode.cpp	2009-03-29 13:20:12 UTC (rev 7564)
@@ -292,8 +292,7 @@
 
       // get a mimeType from the extention
       String mimeType;
-      String ext;
-      wxSplitPath(fileName, NULL, NULL, &ext);
+      String ext = wxFileName(fileName).GetExt();
       if ( !ext.empty() )
       {
          wxFileType *

Modified: trunk/M/src/util/upgrade.cpp
===================================================================
--- trunk/M/src/util/upgrade.cpp	2009-03-29 13:06:23 UTC (rev 7563)
+++ trunk/M/src/util/upgrade.cpp	2009-03-29 13:20:12 UTC (rev 7564)
@@ -3671,12 +3671,13 @@
 
    msgText = msgText.Mid( msgText.Find(M_SYNCMAIL_CONFIGSTART) +
                           wxStrlen( M_SYNCMAIL_CONFIGSTART) );
-   wxString filename = wxGetTempFileName(_T("MTemp"));
-   wxFile tmpfile(filename, wxFile::write);
+   wxFile tmpfile;
+   wxString filename = wxFileName::CreateTempFileName("MTemp", &tmpfile);
    tmpfile.Write(msgText, msgText.Length());
    tmpfile.Close();
 
-   wxFileConfig fc(wxEmptyString, wxEmptyString, filename, wxEmptyString, wxCONFIG_USE_LOCAL_FILE);
+   wxFileConfig fc(wxEmptyString, wxEmptyString, filename, wxEmptyString,
+                   wxCONFIG_USE_LOCAL_FILE);
 
    bool rc = true;
 
@@ -3841,7 +3842,7 @@
       mf->ExpungeMessages();
    }
 
-   wxString filename = wxGetTempFileName(_T("MTemp"));
+   wxString filename = wxFileName::CreateTempFileName(_T("MTemp"));
    wxFileConfig fc(wxEmptyString, wxEmptyString, filename, wxEmptyString, wxCONFIG_USE_LOCAL_FILE);
 
    bool rc = true;

Modified: trunk/M/src/wx/generic/persctrl.cpp
===================================================================
--- trunk/M/src/wx/generic/persctrl.cpp	2009-03-29 13:06:23 UTC (rev 7563)
+++ trunk/M/src/wx/generic/persctrl.cpp	2009-03-29 13:20:12 UTC (rev 7564)
@@ -2016,7 +2016,7 @@
         wxString filename = dialog->GetPath();
         if ( !filename.empty() && config ) {
             wxString path, name, ext;
-            wxSplitPath(filename, &path, &name, &ext);
+            wxFileName::SplitPath(filename, &path, &name, &ext);
 
             if( ext.Length() )
                name << '.' << ext;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

------------------------------------------------------------------------------