Show UnsavedDocumentsDialog when closing window or quitting application
so user can save and or discard docs more efficiently.
This commit is contained in:
parent
b97adced4c
commit
784ad68758
16 changed files with 544 additions and 164 deletions
27
pglab/querytool/SqlDocumentRegistry.cpp
Normal file
27
pglab/querytool/SqlDocumentRegistry.cpp
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#include "SqlDocumentRegistry.h"
|
||||
#include "SqlDocument.h"
|
||||
|
||||
void SqlDocumentRegistry::add(const std::shared_ptr<SqlDocument> &document)
|
||||
{
|
||||
m_documents.push_back(document);
|
||||
}
|
||||
|
||||
QList<std::shared_ptr<SqlDocument>> SqlDocumentRegistry::documents() const
|
||||
{
|
||||
QList<std::shared_ptr<SqlDocument>> result;
|
||||
for (const auto &weak : m_documents) {
|
||||
if (auto doc = weak.lock())
|
||||
result.append(doc);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
QList<std::shared_ptr<SqlDocument>> SqlDocumentRegistry::modifiedDocuments() const
|
||||
{
|
||||
QList<std::shared_ptr<SqlDocument>> result;
|
||||
for (auto &doc : documents()) {
|
||||
if (doc->isModified())
|
||||
result.append(doc);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue