~ubuntu-branches/ubuntu/precise/amule-adunanza/precise

« back to all changes in this revision

Viewing changes to src/SearchListCtrl.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2010-02-18 21:16:23 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100218211623-gptwe60zx1knfkmu
Tags: 2010.1+2.2.6-0ubuntu1
* New upstream release (LP: #524697)
  - Drop manpages_spelling_fixes.diff fixed by upstream
  - Drop cryptopp-reference.diff fixed by upstream
  - Bump Standards-Version no changes required
  - Update install files (amule -> amuleadunanza)
  - debian/rules: amule.xpm -> amuleadunanza.xpm
  - Add README.Debian

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
//
2
2
// This file is part of the aMule Project.
3
3
//
4
 
// Copyright (c) 2003-2008 aMule Team ( admin@amule.org / http://www.amule.org )
 
4
// Copyright (c) 2003-2009 aMule Team ( admin@amule.org / http://www.amule.org )
5
5
// Copyright (c) 2002 Merkur ( devs@emule-project.net / http://www.emule-project.net )
6
6
//
7
7
// Any parts of this program derived from the xMule, lMule or eMule project,
324
324
        item.SetMask( wxLIST_MASK_STATE|wxLIST_MASK_TEXT|wxLIST_MASK_IMAGE|wxLIST_MASK_DATA|wxLIST_MASK_WIDTH|wxLIST_MASK_FORMAT );
325
325
 
326
326
        if ( GetItem(item) ) {
327
 
                wxColour newcol = SYSCOLOR(wxSYS_COLOUR_WINDOWTEXT);
 
327
// ADUNANZA BEGIN
 
328
// Patch da forum.amule.org per bug #0001531
 
329
#if 0
 
330
                wxColour newcol = SYSCOLOR(wxSYS_COLOUR_WINDOWTEXT);
 
331
#else
 
332
#       if wxCHECK_VERSION(2,8,10)
 
333
                // wsSYS_COLOUR_LISTBOXTEXT introdotta solo con 2.8.10
 
334
                wxColour newcol = SYSCOLOR(wxSYS_COLOUR_LISTBOXTEXT);
 
335
#       else
 
336
                wxColour newcol = SYSCOLOR(wxSYS_COLOUR_WINDOWTEXT);
 
337
#       endif
 
338
#endif
 
339
// ADUNANZA END
328
340
 
329
341
                CSearchFile* file = (CSearchFile*)GetItemData(index);
330
342
                CKnownFile* sameFile = theApp->downloadqueue->GetFileByID(file->GetFileHash());
722
734
 
723
735
void CSearchListCtrl::OnMarkAsKnown( wxCommandEvent& WXUNUSED(event) )
724
736
{
725
 
        int index = GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
726
 
        if (index == -1) {
727
 
                return;
 
737
#ifndef CLIENT_GUI
 
738
        long index = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
 
739
        while (index > -1) {
 
740
                CSearchFile *searchFile = (CSearchFile *)GetItemData(index);
 
741
                CKnownFile *knownFile(new CKnownFile(*searchFile));
 
742
                theApp->knownfiles->SafeAddKFile(knownFile);
 
743
                UpdateAllRelativesColor(searchFile, index);
 
744
                index = GetNextItem(index, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
728
745
        }
729
 
 
730
 
#ifndef CLIENT_GUI      
731
 
        CSearchFile *searchFile = (CSearchFile *)GetItemData(index);
732
 
        CKnownFile *knownFile(new CKnownFile(*searchFile));
733
 
        theApp->knownfiles->SafeAddKFile(knownFile);
734
 
        UpdateAllRelativesColor(searchFile, index);
735
746
#endif
736
747
}
737
748
 
784
795
                        category = CastByID(ID_AUTOCATASSIGN, NULL, wxChoice)->GetSelection();
785
796
                }               
786
797
        }
787
 
        
 
798
 
 
799
// ADUNANZA BEGIN
 
800
// Backport fix
 
801
        // First process all selections (because they may be invalidated by UpdateResult()
 
802
        // if list is sorted by status)
 
803
        std::list<CSearchFile*> searchFiles;
 
804
// ADUNANZA END 
788
805
        long index = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
789
806
        while (index > -1) {
790
807
                CSearchFile* file = (CSearchFile*)GetItemData(index);
 
808
// ADUNANZA BEGIN
 
809
// Backport fix
 
810
                searchFiles.push_back(file);
 
811
// ADUNANZA END
791
812
                CoreNotify_Search_Add_Download(file, category);
792
813
                UpdateAllRelativesColor(file, index);
793
814
                index = GetNextItem(index, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
794
815
        }
 
816
// ADUNANZA BEGIN
 
817
// Backport fix
 
818
        // Then update the listcontrol
 
819
        for (std::list<CSearchFile*>::iterator it = searchFiles.begin(); it != searchFiles.end(); ++it) {
 
820
                UpdateResult(*it);
 
821
        }
 
822
// ADUNANZA END
795
823
}
796
824
 
797
825
 
817
845
                }
818
846
        } else {
819
847
                dc->SetBackground(GetBrush(wxSYS_COLOUR_LISTBOX));
820
 
                dc->SetTextForeground(SYSCOLOR(wxSYS_COLOUR_WINDOWTEXT));
 
848
// ADUNANZA BEGIN
 
849
// Patch da forum.amule.org per bug #0001531
 
850
#if 0
 
851
                dc->SetTextForeground(SYSCOLOR(wxSYS_COLOUR_WINDOWTEXT));
 
852
#else
 
853
#       if wxCHECK_VERSION(2,8,10)
 
854
                // wsSYS_COLOUR_LISTBOXTEXT introdotta solo con 2.8.10
 
855
                dc->SetTextForeground(SYSCOLOR(wxSYS_COLOUR_LISTBOXTEXT));
 
856
#       else
 
857
                dc->SetTextForeground(SYSCOLOR(wxSYS_COLOUR_WINDOWTEXT));
 
858
#       endif
 
859
#endif
 
860
// ADUNANZA END
821
861
        }
822
862
 
823
863
        // Define the border of the drawn area