Changeset 34


Ignore:
Timestamp:
Jul 13, 2016, 3:24:45 PM (8 years ago)
Author:
chronos
Message:
  • Fixed: Error during removing acronyms in case that multiple acronyms with same name exists.
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormAcronyms.lfm

    r30 r34  
    105105    object MenuItem4: TMenuItem
    106106      Action = AAdd
     107      Bitmap.Data = {
     108        36040000424D3604000000000000360000002800000010000000100000000100
     109        2000000000000004000064000000640000000000000000000000000000000000
     110        0000000000000000000000000000000000000000000000000000000000000000
     111        0000000000000000000000000000000000000000000000000000000000000000
     112        000000000000000000000000000000000000D4D4D4FFB2B2B2FFB2B2B2FFD4D4
     113        D4FF000000000000000000000000000000000000000000000000000000000000
     114        0000000000000000000000000000709B70FF004A00FF004800FF4E764EFFB2B2
     115        B2FF000000000000000000000000000000000000000000000000000000000000
     116        0000000000000000000000000000004E00FF00C800FF00C400FF004800FFB2B2
     117        B2FF000000000000000000000000000000000000000000000000000000000000
     118        0000000000000000000000000000005000FF00CA00FF00C600FF004A00FFB2B2
     119        B2FF000000000000000000000000000000000000000000000000000000000000
     120        0000000000000000000000000000005300FF00CE00FF00CA00FF004C00FFB2B2
     121        B2FF00000000000000000000000000000000000000000000000000000000D4D4
     122        D4FFB2B2B2FFB2B2B2FFB2B2B2FF005400FF00D200FF00CE00FF004E00FFB2B2
     123        B2FFB2B2B2FFB2B2B2FFB2B2B2FFB2B2B2FFD4D4D4FF0000000070A670FF005E
     124        00FF005C00FF005A00FF005800FF005600FF00D600FF00D000FF005000FF004E
     125        00FF004C00FF004A00FF004A00FF4E764EFFB2B2B2FF00000000006200FF8CFE
     126        8CFF00EA00FF00E600FF00E200FF00DE00FF00DA00FF00D400FF00D000FF00CC
     127        00FF00C800FF00C400FF00C200FF004800FFB2B2B2FF00000000006400FFECFF
     128        ECFF8CFE8CFF8CFE8CFF8CFE8CFF8CFE8CFF00DE00FF00D900FF00D400FF00D0
     129        00FF00CC00FF00C800FF00C400FF004A00FFD4D4D4FF0000000070A970FF0064
     130        00FF006400FF006200FF006000FF006000FF8CFE8CFF00DD00FF005800FF0056
     131        00FF005400FF005300FF005000FF709C70FF0000000000000000000000000000
     132        0000000000000000000000000000006000FF8CFE8CFF00E000FF005A00FFB2B2
     133        B2FF000000000000000000000000000000000000000000000000000000000000
     134        0000000000000000000000000000006200FF8CFE8CFF00E500FF005C00FFB2B2
     135        B2FF000000000000000000000000000000000000000000000000000000000000
     136        0000000000000000000000000000006400FF8CFE8CFF00E800FF005E00FFB2B2
     137        B2FF000000000000000000000000000000000000000000000000000000000000
     138        0000000000000000000000000000006400FFECFFECFF8CFE8CFF006000FFD4D4
     139        D4FF000000000000000000000000000000000000000000000000000000000000
     140        000000000000000000000000000070A970FF006400FF006200FF70A670FF0000
     141        0000000000000000000000000000000000000000000000000000
     142      }
    107143    end
    108144    object MenuItem5: TMenuItem
    109145      Action = AModify
     146      Bitmap.Data = {
     147        36040000424D3604000000000000360000002800000010000000100000000100
     148        2000000000000004000064000000640000000000000000000000986B37FF976A
     149        36FF966935FF966734FF956633FF946532FF946531FF936430FF92622FFF9261
     150        2EFF91602DFF90602CFF905F2BFF8F5D2AFF8E5C29FF8D5B28FF996C38FFF8F7
     151        F6FFF8F7F5FFF7F6F5FFF6F6F4FFF6F5F3FFF5F5F3FFF5F4F2FFF4F3F1FFF4F3
     152        F1FFF3F2F0FFF3F2EFFFF2F1EFFFF2F0EEFFF1F0EDFF8E5D29FF996D3AFFF9F8
     153        F7FF959594FF878787FF9B9A9AFFF7F6F4FFF6F5F3FFF6F5F3FFF5F4F2FFF4F3
     154        F1FFF4F3F1FFF3F2F0FFF3F2EFFFF2F1EFFFF2F1EEFF8F5E2AFF9A6E3BFFF9F9
     155        F8FF7C7C7CFFC4C4C4FF878787FFF7F6F5FF7A7A7AFF787878FF747474FF7171
     156        70FF6D6D6CFF696968FF656565FF616161FFF2F1EFFF905F2BFF9B6F3CFFFAF9
     157        F8FFBEBEBDFF929292FFBCBCBBFFF8F7F6FFF7F7F5FFF7F6F4FFF6F5F4FFF6F5
     158        F3FFF5F4F2FFF5F4F2FFF4F3F1FFF4F2F0FFF3F2F0FF91602DFF9C703DFFFAFA
     159        F9FFFAF9F9FFF9F9F8FFF9F8F7FFF8F8F7FFF8F7F6FFF7F7F5FFF7F6F5FFF6F5
     160        F4FFF6F5F3FFF5F4F3FFF5F4F2FFF4F3F1FFF4F3F0FF92612EFF9D723EFFFBFB
     161        FAFF9F9F9EFF7F7F7FFFAEAEADFFF9F8F7FFF8F8F7FFF8F7F6FFF7F7F5FFF7F6
     162        F5FFF6F6F4FFF6F5F3FFF5F4F3FFF5F4F2FFF4F3F1FF92622FFF9D7340FFFCFB
     163        FBFF818181FFC4C4C4FF8F8F8FFFFAF9F8FF7B7B7AFF797979FF757574FF7271
     164        71FF6D6D6DFF696969FF666665FF626261FFF5F4F2FF936430FF9E7441FFFCFC
     165        FCFFB5B5B5FF848484FFBEBDBDFFFAFAF9FFFAF9F8FFF9F9F7FFF9F8F7FFF8F8
     166        F6FFF8F7F5FFF7F6F5FFF7F6F4FFF6F5F3FFF6F5F3FF946531FF9F7542FFFDFD
     167        FCFFFCFCFCFFFCFCFBFFFBFBFAFFFBFAFAFFFAFAF9FFFAF9F8FFF9F9F8FFF9F8
     168        F7FFF8F8F6FFF8F7F6FFF7F6F5FFF7F6F4FFF6F5F4FF956633FFA07643FFFEFD
     169        FDFF8C8C8CFF525252FFA4A4A4FFFBFBFAFFFBFBFAFFFAFAF9FFFAF9F8FFF9F9
     170        F8FFF9F8F7FFF8F8F6FFF8F7F6FFF7F7F5FFF7F6F4FF966734FFA17844FFFEFE
     171        FEFF5F5F5FFF949494FF535353FFFCFCFBFF7B7B7BFF797979FF757575FF7272
     172        72FF6E6E6EFF6A6A69FF666666FF626262FFF7F7F5FF966935FFA17946FFFFFF
     173        FFFF878787FF5D5D5DFFA0A0A0FFFDFCFCFFFCFCFBFFFCFBFBFFFBFBFAFFFBFA
     174        F9FFFAFAF9FFFAF9F8FFF9F8F7FFF8F8F7FFF8F7F6FF976A36FFA27A47FFFFFF
     175        FFFFFFFFFFFFFEFEFEFFFEFEFEFFFDFDFDFFFDFDFCFFFCFCFBFFFCFBFBFFFBFB
     176        FAFFFBFAF9FFFAFAF9FFFAF9F8FFF9F9F7FFF9F8F7FF986B37FFA37B48FFBEA2
     177        7FFFBEA17EFFBDA17DFFBDA07CFFBD9F7CFFBC9F7BFFBB9E7AFFBB9D7AFFBB9D
     178        79FFBA9C78FFB99B78FFB99A77FFB89A76FFB89975FF996C39FFA37B48FFA37B
     179        48FFA27A47FFA27946FFA17845FFA07744FFA07643FF9F7542FF9E7441FF9E73
     180        40FF9D723FFF9C713EFF9C703DFF9B6F3CFF9A6E3BFF9A6D3AFF
     181      }
    110182    end
    111183    object MenuItem6: TMenuItem
    112184      Action = ARemove
     185      Bitmap.Data = {
     186        36040000424D3604000000000000360000002800000010000000100000000100
     187        2000000000000004000064000000640000000000000000000000000000000000
     188        0000000000000000000000000000000000000000000000000000000000000000
     189        0000000000000000000000000000000000000000000000000000000000000000
     190        000000000000DCDCDCFFB2B2B2FFDCDCDCFF0000000000000000000000000000
     191        000000000000DCDCDCFFB2B2B2FFDCDCDCFF0000000000000000000000000000
     192        00007979A8FF000067FF626291FFB2B2B2FFDCDCDCFF00000000000000000000
     193        00007979A8FF000050FF626291FFB2B2B2FFDCDCDCFF00000000000000008C8C
     194        BBFF00006EFF0035FFFF000068FF626291FFB2B2B2FFDCDCDCFF000000007979
     195        A8FF000054FF0015FFFF000050FF626291FFB2B2B2FF00000000000000000000
     196        72FF619BFFFF003AFFFF0035FFFF000067FF626291FFB2B2B2FF7979A8FF0000
     197        59FF001BFFFF0018FFFF0015FFFF000050FFDCDCDCFF00000000000000008C8C
     198        BBFF000075FF619BFFFF003AFFFF0035FFFF000067FF626291FF000061FF0023
     199        FFFF001FFFFF001BFFFF000054FF7979A8FF0000000000000000000000000000
     200        00008C8CBBFF000075FF619BFFFF003AFFFF0035FFFF000067FF002CFFFF0027
     201        FFFF0023FFFF000059FF7979A8FF000000000000000000000000000000000000
     202        0000000000008C8CBBFF000075FF619BFFFF003AFFFF0035FFFF0030FFFF002B
     203        FFFF000061FF7979A8FF00000000000000000000000000000000000000000000
     204        000000000000000000007979A8FF000075FF003EFFFF003AFFFF0035FFFF0000
     205        68FF626291FFB2B2B2FFDCDCDCFF000000000000000000000000000000000000
     206        0000000000007979A8FF00007CFF0047FFFF0042FFFF003EFFFF003AFFFF0035
     207        FFFF000068FF626291FFB2B2B2FFDCDCDCFF0000000000000000000000000000
     208        00007979A8FF000082FF004EFFFF004BFFFF0047FFFF000075FF619BFFFF003A
     209        FFFF0035FFFF000068FF626291FFB2B2B2FFDCDCDCFF00000000000000008C8C
     210        BBFF000086FF0054FFFF0052FFFF004EFFFF00007CFF7979A8FF000075FF619B
     211        FFFF003AFFFF0035FFFF000067FF626291FFB2B2B2FF00000000000000000000
     212        88FF619BFFFF0057FFFF0054FFFF000082FF7979A8FF000000008C8CBBFF0000
     213        75FF619BFFFF003AFFFF0035FFFF000068FFDCDCDCFF00000000000000008C8C
     214        BBFF000088FF619BFFFF000086FF7979A8FF0000000000000000000000008C8C
     215        BBFF000075FF619BFFFF00006EFF7979A8FF0000000000000000000000000000
     216        00008C8CBBFF000088FF8C8CBBFF000000000000000000000000000000000000
     217        00008C8CBBFF000075FF8C8CBBFF000000000000000000000000000000000000
     218        0000000000000000000000000000000000000000000000000000000000000000
     219        0000000000000000000000000000000000000000000000000000
     220      }
    113221    end
    114222    object MenuItem7: TMenuItem
  • trunk/Forms/UFormAcronyms.pas

    r27 r34  
    147147      not FormMain.CompareStrings(TempEntry.Categories, TempCategories) then begin
    148148        // TODO: Update item inplace if possible
    149         FormMain.AcronymDb.RemoveAcronym(Acronym.Name, Name);
     149        FormMain.AcronymDb.RemoveMeaning(TAcronymMeaning(ListViewAcronyms.Selected.Data));
    150150        Meaning := FormMain.AcronymDb.AddAcronym(TempEntry.Name, TempEntry.Meaning);
    151151        Meaning.Description := TempEntry.Description;
     
    172172        if ListViewAcronyms.Items[I].Selected then begin
    173173          ListViewAcronyms.Items[I].Selected := False;
    174           FormMain.AcronymDb.RemoveAcronym(
    175             TAcronymMeaning(ListViewAcronyms.Items[I].Data).Acronym.Name,
    176             TAcronymMeaning(ListViewAcronyms.Items[I].Data).Name);
     174          FormMain.AcronymDb.RemoveMeaning(TAcronymMeaning(ListViewAcronyms.Items[I].Data));
    177175        end;
    178176      UpdateAcronymsList;
     
    202200    case Column of
    203201      0: Result := CompareString(TAcronymMeaning(Item1).Acronym.Name, TAcronymMeaning(Item2).Acronym.Name);
    204       1: Result := CompareString(TAcronymMeaning(Item1).Description, TAcronymMeaning(Item2).Description);
     202      1: Result := CompareString(TAcronymMeaning(Item1).Name, TAcronymMeaning(Item2).Name);
    205203      2: Result := CompareString(TAcronymMeaning(Item1).Categories.GetString, TAcronymMeaning(Item2).Categories.GetString);
    206204    end;
  • trunk/Languages/AcronymDecoder.cs.po

    r33 r34  
    109109#: tformacronyms.listviewacronyms.columns[0].caption
    110110#, fuzzy
     111#| msgid "Id"
     112msgctxt "tformacronyms.listviewacronyms.columns[0].caption"
     113msgid "Name"
     114msgstr "Název"
     115
     116#: tformacronyms.listviewacronyms.columns[1].caption
     117#, fuzzy
    111118#| msgid "Name"
    112 msgctxt "tformacronyms.listviewacronyms.columns[0].caption"
    113 msgid "Id"
    114 msgstr "Název"
    115 
    116 #: tformacronyms.listviewacronyms.columns[1].caption
     119msgctxt "tformacronyms.listviewacronyms.columns[1].caption"
     120msgid "Description"
     121msgstr "Popis"
     122
     123#: tformacronyms.listviewacronyms.columns[2].caption
    117124#, fuzzy
    118125#| msgid "Description"
    119 msgctxt "tformacronyms.listviewacronyms.columns[1].caption"
    120 msgid "Name"
    121 msgstr "Popis"
    122 
    123 #: tformacronyms.listviewacronyms.columns[2].caption
    124 #, fuzzy
    125 #| msgid "Categories"
    126126msgctxt "tformacronyms.listviewacronyms.columns[2].caption"
    127 msgid "Description"
    128 msgstr "Kategorie"
    129 
    130 #: tformacronyms.listviewacronyms.columns[3].caption
    131 #, fuzzy
    132 msgctxt "tformacronyms.listviewacronyms.columns[3].caption"
    133127msgid "Categories"
    134128msgstr "Kategorie"
  • trunk/Languages/AcronymDecoder.po

    r33 r34  
    9999#: tformacronyms.listviewacronyms.columns[0].caption
    100100msgctxt "TFORMACRONYMS.LISTVIEWACRONYMS.COLUMNS[0].CAPTION"
    101 msgid "Id"
     101msgid "Name"
    102102msgstr ""
    103103
    104104#: tformacronyms.listviewacronyms.columns[1].caption
    105105msgctxt "TFORMACRONYMS.LISTVIEWACRONYMS.COLUMNS[1].CAPTION"
    106 msgid "Name"
     106msgid "Description"
    107107msgstr ""
    108108
    109109#: tformacronyms.listviewacronyms.columns[2].caption
    110110msgctxt "TFORMACRONYMS.LISTVIEWACRONYMS.COLUMNS[2].CAPTION"
    111 msgid "Description"
    112 msgstr ""
    113 
    114 #: tformacronyms.listviewacronyms.columns[3].caption
    115 msgctxt "TFORMACRONYMS.LISTVIEWACRONYMS.COLUMNS[3].CAPTION"
    116111msgid "Categories"
    117112msgstr ""
  • trunk/UAcronym.pas

    r33 r34  
    218218    procedure FilterList(AName: string; Items: TAcronymMeanings);
    219219    function AddAcronym(AcronymName, MeaningName: string): TAcronymMeaning;
     220    procedure RemoveMeaning(Meaning: TAcronymMeaning);
    220221    procedure RemoveAcronym(AcronymName, MeaningName: string);
    221222    procedure AssignToList(List: TListObject);
     
    772773  LastId := 0;
    773774  for I := 0 to Count - 1 do begin
    774     if TAcronymCategory(Items[I]).Id > LastId then LastId := TAcronymCategory(Items[I]).Id;
     775    if TAcronymMeaning(Items[I]).Id > LastId then LastId := TAcronymMeaning(Items[I]).Id;
    775776  end;
    776777  // Add ID to new items without ID
    777778  for I := 0 to Count - 1 do begin
    778     if TAcronymCategory(Items[I]).Id = 0 then begin
     779    if TAcronymMeaning(Items[I]).Id = 0 then begin
    779780      Inc(LastId);
    780       TAcronymCategory(Items[I]).Id := LastId;
     781      TAcronymMeaning(Items[I]).Id := LastId;
    781782    end;
    782783  end;
     
    875876  I: Integer;
    876877begin
    877   if Assigned(Acronym) then
    878     Acronym.Meanings.Remove(Self);
    879878  for I := 0 to Categories.Count - 1 do
    880879    TAcronymCategory(Categories[I]).AcronymMeanings.Remove(Self);
     
    13701369end;
    13711370
     1371procedure TAcronymDb.RemoveMeaning(Meaning: TAcronymMeaning);
     1372var
     1373  Acronym: TAcronym;
     1374begin
     1375  Acronym := Meaning.Acronym;
     1376  Acronym.Meanings.Remove(Meaning);
     1377  if Acronym.Meanings.Count = 0 then
     1378    Acronyms.Remove(Acronym);
     1379  Modified := True;
     1380end;
     1381
    13721382procedure TAcronymDb.RemoveAcronym(AcronymName, MeaningName: string);
    13731383var
     
    13781388  if Assigned(Acronym) then begin
    13791389    Meaning := Acronym.Meanings.SearchByName(MeaningName);
    1380     if Assigned(Meaning) then begin
    1381       Acronym.Meanings.Remove(Meaning);
    1382       if Acronym.Meanings.Count = 0 then
    1383         Acronyms.Remove(Acronym);
    1384     end;
    1385   end;
    1386   Modified := True;
     1390    if Assigned(Meaning) then RemoveMeaning(Meaning);
     1391  end;
    13871392end;
    13881393
Note: See TracChangeset for help on using the changeset viewer.