Commit edefa277 authored by Méven Car's avatar Méven Car Committed by Christoph Cullmann
Browse files

Prevent storing diff files in recent files history

BUG: 436906
parent 4a527646
......@@ -1176,6 +1176,9 @@ void KateMainWindow::queueModifiedOnDisc(KTextEditor::Document *doc)
s_modOnHdDialog = new KateMwModOnHdDialog(list, this);
m_modignore = true;
KWindowSystem::setOnAllDesktops(s_modOnHdDialog->winId(), true);
connect(s_modOnHdDialog, &KateMwModOnHdDialog::requesOpenDiffDocumment, this, [this](const QUrl &url) {
viewManager()->openUrl(url, QString(), true, true);
});
s_modOnHdDialog->exec();
delete s_modOnHdDialog; // s_modOnHdDialog is set to 0 in destructor of KateMwModOnHdDialog (jowenn!!!)
m_modignore = false;
......
......@@ -344,11 +344,7 @@ void KateMwModOnHdDialog::slotPDone()
delete m_diffFile;
m_diffFile = nullptr;
// OpenUrlJob will delete the temp. file
auto *job = new KIO::OpenUrlJob(url, QStringLiteral("text/x-patch"));
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
job->setDeleteTemporaryFile(true);
job->start();
Q_EMIT requesOpenDiffDocumment(url);
}
void KateMwModOnHdDialog::addDocument(KTextEditor::Document *doc)
......
......@@ -32,6 +32,9 @@ public:
~KateMwModOnHdDialog() override;
void addDocument(KTextEditor::Document *doc);
Q_SIGNALS:
void requesOpenDiffDocumment(const QUrl &documentUrl);
private Q_SLOTS:
void slotIgnore();
void slotOverwrite();
......
......@@ -24,7 +24,6 @@
#include <KConfigGroup>
#include <KLocalizedString>
#include <KMessageBox>
#include <KRecentFilesAction>
#include <KToolBar>
#include <KXMLGUIFactory>
......@@ -282,7 +281,9 @@ KTextEditor::Document *KateViewManager::openUrl(const QUrl &url, const QString &
{
KTextEditor::Document *doc = KateApp::self()->documentManager()->openUrl(url, encoding, isTempFile, docInfo);
m_mainWindow->addRecentOpenedFile(doc->url());
if (!isTempFile) {
m_mainWindow->addRecentOpenedFile(doc->url());
}
if (activate) {
activateView(doc);
......@@ -295,8 +296,10 @@ KTextEditor::Document *KateViewManager::openUrls(const QList<QUrl> &urls, const
{
const QList<KTextEditor::Document *> docs = KateApp::self()->documentManager()->openUrls(urls, encoding, isTempFile, docInfo);
for (const KTextEditor::Document *doc : docs) {
m_mainWindow->addRecentOpenedFile(doc->url());
if (!isTempFile) {
for (const KTextEditor::Document *doc : docs) {
m_mainWindow->addRecentOpenedFile(doc->url());
}
}
return docs.isEmpty() ? nullptr : docs.last();
......
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