Changeset View
Changeset View
Standalone View
Standalone View
app/searchstringinput.cpp
Show First 20 Lines • Show All 97 Lines • ▼ Show 20 Line(s) | |||||
98 | { | 98 | { | ||
99 | DictQuery result( _actionTextInput->currentText() ); | 99 | DictQuery result( _actionTextInput->currentText() ); | ||
100 | 100 | | |||
101 | if( _actionFilterRare->currentItem() == DictQuery::Rare ) | 101 | if( _actionFilterRare->currentItem() == DictQuery::Rare ) | ||
102 | { | 102 | { | ||
103 | result.setProperty( "common", "1" ); | 103 | result.setProperty( "common", "1" ); | ||
104 | } | 104 | } | ||
105 | 105 | | |||
106 | result.setFilterType( (DictQuery::FilterType)_actionFilterRare->currentItem() ); | 106 | result.setFilterType( static_cast<DictQuery::FilterType>(_actionFilterRare->currentItem() ) ); | ||
107 | result.setMatchType( (DictQuery::MatchType)_actionSearchSection->currentItem() ); | 107 | result.setMatchType( static_cast<DictQuery::MatchType>(_actionSearchSection->currentItem() ) ); | ||
108 | result.setMatchWordType( (DictQuery::MatchWordType)_actionSelectWordType->currentItem() ); | 108 | result.setMatchWordType( static_cast<DictQuery::MatchWordType>(_actionSelectWordType->currentItem() ) ); | ||
109 | 109 | | |||
110 | return result; | 110 | return result; | ||
111 | } | 111 | } | ||
112 | 112 | | |||
113 | void SearchStringInput::setDefaultsFromConfig() | 113 | void SearchStringInput::setDefaultsFromConfig() | ||
114 | { | 114 | { | ||
115 | KitenConfigSkeleton* config = KitenConfigSkeleton::self(); | 115 | KitenConfigSkeleton* config = KitenConfigSkeleton::self(); | ||
116 | _actionFilterRare->setCurrentItem( config->filter_rare() ); | 116 | _actionFilterRare->setCurrentItem( config->filter_rare() ); | ||
117 | _actionSearchSection->setCurrentItem( config->search_precision() ); | 117 | _actionSearchSection->setCurrentItem( config->search_precision() ); | ||
118 | _actionSelectWordType->setCurrentItem( config->search_limit_to_wordtype() ); | 118 | _actionSelectWordType->setCurrentItem( config->search_limit_to_wordtype() ); | ||
119 | } | 119 | } | ||
120 | 120 | | |||
121 | void SearchStringInput::setSearchQuery( const DictQuery &query ) | 121 | void SearchStringInput::setSearchQuery( const DictQuery &query ) | ||
122 | { | 122 | { | ||
123 | qDebug() << "------------------------------Set Triggered"; | 123 | qDebug() << "------------------------------Set Triggered"; | ||
124 | //First we set the various actions according to the query | 124 | //First we set the various actions according to the query | ||
125 | _actionFilterRare->setCurrentItem( query.getFilterType() ); | 125 | _actionFilterRare->setCurrentItem( query.getFilterType() ); | ||
126 | _actionSearchSection->setCurrentItem( query.getMatchType() ); | 126 | _actionSearchSection->setCurrentItem( query.getMatchType() ); | ||
127 | _actionSelectWordType->setCurrentItem( query.getMatchWordType() ); | 127 | _actionSelectWordType->setCurrentItem( query.getMatchWordType() ); | ||
128 | 128 | | |||
129 | //Secondly we remove aspects that are visible in the gui from the search string | 129 | //Secondly we remove aspects that are visible in the gui from the search string | ||
130 | DictQuery copy( query ); | 130 | DictQuery copy( query ); | ||
131 | foreach( KToolBar *bar, _parent->toolBars() ) | 131 | foreach( KToolBar *bar, _parent->toolBars() ) | ||
132 | { | 132 | { | ||
133 | if( bar->widgetForAction( _actionFilterRare ) != NULL ) | 133 | if( bar->widgetForAction( _actionFilterRare ) != nullptr ) | ||
134 | copy.removeProperty( "common" ); | 134 | copy.removeProperty( "common" ); | ||
135 | 135 | | |||
136 | if( bar->widgetForAction( _actionSelectWordType ) != NULL ) | 136 | if( bar->widgetForAction( _actionSelectWordType ) != nullptr ) | ||
137 | copy.removeProperty("type"); | 137 | copy.removeProperty("type"); | ||
138 | } | 138 | } | ||
139 | 139 | | |||
140 | _actionTextInput->addToHistory(copy.toString()); // Update history and completion list | 140 | _actionTextInput->addToHistory(copy.toString()); // Update history and completion list | ||
141 | _actionTextInput->setCurrentItem( copy.toString(), true ); | 141 | _actionTextInput->setCurrentItem( copy.toString(), true ); | ||
142 | _actionTextInput->reset(); // Call this manually when you call setCurrentItem | 142 | _actionTextInput->reset(); // Call this manually when you call setCurrentItem | ||
143 | } | 143 | } | ||
144 | 144 | | |||
Show All 13 Lines |