~ubuntu-branches/ubuntu/saucy/filezilla/saucy-proposed

« back to all changes in this revision

Viewing changes to src/interface/search.cpp

  • Committer: Package Import Robot
  • Author(s): Adrien Cunin
  • Date: 2012-12-07 17:17:17 UTC
  • mfrom: (1.1.31)
  • Revision ID: package-import@ubuntu.com-20121207171717-nt6as62u4pa1uv11
Tags: 3.6.0.2-1ubuntu1
* Merge from Debian experimental. Remaining Ubuntu change:
   - Added debian/patches/11_use-decimal-si-by-default.patch in order to
     comply with UnitsPolicy

Show diffs side-by-side

added added

removed removed

Lines of Context:
514
514
 
515
515
CSearchDialog::CSearchDialog(wxWindow* parent, CState* pState, CQueueView* pQueue)
516
516
        : CStateEventHandler(pState)
 
517
        , m_parent(parent)
 
518
        , m_results(0)
 
519
        , m_pQueue(pQueue)
 
520
        , m_pWindowStateManager(0)
 
521
        , m_searching(false)
517
522
{
518
 
        m_pQueue = pQueue;
519
 
        m_parent = parent;
520
 
        m_pWindowStateManager = 0;
521
 
        m_searching = false;
522
523
}
523
524
 
524
525
CSearchDialog::~CSearchDialog()
625
626
        // Do not process same directory multiple times
626
627
        if (!m_visited.insert(listing->path).second)
627
628
                return;
628
 
        
 
629
 
629
630
        int old_count = m_results->m_fileData.size();
630
631
        int added = 0;
631
632
 
878
879
                                                continue;
879
880
                                        }
880
881
                                }
881
 
                                iter++;
 
882
                                ++iter;
882
883
                        }
883
884
                        if (!replaced)
884
885
                                selected_dirs.push_back(path);
889
890
 
890
891
        // Now in a second phase filter out all files that are also in a directory
891
892
        std::list<int> selected_files_new;
892
 
        for (std::list<int>::const_iterator iter = selected_files.begin(); iter != selected_files.end(); iter++)
 
893
        for (std::list<int>::const_iterator iter = selected_files.begin(); iter != selected_files.end(); ++iter)
893
894
        {
894
895
                CServerPath path = m_results->m_fileData[*iter].path;
895
896
                std::list<CServerPath>::const_iterator path_iter;
896
 
                for (path_iter = selected_dirs.begin(); path_iter != selected_dirs.end(); path_iter++)
 
897
                for (path_iter = selected_dirs.begin(); path_iter != selected_dirs.end(); ++path_iter)
897
898
                {
898
899
                        if (*path_iter == path || path_iter->IsParentOf(path, false))
899
900
                                break;
902
903
                        selected_files_new.push_back(*iter);
903
904
        }
904
905
        selected_files.swap(selected_files_new);
905
 
        
 
906
 
906
907
        // At this point selected_dirs contains uncomparable
907
908
        // paths and selected_files contains only files not
908
909
        // covered by any of those directories.
951
952
        bool start = XRCCTRL(dlg, "ID_QUEUE_START", wxRadioButton)->GetValue();
952
953
        bool flatten = XRCCTRL(dlg, "ID_PATHS_FLATTEN", wxRadioButton)->GetValue();
953
954
 
954
 
        for (std::list<int>::const_iterator iter = selected_files.begin(); iter != selected_files.end(); iter++)
 
955
        for (std::list<int>::const_iterator iter = selected_files.begin(); iter != selected_files.end(); ++iter)
955
956
        {
956
957
                const CDirentry& entry = m_results->m_fileData[*iter].entry;
957
958
 
966
967
                                segments.push_front(remote_path.GetLastSegment());
967
968
                                remote_path = remote_path.GetParent();
968
969
                        }
969
 
                        for (std::list<wxString>::const_iterator segment_iter = segments.begin(); segment_iter != segments.end(); segment_iter++)
 
970
                        for (std::list<wxString>::const_iterator segment_iter = segments.begin(); segment_iter != segments.end(); ++segment_iter)
970
971
                                target_path.AddSegment(*segment_iter);
971
972
                }
972
973
 
987
988
        else
988
989
                mode = start ? CRecursiveOperation::recursive_download : CRecursiveOperation::recursive_addtoqueue;
989
990
 
990
 
        for (std::list<CServerPath>::const_iterator iter = selected_dirs.begin(); iter != selected_dirs.end(); iter++)
 
991
        for (std::list<CServerPath>::const_iterator iter = selected_dirs.begin(); iter != selected_dirs.end(); ++iter)
991
992
        {
992
993
                CLocalPath target_path = path;
993
994
                if (!flatten && iter->HasParent())
1020
1021
 
1021
1022
        wxString question;
1022
1023
        if (selected_dirs.empty())
1023
 
                question.Printf(wxPLURAL("Really delete %d file?", "Really delete %d files?", selected_files.size()), selected_files.size());
 
1024
                question.Printf(wxPLURAL("Really delete %d file from the server?", "Really delete %d files from the server?", selected_files.size()), selected_files.size());
1024
1025
        else if (selected_files.empty())
1025
 
                question.Printf(wxPLURAL("Really delete %d directory with its contents?", "Really delete %d directories with their contents?", selected_dirs.size()), selected_dirs.size());
 
1026
                question.Printf(wxPLURAL("Really delete %d directory with its contents from the server?", "Really delete %d directories with their contents from the server?", selected_dirs.size()), selected_dirs.size());
1026
1027
        else
1027
1028
        {
1028
1029
                wxString files = wxString::Format(wxPLURAL("%d file", "%d files", selected_files.size()), selected_files.size());
1029
1030
                wxString dirs = wxString::Format(wxPLURAL("%d directory with its contents", "%d directories with their contents", selected_dirs.size()), selected_dirs.size());
1030
 
                question.Printf(_("Really delete %s and %s?"), files.c_str(), dirs.c_str());
 
1031
                question.Printf(_("Really delete %s and %s from the server?"), files.c_str(), dirs.c_str());
1031
1032
        }
1032
1033
 
1033
1034
        if (wxMessageBox(question, _("Confirm deletion"), wxICON_QUESTION | wxYES_NO) != wxYES)
1034
1035
                return;
1035
1036
 
1036
 
        for (std::list<int>::const_iterator iter = selected_files.begin(); iter != selected_files.end(); iter++)
 
1037
        for (std::list<int>::const_iterator iter = selected_files.begin(); iter != selected_files.end(); ++iter)
1037
1038
        {
1038
1039
                const CDirentry& entry = m_results->m_fileData[*iter].entry;
1039
1040
                std::list<wxString> files_to_delete;
1041
1042
                m_pState->m_pCommandQueue->ProcessCommand(new CDeleteCommand(m_results->m_fileData[*iter].path, files_to_delete));
1042
1043
        }
1043
1044
 
1044
 
        for (std::list<CServerPath>::const_iterator iter = selected_dirs.begin(); iter != selected_dirs.end(); iter++)
 
1045
        for (std::list<CServerPath>::const_iterator iter = selected_dirs.begin(); iter != selected_dirs.end(); ++iter)
1045
1046
        {
1046
1047
                CServerPath path = *iter;
1047
1048
                if (!path.HasParent())
1087
1088
        CInterProcessMutex mutex(MUTEX_SEARCHCONDITIONS);
1088
1089
 
1089
1090
        CXmlFile file;
1090
 
        
 
1091
 
1091
1092
        TiXmlElement* pDocument = file.Load(_T("search"));
1092
1093
        if (!pDocument)
1093
1094
        {
1108
1109
        CInterProcessMutex mutex(MUTEX_SEARCHCONDITIONS);
1109
1110
 
1110
1111
        CXmlFile file;
1111
 
        
 
1112
 
1112
1113
        TiXmlElement* pDocument = file.Load(_T("search"));
1113
1114
        if (!pDocument)
1114
1115
        {