Ticket #1531: filezilla_more_fileexist_actions_rev2413.patch

File filezilla_more_fileexist_actions_rev2413.patch, 19.3 KB (added by paolozambotti, 16 years ago)

Two more file exist action patch on rev 2413

  • src/interface/defaultfileexistsdlg.cpp

     
    3333    case CFileExistsNotification::overwriteNewer:
    3434        XRCCTRL(*this, "ID_DL_OVERWRITEIFNEWER", wxRadioButton)->SetValue(true);
    3535        break;
     36    case CFileExistsNotification::overwriteSize:
     37        XRCCTRL(*this, "ID_DL_OVERWRITESIZE", wxRadioButton)->SetValue(true);
     38        break;
     39    case CFileExistsNotification::overwriteSizeOrNewer:
     40        XRCCTRL(*this, "ID_DL_OVERWRITESIZEORNEWER", wxRadioButton)->SetValue(true);
     41        break;
    3642    case CFileExistsNotification::resume:
    3743        XRCCTRL(*this, "ID_DL_RESUME", wxRadioButton)->SetValue(true);
    3844        break;
     
    5864    case CFileExistsNotification::overwriteNewer:
    5965        XRCCTRL(*this, "ID_UL_OVERWRITEIFNEWER", wxRadioButton)->SetValue(true);
    6066        break;
     67    case CFileExistsNotification::CFileExistsNotification::overwriteSize:
     68        XRCCTRL(*this, "ID_UL_OVERWRITESIZE", wxRadioButton)->SetValue(true);
     69        break;
     70    case CFileExistsNotification::CFileExistsNotification::overwriteSizeOrNewer:
     71        XRCCTRL(*this, "ID_UL_OVERWRITESIZEORNEWER", wxRadioButton)->SetValue(true);
     72        break;
    6173    case CFileExistsNotification::resume:
    6274        XRCCTRL(*this, "ID_UL_RESUME", wxRadioButton)->SetValue(true);
    6375        break;
     
    95107        action = CFileExistsNotification::overwrite;
    96108    else if (XRCCTRL(*this, "ID_DL_OVERWRITEIFNEWER", wxRadioButton)->GetValue())
    97109        action = CFileExistsNotification::overwriteNewer;
     110    else if (XRCCTRL(*this, "ID_DL_OVERWRITESIZE", wxRadioButton)->GetValue())
     111        action = CFileExistsNotification::overwriteSize;
     112    else if (XRCCTRL(*this, "ID_DL_OVERWRITESIZEORNEWER", wxRadioButton)->GetValue())
     113        action = CFileExistsNotification::overwriteSizeOrNewer;
    98114    else if (XRCCTRL(*this, "ID_DL_RESUME", wxRadioButton)->GetValue())
    99115        action = CFileExistsNotification::resume;
    100116    else if (XRCCTRL(*this, "ID_DL_RENAME", wxRadioButton)->GetValue())
     
    115131        action = CFileExistsNotification::overwrite;
    116132    else if (XRCCTRL(*this, "ID_UL_OVERWRITEIFNEWER", wxRadioButton)->GetValue())
    117133        action = CFileExistsNotification::overwriteNewer;
     134    else if (XRCCTRL(*this, "ID_UL_OVERWRITESIZE", wxRadioButton)->GetValue())
     135        action = CFileExistsNotification::overwriteSize;
     136    else if (XRCCTRL(*this, "ID_UL_OVERWRITESIZEORNEWER", wxRadioButton)->GetValue())
     137        action = CFileExistsNotification::overwriteSizeOrNewer;
    118138    else if (XRCCTRL(*this, "ID_UL_RESUME", wxRadioButton)->GetValue())
    119139        action = CFileExistsNotification::resume;
    120140    else if (XRCCTRL(*this, "ID_UL_RENAME", wxRadioButton)->GetValue())
  • src/interface/fileexistsdlg.cpp

     
    1313CFileExistsDlg::CFileExistsDlg(CFileExistsNotification *pNotification)
    1414{
    1515    m_pNotification = pNotification;
    16     m_pAction1 = m_pAction2 = m_pAction3 = m_pAction4 = m_pAction5 = 0;
     16    m_pAction1 = m_pAction2 = m_pAction3 = m_pAction4 = m_pAction5 = m_pAction6 = m_pAction7 = 0;
    1717    m_action = CFileExistsNotification::overwrite;
    1818    m_always = false;
    1919    m_queueOnly = false;
     
    3939    m_pAction3 = wxDynamicCast(FindWindow(XRCID("ID_ACTION3")), wxRadioButton);
    4040    m_pAction4 = wxDynamicCast(FindWindow(XRCID("ID_ACTION4")), wxRadioButton);
    4141    m_pAction5 = wxDynamicCast(FindWindow(XRCID("ID_ACTION5")), wxRadioButton);
     42    m_pAction6 = wxDynamicCast(FindWindow(XRCID("ID_ACTION6")), wxRadioButton);
     43    m_pAction7 = wxDynamicCast(FindWindow(XRCID("ID_ACTION7")), wxRadioButton);
    4244
    4345    wxString localFile = m_pNotification->localFile;
    4446
     
    264266        m_action = CFileExistsNotification::rename;
    265267    else if (m_pAction5 && m_pAction5->GetValue())
    266268        m_action = CFileExistsNotification::skip;
     269    else if (m_pAction6 && m_pAction6->GetValue())
     270        m_action = CFileExistsNotification::overwriteSizeOrNewer;
     271    else if (m_pAction7 && m_pAction7->GetValue())
     272        m_action = CFileExistsNotification::overwriteSize;
    267273    else
    268274        m_action = CFileExistsNotification::overwrite;
    269275
  • 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;
     32    wxRadioButton *m_pAction1, *m_pAction2, *m_pAction3, *m_pAction4, *m_pAction5, *m_pAction6, *m_pAction7;
    3333    enum CFileExistsNotification::OverwriteAction m_action;
    3434    bool m_always;
    3535    bool m_directionOnly;
  • src/interface/optionspage_fileexists.cpp

     
    1717    case CFileExistsNotification::overwriteNewer:
    1818        SetRCheck(XRCID("ID_DL_OVERWRITEIFNEWER"), true, failure);
    1919        break;
     20    case CFileExistsNotification::overwriteSize:
     21        SetRCheck(XRCID("ID_DL_OVERWRITESIZE"), true, failure);
     22        break;
     23    case CFileExistsNotification::overwriteSizeOrNewer:
     24        SetRCheck(XRCID("ID_DL_OVERWRITESIZEORNEWER"), true, failure);
     25        break;
    2026    case CFileExistsNotification::resume:
    2127        SetRCheck(XRCID("ID_DL_RESUME"), true, failure);
    2228        break;
     
    4046    case CFileExistsNotification::overwriteNewer:
    4147        SetRCheck(XRCID("ID_UL_OVERWRITEIFNEWER"), true, failure);
    4248        break;
     49    case CFileExistsNotification::overwriteSize:
     50        SetRCheck(XRCID("ID_UL_OVERWRITESIZE"), true, failure);
     51        break;
     52    case CFileExistsNotification::overwriteSizeOrNewer:
     53        SetRCheck(XRCID("ID_UL_OVERWRITESIZEORNEWER"), true, failure);
     54        break;
    4355    case CFileExistsNotification::resume:
    4456        SetRCheck(XRCID("ID_UL_RESUME"), true, failure);
    4557        break;
     
    6678        value = CFileExistsNotification::overwrite;
    6779    else if (GetRCheck(XRCID("ID_DL_OVERWRITEIFNEWER")))
    6880        value = CFileExistsNotification::overwriteNewer;
     81    else if (GetRCheck(XRCID("ID_DL_OVERWRITESIZE")))
     82        value = CFileExistsNotification::overwriteSize;
     83    else if (GetRCheck(XRCID("ID_DL_OVERWRITESIZEORNEWER")))
     84        value = CFileExistsNotification::overwriteSizeOrNewer;
    6985    else if (GetRCheck(XRCID("ID_DL_RESUME")))
    7086        value = CFileExistsNotification::resume;
    7187    else if (GetRCheck(XRCID("ID_DL_RENAME")))
     
    8096        value = CFileExistsNotification::overwrite;
    8197    else if (GetRCheck(XRCID("ID_UL_OVERWRITEIFNEWER")))
    8298        value = CFileExistsNotification::overwriteNewer;
     99    else if (GetRCheck(XRCID("ID_UL_OVERWRITESIZE")))
     100        value = CFileExistsNotification::overwriteSize;
     101    else if (GetRCheck(XRCID("ID_UL_OVERWRITESIZEORNEWER")))
     102        value = CFileExistsNotification::overwriteSizeOrNewer;
    83103    else if (GetRCheck(XRCID("ID_UL_RESUME")))
    84104        value = CFileExistsNotification::resume;
    85105    else if (GetRCheck(XRCID("ID_UL_RENAME")))
  • src/include/notification.h

     
    153153        ask,
    154154        overwrite,
    155155        overwriteNewer, // Overwrite if source file is newer than target file
     156        overwriteSize,  // Overwrite if source file is is different in size than target file
     157        overwriteSizeOrNewer,   // Overwrite if source file is different in size or newer than target file
    156158        resume, // Overwrites if cannot be resumed
    157159        rename,
    158160        skip,
  • src/engine/sftpcontrolsocket.cpp

     
    793793                    ResetOperation(FZ_REPLY_OK);
    794794                }
    795795                break;
     796            case CFileExistsNotification::overwriteSize:
     797                /* First compare flags both size known but different, one size known and the other not (obviously they are different).
     798                   Second compare flags the remaining case in which we need to send command : both size unknown */
     799                if ((pFileExistsNotification->localSize != pFileExistsNotification->remoteSize) || (pFileExistsNotification->localSize != -1))
     800                    SendNextCommand();
     801                else
     802                {
     803                    if (pData->download)
     804                    {
     805                        wxString filename = pData->remotePath.FormatFilename(pData->remoteFile);
     806                        LogMessage(Status, _("Skipping download of %s"), filename.c_str());
     807                    }
     808                    else
     809                    {
     810                        LogMessage(Status, _("Skipping upload of %s"), pData->localFile.c_str());
     811                    }
     812                    ResetOperation(FZ_REPLY_OK);
     813                }
     814                break;
     815            case CFileExistsNotification::overwriteSizeOrNewer:
     816                if (!pFileExistsNotification->localTime.IsValid() || !pFileExistsNotification->remoteTime.IsValid())
     817                    SendNextCommand();
     818                /* First compare flags both size known but different, one size known and the other not (obviously they are different).
     819                   Second compare flags the remaining case in which we need to send command : both size unknown */
     820                else if ((pFileExistsNotification->localSize != pFileExistsNotification->remoteSize) || (pFileExistsNotification->localSize != -1))
     821                    SendNextCommand();
     822                else if (pFileExistsNotification->download && pFileExistsNotification->localTime.IsEarlierThan(pFileExistsNotification->remoteTime))
     823                    SendNextCommand();
     824                else if (!pFileExistsNotification->download && pFileExistsNotification->localTime.IsLaterThan(pFileExistsNotification->remoteTime))
     825                    SendNextCommand();
     826                else
     827                {
     828                    if (pData->download)
     829                    {
     830                        wxString filename = pData->remotePath.FormatFilename(pData->remoteFile);
     831                        LogMessage(Status, _("Skipping download of %s"), filename.c_str());
     832                    }
     833                    else
     834                    {
     835                        LogMessage(Status, _("Skipping upload of %s"), pData->localFile.c_str());
     836                    }
     837                    ResetOperation(FZ_REPLY_OK);
     838                }
     839                break;
    796840            case CFileExistsNotification::resume:
    797841                if (pData->download && pFileExistsNotification->localSize != -1)
    798842                    pData->resume = true;
  • src/engine/httpcontrolsocket.cpp

     
    215215                    ResetOperation(FZ_REPLY_OK);
    216216                }
    217217                break;
     218            case CFileExistsNotification::overwriteSize:
     219                /* First compare flags both size known but different, one size known and the other not (obviously they are different).
     220                   Second compare flags the remaining case in which we need to send command : both size unknown */
     221                if ((pFileExistsNotification->localSize != pFileExistsNotification->remoteSize) || (pFileExistsNotification->localSize != -1))
     222                    SendNextCommand();
     223                else
     224                {
     225                    if (pData->download)
     226                    {
     227                        wxString filename = pData->remotePath.FormatFilename(pData->remoteFile);
     228                        LogMessage(Status, _("Skipping download of %s"), filename.c_str());
     229                    }
     230                    else
     231                    {
     232                        LogMessage(Status, _("Skipping upload of %s"), pData->localFile.c_str());
     233                    }
     234                    ResetOperation(FZ_REPLY_OK);
     235                }
     236                break;
     237            case CFileExistsNotification::overwriteSizeOrNewer:
     238                if (!pFileExistsNotification->localTime.IsValid() || !pFileExistsNotification->remoteTime.IsValid())
     239                    SendNextCommand();
     240                /* First compare flags both size known but different, one size known and the other not (obviously they are different).
     241                   Second compare flags the remaining case in which we need to send command : both size unknown */
     242                else if ((pFileExistsNotification->localSize != pFileExistsNotification->remoteSize) || (pFileExistsNotification->localSize != -1))
     243                    SendNextCommand();
     244                else if (pFileExistsNotification->download && pFileExistsNotification->localTime.IsEarlierThan(pFileExistsNotification->remoteTime))
     245                    SendNextCommand();
     246                else if (!pFileExistsNotification->download && pFileExistsNotification->localTime.IsLaterThan(pFileExistsNotification->remoteTime))
     247                    SendNextCommand();
     248                else
     249                {
     250                    if (pData->download)
     251                    {
     252                        wxString filename = pData->remotePath.FormatFilename(pData->remoteFile);
     253                        LogMessage(Status, _("Skipping download of %s"), filename.c_str());
     254                    }
     255                    else
     256                    {
     257                        LogMessage(Status, _("Skipping upload of %s"), pData->localFile.c_str());
     258                    }
     259                    ResetOperation(FZ_REPLY_OK);
     260                }
     261                break;
    218262            case CFileExistsNotification::resume:
    219263                ResetOperation(FZ_REPLY_CRITICALERROR | FZ_REPLY_NOTSUPPORTED);
    220264                break;
  • src/engine/ftpcontrolsocket.cpp

     
    27262726                    ResetOperation(FZ_REPLY_OK);
    27272727                }
    27282728                break;
     2729            case CFileExistsNotification::overwriteSize:
     2730                /* First compare flags both size known but different, one size known and the other not (obviously they are different).
     2731                   Second compare flags the remaining case in which we need to send command : both size unknown */
     2732                if ((pFileExistsNotification->localSize != pFileExistsNotification->remoteSize) || (pFileExistsNotification->localSize != -1))
     2733                    SendNextCommand();
     2734                else
     2735                {
     2736                    if (pData->download)
     2737                    {
     2738                        wxString filename = pData->remotePath.FormatFilename(pData->remoteFile);
     2739                        LogMessage(Status, _("Skipping download of %s"), filename.c_str());
     2740                    }
     2741                    else
     2742                    {
     2743                        LogMessage(Status, _("Skipping upload of %s"), pData->localFile.c_str());
     2744                    }
     2745                    ResetOperation(FZ_REPLY_OK);
     2746                }
     2747                break;
     2748            case CFileExistsNotification::overwriteSizeOrNewer:
     2749                if (!pFileExistsNotification->localTime.IsValid() || !pFileExistsNotification->remoteTime.IsValid())
     2750                    SendNextCommand();
     2751                /* First compare flags both size known but different, one size known and the other not (obviously they are different).
     2752                   Second compare flags the remaining case in which we need to send command : both size unknown */
     2753                else if ((pFileExistsNotification->localSize != pFileExistsNotification->remoteSize) || (pFileExistsNotification->localSize != -1))
     2754                    SendNextCommand();
     2755                else if (pFileExistsNotification->download && pFileExistsNotification->localTime.IsEarlierThan(pFileExistsNotification->remoteTime))
     2756                    SendNextCommand();
     2757                else if (!pFileExistsNotification->download && pFileExistsNotification->localTime.IsLaterThan(pFileExistsNotification->remoteTime))
     2758                    SendNextCommand();
     2759                else
     2760                {
     2761                    if (pData->download)
     2762                    {
     2763                        wxString filename = pData->remotePath.FormatFilename(pData->remoteFile);
     2764                        LogMessage(Status, _("Skipping download of %s"), filename.c_str());
     2765                    }
     2766                    else
     2767                    {
     2768                        LogMessage(Status, _("Skipping upload of %s"), pData->localFile.c_str());
     2769                    }
     2770                    ResetOperation(FZ_REPLY_OK);
     2771                }
     2772                break;
    27292773            case CFileExistsNotification::resume:
    27302774                if (pData->download && pData->localFileSize != -1)
    27312775                    pData->resume = true;
  • src/interface/resources/dialogs.xrc

     
    812812                  <object class="sizeritem">
    813813                    <flag>wxLEFT|wxRIGHT|wxTOP</flag>
    814814                    <border>5</border>
     815                    <object class="wxRadioButton" name="ID_ACTION7">
     816                      <label>Overwrite if different size</label>
     817                      <value>0</value>
     818                    </object>
     819                  </object>
     820                  <object class="sizeritem">
     821                    <flag>wxLEFT|wxRIGHT|wxTOP</flag>
     822                    <border>5</border>
     823                    <object class="wxRadioButton" name="ID_ACTION6">
     824                      <label>Overwrite if different size or source newer</label>
     825                      <value>0</value>
     826                    </object>
     827                  </object>
     828                  <object class="sizeritem">
     829                    <flag>wxLEFT|wxRIGHT|wxTOP</flag>
     830                    <border>5</border>
    815831                    <object class="wxRadioButton" name="ID_ACTION3">
    816832                      <label>&amp;Resume</label>
    817833                      <value>0</value>
     
    39904006                        </object>
    39914007                      </object>
    39924008                      <object class="sizeritem">
     4009                        <object class="wxRadioButton" name="ID_DL_OVERWRITESIZE">
     4010                          <label>Overwrite if different size</label>
     4011                        </object>
     4012                      </object>
     4013                      <object class="sizeritem">
     4014                        <object class="wxRadioButton" name="ID_DL_OVERWRITESIZEORNEWER">
     4015                          <label>Overwrite if different size or source newer</label>
     4016                        </object>
     4017                      </object>
     4018                      <object class="sizeritem">
    39934019                        <object class="wxRadioButton" name="ID_DL_RESUME">
    39944020                          <label>&amp;Resume</label>
    39954021                        </object>
     
    40434069                        </object>
    40444070                      </object>
    40454071                      <object class="sizeritem">
     4072                        <object class="wxRadioButton" name="ID_UL_OVERWRITESIZE">
     4073                          <label>Overwrite if different size</label>
     4074                        </object>
     4075                      </object>
     4076                      <object class="sizeritem">
     4077                        <object class="wxRadioButton" name="ID_UL_OVERWRITESIZEORNEWER">
     4078                          <label>Overwrite if different size or source newer</label>
     4079                        </object>
     4080                      </object>
     4081                      <object class="sizeritem">
    40464082                        <object class="wxRadioButton" name="ID_UL_RESUME">
    40474083                          <label>Res&amp;ume</label>
    40484084                        </object>
     
    41454181                    </object>
    41464182                  </object>
    41474183                  <object class="sizeritem">
     4184                    <object class="wxRadioButton" name="ID_DL_OVERWRITESIZE">
     4185                      <label>Overwrite if different size</label>
     4186                    </object>
     4187                  </object>
     4188                  <object class="sizeritem">
     4189                    <object class="wxRadioButton" name="ID_DL_OVERWRITESIZEORNEWER">
     4190                      <label>Overwrite if different size or source newer</label>
     4191                    </object>
     4192                  </object>
     4193                  <object class="sizeritem">
    41484194                    <object class="wxRadioButton" name="ID_DL_RESUME">
    41494195                      <label>&amp;Resume</label>
    41504196                    </object>
     
    41924238                    </object>
    41934239                  </object>
    41944240                  <object class="sizeritem">
     4241                    <object class="wxRadioButton" name="ID_UL_OVERWRITESIZE">
     4242                      <label>Overwrite if different size</label>
     4243                    </object>
     4244                  </object>
     4245                  <object class="sizeritem">
     4246                    <object class="wxRadioButton" name="ID_UL_OVERWRITESIZEORNEWER">
     4247                      <label>Overwrite if different size or source newer</label>
     4248                    </object>
     4249                  </object>
     4250                  <object class="sizeritem">
    41954251                    <object class="wxRadioButton" name="ID_UL_RESUME">
    41964252                      <label>Res&amp;ume</label>
    41974253                    </object>