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
e00322a6
Commit
e00322a6
authored
Mar 13, 2021
by
Anthony Fieroni
Committed by
Stefano Crocco
Apr 03, 2021
Browse files
Proper history navigation
Signed-off-by:
Anthony Fieroni
<
bvbfan@abv.bg
>
parent
0b111ae2
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/konqview.cpp
View file @
e00322a6
...
...
@@ -220,7 +220,7 @@ void KonqView::openUrl(const QUrl &url, const QString &locationBarURL,
m_pPart
->
openUrl
(
url
);
updateHistoryEntry
(
false
/* don't save location bar URL yet */
);
updateHistoryEntry
(
true
);
// add pending history entry
KonqHistoryManager
::
kself
()
->
addPending
(
url
,
locationBarURL
,
QString
());
...
...
@@ -572,8 +572,8 @@ void KonqView::slotCompleted(bool hasPending)
m_pKonqFrame
->
statusbar
()
->
slotLoadingProgress
(
-
1
);
if
(
!
m_bLockHistory
)
{
// Success... update history entry
, including location bar URL
updateHistoryEntry
(
tru
e
);
// Success... update history entry
updateHistoryEntry
(
fals
e
);
if
(
m_bAborted
)
{
// remove the pending entry on error
KonqHistoryManager
::
kself
()
->
removePending
(
url
());
...
...
@@ -695,8 +695,9 @@ void KonqView::slotOpenURLNotify()
#ifdef DEBUG_HISTORY
qCDebug
(
KONQUEROR_LOG
);
#endif
updateHistoryEntry
(
tru
e
);
updateHistoryEntry
(
fals
e
);
createHistoryEntry
();
updateHistoryEntry
(
true
);
if
(
m_pMainWindow
->
currentView
()
==
this
)
{
m_pMainWindow
->
updateToolBarActions
();
}
...
...
@@ -735,7 +736,7 @@ void KonqView::appendHistoryEntry(HistoryEntry *historyEntry)
m_lstHistory
.
append
(
historyEntry
);
}
void
KonqView
::
updateHistoryEntry
(
bool
saveLocationBarURL
)
void
KonqView
::
updateHistoryEntry
(
bool
needsReload
)
{
Q_ASSERT
(
!
m_bLockHistory
);
// should never happen
...
...
@@ -744,8 +745,12 @@ void KonqView::updateHistoryEntry(bool saveLocationBarURL)
return
;
}
current
->
reload
=
false
;
// We have a state for it now.
if
(
browserExtension
())
{
#ifdef DEBUG_HISTORY
qCDebug
(
KONQUEROR_LOG
)
<<
"Saving part URL:"
<<
m_pPart
->
url
()
<<
"in history position"
<<
historyIndex
();
#endif
current
->
reload
=
needsReload
;
// We have a state for it now.
if
(
!
needsReload
&&
browserExtension
())
{
current
->
buffer
=
QByteArray
();
// Start with empty buffer.
QDataStream
stream
(
&
current
->
buffer
,
QIODevice
::
WriteOnly
);
...
...
@@ -757,7 +762,7 @@ void KonqView::updateHistoryEntry(bool saveLocationBarURL)
#endif
current
->
url
=
m_pPart
->
url
();
if
(
saveLocationBarURL
)
{
if
(
!
needsReload
)
{
#ifdef DEBUG_HISTORY
qCDebug
(
KONQUEROR_LOG
)
<<
"Saving location bar URL:"
<<
m_sLocationBarURL
<<
"in history position"
<<
historyIndex
();
#endif
...
...
@@ -831,7 +836,7 @@ void KonqView::restoreHistory()
aboutToOpenURL
(
h
.
url
);
if
(
h
.
reload
==
false
&&
browserExtension
())
{
if
(
h
.
reload
==
false
&&
browserExtension
()
&&
historyIndex
()
>
0
)
{
//qCDebug(KONQUEROR_LOG) << "Restoring view from stream";
QDataStream
stream
(
h
.
buffer
);
...
...
@@ -938,7 +943,7 @@ void KonqView::stop()
m_pKonqFrame
->
statusbar
()
->
slotLoadingProgress
(
-
1
);
}
if
(
!
m_bLockHistory
&&
m_lstHistory
.
count
()
>
0
)
{
updateHistoryEntry
(
tru
e
);
updateHistoryEntry
(
fals
e
);
}
}
...
...
@@ -1272,9 +1277,6 @@ void KonqView::saveConfig(KConfigGroup &config, const QString &prefix, const Kon
if
(
options
&
KonqFrameBase
::
SaveUrls
)
{
config
.
writePathEntry
(
QStringLiteral
(
"URL"
).
prepend
(
prefix
),
url
().
url
());
}
else
if
(
options
&
KonqFrameBase
::
SaveHistoryItems
)
{
if
(
m_pPart
&&
!
m_bLockHistory
)
{
updateHistoryEntry
(
true
);
}
QList
<
HistoryEntry
*>::
Iterator
it
=
m_lstHistory
.
begin
();
for
(
int
i
=
0
;
it
!=
m_lstHistory
.
end
();
++
it
,
++
i
)
{
// In order to not end up with a huge config file, we only save full
...
...
src/konqview.h
View file @
e00322a6
...
...
@@ -579,10 +579,10 @@ private:
/**
* Updates the current entry in the history.
* @param
saveLocationBarURL whether to save the location bar URL as part of it
* @param
needsReload whether page is fully loaded
* (not done in openUrl, to be able to revert if aborting)
*/
void
updateHistoryEntry
(
bool
saveLocationBarURL
);
void
updateHistoryEntry
(
bool
needsReload
);
void
aboutToOpenURL
(
const
QUrl
&
url
,
const
KParts
::
OpenUrlArguments
&
args
=
KParts
::
OpenUrlArguments
());
...
...
Write
Preview
Markdown
is supported
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