Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma Mobile
Angelfish
Commits
51407074
Commit
51407074
authored
Oct 16, 2019
by
Jonah Brüchert
Browse files
Save lastVisited to disk and sort accordingly
parent
81a2d68b
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/contents/ui/History.qml
View file @
51407074
...
...
@@ -23,6 +23,7 @@ import QtQuick 2.3
import
QtQuick
.
Layouts
1.0
import
org
.
kde
.
kirigami
2.2
as
Kirigami
import
org
.
kde
.
mobile
.
angelfish
1.0
Kirigami.ScrollablePage
{
id
:
history
...
...
@@ -34,7 +35,9 @@ Kirigami.ScrollablePage {
interactive
:
height
<
contentHeight
clip
:
true
model
:
browserManager
.
history
model
:
UrlFilterProxyModel
{
sourceModel
:
browserManager
.
history
}
delegate
:
UrlDelegate
{
onClicked
:
pageStack
.
layers
.
pop
()
...
...
src/contents/ui/webbrowser.qml
View file @
51407074
...
...
@@ -80,6 +80,7 @@ Kirigami.ApplicationWindow {
request
.
url
=
currentWebView
.
url
;
request
.
title
=
currentWebView
.
title
;
request
.
icon
=
currentWebView
.
icon
;
request
.
lastVisited
=
new
Date
();
browserManager
.
addToHistory
(
request
);
}
...
...
src/urlfilterproxymodel.cpp
View file @
51407074
...
...
@@ -22,6 +22,8 @@
#include
"urlfilterproxymodel.h"
#include
"browsermanager.h"
#include
<QDateTime>
#include
"urlmodel.h"
using
namespace
AngelFish
;
...
...
@@ -42,9 +44,10 @@ bool UrlFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sou
bool
UrlFilterProxyModel
::
lessThan
(
const
QModelIndex
&
source_left
,
const
QModelIndex
&
source_right
)
const
{
// as we currently don't write the lastVisited role to disk, we simply sort by index/position in
// the model
return
source_left
.
row
()
<
source_right
.
row
();
auto
leftDate
=
QDateTime
::
fromString
(
sourceModel
()
->
data
(
source_left
,
UrlModel
::
lastVisited
).
toString
(),
Qt
::
ISODate
);
auto
rightDate
=
QDateTime
::
fromString
(
sourceModel
()
->
data
(
source_right
,
UrlModel
::
lastVisited
).
toString
(),
Qt
::
ISODate
);
return
leftDate
<
rightDate
;
}
void
UrlFilterProxyModel
::
setSourceModel
(
QAbstractItemModel
*
sourceModel
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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