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
7cf49fa6
Commit
7cf49fa6
authored
May 17, 2010
by
Dan Pascu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved Undo Delete text in context menu for the search view as well
parent
a5fd5fdb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
contacts.py
blink/contacts.py
+14
-0
No files found.
blink/contacts.py
View file @
7cf49fa6
...
@@ -1316,13 +1316,26 @@ class ContactSearchListView(QListView):
...
@@ -1316,13 +1316,26 @@ class ContactSearchListView(QListView):
model
=
self
.
model
()
model
=
self
.
model
()
source_model
=
model
.
sourceModel
()
source_model
=
model
.
sourceModel
()
selected_items
=
[
model
.
data
(
index
)
for
index
in
self
.
selectionModel
()
.
selectedIndexes
()]
selected_items
=
[
model
.
data
(
index
)
for
index
in
self
.
selectionModel
()
.
selectedIndexes
()]
if
not
source_model
.
deleted_items
:
undo_delete_text
=
"Undo Delete"
elif
len
(
source_model
.
deleted_items
[
-
1
])
==
1
:
item
=
source_model
.
deleted_items
[
-
1
][
0
]
if
type
(
item
)
is
Contact
:
name
=
item
.
name
or
item
.
uri
else
:
name
=
item
.
name
undo_delete_text
=
'Undo Delete "
%
s"'
%
name
else
:
undo_delete_text
=
"Undo Delete (
%
d items)"
%
len
(
source_model
.
deleted_items
[
-
1
])
menu
=
QMenu
(
self
)
menu
=
QMenu
(
self
)
if
not
selected_items
:
if
not
selected_items
:
menu
.
addAction
(
self
.
actions
.
undo_last_delete
)
menu
.
addAction
(
self
.
actions
.
undo_last_delete
)
self
.
actions
.
undo_last_delete
.
setText
(
undo_delete_text
)
self
.
actions
.
undo_last_delete
.
setEnabled
(
len
(
source_model
.
deleted_items
)
>
0
)
self
.
actions
.
undo_last_delete
.
setEnabled
(
len
(
source_model
.
deleted_items
)
>
0
)
elif
len
(
selected_items
)
>
1
:
elif
len
(
selected_items
)
>
1
:
menu
.
addAction
(
self
.
actions
.
delete_selection
)
menu
.
addAction
(
self
.
actions
.
delete_selection
)
menu
.
addAction
(
self
.
actions
.
undo_last_delete
)
menu
.
addAction
(
self
.
actions
.
undo_last_delete
)
self
.
actions
.
undo_last_delete
.
setText
(
undo_delete_text
)
self
.
actions
.
delete_selection
.
setEnabled
(
any
(
item
.
deletable
for
item
in
selected_items
))
self
.
actions
.
delete_selection
.
setEnabled
(
any
(
item
.
deletable
for
item
in
selected_items
))
self
.
actions
.
undo_last_delete
.
setEnabled
(
len
(
source_model
.
deleted_items
)
>
0
)
self
.
actions
.
undo_last_delete
.
setEnabled
(
len
(
source_model
.
deleted_items
)
>
0
)
else
:
else
:
...
@@ -1341,6 +1354,7 @@ class ContactSearchListView(QListView):
...
@@ -1341,6 +1354,7 @@ class ContactSearchListView(QListView):
menu
.
addAction
(
self
.
actions
.
edit_item
)
menu
.
addAction
(
self
.
actions
.
edit_item
)
menu
.
addAction
(
self
.
actions
.
delete_item
)
menu
.
addAction
(
self
.
actions
.
delete_item
)
menu
.
addAction
(
self
.
actions
.
undo_last_delete
)
menu
.
addAction
(
self
.
actions
.
undo_last_delete
)
self
.
actions
.
undo_last_delete
.
setText
(
undo_delete_text
)
self
.
actions
.
edit_item
.
setEnabled
(
contact
.
editable
)
self
.
actions
.
edit_item
.
setEnabled
(
contact
.
editable
)
self
.
actions
.
delete_item
.
setEnabled
(
contact
.
deletable
)
self
.
actions
.
delete_item
.
setEnabled
(
contact
.
deletable
)
self
.
actions
.
undo_last_delete
.
setEnabled
(
len
(
source_model
.
deleted_items
)
>
0
)
self
.
actions
.
undo_last_delete
.
setEnabled
(
len
(
source_model
.
deleted_items
)
>
0
)
...
...
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