Commit 37f8bacc authored by Krzysztof Stokop's avatar Krzysztof Stokop
Browse files

Trying to close all docs from the project, not compiling with:

kate/addons/project/kateprojectpluginview.cpp:585: 
	undefined reference to `KTextEditor::MainWindow::closeUrl(QUrl const&)'
parent dccb4032
......@@ -32,6 +32,7 @@
#include <QTimer>
#include <QVBoxLayout>
K_PLUGIN_FACTORY_WITH_JSON(KateProjectPluginFactory, "kateprojectplugin.json", registerPlugin<KateProjectPlugin>();)
KateProjectPluginView::KateProjectPluginView(KateProjectPlugin *plugin, KTextEditor::MainWindow *mainWin)
......@@ -569,18 +570,21 @@ void KateProjectPluginView::slotProjectClose()
{
const auto project = static_cast<KateProjectView *>(current)->project();
m_project2View.erase(m_project2View.find(static_cast<KateProjectView *>(current)->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(static_cast<KateProjectView *>(current)->project()));
m_projectsCombo->removeItem(m_plugin->projects().indexOf(static_cast<KateProjectView *>(current)->project()));
m_projectsComboGit->removeItem(m_plugin->projects().indexOf(static_cast<KateProjectView *>(current)->project()));
m_plugin->closeProject(project);
// m_project2View.erase(m_project2View.find(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));
//
// m_plugin->closeProject(project);
for(int i = 0; i < project->files().size(); i++)
{
m_mainWindow->closeUrl(QUrl(project->files()[i]));
}
}
}
......
......@@ -881,6 +881,11 @@ void KateMainWindow::openUrl(const QString &name)
m_viewManager->openUrl(QUrl(name));
}
// void KateMainWindow::closeUrl(const QString &name)
// {
// m_viewManager->closeUrl(QUrl(name));
// }
void KateMainWindow::slotConfigure()
{
showPluginConfigPage(nullptr, 0);
......
......@@ -233,6 +233,7 @@ Q_SIGNALS:
public:
void openUrl(const QString &name = QString());
// void closeUrl(const QString &name = QString());
QHash<KTextEditor::Plugin *, QObject *> &pluginViews()
{
......
......@@ -278,6 +278,7 @@ 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);
......@@ -322,6 +323,20 @@ void KateViewManager::openUrl(const QUrl &url)
openUrl(url, QString());
}
bool KateViewManager::closeUrl(const QUrl &url)
{
for(int i = 0; i < activeViewSpace()->documentList().size(); i++)
{
if(activeViewSpace()->documentList()[i]->url() == url)
{
slotDocumentClose(activeViewSpace()->documentList()[i]);
return true;
}
}
return false;
}
KateMainWindow *KateViewManager::mainWindow()
{
return m_mainWindow;
......
......@@ -59,6 +59,8 @@ public:
KTextEditor::Document *
openUrl(const QUrl &url, const QString &encoding, bool activate = true, bool isTempFile = false, const KateDocumentInfo &docInfo = KateDocumentInfo());
bool closeUrl(const QUrl &url);
KTextEditor::Document *
openUrls(const QList<QUrl> &url, const QString &encoding, bool isTempFile = false, const KateDocumentInfo &docInfo = KateDocumentInfo());
......
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