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
da94f8ab
Commit
da94f8ab
authored
Jul 04, 2023
by
Tijmen de Mes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added option to remove messages
parent
e320af39
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
+33
-0
chatwindow.py
blink/chatwindow.py
+29
-0
messages.py
blink/messages.py
+4
-0
No files found.
blink/chatwindow.py
View file @
da94f8ab
...
@@ -376,6 +376,7 @@ class ChatWebPage(QWebPage):
...
@@ -376,6 +376,7 @@ class ChatWebPage(QWebPage):
class
ChatWebView
(
QWebView
):
class
ChatWebView
(
QWebView
):
sizeChanged
=
pyqtSignal
()
sizeChanged
=
pyqtSignal
()
messageShouldRemove
=
pyqtSignal
(
str
)
def
__init__
(
self
,
parent
=
None
):
def
__init__
(
self
,
parent
=
None
):
super
(
ChatWebView
,
self
)
.
__init__
(
parent
)
super
(
ChatWebView
,
self
)
.
__init__
(
parent
)
...
@@ -388,6 +389,25 @@ class ChatWebView(QWebView):
...
@@ -388,6 +389,25 @@ class ChatWebView(QWebView):
def
contextMenuEvent
(
self
,
event
):
def
contextMenuEvent
(
self
,
event
):
menu
=
self
.
page
()
.
createStandardContextMenu
()
menu
=
self
.
page
()
.
createStandardContextMenu
()
hit
=
self
.
page
()
.
currentFrame
()
.
hitTestContent
(
event
.
pos
())
self
.
id
=
None
if
hit
.
element
()
.
hasAttribute
(
'id'
):
id
=
hit
.
element
()
.
attribute
(
'id'
)
else
:
id
=
hit
.
element
()
.
parent
()
.
attribute
(
'id'
)
if
not
id
:
id
=
hit
.
element
()
.
parent
()
.
parent
()
.
attribute
(
'id'
)
if
id
.
startswith
(
'text-'
):
self
.
id
=
id
[
5
:]
action
=
menu
.
addAction
(
'Remove Message'
)
action
.
triggered
.
connect
(
self
.
_SH_RemoveClicked
)
if
id
.
startswith
(
'message-'
):
self
.
id
=
id
[
8
:]
action
=
menu
.
addAction
(
'Remove Message'
)
action
.
triggered
.
connect
(
self
.
_SH_RemoveClicked
)
if
any
(
action
.
isVisible
()
and
not
action
.
isSeparator
()
for
action
in
menu
.
actions
()):
if
any
(
action
.
isVisible
()
and
not
action
.
isSeparator
()
for
action
in
menu
.
actions
()):
menu
.
exec_
(
event
.
globalPos
())
menu
.
exec_
(
event
.
globalPos
())
...
@@ -402,6 +422,9 @@ class ChatWebView(QWebView):
...
@@ -402,6 +422,9 @@ class ChatWebView(QWebView):
super
(
ChatWebView
,
self
)
.
resizeEvent
(
event
)
super
(
ChatWebView
,
self
)
.
resizeEvent
(
event
)
self
.
sizeChanged
.
emit
()
self
.
sizeChanged
.
emit
()
def
_SH_RemoveClicked
(
self
):
self
.
messageShouldRemove
.
emit
(
self
.
id
)
ui_class
,
base_class
=
uic
.
loadUiType
(
Resources
.
get
(
'chat_input_lock.ui'
))
ui_class
,
base_class
=
uic
.
loadUiType
(
Resources
.
get
(
'chat_input_lock.ui'
))
...
@@ -687,6 +710,8 @@ class ChatWidget(base_class, ui_class):
...
@@ -687,6 +710,8 @@ class ChatWidget(base_class, ui_class):
self
.
chat_input
.
lockReleased
.
connect
(
self
.
_SH_ChatInputLockReleased
)
self
.
chat_input
.
lockReleased
.
connect
(
self
.
_SH_ChatInputLockReleased
)
self
.
chat_view
.
sizeChanged
.
connect
(
self
.
_SH_ChatViewSizeChanged
)
self
.
chat_view
.
sizeChanged
.
connect
(
self
.
_SH_ChatViewSizeChanged
)
self
.
chat_view
.
page
()
.
mainFrame
()
.
contentsSizeChanged
.
connect
(
self
.
_SH_ChatViewFrameContentsSizeChanged
)
self
.
chat_view
.
page
()
.
mainFrame
()
.
contentsSizeChanged
.
connect
(
self
.
_SH_ChatViewFrameContentsSizeChanged
)
self
.
chat_view
.
messageShouldRemove
.
connect
(
self
.
_SH_MessageShouldRemove
)
self
.
composing_timer
.
timeout
.
connect
(
self
.
_SH_ComposingTimerTimeout
)
self
.
composing_timer
.
timeout
.
connect
(
self
.
_SH_ComposingTimerTimeout
)
self
.
otr_timer
.
timeout
.
connect
(
self
.
_SH_OTRTimerTimeout
)
self
.
otr_timer
.
timeout
.
connect
(
self
.
_SH_OTRTimerTimeout
)
...
@@ -907,6 +932,10 @@ class ChatWidget(base_class, ui_class):
...
@@ -907,6 +932,10 @@ class ChatWidget(base_class, ui_class):
self
.
chat_input
.
keyPressEvent
(
QKeyEvent
(
QEvent
.
KeyPress
,
Qt
.
Key_Return
,
Qt
.
NoModifier
,
text
=
'
\r
'
))
self
.
chat_input
.
keyPressEvent
(
QKeyEvent
(
QEvent
.
KeyPress
,
Qt
.
Key_Return
,
Qt
.
NoModifier
,
text
=
'
\r
'
))
self
.
chat_input
.
setHtml
(
user_text
)
self
.
chat_input
.
setHtml
(
user_text
)
def
_SH_MessageShouldRemove
(
self
,
id
):
blink_session
=
self
.
session
.
blink_session
MessageManager
()
.
send_remove_message
(
blink_session
,
id
)
def
_SH_ChatViewSizeChanged
(
self
):
def
_SH_ChatViewSizeChanged
(
self
):
# print("chat view size changed")
# print("chat view size changed")
self
.
_align_chat
(
scroll
=
True
)
self
.
_align_chat
(
scroll
=
True
)
...
...
blink/messages.py
View file @
da94f8ab
...
@@ -1271,6 +1271,10 @@ class MessageManager(object, metaclass=Singleton):
...
@@ -1271,6 +1271,10 @@ class MessageManager(object, metaclass=Singleton):
outgoing_message
=
OutgoingMessage
(
session
.
account
,
session
.
contact
,
content
,
IsComposingDocument
.
content_type
,
session
=
session
)
outgoing_message
=
OutgoingMessage
(
session
.
account
,
session
.
contact
,
content
,
IsComposingDocument
.
content_type
,
session
=
session
)
self
.
_send_message
(
outgoing_message
)
self
.
_send_message
(
outgoing_message
)
def
send_remove_message
(
self
,
session
,
id
,
account
=
None
):
outgoing_message
=
OutgoingMessage
(
session
.
account
,
session
.
contact
,
id
,
'application/sylk-api-message-remove'
,
session
=
session
)
self
.
_send_message
(
outgoing_message
)
def
send_imdn_message
(
self
,
session
,
id
,
timestamp
,
state
,
account
=
None
):
def
send_imdn_message
(
self
,
session
,
id
,
timestamp
,
state
,
account
=
None
):
if
account
is
None
and
not
session
.
account
.
sms
.
use_cpim
or
not
session
.
account
.
sms
.
enable_imdn
:
if
account
is
None
and
not
session
.
account
.
sms
.
use_cpim
or
not
session
.
account
.
sms
.
enable_imdn
:
return
return
...
...
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