Changeset 27602

Show
Ignore:
Timestamp:
11/17/08 08:15:44 (2 months ago)
Author:
spitz
Message:

* GuiThesaurus?.cpp:

  • entry parsing should work for all cases now.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lyx-devel/trunk/src/frontends/qt4/GuiThesaurus.cpp

    r27572 r27602  
    106106 
    107107        QString item = meaningsTV->currentItem()->text(col); 
    108         // cut out the classification in brackets 
    109         // (as in "hominid (generic term)") 
    110         // FIXME: not ideal yet. We need to cut off classifications 
    111         // at the beginning as well  
    112         // (as in "(noun) man" and "(noun) male (generic term)") 
     108        // cut out the classification in brackets: 
     109        // "hominid (generic term)" -> "hominid" 
    113110        QRegExp re("^([^\\(\\)]+)\\b\\(?.*\\)?.*$"); 
     111        // This is for items with classifications at the beginning: 
     112        // "(noun) man" -> "man"; "(noun) male (generic term)" -> "male" 
     113        QRegExp rex("^(\\(.+\\))\\s*([^\\(\\)]+)\\s*\\(?.*\\)?.*$"); 
    114114        int pos = re.indexIn(item); 
    115115        if (pos > -1) 
    116116                item = re.cap(1).trimmed(); 
     117        pos = rex.indexIn(item); 
     118        if (pos > -1) 
     119                item = rex.cap(2).trimmed(); 
    117120        replaceED->setText(item); 
    118121        replacePB->setEnabled(true); 
     
    130133{ 
    131134        QString str = item->text(col); 
    132         // cut out the classification in brackets 
    133         // (as in "hominid (generic term)") 
    134         // FIXME: not ideal yet. We need to cut off classifications 
    135         // at the beginning as well  
    136         // (as in "(noun) man" and "(noun) male (generic term)") 
     135        // cut out the classification in brackets: 
     136        // "hominid (generic term)" -> "hominid" 
    137137        QRegExp re("^([^\\(\\)]+)\\b\\(?.*\\)?.*$"); 
     138        // This is for items with classifications at the beginning: 
     139        // "(noun) man" -> "man"; "(noun) male (generic term)" -> "male" 
     140        QRegExp rex("^(\\(.+\\))\\s*([^\\(\\)]+)\\s*\\(?.*\\)?.*$"); 
    138141        int pos = re.indexIn(str); 
    139142        if (pos > -1) 
    140143                str = re.cap(1).trimmed(); 
     144        pos = rex.indexIn(str); 
     145        if (pos > -1) 
     146                str = rex.cap(2).trimmed(); 
    141147        entryCO->insertItem(0, str); 
    142148        entryCO->setCurrentIndex(0);