Commit 85def533 authored by Krzysztof Stokop's avatar Krzysztof Stokop
Browse files

cleaning

parent 9c8756cc
File mode changed from 100755 to 100644
......@@ -67,7 +67,6 @@ public:
* @return success
*/
bool reload(bool force = false);
/**
* Accessor to file name.
......
......@@ -190,27 +190,24 @@ KateProject *KateProjectPlugin::projectForDir(QDir dir)
return nullptr;
}
bool KateProjectPlugin::closeProject(KateProject *project)
{
Q_EMIT pluginViewProjectClosing(project);
QList< KTextEditor::Document* > documents = KTextEditor::Editor::instance()->application()->documents();
m_projects.removeOne(project);
for (KateProject *projectIterator : m_projects)
for(int i = 0; i<documents.size(); i++)
if(QUrl(project->baseDir()).isParentOf(documents[i]->url().adjusted(QUrl::RemoveScheme)))
KTextEditor::Editor::instance()->application()->closeDocument(documents[i]);
Q_EMIT pluginViewProjectClosing(project);
if(m_projects.removeOne(project))
{
if(project == projectIterator)
{
m_fileWatcher.removePath(QFileInfo(projectIterator->fileName()).canonicalPath());
delete projectIterator;
return true;
}
m_fileWatcher.removePath(QFileInfo(project->fileName()).canonicalPath());
delete project;
return true;
}
return false;
else return false;
}
KateProject *KateProjectPlugin::projectForUrl(const QUrl &url)
{
if (url.isEmpty() || !url.isLocalFile()) {
......
......@@ -10,7 +10,6 @@
#include "gitwidget.h"
#include "kateprojectinfoviewindex.h"
#include <ktexteditor/application.h>
#include <ktexteditor/codecompletioninterface.h>
#include <ktexteditor/document.h>
......@@ -33,7 +32,6 @@
#include <QTimer>
#include <QVBoxLayout>
K_PLUGIN_FACTORY_WITH_JSON(KateProjectPluginFactory, "kateprojectplugin.json", registerPlugin<KateProjectPlugin>();)
KateProjectPluginView::KateProjectPluginView(KateProjectPlugin *plugin, KTextEditor::MainWindow *mainWin)
......@@ -115,7 +113,6 @@ KateProjectPluginView::KateProjectPluginView(KateProjectPlugin *plugin, KTextEdi
connect(m_reloadButton, &QToolButton::clicked, this, &KateProjectPluginView::slotProjectReload);
connect(m_closeProjectButton, &QToolButton::clicked, this, &KateProjectPluginView::slotProjectAboutToClose);
connect(this, &KateProjectPluginView::pluginProjectClose, m_plugin, &KateProjectPlugin::closeProject);
connect(m_plugin, &KateProjectPlugin::pluginViewProjectClosing, this, &KateProjectPluginView::slotProjectClose);
connect(m_gitStatusRefreshButton, &QToolButton::clicked, this, [this] {
......@@ -568,20 +565,10 @@ void KateProjectPluginView::slotProjectReload()
void KateProjectPluginView::slotProjectAboutToClose()
{
if (QWidget *current = m_stackedProjectViews->currentWidget())
{
const auto project = static_cast<KateProjectView *>(current)->project();
Q_EMIT pluginProjectClose(project);
for(int i = 0; i < m_mainWindow->views().size(); i++)
{
if(QUrl(project->baseDir()).isParentOf(m_mainWindow->views()[i]->document()->url().adjusted(QUrl::RemoveScheme)))
{
KTextEditor::Editor::instance()->application()->closeDocument(m_mainWindow->views()[i]->document());
}
}
m_plugin->closeProject(project);
}
}
......@@ -591,7 +578,6 @@ void KateProjectPluginView::slotProjectClose(KateProject *project)
m_stackedProjectViews->removeWidget(m_stackedProjectViews->currentWidget());
m_stackedProjectInfoViews->removeWidget(m_stackedProjectInfoViews->currentWidget());
m_stackedgitViews->removeWidget(m_stackedgitViews->currentWidget());
m_plugin->projects().removeAt(m_plugin->projects().indexOf(project));
m_projectsCombo->removeItem(m_plugin->projects().indexOf(project));
m_projectsComboGit->removeItem(m_plugin->projects().indexOf(project));
}
......
......@@ -278,7 +278,6 @@ void KateViewManager::slotDocumentClose()
slotDocumentClose(activeView()->document());
}
KTextEditor::Document *KateViewManager::openUrl(const QUrl &url, const QString &encoding, bool activate, bool isTempFile, const KateDocumentInfo &docInfo)
{
KTextEditor::Document *doc = KateApp::self()->documentManager()->openUrl(url, encoding, isTempFile, docInfo);
......
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