Ticket #7991: myModif.8.patch

File myModif.8.patch, 14.9 KB (added by aug125, 13 years ago)
  • src/interface/Mainfrm.cpp

     
    5050#include "toolbar.h"
    5151#include "menu_bar.h"
    5252#include "string_coalescer.h"
     53#include "select_dialog.h"
    5354
    5455#ifdef __WXMSW__
    5556#include <wx/module.h>
     
    6768DEFINE_EVENT_TYPE(fzEVT_TASKBAR_CLICK_DELAYED);
    6869#endif
    6970
     71
     72
     73
    7074static int tab_hotkey_ids[10];
    7175
    7276BEGIN_EVENT_TABLE(CMainFrame, wxFrame)
     
    336340    m_pContextControl->CreateTab();
    337341
    338342    m_pContextControl->GetCurrentControls();
    339    
     343
    340344    switch (message_log_position)
    341345    {
    342346    case 1:
     
    508512        delete m_pMenuBar;
    509513    }
    510514    m_pMenuBar = CMenuBar::Load(this);
    511    
     515
    512516    if (!m_pMenuBar)
    513517        return false;
    514518
     
    610614    {
    611615        OnMenuEditSettings(event);
    612616    }
     617    else if(event.GetId() == XRCID("ID_MENU_EDIT_SELECT"))
     618    {
     619        OnSelectSettings(event);
     620
     621    }
    613622    else if (event.GetId() == XRCID("ID_MENU_EDIT_NETCONFWIZARD"))
    614623    {
    615624        CNetConfWizard wizard(this, COptions::Get());
     
    854863            CSiteManager::GetBookmarks(controls->site_bookmarks->path, controls->site_bookmarks->bookmarks);
    855864            if (m_pMenuBar)
    856865                m_pMenuBar->UpdateBookmarkMenu();
    857         }   
     866        }
    858867    }
    859868    else if (event.GetId() == XRCID("ID_MENU_HELP_WELCOME"))
    860869    {
     
    946955    {
    947956        if ((*iter)->m_pEngine != pEngine)
    948957            continue;
    949        
     958
    950959        pState = *iter;
    951960        break;
    952961    }
     
    12421251        }
    12431252
    12441253        RememberSplitterPositions();
    1245        
     1254
    12461255#ifdef __WXMAC__
    12471256        if (m_pToolBar)
    12481257            COptions::Get()->SetOption(OPTION_TOOLBAR_HIDDEN, m_pToolBar->IsShown() ? 0 : 1);
     
    15391548    CheckChangedSettings();
    15401549}
    15411550
     1551void CMainFrame::OnSelectSettings(wxCommandEvent& event)
     1552{
     1553
     1554        CContextControl::_context_controls* controls = m_pContextControl->GetCurrentControls();
     1555
     1556    CSelect_dialog *dlg= new CSelect_dialog(wxT("Select local files..."), (controls->pLocalListView));
     1557    dlg->ShowModal();
     1558    delete dlg;
     1559
     1560}
     1561
    15421562void CMainFrame::OnToggleLogView(wxCommandEvent& event)
    15431563{
    15441564    if (!m_pTopSplitter)
     
    15861606            shown = true;
    15871607        }
    15881608    }
    1589    
     1609
    15901610    if (COptions::Get()->GetOptionVal(OPTION_MESSAGELOG_POSITION) != 2)
    15911611        COptions::Get()->SetOption(OPTION_SHOW_MESSAGELOG, shown);
    15921612}
     
    16371657            continue;
    16381658
    16391659        controls->pLocalTreeViewPanel->SetHeader(controls->pLocalListViewPanel->DetachHeader());
    1640        
     1660
    16411661        if (layout == 3 && swap)
    16421662            controls->pLocalSplitter->SplitVertically(controls->pLocalListViewPanel, controls->pLocalTreeViewPanel);
    16431663        else if (layout)
     
    18011821
    18021822    if (messagelog_position == -1)
    18031823        messagelog_position = COptions::Get()->GetOptionVal(OPTION_MESSAGELOG_POSITION);
    1804    
     1824
    18051825    // First handle changes in message log position as it can make size of the other panes change
    18061826    {
    18071827        bool shown = m_pStatusView->IsShown();
    18081828        wxWindow* parent = m_pStatusView->GetParent();
    1809    
     1829
    18101830        bool changed;
    18111831        if (parent == m_pTopSplitter && messagelog_position != 0)
    18121832        {
     
    22082228    CContextControl::_context_controls* controls = m_pContextControl->GetCurrentControls();
    22092229    if (!controls)
    22102230        return;
    2211    
     2231
    22122232    wxString posString;
    22132233
    22142234    // top_pos
     
    25542574        // create another instance of the module and call its Exit() member.
    25552575        // After that, the next call to a wxDisplay will create a new factory and
    25562576        // get the new display layout from Windows.
    2557         // 
     2577        //
    25582578        // Note: Both the factory pattern as well as the dynamic object system
    25592579        //       are perfect example of bad design.
    25602580        //
  • src/interface/select_dialog.cpp

     
     1#include <filezilla.h>
     2/*#include <wx/utils.h>
     3#include <wx/stattext.h>
     4#include <wx/combobox.h>
     5#include <wx/textctrl.h>
     6#include <wx/sizer.h>
     7#include <wx/string.h>
     8#include <wx/statbox.h>
     9*/
     10
     11#include "select_dialog.h"
     12#include "context_control.h"
     13#include "LocalListView.h"
     14
     15BEGIN_EVENT_TABLE(CSelect_dialog,wxDialog)
     16
     17    EVT_BUTTON(BS,CSelect_dialog::select_button)
     18    EVT_BUTTON(BE,CSelect_dialog::erase_button)
     19
     20END_EVENT_TABLE()
     21
     22CSelect_dialog::CSelect_dialog(const wxString title, CLocalListView *lv )
     23       : wxDialog(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(600, 330)) // 600, 320
     24{
     25    Centre();
     26
     27    m_lv = lv;
     28
     29    m_buttonSelect = new wxButton(this, BS, wxT("Select"), wxPoint(50,270), wxDefaultSize, 0);
     30    m_buttonErase = new wxButton(this, BE, _("&Unselect all"), wxPoint(140,270), wxDefaultSize, 0);
     31    m_buttonCancel = new wxButton(this, wxID_CANCEL,wxT("Close"), wxPoint(370,270), wxDefaultSize, 0);
     32   
     33
     34    m_nameBox = new wxStaticBox(this, -1, wxT("Select by name"),wxPoint(20,23),wxSize(150,70));
     35    m_dateBox = new wxStaticBox(this, -1, wxT("Select by date"),wxPoint(200,23),wxSize(250,74));
     36    m_sizeBox = new wxStaticBox(this, -1, wxT("Select by size"),wxPoint(20,150),wxSize(550,80));
     37
     38    m_nameText = new wxTextCtrl(this, -1,wxT(""),wxPoint(50,50)), wxSize(900,110);
     39
     40    m_comboD = new wxComboBox(this, -1, wxT("<unused>"), wxPoint(230,50), wxDefaultSize, 0, NULL, wxCB_READONLY);
     41
     42    m_comboS = new wxComboBox(this, -1, wxT("<unused>"), wxPoint(50,180), wxDefaultSize, 0, NULL, wxCB_READONLY);
     43    m_sizeText = new wxTextCtrl(this, -1,wxT(""),wxPoint(280,180));
     44    wxStaticText *m_than = new wxStaticText(this, -1, wxT("than"),wxPoint(245,185));
     45    m_comboUnit = new wxComboBox(this, -1, wxT("ko (kilooctet)"), wxPoint(365,180), wxDefaultSize, 0, NULL, wxCB_READONLY);
     46   
     47    m_comboS->Append(wxT("<unused>"));
     48    m_comboS->Append(wxT("Larger"));
     49    m_comboS->Append(wxT("Larger or equal"));
     50    m_comboS->Append(wxT("Smaller"));
     51    m_comboS->Append(wxT("Smaller or equal"));
     52
     53    m_comboD->Append(wxT("<unused>"));
     54    m_comboD->Append(wxT("modified for 1 hour"));
     55    m_comboD->Append(wxT("modified today"));
     56    m_comboD->Append(wxT("modified for 2 days"));
     57    m_comboD->Append(wxT("modified for 7 days"));
     58    m_comboD->Append(wxT("modified for 1 month"));
     59
     60    m_comboUnit->Append(wxT("o (octet)"));
     61    m_comboUnit->Append(wxT("Ko (kilooctet)"));
     62    m_comboUnit->Append(wxT("Mo (megaoctet)"));
     63    m_comboUnit->Append(wxT("Go (gigaoctet)"));
     64           
     65   
     66
     67}
     68
     69void CSelect_dialog::select_button(wxCommandEvent& event)
     70{
     71    wxString _name;
     72    bool _dir;
     73    wxLongLong _size;
     74    wxDateTime _date;
     75    bool _hasTime;
     76    int i=0;
     77
     78   
     79
     80    bool select;
     81
     82    int unit;
     83
     84    if (m_comboUnit->GetValue() == wxT("o (octet)")) unit = 1;
     85    if (m_comboUnit->GetValue() == wxT("Ko (kilooctet)")) unit = 1000;
     86    if (m_comboUnit->GetValue() == wxT("Mo (megaoctet)")) unit = 1000000;
     87    if (m_comboUnit->GetValue() == wxT("Go (gigaoctet)")) unit = 1000000000;
     88
     89
     90    double sizeSpecified;
     91
     92        if (m_comboS->GetValue() != wxT("<unused>") && !(m_sizeText->GetValue()).ToDouble(&sizeSpecified))
     93        {
     94            wxMessageBox( wxT("Incorrect number") );   
     95            return;
     96        }
     97
     98    m_lv->StartSelect();
     99
     100    while(m_lv->GetNextFileSelect(_name, _dir, _size, _date, _hasTime))
     101    {
     102        select = true;     
     103
     104        if (_dir) select = false; // No select directory
     105
     106        // Name
     107        if (!(_name.Contains(m_nameText->GetValue()))) select=false;
     108
     109        // Size
     110        if (m_comboS->GetValue() == wxT("Larger") && sizeSpecified * unit >= _size.ToLong()) select = false ;
     111        if (m_comboS->GetValue() == wxT("Larger or equal") && sizeSpecified * unit > _size.ToLong()) select = false ;
     112        if (m_comboS->GetValue() == wxT("Smaller") && sizeSpecified * unit <= _size.ToLong()) select = false ;
     113        if (m_comboS->GetValue() == wxT("Smaller or equal") && sizeSpecified * unit < _size.ToLong()) select = false ;
     114
     115
     116        // Date
     117
     118        if (m_comboD->GetValue() == wxT("modified for 1 hour") && _date.IsEarlierThan(wxDateTime::UNow().Subtract(wxTimeSpan(1,0,0,0)))) select = false ;
     119        if (m_comboD->GetValue() == wxT("modified today") && !(_date.IsSameDate(wxDateTime::UNow()))) select = false ;     
     120        if (m_comboD->GetValue() == wxT("modified for 2 days") && _date.IsEarlierThan(wxDateTime::UNow().Subtract(wxDateSpan(0,0,0,2)))) select = false ;
     121        if (m_comboD->GetValue() == wxT("modified for 7 days") && _date.IsEarlierThan(wxDateTime::UNow().Subtract(wxDateSpan(0,0,1,0)))) select = false ;
     122        if (m_comboD->GetValue() == wxT("modified for 1 month") && _date.IsEarlierThan(wxDateTime::UNow().Subtract(wxDateSpan(0,1,0,0)))) select = false ;
     123       
     124           
     125
     126        if (select)
     127            m_lv->SetItemState(i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
     128       
     129        i++;
     130    }
     131
     132    m_lv->FinishComparison();
     133
     134
     135}
     136
     137void CSelect_dialog::erase_button(wxCommandEvent& event)
     138{
     139    wxString _name;
     140    bool _dir;
     141    wxLongLong _size;
     142    wxDateTime _date;
     143    bool _hasTime;
     144    int i=0;
     145   
     146    m_lv->StartSelect();
     147
     148    while(m_lv->GetNextFileSelect(_name, _dir, _size, _date, _hasTime))
     149    {
     150        m_lv->SetItemState(i, 0, wxLIST_STATE_SELECTED);
     151        i++;
     152    }
     153
     154    m_lv->FinishComparison();
     155
     156}
  • src/interface/LocalListView.cpp

    Modification de propriétés sur src/interface/select_dialog.cpp
    ___________________________________________________________________
    Ajouté : svn:executable
       + *
    
     
    18561856    }
    18571857}
    18581858
     1859
     1860void CLocalListView::StartSelect()
     1861{
     1862    m_selectIndex = 0;
     1863}
     1864
     1865bool CLocalListView::GetNextFileSelect(wxString& name, bool& dir, wxLongLong& size, wxDateTime& date, bool &hasTime)
     1866{
     1867
     1868    if (m_selectIndex >= m_fileData.size()) return false;
     1869
     1870    const CLocalFileData& data = m_fileData[m_indexMapping[m_selectIndex]];
     1871
     1872    name = data.name;
     1873    dir = data.dir;
     1874    size = data.size;
     1875    date = data.lastModified;
     1876    hasTime = true;
     1877
     1878    m_selectIndex++;
     1879
     1880    return true;
     1881}
     1882
     1883
     1884
    18591885bool CLocalListView::GetNextFile(wxString& name, bool& dir, wxLongLong& size, wxDateTime& date, bool &hasTime)
    18601886{
    18611887    if (++m_comparisonIndex >= (int)m_originalIndexMapping.size())
     
    22192245            continue;
    22202246
    22212247        m_fileData[index].label = drive + _T(" (") + iter->volumeName + _T(")");
    2222        
     2248
    22232249        RefreshItem(item);
    22242250    }
    22252251}
  • src/interface/select_dialog.h

     
     1#ifndef _SELECT_DIALOG_H
     2#define _SELECT_DIALOG_H
     3
     4#include <wx/wx.h>
     5#include "context_control.h"
     6#include "LocalListView.h"
     7
     8enum
     9{
     10    BS=1,
     11    BE=2   
     12};
     13
     14class CSelect_dialog : public wxDialog
     15{
     16public:
     17        CSelect_dialog(const wxString title, CLocalListView *lv);
     18
     19    void select_button(wxCommandEvent& event);
     20    void erase_button (wxCommandEvent& event);
     21private:
     22
     23    wxButton *m_buttonSelect, *m_buttonCancel, *m_buttonErase;
     24    wxComboBox *m_comboD, *m_comboS, *m_comboUnit; 
     25    wxTextCtrl *m_sizeText, *m_nameText;
     26    wxStaticBox *m_sizeBox, *m_dateBox, *m_nameBox;
     27    CLocalListView *m_lv;
     28
     29    DECLARE_EVENT_TABLE()
     30   
     31};
     32#endif
  • src/interface/Makefile.am

    Modification de propriétés sur src/interface/select_dialog.h
    ___________________________________________________________________
    Ajouté : svn:executable
       + *
    
     
    6464        RemoteListView.cpp \
    6565        RemoteTreeView.cpp \
    6666        search.cpp \
     67        select_dialog.cpp \
    6768        settings/optionspage.cpp \
    6869        settings/optionspage_connection.cpp \
    6970        settings/optionspage_connection_active.cpp \
     
    176177         RemoteListView.h \
    177178         RemoteTreeView.h \
    178179         search.h \
     180         select_dialog.h \
    179181         settings/optionspage.h \
    180182         settings/optionspage_connection.h \
    181183         settings/optionspage_connection_active.h \
  • src/interface/resources/menus.xrc

     
    4343    </object>
    4444    <object class="wxMenu">
    4545      <label>&amp;Edit</label>
     46      <object class="wxMenuItem" name="ID_MENU_EDIT_SELECT">
     47        <label>Se&amp;lect local files...</label>
     48      </object>     
     49      <object class="separator"/>
    4650      <object class="wxMenuItem" name="ID_MENU_EDIT_NETCONFWIZARD">
    4751        <label>&amp;Network configuration wizard...</label>
    4852      </object>
     
    597601      <label>&amp;Configure speed limits...</label>
    598602    </object>
    599603  </object>
    600 </resource>
    601  No newline at end of file
     604</resource>
  • src/interface/Mainfrm.h

     
    5555    void ProcessCommandLine();
    5656
    5757    void PostInitialize();
    58    
     58
    5959    bool ConnectToServer(const CServer& server, const CServerPath& path = CServerPath());
    6060
    6161    CContextControl* GetContextControl() { return m_pContextControl; }
     
    118118    void OnSiteManager(wxCommandEvent& event);
    119119    void OnProcessQueue(wxCommandEvent& event);
    120120    void OnMenuEditSettings(wxCommandEvent& event);
     121    void OnSelectSettings(wxCommandEvent& event);
    121122    void OnToggleToolBar(wxCommandEvent& event);
    122123    void OnToggleLogView(wxCommandEvent& event);
    123124    void OnToggleLocalTreeView(wxCommandEvent& event);
  • src/interface/LocalListView.h

     
    6464    virtual bool GetNextFile(wxString& name, bool &dir, wxLongLong &size, wxDateTime& date, bool &hasTime);
    6565    virtual void FinishComparison();
    6666
     67    virtual void StartSelect();
     68    virtual bool GetNextFileSelect(wxString& name, bool &dir, wxLongLong &size, wxDateTime& date, bool &hasTime);
     69
    6770    virtual bool ItemIsDir(int index) const;
    6871    virtual wxLongLong ItemGetSize(int index) const;
    6972
     
    8790    wxDropTarget* m_pDropTarget;
    8891    int m_dropTarget;
    8992
     93    unsigned int m_selectIndex;
     94
    9095    // Event handlers
    9196    DECLARE_EVENT_TABLE();
    9297    void OnItemActivated(wxListEvent& event);
  • src/tinyxml/tinyxml.cpp

     
    5757    {
    5858        unsigned char c = (unsigned char) str[i];
    5959
    60         if ( c == '&' )
     60        if (    c == '&'
     61             && i < ( (int)str.length() - 2 )
     62             && str[i+1] == '#'
     63             && str[i+2] == 'x' )
    6164        {
     65            // Hexadecimal character reference.
     66            // Pass through unchanged.
     67            // &#xA9;   -- copyright symbol, for example.
     68            //
     69            // The -1 is a bug fix from Rob Laveaux. It keeps
     70            // an overflow from happening if there is no ';'.
     71            // There are actually 2 ways to exit this loop -
     72            // while fails (error case) and break (semicolon found).
     73            // However, there is no mechanism (currently) for
     74            // this function to return an error.
     75            while ( i<(int)str.length()-1 )
     76            {
     77                outString->append( str.c_str() + i, 1 );
     78                ++i;
     79                if ( str[i] == ';' )
     80                    break;
     81            }
     82        }
     83        else if ( c == '&' )
     84        {
    6285            outString->append( entity[0].str, entity[0].strLength );
    6386            ++i;
    6487        }