Commit 21d0b10c authored by Thomas Friedrichsmeier's avatar Thomas Friedrichsmeier Committed by Christoph Cullmann

Avoid some unneeded clones of snippet repositories.

When an upstream repository is changed, the snippets plugin makes a copy in the personal data dir.
Unfortunately, changes are often detected without any real modification. Importantly, a "rename" is
often triggered simply by clicking on a repository name.

This patch disregards such spurious "changes", and also clarifies the corresponding message a bit.
parent 0d75b07f
...@@ -242,7 +242,7 @@ void SnippetRepository::save() ...@@ -242,7 +242,7 @@ void SnippetRepository::save()
outname = dir.absoluteFilePath(QString::number(i) + fi.fileName()); outname = dir.absoluteFilePath(QString::number(i) + fi.fileName());
} }
KMessageBox::information(QApplication::activeWindow(), KMessageBox::information(QApplication::activeWindow(),
i18n("You have edited a data file not located in your personal data directory; as such, a renamed clone of the original data file has been created within your personal data directory.")); i18n("You have edited a snippet repository file not located in your personal directory; as such, a copy of the original file has been created within your personal data directory."));
} }
QFile outfile(outname); QFile outfile(outname);
......
...@@ -96,6 +96,10 @@ bool SnippetStore::setData(const QModelIndex &index, const QVariant &value, int ...@@ -96,6 +96,10 @@ bool SnippetStore::setData(const QModelIndex &index, const QVariant &value, int
// don't allow empty names // don't allow empty names
return false; return false;
} }
if (value == data(index, role)) {
// if unchanged, avoid saving
return true;
}
const bool success = QStandardItemModel::setData(index, value, role); const bool success = QStandardItemModel::setData(index, value, role);
if (!success || role != Qt::EditRole) { if (!success || role != Qt::EditRole) {
return success; return success;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment