Changeset View
Changeset View
Standalone View
Standalone View
addons/search/replace_matches.cpp
Show First 20 Lines • Show All 248 Lines • ▼ Show 20 Line(s) | 246 | if (!doc) { | |||
---|---|---|---|---|---|
249 | return; | 249 | return; | ||
250 | } | 250 | } | ||
251 | 251 | | |||
252 | if (m_progressTime.elapsed() > 100) { | 252 | if (m_progressTime.elapsed() > 100) { | ||
253 | m_progressTime.restart(); | 253 | m_progressTime.restart(); | ||
254 | emit replaceStatus(doc->url()); | 254 | emit replaceStatus(doc->url()); | ||
255 | } | 255 | } | ||
256 | 256 | | |||
257 | // Make one transaction for the whole replace to speed up things | ||||
258 | // and get all replacements in one "undo" | ||||
259 | KTextEditor::Document::EditingTransaction transaction(doc); | ||||
260 | | ||||
257 | // Create a vector of moving ranges for updating the tree-view after replace | 261 | // Create a vector of moving ranges for updating the tree-view after replace | ||
258 | QVector<KTextEditor::MovingRange*> matches; | 262 | QVector<KTextEditor::MovingRange*> matches; | ||
259 | QVector<bool> replaced; | 263 | QVector<bool> replaced; | ||
260 | KTextEditor::MovingInterface* miface = qobject_cast<KTextEditor::MovingInterface*>(doc); | 264 | KTextEditor::MovingInterface* miface = qobject_cast<KTextEditor::MovingInterface*>(doc); | ||
261 | 265 | | |||
262 | 266 | | |||
263 | for (int i=0; i<rootItem->childCount(); i++) { | 267 | for (int i=0; i<rootItem->childCount(); i++) { | ||
264 | QTreeWidgetItem *item = rootItem->child(i); | 268 | QTreeWidgetItem *item = rootItem->child(i); | ||
Show All 37 Lines |