feature: paste image in chat #51

Merged
blue merged 3 commits from shunf4/squawk:feat/paste_img into messageFeed 2021-10-16 15:34:01 +00:00
Contributor

Add feature: paste image in chat (context menu/Ctrl-V).

This PR is based on #50. The changes for this PR is at the lastest commit.

Add feature: paste image in chat (context menu/Ctrl-V). This PR is based on #50. The changes for this PR is at the lastest commit.
shunf4 added 17 commits 2021-10-06 16:35:15 +00:00
blue reviewed 2021-10-11 12:29:16 +00:00
@ -84,2 +90,3 @@
m_ui->messageEditor->installEventFilter(&ker);
QAction* pasteImageAction = new QAction(tr("Paste Image"), this);
Owner

Do you mind if we better move it to initialization block? Cuz, since you declare here that variable again as QAction* it might be even considered like another variable rather than that one declared as a property...

Do you mind if we better move it to initialization block? Cuz, since you declare here that variable again as QAction* it might be even considered like another variable rather than that one declared as a property...
Author
Contributor

How about this change? 52551c1ce0

How about this change? https://git.macaw.me/blue/squawk/commit/52551c1ce0be0a223e388d339389b7a55b159b6c
Owner

That's good, thank you!

That's good, thank you!
blue marked this conversation as resolved
blue reviewed 2021-10-11 12:34:58 +00:00
@ -221,0 +253,4 @@
if (image.isNull()) {
return;
}
QTemporaryFile *tempFile = new QTemporaryFile(QDir::tempPath() + QStringLiteral("/squawk_img_attach_XXXXXX.png"), QApplication::instance());
Owner

Interestring solution...
I actually was thinking of it, but was more into may be saving it into downloads folder, for the next time. Like this way at somepoint the image is not going to be accesible, so, we're going to be forced to download it to see it.
Dunno, i really have mixed feelings about my way, what do you think?

Interestring solution... I actually was thinking of it, but was more into may be saving it into downloads folder, for the next time. Like this way at somepoint the image is not going to be accesible, so, we're going to be forced to download it to see it. Dunno, i really have mixed feelings about my way, what do you think?
Author
Contributor

I agree with you. Placing the pasted image into downloads folder is better.

Or putting it to temp folder, then moving it to downloads folder if it is sent successfully?

I agree with you. Placing the pasted image into downloads folder is better. Or putting it to temp folder, then moving it to downloads folder if it is sent successfully?
Owner

Yeah, that would do! But if you will move the image on successfull send you're going to need to update the path to the image in databases after the image is moved, I hope I've done that handler...

Yeah, that would do! But if you will move the image on successfull send you're going to need to update the path to the image in databases after the image is moved, I hope I've done that handler...
Author
Contributor

Done in 39f2f3d975 .

The file is copied (rather than moved) because it might still be used by QImageReader in message preview widget.

Done in https://git.macaw.me/blue/squawk/commit/39f2f3d975a1ce38144ef1992506416a934e5005 . The file is copied (rather than moved) because it might still be used by `QImageReader` in message preview widget.
shunf4 added 1 commit 2021-10-13 12:07:07 +00:00
shunf4 added 1 commit 2021-10-15 16:21:15 +00:00
blue merged commit 893ff53aa8 into messageFeed 2021-10-16 15:34:01 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blue/squawk#51
No description provided.