Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mesonium
gajim
Commits
c9537bbd
Commit
c9537bbd
authored
3 years ago
by
Daniel Brötzmann
Browse files
Options
Downloads
Patches
Plain Diff
SearchView: Typing
parent
c14cc32b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gajim/common/storage/archive.py
+4
-2
4 additions, 2 deletions
gajim/common/storage/archive.py
gajim/gtk/search_view.py
+15
-8
15 additions, 8 deletions
gajim/gtk/search_view.py
with
19 additions
and
10 deletions
gajim/common/storage/archive.py
+
4
−
2
View file @
c9537bbd
...
...
@@ -121,6 +121,8 @@ class LastConversationRow(NamedTuple):
class
SearchLogRow
(
NamedTuple
):
account_id
:
int
jid_id
:
int
contact_name
:
str
time
:
float
kind
:
int
...
...
@@ -675,8 +677,8 @@ def search_log(self,
users_query_string
=
'
AND UPPER(contact_name) IN (?)
'
sql
=
'''
SELECT contact_name, time, kind, show, message,
subject,
additional_data, log_line_id
SELECT
account_id, jid_id,
contact_name, time, kind, show, message,
subject,
additional_data, log_line_id
FROM logs NATURAL JOIN jids WHERE jid IN ({jids})
AND message LIKE like(?)
AND kind NOT IN ({kinds})
...
...
This diff is collapsed.
Click to expand it.
gajim/gtk/search_view.py
+
15
−
8
View file @
c9537bbd
...
...
@@ -35,6 +35,7 @@
from
gajim.common.const
import
KindConstant
from
gajim.common.const
import
FILE_CATEGORIES
from
gajim.common.i18n
import
_
from
gajim.common.storage.archive
import
SearchLogRow
from
.conversation.message_widget
import
MessageWidget
from
.builder
import
get_builder
...
...
@@ -56,8 +57,8 @@ def __init__(self) -> None:
self
.
_account
:
Optional
[
str
]
=
None
self
.
_jid
:
Optional
[
JID
]
=
None
self
.
_results
:
list
[
str
]
=
[]
self
.
_scope
:
Optional
[
str
]
=
None
self
.
_results
:
list
[
SearchLogRow
]
=
[]
self
.
_scope
:
str
=
'
everywhere
'
self
.
_ui
=
get_builder
(
'
search_view.ui
'
)
self
.
_ui
.
results_listbox
.
set_header_func
(
self
.
_header_func
)
...
...
@@ -86,6 +87,9 @@ def _header_func(row: Union[CounterRow, ResultRow],
else
:
row
.
set_header
(
RowHeader
(
row
.
account
,
row
.
jid
,
row
.
time
))
else
:
if
isinstance
(
row
,
CounterRow
):
row
.
set_header
(
None
)
return
date1
=
time
.
strftime
(
'
%x
'
,
time
.
localtime
(
row
.
time
))
date2
=
time
.
strftime
(
'
%x
'
,
time
.
localtime
(
before
.
time
))
if
before
.
jid
!=
row
.
jid
:
...
...
@@ -184,13 +188,13 @@ def _on_search(self, entry: Gtk.Entry) -> None:
def
_filter_results_for_files
(
self
,
filetypes
:
list
[
str
])
->
None
:
if
'
file
'
in
filetypes
:
results
=
[]
results
:
list
[
SearchLogRow
]
=
[]
for
result
in
self
.
_results
:
if
result
.
additional_data
.
get_value
(
'
gajim
'
,
'
oob_url
'
):
results
.
append
(
result
)
self
.
_results
=
results
else
:
results
=
[]
results
:
list
[
SearchLogRow
]
=
[]
for
result
in
self
.
_results
:
url
=
result
.
additional_data
.
get_value
(
'
gajim
'
,
'
oob_url
'
)
if
url
is
None
:
...
...
@@ -223,11 +227,14 @@ def _add_results(self) -> None:
accounts
=
self
.
_get_accounts
()
for
msg
in
self
.
_results
[:
25
]:
if
self
.
_scope
==
'
everywhere
'
:
archive_jid
=
app
.
storage
.
archive
.
get_jid_from_id
(
msg
.
jid_id
)
result_row
=
ResultRow
(
msg
,
accounts
.
get
(
msg
.
account_id
)
,
a
pp
.
storage
.
archive
.
get_jid_from_id
(
msg
.
jid_id
)
.
jid
)
accounts
[
msg
.
account_id
]
,
a
rchive_jid
.
jid
)
else
:
assert
self
.
_account
is
not
None
assert
self
.
_jid
is
not
None
result_row
=
ResultRow
(
msg
,
self
.
_account
,
self
.
_jid
)
self
.
_ui
.
results_listbox
.
add
(
result_row
)
...
...
@@ -242,8 +249,8 @@ def _on_edge_reached(self,
self
.
_add_results
()
@staticmethod
def
_get_accounts
()
->
dict
[
str
,
str
]:
accounts
:
dict
[
str
,
str
]
=
{}
def
_get_accounts
()
->
dict
[
int
,
str
]:
accounts
:
dict
[
int
,
str
]
=
{}
for
account
in
app
.
settings
.
get_accounts
():
account_id
=
app
.
storage
.
archive
.
get_account_id
(
account
)
accounts
[
account_id
]
=
account
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment