Ticket #8176: OverwriteIfNewerElseResume.patch

File OverwriteIfNewerElseResume.patch, 8.8 KB (added by Paolo Zambotti, 8 years ago)

Overwrite if newer else resume if sizes differ patch file (from svn diff)

  • filezilla_svn/src/include/notification.h

     
    158158        overwriteNewer, // Overwrite if source file is newer than target file
    159159        overwriteSize,  // Overwrite if source file is is different in size than target file
    160160        overwriteSizeOrNewer,   // Overwrite if source file is different in size or newer than target file
     161        overwriteNewerElseResume, // Overwrite if source file is newer otherwise resume if sizes differ
    161162        resume, // Overwrites if cannot be resumed
    162163        rename,
    163164        skip,
  • filezilla_svn/src/interface/fileexistsdlg.cpp

     
    1515CFileExistsDlg::CFileExistsDlg(CFileExistsNotification *pNotification)
    1616{
    1717    m_pNotification = pNotification;
    18     m_pAction1 = m_pAction2 = m_pAction3 = m_pAction4 = m_pAction5 = m_pAction6 = m_pAction7 = 0;
     18    m_pAction1 = m_pAction2 = m_pAction3 = m_pAction4 = m_pAction5 = m_pAction6 = m_pAction7 = m_pAction8 = 0;
    1919    m_action = CFileExistsNotification::overwrite;
    2020    m_always = false;
    2121    m_queueOnly = false;
     
    4343    m_pAction5 = wxDynamicCast(FindWindow(XRCID("ID_ACTION5")), wxRadioButton);
    4444    m_pAction6 = wxDynamicCast(FindWindow(XRCID("ID_ACTION6")), wxRadioButton);
    4545    m_pAction7 = wxDynamicCast(FindWindow(XRCID("ID_ACTION7")), wxRadioButton);
     46    m_pAction8 = wxDynamicCast(FindWindow(XRCID("ID_ACTION8")), wxRadioButton);
    4647
    4748    wxString localFile = m_pNotification->localFile;
    4849
     
    271272        m_action = CFileExistsNotification::overwriteSizeOrNewer;
    272273    else if (m_pAction7 && m_pAction7->GetValue())
    273274        m_action = CFileExistsNotification::overwriteSize;
     275    else if (m_pAction8 && m_pAction8->GetValue())
     276        m_action = CFileExistsNotification::overwriteNewerElseResume;
    274277    else
    275278        m_action = CFileExistsNotification::overwrite;
    276279
  • filezilla_svn/src/interface/fileexistsdlg.h

     
    2929    wxString GetPathEllipsis(wxString path, wxWindow *window);
    3030
    3131    CFileExistsNotification *m_pNotification;
    32     wxRadioButton *m_pAction1, *m_pAction2, *m_pAction3, *m_pAction4, *m_pAction5, *m_pAction6, *m_pAction7;
     32    wxRadioButton *m_pAction1, *m_pAction2, *m_pAction3, *m_pAction4, *m_pAction5, *m_pAction6, *m_pAction7, *m_pAction8;
    3333    enum CFileExistsNotification::OverwriteAction m_action;
    3434    bool m_always;
    3535    bool m_directionOnly;
  • filezilla_svn/src/interface/resources/settings.xrc

     
    1 <?xml version="1.0" encoding="UTF-8"?>
     1<?xml version="1.0" encoding="UTF-8"?>
    22<resource version="2.3.0.1" xmlns="http://www.wxwindows.org/wxxrc">
    33  <object class="wxDialog" name="ID_SETTINGS">
    44    <title>Settings</title>
     
    11421142                    <item>Overwrite file if source file newer</item>
    11431143                    <item>Overwrite file if size differs</item>
    11441144                    <item>Overwrite file if size differs or source file is newer</item>
     1145                    <item>Overwrite file if source file newer else resume</item>
    11451146                    <item>Resume file transfer</item>
    11461147                    <item>Rename file</item>
    11471148                    <item>Skip file</item>
     
    11631164                    <item>Overwrite file if source file newer</item>
    11641165                    <item>Overwrite file if size differs</item>
    11651166                    <item>Overwrite file if size differs or source file is newer</item>
     1167                    <item>Overwrite file if source file newer else resume</item>
    11661168                    <item>Resume file transfer</item>
    11671169                    <item>Rename file</item>
    11681170                    <item>Skip file</item>
  • filezilla_svn/src/interface/resources/dialogs.xrc

     
    1 <?xml version="1.0" encoding="UTF-8"?>
     1<?xml version="1.0" encoding="UTF-8"?>
    22<resource version="2.3.0.1" xmlns="http://www.wxwindows.org/wxxrc">
    33  <object class="wxDialog" name="ID_VERIFYCERT">
    44    <title>Unknown certificate</title>
     
    646646                    <border>5</border>
    647647                  </object>
    648648                  <object class="sizeritem">
     649                    <object class="wxRadioButton" name="ID_ACTION8">
     650                      <label>Overwrite file if source file newer else resume</label>
     651                    </object>
    649652                    <flag>wxLEFT|wxRIGHT|wxTOP</flag>
    650653                    <border>5</border>
     654                  </object>
     655                  <object class="sizeritem">
     656                    <flag>wxLEFT|wxRIGHT|wxTOP</flag>
     657                    <border>5</border>
    651658                    <object class="wxRadioButton" name="ID_ACTION3">
    652659                      <label>&amp;Resume</label>
    653660                      <value>0</value>
     
    27642771                        <item>Overwrite file if source file newer</item>
    27652772                        <item>Overwrite file if size differs</item>
    27662773                        <item>Overwrite file if size differs or source file is newer</item>
     2774                        <item>Overwrite file if source file newer else resume</item>
    27672775                        <item>Resume file transfer</item>
    27682776                        <item>Rename file</item>
    27692777                        <item>Skip file</item>
     
    27872795                        <item>Overwrite file if source file newer</item>
    27882796                        <item>Overwrite file if size differs</item>
    27892797                        <item>Overwrite file if size differs or source file is newer</item>
     2798                        <item>Overwrite file if source file newer else resume</item>
    27902799                        <item>Resume file transfer</item>
    27912800                        <item>Rename file</item>
    27922801                        <item>Skip file</item>
  • filezilla_svn/src/engine/ControlSocket.cpp

     
    13851385        }
    13861386        ResetOperation(FZ_REPLY_OK);
    13871387        break;
     1388    case CFileExistsNotification::overwriteNewerElseResume:
     1389        /* if at least one of the file times is not valid -> overwrite */
     1390        if (!pFileExistsNotification->localTime.IsValid() || !pFileExistsNotification->remoteTime.IsValid())
     1391            SendNextCommand();
     1392        /* if we are downloading and local file is older -> overwrite */
     1393        else if (pFileExistsNotification->download && pFileExistsNotification->localTime.IsEarlierThan(pFileExistsNotification->remoteTime))
     1394            SendNextCommand();
     1395        /* if we are uploading and local file is newer -> overwrite */
     1396        else if (!pFileExistsNotification->download && pFileExistsNotification->localTime.IsLaterThan(pFileExistsNotification->remoteTime))
     1397            SendNextCommand();
     1398        /* if we are downloading and local file not exist -> let me say overwrite */
     1399        else if (pFileExistsNotification->download && pFileExistsNotification->localSize == -1)
     1400            SendNextCommand();
     1401        /* if we are uploading and remote file not exist -> let me say overwrite */
     1402        else if (!pFileExistsNotification->download && pFileExistsNotification->remoteSize == -1)
     1403            SendNextCommand();
     1404      /* finally if sizes differs */
     1405        else if (pFileExistsNotification->localSize != pFileExistsNotification->remoteSize)
     1406        {
     1407        /* if downloading and local file exist then set resume mode */
     1408        if (pData->download && pData->localFileSize != -1)
     1409            pData->resume = true;
     1410        /* if uploading and remote file exist then set resume mode */
     1411        else if (!pData->download && pData->remoteFileSize != -1)
     1412            pData->resume = true;
     1413        SendNextCommand();
     1414    }
     1415    /* if none of the above contitions are satisfied then we could skip the file */
     1416    else
     1417        {
     1418            if (pData->download)
     1419            {
     1420                wxString filename = pData->remotePath.FormatFilename(pData->remoteFile);
     1421                LogMessage(Status, _("Skipping download of %s"), filename.c_str());
     1422            }
     1423            else
     1424            {
     1425                LogMessage(Status, _("Skipping upload of %s"), pData->localFile.c_str());
     1426            }
     1427            ResetOperation(FZ_REPLY_OK);
     1428        }
     1429        break;
    13881430    default:
    13891431        LogMessage(__TFILE__, __LINE__, this, Debug_Warning, _T("Unknown file exists action: %d"), pFileExistsNotification->overwriteAction);
    13901432        ResetOperation(FZ_REPLY_INTERNALERROR);