Changeset View
Changeset View
Standalone View
Standalone View
plugins/grepview/grepviewplugin.cpp
Show First 20 Lines • Show All 100 Lines • ▼ Show 20 Line(s) | |||||
101 | } | 101 | } | ||
102 | 102 | | |||
103 | GrepViewPlugin::~GrepViewPlugin() | 103 | GrepViewPlugin::~GrepViewPlugin() | ||
104 | { | 104 | { | ||
105 | } | 105 | } | ||
106 | 106 | | |||
107 | void GrepViewPlugin::unload() | 107 | void GrepViewPlugin::unload() | ||
108 | { | 108 | { | ||
109 | if (m_currentDialog) { | 109 | foreach (const QPointer<GrepDialog> &p, m_currentDialogs) { | ||
110 | m_currentDialog->reject(); | 110 | if (p) { | ||
111 | m_currentDialog->deleteLater(); | 111 | p->reject(); | ||
112 | p->deleteLater(); | ||||
113 | } | ||||
apol: const & | |||||
112 | } | 114 | } | ||
113 | 115 | | |||
114 | core()->uiController()->removeToolView(m_factory); | 116 | core()->uiController()->removeToolView(m_factory); | ||
115 | } | 117 | } | ||
116 | 118 | | |||
117 | void GrepViewPlugin::startSearch(QString pattern, QString directory, bool show) | 119 | void GrepViewPlugin::startSearch(QString pattern, QString directory, bool show) | ||
118 | { | 120 | { | ||
119 | m_directory = directory; | 121 | m_directory = directory; | ||
Show All 38 Lines | 155 | if (mimetype == directoryMime) { | |||
158 | extension.addAction( KDevelop::ContextMenuExtension::ExtensionGroup, action ); | 160 | extension.addAction( KDevelop::ContextMenuExtension::ExtensionGroup, action ); | ||
159 | } | 161 | } | ||
160 | } | 162 | } | ||
161 | return extension; | 163 | return extension; | ||
162 | } | 164 | } | ||
163 | 165 | | |||
164 | void GrepViewPlugin::showDialog(bool setLastUsed, QString pattern, bool show) | 166 | void GrepViewPlugin::showDialog(bool setLastUsed, QString pattern, bool show) | ||
165 | { | 167 | { | ||
166 | GrepDialog* dlg = new GrepDialog( this, core()->uiController()->activeMainWindow() ); | 168 | // check if dialog pointers are still valid, remove them otherwise | ||
167 | m_currentDialog = dlg; | 169 | m_currentDialogs.removeAll(QPointer<GrepDialog>()); | ||
170 | | ||||
171 | GrepDialog* dlg = new GrepDialog( this, core()->uiController()->activeMainWindow(), show ); | ||||
172 | m_currentDialogs << dlg; | ||||
168 | 173 | | |||
169 | GrepJobSettings dlgSettings = dlg->settings(); | 174 | GrepJobSettings dlgSettings = dlg->settings(); | ||
170 | KDevelop::IDocument* doc = core()->documentController()->activeDocument(); | 175 | KDevelop::IDocument* doc = core()->documentController()->activeDocument(); | ||
171 | 176 | | |||
172 | if(!pattern.isEmpty()) | 177 | if(!pattern.isEmpty()) | ||
173 | { | 178 | { | ||
174 | dlgSettings.pattern = pattern; | 179 | dlgSettings.pattern = pattern; | ||
175 | dlg->setSettings(dlgSettings); | 180 | dlg->setSettings(dlgSettings); | ||
176 | } | 181 | } | ||
177 | else if(!setLastUsed) | 182 | else if(!setLastUsed) | ||
178 | { | 183 | { | ||
apol: Please remove style changes, they make it much harder to review your patches. | |||||
179 | QString pattern = patternFromSelection(doc); | 184 | QString pattern = patternFromSelection(doc); | ||
180 | if (!pattern.isEmpty()) { | 185 | if (!pattern.isEmpty()) { | ||
181 | dlgSettings.pattern = pattern; | 186 | dlgSettings.pattern = pattern; | ||
182 | dlg->setSettings(dlgSettings); | 187 | dlg->setSettings(dlgSettings); | ||
183 | } | 188 | } | ||
184 | } | 189 | } | ||
185 | 190 | | |||
186 | //if directory is empty then use a default value from the config file. | 191 | //if directory is empty then use a default value from the config file. | ||
Show All 40 Lines | |||||
227 | { | 232 | { | ||
228 | return m_currentJob; | 233 | return m_currentJob; | ||
229 | } | 234 | } | ||
230 | 235 | | |||
231 | void GrepViewPlugin::jobFinished(KJob* job) | 236 | void GrepViewPlugin::jobFinished(KJob* job) | ||
232 | { | 237 | { | ||
233 | if(job == m_currentJob) | 238 | if(job == m_currentJob) | ||
234 | { | 239 | { | ||
235 | emit grepJobFinished(); | | |||
236 | m_currentJob = nullptr; | 240 | m_currentJob = nullptr; | ||
241 | emit grepJobFinished(); | ||||
237 | } | 242 | } | ||
238 | } | 243 | } |
const &