Merge lp:~tiagosh/messaging-app/fix-1417350 into lp:messaging-app

Proposed by Tiago Salem Herrmann
Status: Merged
Approved by: Bill Filler
Approved revision: 329
Merged at revision: 327
Proposed branch: lp:~tiagosh/messaging-app/fix-1417350
Merge into: lp:messaging-app
Diff against target: 382 lines (+68/-36)
10 files modified
CMakeLists.txt (+1/-1)
debian/control (+1/-0)
po/messaging-app.pot (+29/-30)
src/CMakeLists.txt (+3/-0)
src/messagingapplication.cpp (+21/-0)
src/messagingapplication.h (+1/-0)
src/qml/MMSDelegate.qml (+1/-0)
src/qml/MessageInfoDialog.qml (+0/-4)
src/qml/RegularMessageDelegate.qml (+10/-1)
src/qml/SMSDelegate.qml (+1/-0)
To merge this branch: bzr merge lp:~tiagosh/messaging-app/fix-1417350
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Ubuntu Phablet Team Pending
Review via email: mp+250765@code.launchpad.net

Commit message

Show short notification when messages are copied to clipboard.

Description of the change

Show short notification when messages are copied to clipboard.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
326. By Tiago Salem Herrmann

only display copy action if there is text to be copied

327. By Tiago Salem Herrmann

update pot file

328. By Tiago Salem Herrmann

Fix displaying MessageInfoDialog

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Charles Kerr (charlesk) wrote :

After this patch, both 1417350 and 1426058 wfm in testing.

This patch does introduce a small resource leak, the NotifyNotification on diff line 298 is never freed -- there should probably be a call to g_object_unref(G_OBJECT(notification)) at the end of MessagingApplication::showNotificationMessage()'s body.

329. By Tiago Salem Herrmann

fix memory leak

Revision history for this message
Tiago Salem Herrmann (tiagosh) wrote :

Good catch! I fixed the leak.
Thanks for the review.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2014-09-02 20:49:19 +0000
3+++ CMakeLists.txt 2015-02-27 19:46:47 +0000
4@@ -58,7 +58,7 @@
5 #pkg_check_modules(TPL_QT5 REQUIRED TelepathyLoggerQt5)
6 #pkg_check_modules(QTGLIB REQUIRED QtGLib-2.0)
7 #pkg_check_modules(GLIB REQUIRED glib-2.0)
8-#pkg_check_modules(NOTIFY REQUIRED libnotify)
9+pkg_check_modules(NOTIFY REQUIRED libnotify)
10 #pkg_check_modules(MESSAGING_MENU REQUIRED messaging-menu)
11
12 # Check if the messaging menu has the message header
13
14=== modified file 'debian/control'
15--- debian/control 2014-11-18 17:32:49 +0000
16+++ debian/control 2015-02-27 19:46:47 +0000
17@@ -5,6 +5,7 @@
18 Build-Depends: cmake,
19 debhelper (>= 9),
20 dh-translations,
21+ libnotify-dev,
22 python-flake8,
23 pkg-config,
24 python3,
25
26=== modified file 'po/messaging-app.pot'
27--- po/messaging-app.pot 2015-01-27 19:03:46 +0000
28+++ po/messaging-app.pot 2015-02-27 19:46:47 +0000
29@@ -8,7 +8,7 @@
30 msgstr ""
31 "Project-Id-Version: PACKAGE VERSION\n"
32 "Report-Msgid-Bugs-To: \n"
33-"POT-Creation-Date: 2015-01-16 15:26-0200\n"
34+"POT-Creation-Date: 2015-02-26 15:10-0300\n"
35 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
36 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
37 "Language-Team: LANGUAGE <LL@li.org>\n"
38@@ -19,7 +19,7 @@
39 "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
40
41 #. TRANSLATORS: %1 is the first recipient the message is sent to, %2 is the count of remaining recipients
42-#: ../src/qml/ThreadDelegate.qml:45
43+#: ../src/qml/ThreadDelegate.qml:51
44 #, qt-format
45 msgid "%1 + %2"
46 msgstr ""
47@@ -49,16 +49,11 @@
48 msgid "+"
49 msgstr ""
50
51-#. TRANSLATORS: this refers to creating a new contact
52-#: ../src/qml/NewRecipientPage.qml:179
53-msgid "+ Create New"
54-msgstr ""
55-
56 #: ../src/qml/MessageInfoDialog.qml:60
57 msgid "Accepted"
58 msgstr ""
59
60-#: ../src/qml/Messages.qml:470
61+#: ../src/qml/Messages.qml:563
62 msgid "Add"
63 msgstr ""
64
65@@ -70,39 +65,39 @@
66 msgid "All"
67 msgstr ""
68
69-#: ../src/qml/ThreadDelegate.qml:77
70+#: ../src/qml/ThreadDelegate.qml:83
71 #, qt-format
72 msgid "Attachment: %1 contact"
73 msgid_plural "Attachments: %1 contacts"
74 msgstr[0] ""
75 msgstr[1] ""
76
77-#: ../src/qml/ThreadDelegate.qml:80
78+#: ../src/qml/ThreadDelegate.qml:86
79 #, qt-format
80 msgid "Attachment: %1 file"
81 msgid_plural "Attachments: %1 files"
82 msgstr[0] ""
83 msgstr[1] ""
84
85-#: ../src/qml/ThreadDelegate.qml:71
86+#: ../src/qml/ThreadDelegate.qml:77
87 #, qt-format
88 msgid "Attachment: %1 image"
89 msgid_plural "Attachments: %1 images"
90 msgstr[0] ""
91 msgstr[1] ""
92
93-#: ../src/qml/ThreadDelegate.qml:74
94+#: ../src/qml/ThreadDelegate.qml:80
95 #, qt-format
96 msgid "Attachment: %1 video"
97 msgid_plural "Attachments: %1 videos"
98 msgstr[0] ""
99 msgstr[1] ""
100
101-#: ../src/qml/Messages.qml:460 ../src/qml/Messages.qml:514
102+#: ../src/qml/Messages.qml:553 ../src/qml/Messages.qml:607
103 msgid "Call"
104 msgstr ""
105
106-#: ../src/qml/MainPage.qml:84 ../src/qml/NewRecipientPage.qml:83
107+#: ../src/qml/MainPage.qml:85 ../src/qml/NewRecipientPage.qml:83
108 msgid "Cancel"
109 msgstr ""
110
111@@ -113,15 +108,15 @@
112 msgstr ""
113
114 #: ../src/qml/Dialogs/NoSIMCardSelectedDialog.qml:30
115-#: ../src/qml/MessageInfoDialog.qml:137 ../src/qml/Messages.qml:266
116+#: ../src/qml/MessageInfoDialog.qml:137 ../src/qml/Messages.qml:359
117 msgid "Close"
118 msgstr ""
119
120-#: ../src/qml/MainPage.qml:140
121+#: ../src/qml/MainPage.qml:141
122 msgid "Compose a new message by swiping up from the bottom of the screen."
123 msgstr ""
124
125-#: ../src/qml/Messages.qml:524
126+#: ../src/qml/Messages.qml:617
127 msgid "Contact"
128 msgstr ""
129
130@@ -129,7 +124,7 @@
131 msgid "Copy"
132 msgstr ""
133
134-#: ../src/qml/MessageDelegateFactory.qml:42 ../src/qml/ThreadDelegate.qml:105
135+#: ../src/qml/MessageDelegateFactory.qml:42 ../src/qml/ThreadDelegate.qml:96
136 msgid "Delete"
137 msgstr ""
138
139@@ -166,7 +161,7 @@
140 msgstr ""
141
142 #. TRANSLATORS: %1 refers to the number of participants in a group chat
143-#: ../src/qml/Messages.qml:154
144+#: ../src/qml/Messages.qml:247
145 #, qt-format
146 msgid "Group (%1)"
147 msgstr ""
148@@ -207,11 +202,11 @@
149 msgid "Messaging App"
150 msgstr ""
151
152-#: ../src/messaging-app.desktop.in.in.h:3
153+#: ../src/messagingapplication.cpp:163 ../src/messaging-app.desktop.in.in.h:3
154 msgid "Messaging application"
155 msgstr ""
156
157-#: ../src/qml/MMSDelegate.qml:215
158+#: ../src/qml/MMSDelegate.qml:212
159 msgid "Missing message data"
160 msgstr ""
161
162@@ -219,7 +214,7 @@
163 msgid "Myself"
164 msgstr ""
165
166-#: ../src/qml/Messages.qml:157
167+#: ../src/qml/Messages.qml:250
168 msgid "New Message"
169 msgstr ""
170
171@@ -232,7 +227,7 @@
172 msgid "No SIM card selected"
173 msgstr ""
174
175-#: ../src/qml/Messages.qml:262
176+#: ../src/qml/Messages.qml:355
177 msgid "No network"
178 msgstr ""
179
180@@ -259,7 +254,7 @@
181 msgid "Received"
182 msgstr ""
183
184-#: ../src/qml/Messages.qml:216
185+#: ../src/qml/Messages.qml:309
186 msgid "Remove"
187 msgstr ""
188
189@@ -283,7 +278,7 @@
190 msgid "Search"
191 msgstr ""
192
193-#: ../src/qml/MainPage.qml:53 ../src/qml/NewRecipientPage.qml:45
194+#: ../src/qml/MainPage.qml:54 ../src/qml/NewRecipientPage.qml:45
195 msgid "Search..."
196 msgstr ""
197
198@@ -293,7 +288,7 @@
199 "choice in <a href=\"system_settings\">System Settings</a>."
200 msgstr ""
201
202-#: ../src/qml/Messages.qml:846
203+#: ../src/qml/Messages.qml:974
204 msgid "Send"
205 msgstr ""
206
207@@ -317,12 +312,16 @@
208 msgid "Temporarily Failed"
209 msgstr ""
210
211-#: ../src/qml/Messages.qml:263
212+#: ../src/qml/MMSDelegate.qml:69 ../src/qml/SMSDelegate.qml:42
213+msgid "Text message copied to clipboard"
214+msgstr ""
215+
216+#: ../src/qml/Messages.qml:356
217 #, qt-format
218 msgid "There is currently no network on %1"
219 msgstr ""
220
221-#: ../src/qml/Messages.qml:263
222+#: ../src/qml/Messages.qml:356
223 msgid "There is currently no network."
224 msgstr ""
225
226@@ -347,7 +346,7 @@
227 msgstr ""
228
229 #: ../src/qml/MMS/MMSContact.qml:83 ../src/qml/MMS/PreviewerContact.qml:27
230-#: ../src/qml/Messages.qml:716
231+#: ../src/qml/Messages.qml:844
232 msgid "Unknown contact"
233 msgstr ""
234
235@@ -355,7 +354,7 @@
236 msgid "Video Preview"
237 msgstr ""
238
239-#: ../src/qml/Messages.qml:816
240+#: ../src/qml/Messages.qml:944
241 msgid "Write a message..."
242 msgstr ""
243
244
245=== modified file 'src/CMakeLists.txt'
246--- src/CMakeLists.txt 2014-07-16 15:26:33 +0000
247+++ src/CMakeLists.txt 2015-02-27 19:46:47 +0000
248@@ -17,8 +17,11 @@
249 include_directories(
250 ${CMAKE_CURRENT_BINARY_DIR}
251 ${CMAKE_CURRENT_SOURCE_DIR}
252+ ${NOTIFY_INCLUDE_DIRS}
253 )
254
255+target_link_libraries(${MESSAGING_APP} ${NOTIFY_LIBRARIES})
256+
257 install(TARGETS ${MESSAGING_APP}
258 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
259 )
260
261=== modified file 'src/messagingapplication.cpp'
262--- src/messagingapplication.cpp 2014-10-17 18:15:29 +0000
263+++ src/messagingapplication.cpp 2015-02-27 19:46:47 +0000
264@@ -18,6 +18,8 @@
265
266 #include "messagingapplication.h"
267
268+#include <libnotify/notify.h>
269+
270 #include <QDir>
271 #include <QUrl>
272 #include <QUrlQuery>
273@@ -39,6 +41,10 @@
274 using namespace QtVersit;
275 #define Pair QPair<QString,QString>
276
277+namespace C {
278+#include <libintl.h>
279+}
280+
281 static void printUsage(const QStringList& arguments)
282 {
283 qDebug() << "usage:"
284@@ -154,6 +160,7 @@
285 } else {
286 m_view->show();
287 }
288+ notify_init(C::gettext("Messaging application"));
289
290 return true;
291 }
292@@ -270,3 +277,17 @@
293 return QString();
294 }
295
296+void MessagingApplication::showNotificationMessage(const QString &message, const QString &icon)
297+{
298+ NotifyNotification *notification = notify_notification_new(message.toStdString().c_str(),
299+ NULL,
300+ icon.toStdString().c_str());
301+ notify_notification_set_urgency(notification, NOTIFY_URGENCY_LOW);
302+
303+ GError *error = NULL;
304+ if (!notify_notification_show(notification, &error)) {
305+ qWarning() << "Failed to show notification:" << error->message;
306+ g_error_free (error);
307+ }
308+ g_object_unref(G_OBJECT(notification));
309+}
310
311=== modified file 'src/messagingapplication.h'
312--- src/messagingapplication.h 2014-07-01 18:08:32 +0000
313+++ src/messagingapplication.h 2015-02-27 19:46:47 +0000
314@@ -39,6 +39,7 @@
315 QString readTextFile(const QString &fileName);
316 QString fileMimeType(const QString &fileName);
317 QString contactNameFromVCard(const QString &fileName);
318+ void showNotificationMessage(const QString &message, const QString &icon = QString());
319
320 private Q_SLOTS:
321 void onViewStatusChanged(QQuickView::Status status);
322
323=== modified file 'src/qml/MMSDelegate.qml'
324--- src/qml/MMSDelegate.qml 2015-02-09 20:35:33 +0000
325+++ src/qml/MMSDelegate.qml 2015-02-27 19:46:47 +0000
326@@ -66,6 +66,7 @@
327 function copyMessage()
328 {
329 Clipboard.push(root.messageText)
330+ application.showNotificationMessage(i18n.tr("Text message copied to clipboard"), "edit-copy")
331 }
332
333 onAttachmentsChanged: {
334
335=== modified file 'src/qml/MessageInfoDialog.qml'
336--- src/qml/MessageInfoDialog.qml 2014-09-02 22:17:38 +0000
337+++ src/qml/MessageInfoDialog.qml 2015-02-27 19:46:47 +0000
338@@ -89,10 +89,6 @@
339
340 title: i18n.tr("Message info")
341
342- anchors.centerIn: parent
343- height: childrenRect.height
344- width: childrenRect.width
345-
346 Label {
347 text: "<b>%1:</b> %2".arg(i18n.tr("Type")).arg(root.activeMessage.type)
348 }
349
350=== modified file 'src/qml/RegularMessageDelegate.qml'
351--- src/qml/RegularMessageDelegate.qml 2014-09-24 19:57:31 +0000
352+++ src/qml/RegularMessageDelegate.qml 2015-02-27 19:46:47 +0000
353@@ -60,7 +60,16 @@
354 if (textMessageStatus === HistoryThreadModel.MessageStatusPermanentlyFailed) {
355 actions.push(reloadAction)
356 }
357- actions.push(copyAction)
358+ var hasTextAttachments = false
359+ for (var i=0; i < textMessageAttachments.length; i++) {
360+ if (startsWith(textMessageAttachments[i].contentType, "text/plain")) {
361+ hasTextAttachments = true
362+ break
363+ }
364+ }
365+ if (messageData.textMessage !== "" || hasTextAttachments) {
366+ actions.push(copyAction)
367+ }
368 actions.push(infoAction)
369 return actions
370 }
371
372=== modified file 'src/qml/SMSDelegate.qml'
373--- src/qml/SMSDelegate.qml 2015-02-09 20:35:33 +0000
374+++ src/qml/SMSDelegate.qml 2015-02-27 19:46:47 +0000
375@@ -39,6 +39,7 @@
376 function copyMessage()
377 {
378 Clipboard.push(bubble.messageText)
379+ application.showNotificationMessage(i18n.tr("Text message copied to clipboard"), "edit-copy")
380 }
381
382 height: bubble.height

Subscribers

People subscribed via source and target branches