Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Network
Konqueror
Commits
bfd6ddf5
Commit
bfd6ddf5
authored
Dec 03, 2020
by
David Faure
Browse files
Remove all usage of KParts::BrowserHostExtension, only useful to KHTML
parent
ce7283f6
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/konqmainwindow.cpp
View file @
bfd6ddf5
...
...
@@ -52,10 +52,10 @@
#include <config-konqueror.h>
#include <kstringhandler.h>
#include "konqurl.h"
#include "konqsettingsxt.h"
#include <konq_events.h>
#include <konqpixmapprovider.h>
#include <konqsettings.h>
#include <kwidgetsaddons_version.h>
#include <kbookmarkmanager.h>
...
...
@@ -133,7 +133,6 @@
#include <KIO/FileUndoManager>
#include <kparts/browseropenorsavequestion.h>
#include <KParts/OpenUrlEvent>
#include <KParts/BrowserHostExtension>
#include <KCompletionMatches>
#include <kacceleratormanager.h>
#include <kuser.h>
...
...
@@ -957,14 +956,14 @@ bool KonqMainWindow::openView(QString mimeType, const QUrl &_url, KonqView *chil
return
ok
||
bOthersFollowed
;
}
static
KonqView
*
findChildView
(
KParts
::
ReadOnlyPart
*
callingPart
,
const
QString
&
name
,
KonqMainWindow
*&
mainWindow
,
KParts
::
BrowserHostExtension
*&
hostExtension
,
KParts
::
ReadOnlyPart
**
part
)
static
KonqView
*
findChildView
(
KParts
::
ReadOnlyPart
*
callingPart
,
const
QString
&
name
,
KonqMainWindow
*&
mainWindow
,
KParts
::
ReadOnlyPart
**
part
)
{
if
(
!
KonqMainWindow
::
mainWindowList
())
{
return
nullptr
;
}
foreach
(
KonqMainWindow
*
window
,
*
KonqMainWindow
::
mainWindowList
())
{
KonqView
*
res
=
window
->
childView
(
callingPart
,
name
,
hostExtension
,
part
);
KonqView
*
res
=
window
->
childView
(
callingPart
,
name
,
part
);
if
(
res
)
{
mainWindow
=
window
;
return
res
;
...
...
@@ -999,30 +998,21 @@ void KonqMainWindow::slotOpenURLRequest(const QUrl &url, const KParts::OpenUrlAr
if
(
frameName
.
toLower
()
!=
_top
&&
frameName
.
toLower
()
!=
_self
&&
frameName
.
toLower
()
!=
_parent
)
{
KParts
::
BrowserHostExtension
*
hostExtension
=
nullptr
;
KonqView
*
view
=
childView
(
callingPart
,
frameName
,
hostExtension
,
nullptr
);
KonqView
*
view
=
childView
(
callingPart
,
frameName
,
nullptr
);
if
(
!
view
)
{
KonqMainWindow
*
mainWindow
=
nullptr
;
view
=
findChildView
(
callingPart
,
frameName
,
mainWindow
,
hostExtension
,
nullptr
);
view
=
findChildView
(
callingPart
,
frameName
,
mainWindow
,
nullptr
);
if
(
!
view
||
!
mainWindow
)
{
slotCreateNewWindow
(
url
,
args
,
browserArgs
);
return
;
}
if
(
hostExtension
)
{
hostExtension
->
openUrlInFrame
(
url
,
args
,
browserArgs
);
}
else
{
mainWindow
->
openUrlRequestHelper
(
view
,
url
,
args
,
browserArgs
);
}
mainWindow
->
openUrlRequestHelper
(
view
,
url
,
args
,
browserArgs
);
return
;
}
if
(
hostExtension
)
{
hostExtension
->
openUrlInFrame
(
url
,
args
,
browserArgs
);
}
else
{
openUrlRequestHelper
(
view
,
url
,
args
,
browserArgs
);
}
openUrlRequestHelper
(
view
,
url
,
args
,
browserArgs
);
return
;
}
}
...
...
@@ -1174,13 +1164,12 @@ void KonqMainWindow::slotCreateNewWindow(const QUrl &url,
KonqMainWindow
*
mainWindow
=
nullptr
;
if
(
!
browserArgs
.
frameName
.
isEmpty
()
&&
browserArgs
.
frameName
.
toLower
()
!=
QLatin1String
(
"_blank"
))
{
KParts
::
BrowserHostExtension
*
hostExtension
=
nullptr
;
KParts
::
ReadOnlyPart
*
ro_part
=
nullptr
;
KParts
::
BrowserExtension
*
be
=
::
qobject_cast
<
KParts
::
BrowserExtension
*>
(
sender
());
if
(
be
)
{
ro_part
=
::
qobject_cast
<
KParts
::
ReadOnlyPart
*>
(
be
->
parent
());
}
if
(
findChildView
(
ro_part
,
browserArgs
.
frameName
,
mainWindow
,
hostExtension
,
part
))
{
if
(
findChildView
(
ro_part
,
browserArgs
.
frameName
,
mainWindow
,
part
))
{
// Found a view. If url isn't empty, we should open it - but this never happens currently
// findChildView put the resulting part in 'part', so we can just return now
//qCDebug(KONQUEROR_LOG) << "frame=" << browserArgs.frameName << "-> found part=" << part << part->name();
...
...
@@ -2219,7 +2208,7 @@ KonqView *KonqMainWindow::childView(KParts::ReadOnlyPart *view)
return
m_mapViews
.
value
(
view
);
}
KonqView
*
KonqMainWindow
::
childView
(
KParts
::
ReadOnlyPart
*
callingPart
,
const
QString
&
name
,
KParts
::
BrowserHostExtension
*&
hostExtension
,
KParts
::
ReadOnlyPart
**
part
)
KonqView
*
KonqMainWindow
::
childView
(
KParts
::
ReadOnlyPart
*
callingPart
,
const
QString
&
name
,
KParts
::
ReadOnlyPart
**
part
)
{
//qCDebug(KONQUEROR_LOG) << "this=" << this << "looking for" << name;
QList
<
KonqView
*>
views
=
m_mapViews
.
values
();
...
...
@@ -2231,47 +2220,18 @@ KonqView *KonqMainWindow::childView(KParts::ReadOnlyPart *callingPart, const QSt
}
}
Q_FOREACH
(
KonqView
*
view
,
views
)
{
for
(
KonqView
*
view
:
qAsConst
(
views
)
)
{
QString
viewName
=
view
->
viewName
();
//qCDebug(KONQUEROR_LOG) << " - viewName=" << viewName
// << "frame names:" << view->frameNames();
// First look for a hostextension containing this frame name
KParts
::
BrowserHostExtension
*
ext
=
KParts
::
BrowserHostExtension
::
childObject
(
view
->
part
());
if
(
ext
)
{
ext
=
ext
->
findFrameParent
(
callingPart
,
name
);
qCDebug
(
KONQUEROR_LOG
)
<<
"BrowserHostExtension found part"
<<
ext
;
if
(
!
ext
)
{
continue
;
// Don't use this window
}
}
if
(
!
viewName
.
isEmpty
()
&&
viewName
==
name
)
{
qCDebug
(
KONQUEROR_LOG
)
<<
"found existing view by name:"
<<
view
;
hostExtension
=
nullptr
;
if
(
part
)
{
*
part
=
view
->
part
();
}
return
view
;
}
// KParts::BrowserHostExtension* ext = KonqView::hostExtension( view->part(), name );
if
(
ext
)
{
const
QList
<
KParts
::
ReadOnlyPart
*>
frames
=
ext
->
frames
();
QListIterator
<
KParts
::
ReadOnlyPart
*>
frameIt
(
frames
);
while
(
frameIt
.
hasNext
())
{
KParts
::
ReadOnlyPart
*
item
=
frameIt
.
next
();
if
(
item
->
objectName
()
==
name
)
{
qCDebug
(
KONQUEROR_LOG
)
<<
"found a frame of name"
<<
name
<<
":"
<<
item
;
hostExtension
=
ext
;
if
(
part
)
{
*
part
=
item
;
}
return
view
;
}
}
}
}
return
nullptr
;
...
...
src/konqmainwindow.h
View file @
bfd6ddf5
...
...
@@ -74,7 +74,6 @@ class QLineEdit;
namespace
KParts
{
class
BrowserExtension
;
class
BrowserHostExtension
;
class
ReadOnlyPart
;
class
OpenUrlArguments
;
struct
BrowserArguments
;
...
...
@@ -162,7 +161,7 @@ public:
void
removeChildView
(
KonqView
*
childView
);
KonqView
*
childView
(
KParts
::
ReadOnlyPart
*
view
);
KonqView
*
childView
(
KParts
::
ReadOnlyPart
*
callingPart
,
const
QString
&
name
,
KParts
::
BrowserHostExtension
*&
hostExtension
,
KParts
::
ReadOnlyPart
**
part
);
KonqView
*
childView
(
KParts
::
ReadOnlyPart
*
callingPart
,
const
QString
&
name
,
KParts
::
ReadOnlyPart
**
part
);
// Total number of views
int
viewCount
()
const
...
...
src/konqview.cpp
View file @
bfd6ddf5
...
...
@@ -57,7 +57,6 @@
#include <KParts/ReadOnlyPart>
#include <KParts/BrowserArguments>
#include <KParts/OpenUrlEvent>
#include <KParts/BrowserHostExtension>
#include <KParts/OpenUrlArguments>
#include <KParts/BrowserExtension>
#include <KParts/WindowArgs>
...
...
@@ -1000,56 +999,6 @@ void KonqView::setPartMimeType()
m_pPart
->
setArguments
(
args
);
}
QStringList
KonqView
::
frameNames
()
const
{
return
childFrameNames
(
m_pPart
);
}
QStringList
KonqView
::
childFrameNames
(
KParts
::
ReadOnlyPart
*
part
)
{
QStringList
res
;
KParts
::
BrowserHostExtension
*
hostExtension
=
KParts
::
BrowserHostExtension
::
childObject
(
part
);
if
(
!
hostExtension
)
{
return
res
;
}
res
+=
hostExtension
->
frameNames
();
const
QList
<
KParts
::
ReadOnlyPart
*>
children
=
hostExtension
->
frames
();
QListIterator
<
KParts
::
ReadOnlyPart
*>
i
(
children
);
while
(
i
.
hasNext
())
{
res
+=
childFrameNames
(
i
.
next
());
}
return
res
;
}
KParts
::
BrowserHostExtension
*
KonqView
::
hostExtension
(
KParts
::
ReadOnlyPart
*
part
,
const
QString
&
name
)
{
KParts
::
BrowserHostExtension
*
ext
=
KParts
::
BrowserHostExtension
::
childObject
(
part
);
if
(
!
ext
)
{
return
nullptr
;
}
if
(
ext
->
frameNames
().
contains
(
name
))
{
return
ext
;
}
const
QList
<
KParts
::
ReadOnlyPart
*>
children
=
ext
->
frames
();
QListIterator
<
KParts
::
ReadOnlyPart
*>
i
(
children
);
while
(
i
.
hasNext
())
{
KParts
::
BrowserHostExtension
*
childHost
=
hostExtension
(
i
.
next
(),
name
);
if
(
childHost
)
{
return
childHost
;
}
}
return
nullptr
;
}
bool
KonqView
::
callExtensionMethod
(
const
char
*
methodName
)
{
QObject
*
obj
=
KParts
::
BrowserExtension
::
childObject
(
m_pPart
);
...
...
src/konqview.h
View file @
bfd6ddf5
...
...
@@ -469,8 +469,6 @@ public:
void
disableScrolling
();
QStringList
frameNames
()
const
;
QString
dbusObjectPath
();
QString
partObjectPath
();
...
...
@@ -502,10 +500,6 @@ public:
void
saveConfig
(
KConfigGroup
&
config
,
const
QString
&
prefix
,
const
KonqFrameBase
::
Options
&
options
);
void
loadHistoryConfig
(
const
KConfigGroup
&
config
,
const
QString
&
prefix
);
static
QStringList
childFrameNames
(
KParts
::
ReadOnlyPart
*
part
);
static
KParts
::
BrowserHostExtension
*
hostExtension
(
KParts
::
ReadOnlyPart
*
part
,
const
QString
&
name
);
Q_SIGNALS:
/**
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment