Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linphone-desktop
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
linphone-desktop
Commits
02fdc59e
Commit
02fdc59e
authored
Apr 24, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(ui/modules/Linphone/Timeline/Timeline): handle correctly inserted entries
parent
102bbb4c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
45 deletions
+62
-45
resources.qrc
linphone-desktop/resources.qrc
+1
-0
Timeline.js
linphone-desktop/ui/modules/Linphone/Timeline/Timeline.js
+51
-0
Timeline.qml
linphone-desktop/ui/modules/Linphone/Timeline/Timeline.qml
+10
-45
No files found.
linphone-desktop/resources.qrc
View file @
02fdc59e
...
...
@@ -327,6 +327,7 @@
<file>
ui/modules/Linphone/Styles/Timeline/TimelineStyle.qml
</file>
<file>
ui/modules/Linphone/TelKeypad/TelKeypadButton.qml
</file>
<file>
ui/modules/Linphone/TelKeypad/TelKeypad.qml
</file>
<file>
ui/modules/Linphone/Timeline/Timeline.js
</file>
<file>
ui/modules/Linphone/Timeline/Timeline.qml
</file>
<file>
ui/scripts/LinphoneUtils/linphone-utils.js
</file>
<file>
ui/scripts/LinphoneUtils/qmldir
</file>
...
...
linphone-desktop/ui/modules/Linphone/Timeline/Timeline.js
0 → 100644
View file @
02fdc59e
// =============================================================================
// `Timeline.qml` Logic.
// =============================================================================
function
setSelectedEntry
(
sipAddress
)
{
var
model
=
timeline
.
model
var
n
=
view
.
count
timeline
.
_selectedSipAddress
=
sipAddress
for
(
var
i
=
0
;
i
<
n
;
i
++
)
{
if
(
sipAddress
===
model
.
data
(
model
.
index
(
i
,
0
)).
sipAddress
)
{
view
.
currentIndex
=
i
return
}
}
}
function
resetSelectedEntry
()
{
view
.
currentIndex
=
-
1
timeline
.
_selectedSipAddress
=
''
}
// -----------------------------------------------------------------------------
function
handleDataChanged
(
topLeft
,
bottomRight
,
roles
)
{
var
index
=
view
.
currentIndex
var
model
=
timeline
.
model
var
sipAddress
=
timeline
.
_selectedSipAddress
if
(
index
!==
-
1
&&
sipAddress
!==
model
.
data
(
model
.
index
(
index
,
0
)).
sipAddress
)
{
setSelectedEntry
(
sipAddress
)
}
}
function
handleRowsAboutToBeRemoved
(
parent
,
first
,
last
)
{
var
index
=
view
.
currentIndex
if
(
index
>=
first
&&
index
<=
last
)
{
view
.
currentIndex
=
-
1
}
}
function
handleCountChanged
()
{
var
sipAddress
=
timeline
.
_selectedSipAddress
if
(
sipAddress
.
length
>
0
)
{
setSelectedEntry
(
sipAddress
)
}
}
linphone-desktop/ui/modules/Linphone/Timeline/Timeline.qml
View file @
02fdc59e
...
...
@@ -4,7 +4,8 @@ import QtQuick.Layouts 1.3
import
Common
1.0
import
Linphone
1.0
import
Linphone
.
Styles
1.0
import
Utils
1.0
import
'
Timeline.js
'
as
Logic
// =============================================================================
...
...
@@ -14,9 +15,10 @@ ColumnLayout {
// ---------------------------------------------------------------------------
property
alias
model
:
view
.
model
property
string
_selectedSipAddress
property
var
_newInsertedItem
// ---------------------------------------------------------------------------
signal
entrySelected
(
var
entry
)
...
...
@@ -24,21 +26,11 @@ ColumnLayout {
// ---------------------------------------------------------------------------
function
setSelectedEntry
(
sipAddress
)
{
var
n
=
model
.
rowCount
()
for
(
var
i
=
0
;
i
<
n
;
i
++
)
{
_selectedSipAddress
=
sipAddress
if
(
sipAddress
===
model
.
data
(
model
.
index
(
i
,
0
)).
sipAddress
)
{
view
.
currentIndex
=
i
return
}
}
Logic
.
setSelectedEntry
(
sipAddress
)
}
function
resetSelectedEntry
()
{
view
.
currentIndex
=
-
1
_selectedSipAddress
=
''
Logic
.
resetSelectedEntry
()
}
// ---------------------------------------------------------------------------
...
...
@@ -50,37 +42,8 @@ ColumnLayout {
Connections
{
target
:
model
// Handle if current entry was moved in timeline.
onDataChanged
:
{
var
index
=
view
.
currentIndex
if
(
index
!==
-
1
&&
_selectedSipAddress
!==
model
.
data
(
model
.
index
(
index
,
0
)).
sipAddress
)
{
setSelectedEntry
(
_selectedSipAddress
)
}
}
// A timeline entry is removed from timeline if there is no history entry.
onRowsAboutToBeRemoved
:
{
var
index
=
view
.
currentIndex
if
(
index
>=
first
&&
index
<=
last
)
{
view
.
currentIndex
=
-
1
}
}
// A entry is added when history is created.
onRowsInserted
:
{
if
(
_selectedSipAddress
.
length
===
0
)
{
return
}
for
(
var
i
=
first
;
i
<=
last
;
i
++
)
{
if
(
_selectedSipAddress
===
model
.
data
(
model
.
index
(
i
,
0
)).
sipAddress
)
{
view
.
currentIndex
=
i
}
}
}
onDataChanged
:
Logic
.
handleDataChanged
(
topLeft
,
bottomRight
,
roles
)
onRowsAboutToBeRemoved
:
Logic
.
handleRowsAboutToBeRemoved
(
parent
,
first
,
last
)
}
// ---------------------------------------------------------------------------
...
...
@@ -175,5 +138,7 @@ ColumnLayout {
}
}
}
onCountChanged
:
Logic
.
handleCountChanged
()
}
}
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