MCPcopy Create free account
hub / github.com/KDE/kdevelop / removeScratch

Method removeScratch

plugins/scratchpad/scratchpad.cpp:173–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171}
172
173void Scratchpad::removeScratch(const QModelIndex& index)
174{
175 const QString path = index.data(FullPathRole).toString();
176 if (auto* document = core()->documentController()->documentForUrl(QUrl::fromLocalFile(path))) {
177 if (!document->close()) {
178 return; // canceled by the user
179 }
180 }
181
182 if (QFile::remove(path)) {
183 qCDebug(PLUGIN_SCRATCHPAD) << "removed" << index.data(FullPathRole);
184 scratchCommands().deleteEntry(index.data().toString());
185 m_model->removeRow(index.row());
186 } else {
187 emit actionFailed(i18n("Failed to remove scratch: %1", index.data().toString()));
188 }
189}
190
191void Scratchpad::createScratch(const QString& name)
192{

Callers 1

setupActionsMethod · 0.80

Calls 8

scratchCommandsFunction · 0.85
documentForUrlMethod · 0.80
documentControllerMethod · 0.80
removeRowMethod · 0.80
toStringMethod · 0.45
dataMethod · 0.45
closeMethod · 0.45
rowMethod · 0.45

Tested by

no test coverage detected