| 163 | } |
| 164 | |
| 165 | void GrepViewPlugin::showDialog(bool setLastUsed, const QString& pattern, bool show) |
| 166 | { |
| 167 | // check if dialog pointers are still valid, remove them otherwise |
| 168 | m_currentDialogs.removeAll(QPointer<GrepDialog>()); |
| 169 | |
| 170 | auto* const dlg = new GrepDialog(this, nullptr, core()->uiController()->activeMainWindow(), show); |
| 171 | m_currentDialogs << dlg; |
| 172 | |
| 173 | if (!show) { |
| 174 | // The UI is uninitialized, so the settings must be read from config. |
| 175 | dlg->setLastUsedSettings(); |
| 176 | } |
| 177 | |
| 178 | if(!pattern.isEmpty()) |
| 179 | { |
| 180 | dlg->setPattern(pattern); |
| 181 | } |
| 182 | else if(!setLastUsed) |
| 183 | { |
| 184 | QString pattern = patternFromSelection(core()->documentController()->activeDocument()); |
| 185 | if (!pattern.isEmpty()) { |
| 186 | dlg->setPattern(std::move(pattern)); |
| 187 | } |
| 188 | } |
| 189 | |
| 190 | //if directory is empty then use a default value from the config file. |
| 191 | if (!m_directory.isEmpty()) { |
| 192 | dlg->setSearchLocations(m_directory); |
| 193 | } |
| 194 | |
| 195 | if(show) |
| 196 | dlg->show(); |
| 197 | else{ |
| 198 | dlg->startSearch(); |
| 199 | dlg->deleteLater(); |
| 200 | } |
| 201 | } |
| 202 | |
| 203 | void GrepViewPlugin::showDialogFromMenu() |
| 204 | { |
nothing calls this directly
no test coverage detected