Commit d5f592f2 authored by Krzysztof Stokop's avatar Krzysztof Stokop
Browse files

Update kateprojectplugin.cpp

parent 568ac672
...@@ -196,23 +196,18 @@ bool KateProjectPlugin::closeProject(KateProject *project) ...@@ -196,23 +196,18 @@ bool KateProjectPlugin::closeProject(KateProject *project)
{ {
QList< KTextEditor::Document* > documents = KTextEditor::Editor::instance()->application()->documents(); QList< KTextEditor::Document* > documents = KTextEditor::Editor::instance()->application()->documents();
QVector< KTextEditor::Document* > projectDocuments; QVector< KTextEditor::Document* > projectDocuments;
QString text = i18n("Documents will be closed:\n"); QWidget* window = KTextEditor::Editor::instance()->application()->activeMainWindow()->window();
QString title = i18n("Confirm project closing: ") + project->name();
for(int i = 0; i<documents.size(); i++) for(int i = 0; i<documents.size(); i++)
{
if(QUrl(project->baseDir()).isParentOf(documents[i]->url().adjusted(QUrl::RemoveScheme))) if(QUrl(project->baseDir()).isParentOf(documents[i]->url().adjusted(QUrl::RemoveScheme)))
{
projectDocuments.push_back(documents[i]); projectDocuments.push_back(documents[i]);
text+=documents[i]->url().adjusted(QUrl::RemoveScheme).toDisplayString();
text+=i18n("\n");
}
}
QMessageBox confirmationBox(QMessageBox::Information, title, text, QMessageBox::Cancel | QMessageBox::Yes); QString title = i18n("Confirm project closing: ") + project->name();
confirmationBox.setDefaultButton(QMessageBox::Cancel); QString text = i18n("Do you want to close ") + QString::number(projectDocuments.size()) + i18n(" documents and ") + project->name() + i18n(" project?");
QMessageBox confirmationBox;
if(16384==confirmationBox.exec())//4194304 for QMessageBox::Cancel if(QMessageBox::Yes == confirmationBox.question(window, title, text, QMessageBox::No | QMessageBox::Yes, QMessageBox::No))
{ {
for(int i = 0; i<projectDocuments.size(); i++) for(int i = 0; i<projectDocuments.size(); i++)
KTextEditor::Editor::instance()->application()->closeDocument(projectDocuments[i]); KTextEditor::Editor::instance()->application()->closeDocument(projectDocuments[i]);
......
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