Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vmj-qt
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
Kulya
vmj-qt
Commits
6720249b
Commit
6720249b
authored
Jul 26, 2016
by
Dan Pascu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed unicode sorting for contact names
parent
528211f5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
contacts.py
blink/contacts.py
+9
-8
No files found.
blink/contacts.py
View file @
6720249b
import
cPickle
as
pickle
import
locale
import
os
import
re
import
socket
...
...
@@ -1080,22 +1081,22 @@ class Contact(object):
def
__gt__
(
self
,
other
):
if
isinstance
(
other
,
Contact
):
return
self
.
name
>
other
.
name
return
locale
.
strcoll
(
self
.
name
,
other
.
name
)
>
0
return
NotImplemented
def
__ge__
(
self
,
other
):
if
isinstance
(
other
,
Contact
):
return
self
.
name
>=
other
.
name
return
locale
.
strcoll
(
self
.
name
,
other
.
name
)
>=
0
return
NotImplemented
def
__lt__
(
self
,
other
):
if
isinstance
(
other
,
Contact
):
return
self
.
name
<
other
.
name
return
locale
.
strcoll
(
self
.
name
,
other
.
name
)
<
0
return
NotImplemented
def
__le__
(
self
,
other
):
if
isinstance
(
other
,
Contact
):
return
self
.
name
<=
other
.
name
return
locale
.
strcoll
(
self
.
name
,
other
.
name
)
<=
0
return
NotImplemented
def
__repr__
(
self
):
...
...
@@ -2678,13 +2679,13 @@ class ContactModel(QAbstractListModel):
position
=
self
.
items
.
index
(
contact
)
prev_item
=
self
.
items
[
position
-
1
]
if
position
>
0
else
None
next_item
=
self
.
items
[
position
+
1
]
if
position
+
1
<
len
(
self
.
items
)
else
None
prev_ok
=
prev_item
is
None
or
isinstance
(
prev_item
,
Group
)
or
prev_item
.
name
<=
contact
.
name
next_ok
=
next_item
is
None
or
isinstance
(
next_item
,
Group
)
or
next_item
.
name
>=
contact
.
name
prev_ok
=
prev_item
is
None
or
isinstance
(
prev_item
,
Group
)
or
prev_item
<=
contact
next_ok
=
next_item
is
None
or
isinstance
(
next_item
,
Group
)
or
next_item
>=
contact
if
prev_ok
and
next_ok
:
return
None
for
position
in
xrange
(
self
.
items
.
index
(
contact
.
group
)
+
1
,
len
(
self
.
items
)):
item
=
self
.
items
[
position
]
if
isinstance
(
item
,
Group
)
or
item
.
name
>
contact
.
name
:
if
isinstance
(
item
,
Group
)
or
item
>
contact
:
break
else
:
position
=
len
(
self
.
items
)
...
...
@@ -2693,7 +2694,7 @@ class ContactModel(QAbstractListModel):
def
_find_contact_insertion_point
(
self
,
contact
):
for
position
in
xrange
(
self
.
items
.
index
(
contact
.
group
)
+
1
,
len
(
self
.
items
)):
item
=
self
.
items
[
position
]
if
isinstance
(
item
,
Group
)
or
item
.
name
>
contact
.
name
:
if
isinstance
(
item
,
Group
)
or
item
>
contact
:
break
else
:
position
=
len
(
self
.
items
)
...
...
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