Commit be1c8e8f authored by Alexander Semke's avatar Alexander Semke
Browse files

Save and restore the current shown UQL in the web view for the documentation...

Save and restore the current shown UQL in the web view for the documentation when switching between different worksheet tabs.
parent 0f470248
Pipeline #67594 passed with stage
in 20 minutes and 16 seconds
/*
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
---
Copyright (C) 2020 Shubham <aryan100jangid@gmail.com>
Copyright (C) 2020 Alexander Semke <alexander.semke@web.de>
*/
#include "cassert"
SPDX-License-Identifier: GPL-2.0-or-later
SPDX-FileCopyrightText: 2020 Shubham <aryan100jangid@gmail.com>
SPDX-FileCopyrightText: 2020-2021 Alexander Semke <alexander.semke@web.de>
*/
#include "documentationpanelplugin.h"
#include "documentationpanelwidget.h"
#include "session.h"
DocumentationPanelPlugin::DocumentationPanelPlugin(QObject* parent, QList<QVariant> args) : Cantor::PanelPlugin(parent)
......@@ -58,6 +42,7 @@ void DocumentationPanelPlugin::connectToShell(QObject* cantorShell)
Cantor::PanelPlugin::State DocumentationPanelPlugin::saveState()
{
Cantor::PanelPlugin::State state = PanelPlugin::saveState();
state.inners.append(m_widget->url()); //save the currently shown URL in the web view
return state;
}
......@@ -65,7 +50,11 @@ void DocumentationPanelPlugin::restoreState(const Cantor::PanelPlugin::State& st
{
PanelPlugin::restoreState(state);
if(session() && m_widget)
{
m_widget->updateBackend(session()->backend()->name());
if (state.inners.size() == 1)
m_widget->showUrl(state.inners.first().toUrl());
}
}
K_PLUGIN_FACTORY_WITH_JSON(documentationpanelplugin, "documentationpanelplugin.json", registerPlugin<DocumentationPanelPlugin>();)
......
/*
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
---
Copyright (C) 2020 Shubham <aryan100jangid@gmail.com>
Copyright (C) 2020 Alexander Semke <alexander.semke@web.de>
*/
SPDX-License-Identifier: GPL-2.0-or-later
SPDX-FileCopyrightText: 2020 Shubham <aryan100jangid@gmail.com>
SPDX-FileCopyrightText: 2020-2021 Alexander Semke <alexander.semke@web.de>
*/
#ifndef _DOCUMENTATIONPANELPLUGIN_H
#define _DOCUMENTATIONPANELPLUGIN_H
#include "documentationpanelwidget.h"
#include "panelplugin.h"
class DocumentationPanelWidget;
......@@ -39,7 +23,7 @@ class DocumentationPanelPlugin : public Cantor::PanelPlugin
void connectToShell(QObject* cantorShell) override;
Cantor::PanelPlugin::State saveState() override;
void restoreState(const Cantor::PanelPlugin::State& state) override;
void restoreState(const Cantor::PanelPlugin::State&) override;
private:
DocumentationPanelWidget* m_widget = nullptr;
......
/*
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
---
Copyright (C) 2020 Shubham <aryan100jangid@gmail.com>
Copyright (C) 2020 Alexander Semke <alexander.semke@web.de>
*/
SPDX-License-Identifier: GPL-2.0-or-later
SPDX-FileCopyrightText: 2020 Shubham <aryan100jangid@gmail.com>
SPDX-FileCopyrightText: 2020-2021 Alexander Semke <alexander.semke@web.de>
*/
#include "cantor_macros.h"
#include "documentationpanelplugin.h"
#include "documentationpanelwidget.h"
#include <KLocalizedString>
#include <KMessageBox>
......@@ -367,9 +352,9 @@ void DocumentationPanelWidget::showUrl(const QUrl& url)
m_stackedWidget->setCurrentIndex(0); //show the web engine view
}
const QUrl& DocumentationPanelWidget::url() const
QUrl DocumentationPanelWidget::url() const
{
return QUrl();
return m_webEngineView->url();
}
void DocumentationPanelWidget::returnPressed()
......
/*
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
---
Copyright (C) 2020 Shubham <aryan100jangid@gmail.com>
Copyright (C) 2020 Alexander Semke <alexander.semke@web.de>
*/
SPDX-License-Identifier: GPL-2.0-or-later
SPDX-FileCopyrightText: 2020 Shubham <aryan100jangid@gmail.com>
SPDX-FileCopyrightText: 2020-2021 Alexander Semke <alexander.semke@web.de>
*/
#ifndef _DOCUMENTATIONPANELWIDGET_H
#define _DOCUMENTATIONPANELWIDGET_H
......@@ -47,7 +32,7 @@ class DocumentationPanelWidget : public QWidget
~DocumentationPanelWidget();
void updateBackend(const QString&);
const QUrl& url() const;
QUrl url() const;
public Q_SLOTS:
void showUrl(const QUrl&);
......
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