Commit 4f1a80ba authored by Kåre Särs's avatar Kåre Särs
Browse files

Add option to showModOnDiskPrompt() to ignore include non edited.

From reloadAll() we should not ignore non-edited as it would mean we
do not reload files modified on disk from reloadAll().
parent 1cfde2cb
......@@ -405,7 +405,7 @@ void KateDocManager::reloadAll()
}
// take care of all documents that ARE modified on disk
KateApp::self()->activeKateMainWindow()->showModOnDiskPrompt();
KateApp::self()->activeKateMainWindow()->showModOnDiskPrompt(KateMainWindow::PromptAll);
}
void KateDocManager::closeOrphaned()
......
......@@ -507,7 +507,7 @@ bool KateMainWindow::queryClose_internal(KTextEditor::Document *doc)
{
int documentCount = KateApp::self()->documentManager()->documentList().size();
if (!showModOnDiskPrompt()) {
if (!showModOnDiskPrompt(PromptEdited)) {
return false;
}
......@@ -967,13 +967,15 @@ void KateMainWindow::slotFullScreen(bool t)
}
}
bool KateMainWindow::showModOnDiskPrompt()
bool KateMainWindow::showModOnDiskPrompt(ModOnDiskMode mode)
{
const auto documents = KateApp::self()->documentManager()->documentList();
DocVector list;
list.reserve(documents.size());
for (auto doc : documents) {
if (KateApp::self()->documentManager()->documentInfo(doc)->modifiedOnDisc && doc->isModified()) {
if (KateApp::self()->documentManager()->documentInfo(doc)->modifiedOnDisc &&
(doc->isModified() || mode == PromptAll))
{
list.append(doc);
}
}
......
......@@ -106,6 +106,13 @@ public:
* anders: I add this for use from the file selector. */
QUrl activeDocumentUrl();
/** Enumeration to specify if files modified on disk should show up
* in the reload dialog even if not edited in this instance. */
enum ModOnDiskMode {
PromptEdited, ///< Do not list files that have not been edited
PromptAll, ///< Include all files modified on disk
};
/**
* Prompts the user for what to do with files that are modified on disk if any.
* This is optionally run when the window receives focus, and when the last
......@@ -113,7 +120,7 @@ public:
* @return true if no documents are modified on disk, or all documents were
* handled by the dialog; otherwise (the dialog was canceled) false.
*/
bool showModOnDiskPrompt();
bool showModOnDiskPrompt(ModOnDiskMode mode);
public:
/*reimp*/ void readProperties(const KConfigGroup &config) override;
......
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