generic: adjust to kparts changes

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-08-31 04:27:42 +03:00
parent 089a085061
commit a533e0d19c
14 changed files with 2 additions and 249 deletions

View file

@ -216,28 +216,11 @@ bool ArkViewer::viewInInternalViewer(const QString& fileName, const KMimeType::P
return false;
}
if (m_part.data()->browserExtension()) {
connect(m_part.data()->browserExtension(),
SIGNAL(openUrlRequestDelayed(KUrl,KParts::OpenUrlArguments,KParts::BrowserArguments)),
SLOT(slotOpenUrlRequestDelayed(KUrl,KParts::OpenUrlArguments,KParts::BrowserArguments)));
}
m_part.data()->openUrl(fileUrl);
return true;
}
void ArkViewer::slotOpenUrlRequestDelayed(const KUrl& url, const KParts::OpenUrlArguments& arguments, const KParts::BrowserArguments& browserArguments)
{
kDebug() << "Opening URL: " << url;
Q_UNUSED(arguments)
Q_UNUSED(browserArguments)
KRun *runner = new KRun(url, 0, 0, false);
runner->setRunExecutables(false);
}
KService::Ptr ArkViewer::getViewer(const KMimeType::Ptr &mimeType)
{
// No point in even trying to find anything for application/octet-stream

View file

@ -24,7 +24,6 @@
#include <KDialog>
#include <KMimeType>
#include <KParts/BrowserExtension>
#include <KParts/ReadOnlyPart>
#include <KService>
@ -43,9 +42,6 @@ public:
protected:
virtual void keyPressEvent(QKeyEvent *event);
protected slots:
void slotOpenUrlRequestDelayed(const KUrl& url, const KParts::OpenUrlArguments& arguments, const KParts::BrowserArguments& browserArguments);
private slots:
void dialogClosed();

View file

@ -79,7 +79,7 @@ MainWindow::MainWindow() : KParts::MainWindow(), m_part(0)
connect(m_part, SIGNAL(canceled(QString)), SLOT(scanFailed()));
connect(m_part, SIGNAL(canceled(QString)), m_histories, SLOT(stop()));
connect(BrowserExtension::childObject(m_part), SIGNAL(openUrlNotify()), SLOT(urlAboutToChange()));
connect(m_part, SIGNAL(urlAboutToChange()), SLOT(urlAboutToChange()));
const KConfigGroup config = KGlobal::config()->group("general");
m_combo->setHistoryItems(config.readPathEntry("comboHistory", QStringList()));

View file

@ -63,15 +63,9 @@ K_EXPORT_PLUGIN(filelightPartFactory(KAboutData(
setProgramIconName(QLatin1String(APP_NAME)).
setCatalogName(APP_NAME)))
BrowserExtension::BrowserExtension(Part *parent)
: KParts::BrowserExtension(parent)
{}
Part::Part(QWidget *parentWidget, QObject *parent, const QList<QVariant>&)
: ReadOnlyPart(parent)
, m_summary(0)
, m_ext(new BrowserExtension(this))
, m_statusbar(new StatusBarExtension(this))
, m_map(0)
, m_started(false)
@ -210,10 +204,6 @@ Part::closeUrl()
void
Part::updateURL(const KUrl &u)
{
//the map has changed internally, update the interface to reflect this
emit m_ext->openUrlNotify(); //must be done first
emit m_ext->setLocationBarUrl(u.prettyUrl());
if (m_manager->running())
m_manager->abort();

View file

@ -22,7 +22,6 @@
#ifndef FILELIGHTPART_H
#define FILELIGHTPART_H
#include <KParts/BrowserExtension>
#include <KParts/StatusBarExtension>
#include <KParts/Part>
#include <KUrl>
@ -40,13 +39,6 @@ namespace Filelight
{
class Part;
class BrowserExtension : public KParts::BrowserExtension
{
public:
explicit BrowserExtension(Part*);
};
class Part : public KParts::ReadOnlyPart
{
Q_OBJECT
@ -81,7 +73,6 @@ private:
QLayout *m_layout;
QWidget *m_summary;
BrowserExtension *m_ext;
StatusBarExtension *m_statusbar;
RadialMap::Widget *m_map;
QWidget *m_stateWidget;

View file

@ -3,7 +3,6 @@ include_directories(
)
set(gvpart_SRCS
gvbrowserextension.cpp
gvpart.cpp
)

View file

@ -1,64 +0,0 @@
// vim: set tabstop=4 shiftwidth=4 expandtab:
/*
Gwenview: an image viewer
Copyright 2007 Aurélien Gâteau <agateau@kde.org>
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, Cambridge, MA 02110-1301, USA.
*/
// Self
#include "moc_gvbrowserextension.cpp"
// Qt
// KDE
#include <KParts/Part>
#include <KIconLoader>
// Local
#include "../lib/document/documentfactory.h"
#include "../lib/print/printhelper.h"
namespace Gwenview
{
struct GVBrowserExtensionPrivate
{
KParts::ReadOnlyPart* mPart;
};
GVBrowserExtension::GVBrowserExtension(KParts::ReadOnlyPart* part)
: KParts::BrowserExtension(part)
, d(new GVBrowserExtensionPrivate)
{
d->mPart = part;
emit enableAction("print", true);
QString iconPath = KIconLoader::global()->iconPath("image-x-generic", KIconLoader::SizeSmall);
emit setIconUrl(KUrl::fromPath(iconPath));
}
GVBrowserExtension::~GVBrowserExtension()
{
delete d;
}
void GVBrowserExtension::print()
{
Document::Ptr doc = DocumentFactory::instance()->load(d->mPart->url());
PrintHelper printHelper(d->mPart->widget());
printHelper.print(doc);
}
} // namespace

View file

@ -1,51 +0,0 @@
// vim: set tabstop=4 shiftwidth=4 expandtab:
/*
Gwenview: an image viewer
Copyright 2008 Aurélien Gâteau <agateau@kde.org>
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, Cambridge, MA 02110-1301, USA.
*/
#ifndef GVBROWSEREXTENSION_H
#define GVBROWSEREXTENSION_H
// Qt
// KDE
#include <KParts/BrowserExtension>
// Local
namespace Gwenview
{
struct GVBrowserExtensionPrivate;
class GVBrowserExtension : public KParts::BrowserExtension
{
Q_OBJECT
public:
GVBrowserExtension(KParts::ReadOnlyPart*);
~GVBrowserExtension();
private Q_SLOTS:
void print();
private:
GVBrowserExtensionPrivate* const d;
};
} // namespace
#endif /* GVBROWSEREXTENSION_H */

View file

@ -47,7 +47,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "../lib/documentview/documentviewcontroller.h"
#include "../lib/urlutils.h"
#include "../lib/zoomwidget.h"
#include "gvbrowserextension.h"
//Factory Code
K_PLUGIN_FACTORY(GVPartFactory, registerPlugin<Gwenview::GVPart>();)
@ -85,8 +84,6 @@ GVPart::GVPart(QWidget* parentWidget, QObject* parent, const QVariantList& /*arg
KStandardAction::saveAs(this, SLOT(saveAs()), actionCollection());
new GVBrowserExtension(this);
setXMLFile("gvpart/gvpart.rc");
}

View file

@ -173,7 +173,6 @@ install(
set(okularpart_SRCS
part.cpp
extensions.cpp
conf/preferencesdialog.cpp
conf/dlgaccessibility.cpp
conf/dlgdebug.cpp

View file

@ -1,39 +0,0 @@
/***************************************************************************
* Copyright (C) 2002 by Wilco Greven <greven@kde.org> *
* Copyright (C) 2008 by Pino Toscano <pino@kde.org> *
* *
* 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. *
***************************************************************************/
#include "extensions.h"
// local includes
#include "part.h"
namespace Okular
{
/*
* BrowserExtension class
*/
BrowserExtension::BrowserExtension(Part* parent)
: KParts::BrowserExtension( parent ), m_part( parent )
{
emit enableAction("print", true);
setURLDropHandlingEnabled(true);
}
void BrowserExtension::print()
{
m_part->slotPrint();
}
}
#include "moc_extensions.cpp"
/* kate: replace-tabs on; indent-width 4; */

View file

@ -1,40 +0,0 @@
/***************************************************************************
* Copyright (C) 2002 by Wilco Greven <greven@kde.org> *
* Copyright (C) 2008 by Pino Toscano <pino@kde.org> *
* *
* 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. *
***************************************************************************/
#ifndef _EXTENSIONS_H_
#define _EXTENSIONS_H_
#include <kparts/browserextension.h>
namespace Okular
{
class Part;
class BrowserExtension : public KParts::BrowserExtension
{
Q_OBJECT
public:
BrowserExtension(Part*);
public slots:
// Automatically detected by the host.
void print();
private:
Part *m_part;
};
}
#endif
/* kate: replace-tabs on; indent-width 4; */

View file

@ -65,7 +65,6 @@
// local includes
#include "aboutdata.h"
#include "extensions.h"
#include "ui/pageview.h"
#include "ui/toc.h"
#include "ui/searchwidget.h"
@ -310,9 +309,6 @@ m_cliPresentation(false), m_cliPrint(false), m_embedMode(detectEmbedMode(parentW
connect(this, SIGNAL(completed()), this, SLOT(setWindowTitleFromDocument()));
connect(this, SIGNAL(canceled(QString)), this, SLOT(loadCancelled(QString)));
// create browser extension (for printing when embedded into browser)
m_bExtension = new BrowserExtension(this);
// we need an instance
setComponentData( componentData );
@ -929,8 +925,6 @@ void Part::openUrlFromDocument(const KUrl &url)
if (KIO::NetAccess::exists(url, KIO::NetAccess::SourceSide, widget()))
{
m_bExtension->openUrlNotify();
m_bExtension->setLocationBarUrl(url.prettyUrl());
openUrl(url);
} else {
KMessageBox::error( widget(), i18n("Could not open '%1'. File does not exist", url.pathOrUrl() ) );

View file

@ -68,7 +68,6 @@ class BookmarkList;
namespace Okular
{
class BrowserExtension;
class ExportFormat;
/**
@ -217,7 +216,7 @@ class OKULARPART_EXPORT Part : public KParts::ReadWritePart, public Okular::Docu
void slotRebuildBookmarkMenu();
public slots:
// connected to Shell action (and browserExtension), not local one
// connected to Shell action, not local one
void slotPrint();
void restoreDocument(const KConfigGroup &group);
void saveDocumentRestoreInfo(KConfigGroup &group);
@ -324,7 +323,6 @@ class OKULARPART_EXPORT Part : public KParts::ReadWritePart, public Okular::Docu
KAction *m_closeFindBar;
bool m_actionsSearched;
BrowserExtension *m_bExtension;
QList<Okular::ExportFormat> m_exportFormats;
QList<QAction*> m_bookmarkActions;