Merge lp:~boiko/messaging-app/uri_handler into lp:messaging-app
- uri_handler
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Tiago Salem Herrmann |
Approved revision: | 48 |
Merged at revision: | 46 |
Proposed branch: | lp:~boiko/messaging-app/uri_handler |
Merge into: | lp:messaging-app |
Diff against target: |
509 lines (+26/-276) 11 files modified
CMakeLists.txt (+0/-7) debian/messaging-app.install (+0/-1) src/CMakeLists.txt (+3/-8) src/MessagingApp.xml (+0/-43) src/com.canonical.MessagingApp.service.in (+0/-3) src/messagingappdbus.cpp (+0/-76) src/messagingappdbus.h (+0/-53) src/messagingapplication.cpp (+8/-70) src/messagingapplication.h (+0/-7) src/qml/Messages.qml (+5/-7) src/qml/messaging-app.qml (+10/-1) |
To merge this branch: | bzr merge lp:~boiko/messaging-app/uri_handler |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Bill Filler (community) | Approve | ||
Tiago Salem Herrmann (community) | Approve | ||
Michael Terry | Approve | ||
PS Jenkins bot | continuous-integration | Approve | |
Review via email: mp+189428@code.launchpad.net |
Commit message
Change the messaging-app to use the new URL dispatcher mechanism.
Description of the change
Change the messaging-app to use the new URL dispatcher mechanism.
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:48
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Michael Terry (mterry) wrote : | # |
Looks like we remove some functionality ("go to a specific message" and "start a new message"). Do we know those aren't used?
Michael Terry (mterry) wrote : | # |
On IRC, boiko cleared up that we don't use those functions anymore.
This works fine in testing (both receiving and launching requests). Code seems fine too.
Tiago Salem Herrmann (tiagosh) wrote : | # |
looks good.
Preview Diff
1 | === modified file 'CMakeLists.txt' | |||
2 | --- CMakeLists.txt 2013-07-15 20:33:33 +0000 | |||
3 | +++ CMakeLists.txt 2013-10-07 19:24:17 +0000 | |||
4 | @@ -31,13 +31,6 @@ | |||
5 | 31 | # Instruct CMake to run moc automatically when needed. | 31 | # Instruct CMake to run moc automatically when needed. |
6 | 32 | set(CMAKE_AUTOMOC ON) | 32 | set(CMAKE_AUTOMOC ON) |
7 | 33 | 33 | ||
8 | 34 | # Check if should build using ubuntu platform api | ||
9 | 35 | check_include_file_cxx("ubuntu/ui/ubuntu_ui_session_service.h" USE_UBUNTU_PLATFORM_API) | ||
10 | 36 | |||
11 | 37 | if (USE_UBUNTU_PLATFORM_API) | ||
12 | 38 | add_definitions(-DUSE_UBUNTU_PLATFORM_API) | ||
13 | 39 | endif (USE_UBUNTU_PLATFORM_API) | ||
14 | 40 | |||
15 | 41 | configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY) | 34 | configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY) |
16 | 42 | 35 | ||
17 | 43 | find_package(Qt5Core) | 36 | find_package(Qt5Core) |
18 | 44 | 37 | ||
19 | === modified file 'debian/messaging-app.install' | |||
20 | --- debian/messaging-app.install 2013-08-12 20:50:13 +0000 | |||
21 | +++ debian/messaging-app.install 2013-10-07 19:24:17 +0000 | |||
22 | @@ -1,5 +1,4 @@ | |||
23 | 1 | usr/share/applications/messaging-app*.desktop | 1 | usr/share/applications/messaging-app*.desktop |
24 | 2 | usr/share/dbus-1/services/*MessagingApp*.service | ||
25 | 3 | usr/share/locale/*/LC_MESSAGES/messaging-app.mo | 2 | usr/share/locale/*/LC_MESSAGES/messaging-app.mo |
26 | 4 | usr/share/messaging-app/*.qml | 3 | usr/share/messaging-app/*.qml |
27 | 5 | usr/share/messaging-app/*.js | 4 | usr/share/messaging-app/*.js |
28 | 6 | 5 | ||
29 | === modified file 'src/CMakeLists.txt' | |||
30 | --- src/CMakeLists.txt 2013-07-15 20:33:33 +0000 | |||
31 | +++ src/CMakeLists.txt 2013-10-07 19:24:17 +0000 | |||
32 | @@ -2,14 +2,13 @@ | |||
33 | 2 | 2 | ||
34 | 3 | set(messaging_app_HDRS | 3 | set(messaging_app_HDRS |
35 | 4 | messagingapplication.h | 4 | messagingapplication.h |
37 | 5 | messagingappdbus.h) | 5 | ) |
38 | 6 | 6 | ||
39 | 7 | set(messaging_app_SRCS | 7 | set(messaging_app_SRCS |
40 | 8 | messagingapplication.cpp | 8 | messagingapplication.cpp |
43 | 9 | messagingappdbus.cpp | 9 | main.cpp |
44 | 10 | main.cpp) | 10 | ) |
45 | 11 | 11 | ||
46 | 12 | qt5_add_dbus_adaptor(messaging_app_SRCS MessagingApp.xml messagingappdbus.h MessagingAppDBus) | ||
47 | 13 | add_executable(${MESSAGING_APP} | 12 | add_executable(${MESSAGING_APP} |
48 | 14 | ${messaging_app_SRCS} | 13 | ${messaging_app_SRCS} |
49 | 15 | ) | 14 | ) |
50 | @@ -24,10 +23,6 @@ | |||
51 | 24 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | 23 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} |
52 | 25 | ) | 24 | ) |
53 | 26 | 25 | ||
54 | 27 | |||
55 | 28 | configure_file(com.canonical.MessagingApp.service.in com.canonical.MessagingApp.service) | ||
56 | 29 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/com.canonical.MessagingApp.service DESTINATION share/dbus-1/services) | ||
57 | 30 | |||
58 | 31 | # Handle i18n in the desktop file | 26 | # Handle i18n in the desktop file |
59 | 32 | set(DESKTOP_FILE ${MESSAGING_APP}.desktop) | 27 | set(DESKTOP_FILE ${MESSAGING_APP}.desktop) |
60 | 33 | file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE}) | 28 | file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE}) |
61 | 34 | 29 | ||
62 | === removed file 'src/MessagingApp.xml' | |||
63 | --- src/MessagingApp.xml 2013-07-15 20:33:33 +0000 | |||
64 | +++ src/MessagingApp.xml 1970-01-01 00:00:00 +0000 | |||
65 | @@ -1,43 +0,0 @@ | |||
66 | 1 | <!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> | ||
67 | 2 | <node xmlns:dox="http://www.ayatana.org/dbus/dox.dtd"> | ||
68 | 3 | <dox:d><![CDATA[ | ||
69 | 4 | @mainpage | ||
70 | 5 | |||
71 | 6 | An interface to the messaging application. | ||
72 | 7 | ]]></dox:d> | ||
73 | 8 | <interface name="com.canonical.MessagingApp" xmlns:dox="http://www.ayatana.org/dbus/dox.dtd"> | ||
74 | 9 | <dox:d> | ||
75 | 10 | An interface to the messaging application. | ||
76 | 11 | </dox:d> | ||
77 | 12 | <method name="ShowMessages"> | ||
78 | 13 | <dox:d><![CDATA[ | ||
79 | 14 | Request to open the messages tab. | ||
80 | 15 | ]]></dox:d> | ||
81 | 16 | <arg name="number" type="s" direction="in"/> | ||
82 | 17 | </method> | ||
83 | 18 | <method name="ShowMessage"> | ||
84 | 19 | <dox:d><![CDATA[ | ||
85 | 20 | Request to open the messages tab and show the given message. | ||
86 | 21 | ]]></dox:d> | ||
87 | 22 | <arg name="messageId" type="s" direction="in"/> | ||
88 | 23 | </method> | ||
89 | 24 | <method name="NewMessage"> | ||
90 | 25 | <dox:d><![CDATA[ | ||
91 | 26 | Request to open the messages tab to send a new message. | ||
92 | 27 | ]]></dox:d> | ||
93 | 28 | </method> | ||
94 | 29 | <method name="SendMessage"> | ||
95 | 30 | <dox:d><![CDATA[ | ||
96 | 31 | Request to send a message to a contact. | ||
97 | 32 | ]]></dox:d> | ||
98 | 33 | <arg name="number" type="s" direction="in"/> | ||
99 | 34 | <arg name="message" type="s" direction="in"/> | ||
100 | 35 | </method> | ||
101 | 36 | <method name="SendAppMessage"> | ||
102 | 37 | <dox:d><![CDATA[ | ||
103 | 38 | Send a message to the running application. | ||
104 | 39 | ]]></dox:d> | ||
105 | 40 | <arg name="message" type="s" direction="in"/> | ||
106 | 41 | </method> | ||
107 | 42 | </interface> | ||
108 | 43 | </node> | ||
109 | 44 | 0 | ||
110 | === removed file 'src/com.canonical.MessagingApp.service.in' | |||
111 | --- src/com.canonical.MessagingApp.service.in 2013-07-15 20:33:33 +0000 | |||
112 | +++ src/com.canonical.MessagingApp.service.in 1970-01-01 00:00:00 +0000 | |||
113 | @@ -1,3 +0,0 @@ | |||
114 | 1 | [D-BUS Service] | ||
115 | 2 | Name=com.canonical.MessagingApp | ||
116 | 3 | Exec=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/messaging-app | ||
117 | 4 | 0 | ||
118 | === removed file 'src/messagingappdbus.cpp' | |||
119 | --- src/messagingappdbus.cpp 2013-07-31 03:29:25 +0000 | |||
120 | +++ src/messagingappdbus.cpp 1970-01-01 00:00:00 +0000 | |||
121 | @@ -1,76 +0,0 @@ | |||
122 | 1 | /* | ||
123 | 2 | * Copyright (C) 2012-2013 Canonical, Ltd. | ||
124 | 3 | * | ||
125 | 4 | * Authors: | ||
126 | 5 | * Ugo Riboni <ugo.riboni@canonical.com> | ||
127 | 6 | * | ||
128 | 7 | * This file is part of messaging-app. | ||
129 | 8 | * | ||
130 | 9 | * messaging-app is free software; you can redistribute it and/or modify | ||
131 | 10 | * it under the terms of the GNU General Public License as published by | ||
132 | 11 | * the Free Software Foundation; version 3. | ||
133 | 12 | * | ||
134 | 13 | * messaging-app is distributed in the hope that it will be useful, | ||
135 | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
136 | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
137 | 16 | * GNU General Public License for more details. | ||
138 | 17 | * | ||
139 | 18 | * You should have received a copy of the GNU General Public License | ||
140 | 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
141 | 20 | */ | ||
142 | 21 | |||
143 | 22 | #include "messagingappdbus.h" | ||
144 | 23 | #include "messagingappadaptor.h" | ||
145 | 24 | |||
146 | 25 | // Qt | ||
147 | 26 | #include <QtDBus/QDBusConnection> | ||
148 | 27 | |||
149 | 28 | static const char* DBUS_SERVICE = "com.canonical.MessagingApp"; | ||
150 | 29 | static const char* DBUS_OBJECT_PATH = "/com/canonical/MessagingApp"; | ||
151 | 30 | |||
152 | 31 | MessagingAppDBus::MessagingAppDBus(QObject* parent) : QObject(parent) | ||
153 | 32 | { | ||
154 | 33 | } | ||
155 | 34 | |||
156 | 35 | MessagingAppDBus::~MessagingAppDBus() | ||
157 | 36 | { | ||
158 | 37 | } | ||
159 | 38 | |||
160 | 39 | bool | ||
161 | 40 | MessagingAppDBus::connectToBus() | ||
162 | 41 | { | ||
163 | 42 | bool ok = QDBusConnection::sessionBus().registerService(DBUS_SERVICE); | ||
164 | 43 | if (!ok) { | ||
165 | 44 | return false; | ||
166 | 45 | } | ||
167 | 46 | new MessagingAppAdaptor(this); | ||
168 | 47 | QDBusConnection::sessionBus().registerObject(DBUS_OBJECT_PATH, this); | ||
169 | 48 | |||
170 | 49 | return true; | ||
171 | 50 | } | ||
172 | 51 | |||
173 | 52 | void | ||
174 | 53 | MessagingAppDBus::ShowMessages(const QString &number) | ||
175 | 54 | { | ||
176 | 55 | Q_EMIT request(QString("messages://%1").arg(number)); | ||
177 | 56 | } | ||
178 | 57 | |||
179 | 58 | void MessagingAppDBus::ShowMessage(const QString &messageId) | ||
180 | 59 | { | ||
181 | 60 | Q_EMIT request(QString("messageId://%1").arg(messageId)); | ||
182 | 61 | } | ||
183 | 62 | |||
184 | 63 | void MessagingAppDBus::NewMessage() | ||
185 | 64 | { | ||
186 | 65 | Q_EMIT request(QString("messages://")); | ||
187 | 66 | } | ||
188 | 67 | |||
189 | 68 | void MessagingAppDBus::SendMessage(const QString &number, const QString &message) | ||
190 | 69 | { | ||
191 | 70 | Q_EMIT messageSendRequested(number, message); | ||
192 | 71 | } | ||
193 | 72 | |||
194 | 73 | void MessagingAppDBus::SendAppMessage(const QString &message) | ||
195 | 74 | { | ||
196 | 75 | Q_EMIT request(message); | ||
197 | 76 | } | ||
198 | 77 | 0 | ||
199 | === removed file 'src/messagingappdbus.h' | |||
200 | --- src/messagingappdbus.h 2013-07-15 20:33:33 +0000 | |||
201 | +++ src/messagingappdbus.h 1970-01-01 00:00:00 +0000 | |||
202 | @@ -1,53 +0,0 @@ | |||
203 | 1 | /* | ||
204 | 2 | * Copyright (C) 2012-2013 Canonical, Ltd. | ||
205 | 3 | * | ||
206 | 4 | * Authors: | ||
207 | 5 | * Ugo Riboni <ugo.riboni@canonical.com> | ||
208 | 6 | * | ||
209 | 7 | * This file is part of messaging-app. | ||
210 | 8 | * | ||
211 | 9 | * messaging-app is free software; you can redistribute it and/or modify | ||
212 | 10 | * it under the terms of the GNU General Public License as published by | ||
213 | 11 | * the Free Software Foundation; version 3. | ||
214 | 12 | * | ||
215 | 13 | * messaging-app is distributed in the hope that it will be useful, | ||
216 | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
217 | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
218 | 16 | * GNU General Public License for more details. | ||
219 | 17 | * | ||
220 | 18 | * You should have received a copy of the GNU General Public License | ||
221 | 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
222 | 20 | */ | ||
223 | 21 | |||
224 | 22 | #ifndef MESSAGINGAPPDBUS_H | ||
225 | 23 | #define MESSAGINGAPPDBUS_H | ||
226 | 24 | |||
227 | 25 | #include <QtCore/QObject> | ||
228 | 26 | #include <QtDBus/QDBusContext> | ||
229 | 27 | |||
230 | 28 | /** | ||
231 | 29 | * DBus interface for the messaging app | ||
232 | 30 | */ | ||
233 | 31 | class MessagingAppDBus : public QObject, protected QDBusContext | ||
234 | 32 | { | ||
235 | 33 | Q_OBJECT | ||
236 | 34 | |||
237 | 35 | public: | ||
238 | 36 | MessagingAppDBus(QObject* parent=0); | ||
239 | 37 | ~MessagingAppDBus(); | ||
240 | 38 | |||
241 | 39 | bool connectToBus(); | ||
242 | 40 | |||
243 | 41 | public Q_SLOTS: | ||
244 | 42 | Q_NOREPLY void ShowMessages(const QString &number); | ||
245 | 43 | Q_NOREPLY void ShowMessage(const QString &messageId); | ||
246 | 44 | Q_NOREPLY void NewMessage(); | ||
247 | 45 | Q_NOREPLY void SendMessage(const QString &number, const QString &message); | ||
248 | 46 | Q_NOREPLY void SendAppMessage(const QString &message); | ||
249 | 47 | |||
250 | 48 | Q_SIGNALS: | ||
251 | 49 | void request(const QString &message); | ||
252 | 50 | void messageSendRequested(const QString &phoneNumber, const QString &message); | ||
253 | 51 | }; | ||
254 | 52 | |||
255 | 53 | #endif // MESSAGINGAPPDBUS_H | ||
256 | 54 | 0 | ||
257 | === modified file 'src/messagingapplication.cpp' | |||
258 | --- src/messagingapplication.cpp 2013-07-31 03:49:02 +0000 | |||
259 | +++ src/messagingapplication.cpp 2013-10-07 19:24:17 +0000 | |||
260 | @@ -31,15 +31,13 @@ | |||
261 | 31 | #include <QDBusConnectionInterface> | 31 | #include <QDBusConnectionInterface> |
262 | 32 | #include <QLibrary> | 32 | #include <QLibrary> |
263 | 33 | #include "config.h" | 33 | #include "config.h" |
264 | 34 | #include "messagingappdbus.h" | ||
265 | 35 | #include <QQmlEngine> | 34 | #include <QQmlEngine> |
266 | 36 | 35 | ||
267 | 37 | static void printUsage(const QStringList& arguments) | 36 | static void printUsage(const QStringList& arguments) |
268 | 38 | { | 37 | { |
269 | 39 | qDebug() << "usage:" | 38 | qDebug() << "usage:" |
270 | 40 | << arguments.at(0).toUtf8().constData() | 39 | << arguments.at(0).toUtf8().constData() |
273 | 41 | << "[messages://PHONE_NUMBER]" | 40 | << "[message:///PHONE_NUMBER]" |
272 | 42 | << "[messageId://MESSAGE_ID]" | ||
274 | 43 | << "[--fullscreen]" | 41 | << "[--fullscreen]" |
275 | 44 | << "[--help]" | 42 | << "[--help]" |
276 | 45 | << "[-testability]"; | 43 | << "[-testability]"; |
277 | @@ -49,7 +47,6 @@ | |||
278 | 49 | : QGuiApplication(argc, argv), m_view(0), m_applicationIsReady(false) | 47 | : QGuiApplication(argc, argv), m_view(0), m_applicationIsReady(false) |
279 | 50 | { | 48 | { |
280 | 51 | setApplicationName("MessagingApp"); | 49 | setApplicationName("MessagingApp"); |
281 | 52 | m_dbus = new MessagingAppDBus(this); | ||
282 | 53 | } | 50 | } |
283 | 54 | 51 | ||
284 | 55 | bool MessagingApplication::setup() | 52 | bool MessagingApplication::setup() |
285 | @@ -58,8 +55,7 @@ | |||
286 | 58 | bool fullScreen = false; | 55 | bool fullScreen = false; |
287 | 59 | 56 | ||
288 | 60 | if (validSchemes.isEmpty()) { | 57 | if (validSchemes.isEmpty()) { |
291 | 61 | validSchemes << "messages"; | 58 | validSchemes << "message"; |
290 | 62 | validSchemes << "messageId"; | ||
292 | 63 | } | 59 | } |
293 | 64 | 60 | ||
294 | 65 | QStringList arguments = this->arguments(); | 61 | QStringList arguments = this->arguments(); |
295 | @@ -114,27 +110,12 @@ | |||
296 | 114 | } | 110 | } |
297 | 115 | } | 111 | } |
298 | 116 | 112 | ||
299 | 117 | // check if the app is already running, if it is, send the message to the running instance | ||
300 | 118 | QDBusReply<bool> reply = QDBusConnection::sessionBus().interface()->isServiceRegistered("com.canonical.MessagingApp"); | ||
301 | 119 | if (reply.isValid() && reply.value()) { | ||
302 | 120 | QDBusInterface appInterface("com.canonical.MessagingApp", | ||
303 | 121 | "/com/canonical/MessagingApp", | ||
304 | 122 | "com.canonical.MessagingApp"); | ||
305 | 123 | appInterface.call("SendAppMessage", m_arg); | ||
306 | 124 | return false; | ||
307 | 125 | } | ||
308 | 126 | |||
309 | 127 | if (!m_dbus->connectToBus()) { | ||
310 | 128 | qWarning() << "Failed to expose com.canonical.MessagingApp on DBUS."; | ||
311 | 129 | } | ||
312 | 130 | |||
313 | 131 | m_view = new QQuickView(); | 113 | m_view = new QQuickView(); |
314 | 132 | QObject::connect(m_view, SIGNAL(statusChanged(QQuickView::Status)), this, SLOT(onViewStatusChanged(QQuickView::Status))); | 114 | QObject::connect(m_view, SIGNAL(statusChanged(QQuickView::Status)), this, SLOT(onViewStatusChanged(QQuickView::Status))); |
315 | 133 | QObject::connect(m_view->engine(), SIGNAL(quit()), SLOT(quit())); | 115 | QObject::connect(m_view->engine(), SIGNAL(quit()), SLOT(quit())); |
316 | 134 | m_view->setResizeMode(QQuickView::SizeRootObjectToView); | 116 | m_view->setResizeMode(QQuickView::SizeRootObjectToView); |
317 | 135 | m_view->setTitle("Messaging"); | 117 | m_view->setTitle("Messaging"); |
318 | 136 | m_view->rootContext()->setContextProperty("application", this); | 118 | m_view->rootContext()->setContextProperty("application", this); |
319 | 137 | m_view->rootContext()->setContextProperty("dbus", m_dbus); | ||
320 | 138 | m_view->engine()->setBaseUrl(QUrl::fromLocalFile(messagingAppDirectory())); | 119 | m_view->engine()->setBaseUrl(QUrl::fromLocalFile(messagingAppDirectory())); |
321 | 139 | 120 | ||
322 | 140 | QString pluginPath = ubuntuPhonePluginPath(); | 121 | QString pluginPath = ubuntuPhonePluginPath(); |
323 | @@ -149,13 +130,6 @@ | |||
324 | 149 | m_view->show(); | 130 | m_view->show(); |
325 | 150 | } | 131 | } |
326 | 151 | 132 | ||
327 | 152 | connect(m_dbus, | ||
328 | 153 | SIGNAL(request(QString)), | ||
329 | 154 | SLOT(onMessageReceived(QString))); | ||
330 | 155 | connect(m_dbus, | ||
331 | 156 | SIGNAL(messageSendRequested(QString,QString)), | ||
332 | 157 | SLOT(onMessageSendRequested(QString,QString))); | ||
333 | 158 | |||
334 | 159 | return true; | 133 | return true; |
335 | 160 | } | 134 | } |
336 | 161 | 135 | ||
337 | @@ -186,60 +160,24 @@ | |||
338 | 186 | m_arg.clear(); | 160 | m_arg.clear(); |
339 | 187 | } | 161 | } |
340 | 188 | 162 | ||
341 | 189 | void MessagingApplication::onMessageSendRequested(const QString &phoneNumber, const QString &message) | ||
342 | 190 | { | ||
343 | 191 | QQuickItem *mainView = m_view->rootObject(); | ||
344 | 192 | if (!mainView) { | ||
345 | 193 | return; | ||
346 | 194 | } | ||
347 | 195 | const QMetaObject *mo = mainView->metaObject(); | ||
348 | 196 | int index = mo->indexOfMethod("sendMessage(QVariant,QVariant)"); | ||
349 | 197 | if (index != -1) { | ||
350 | 198 | QMetaMethod method = mo->method(index); | ||
351 | 199 | method.invoke(mainView, | ||
352 | 200 | Q_ARG(QVariant, QVariant(phoneNumber)), | ||
353 | 201 | Q_ARG(QVariant, QVariant(message))); | ||
354 | 202 | } | ||
355 | 203 | } | ||
356 | 204 | |||
357 | 205 | void MessagingApplication::parseArgument(const QString &arg) | 163 | void MessagingApplication::parseArgument(const QString &arg) |
358 | 206 | { | 164 | { |
359 | 207 | if (arg.isEmpty()) { | 165 | if (arg.isEmpty()) { |
360 | 208 | return; | 166 | return; |
361 | 209 | } | 167 | } |
362 | 210 | 168 | ||
370 | 211 | QStringList args = arg.split("://"); | 169 | QUrl url(arg); |
371 | 212 | if (args.size() != 2) { | 170 | QString scheme = url.scheme(); |
372 | 213 | return; | 171 | // Remove the first "/" |
373 | 214 | } | 172 | QString value = url.path().right(url.path().length() -1); |
367 | 215 | |||
368 | 216 | QString scheme = args[0]; | ||
369 | 217 | QString value = args[1]; | ||
374 | 218 | 173 | ||
375 | 219 | QQuickItem *mainView = m_view->rootObject(); | 174 | QQuickItem *mainView = m_view->rootObject(); |
376 | 220 | if (!mainView) { | 175 | if (!mainView) { |
377 | 221 | return; | 176 | return; |
378 | 222 | } | 177 | } |
379 | 223 | 178 | ||
399 | 224 | if (scheme == "messages") { | 179 | if (scheme == "message") { |
400 | 225 | if (value.isEmpty()) { | 180 | QMetaObject::invokeMethod(mainView, "startChat", Q_ARG(QVariant, value)); |
382 | 226 | QMetaObject::invokeMethod(mainView, "startNewMessage"); | ||
383 | 227 | } else { | ||
384 | 228 | QMetaObject::invokeMethod(mainView, "startChat", Q_ARG(QVariant, value)); | ||
385 | 229 | } | ||
386 | 230 | } else if (scheme == "messageId") { | ||
387 | 231 | QMetaObject::invokeMethod(mainView, "showMessage", Q_ARG(QVariant, value)); | ||
388 | 232 | } | ||
389 | 233 | } | ||
390 | 234 | |||
391 | 235 | void MessagingApplication::onMessageReceived(const QString &message) | ||
392 | 236 | { | ||
393 | 237 | if (m_applicationIsReady) { | ||
394 | 238 | parseArgument(message); | ||
395 | 239 | m_arg.clear(); | ||
396 | 240 | activateWindow(); | ||
397 | 241 | } else { | ||
398 | 242 | m_arg = message; | ||
401 | 243 | } | 181 | } |
402 | 244 | } | 182 | } |
403 | 245 | 183 | ||
404 | 246 | 184 | ||
405 | === modified file 'src/messagingapplication.h' | |||
406 | --- src/messagingapplication.h 2013-07-15 20:33:33 +0000 | |||
407 | +++ src/messagingapplication.h 2013-10-07 19:24:17 +0000 | |||
408 | @@ -23,8 +23,6 @@ | |||
409 | 23 | #include <QQuickView> | 23 | #include <QQuickView> |
410 | 24 | #include <QGuiApplication> | 24 | #include <QGuiApplication> |
411 | 25 | 25 | ||
412 | 26 | class MessagingAppDBus; | ||
413 | 27 | |||
414 | 28 | class MessagingApplication : public QGuiApplication | 26 | class MessagingApplication : public QGuiApplication |
415 | 29 | { | 27 | { |
416 | 30 | Q_OBJECT | 28 | Q_OBJECT |
417 | @@ -37,19 +35,14 @@ | |||
418 | 37 | 35 | ||
419 | 38 | public Q_SLOTS: | 36 | public Q_SLOTS: |
420 | 39 | void activateWindow(); | 37 | void activateWindow(); |
421 | 40 | |||
422 | 41 | private: | ||
423 | 42 | void parseArgument(const QString &arg); | 38 | void parseArgument(const QString &arg); |
424 | 43 | 39 | ||
425 | 44 | private Q_SLOTS: | 40 | private Q_SLOTS: |
426 | 45 | void onMessageReceived(const QString &message); | ||
427 | 46 | void onViewStatusChanged(QQuickView::Status status); | 41 | void onViewStatusChanged(QQuickView::Status status); |
428 | 47 | void onApplicationReady(); | 42 | void onApplicationReady(); |
429 | 48 | void onMessageSendRequested(const QString &phoneNumber, const QString &message); | ||
430 | 49 | 43 | ||
431 | 50 | private: | 44 | private: |
432 | 51 | QQuickView *m_view; | 45 | QQuickView *m_view; |
433 | 52 | MessagingAppDBus *m_dbus; | ||
434 | 53 | QString m_arg; | 46 | QString m_arg; |
435 | 54 | bool m_applicationIsReady; | 47 | bool m_applicationIsReady; |
436 | 55 | }; | 48 | }; |
437 | 56 | 49 | ||
438 | === modified file 'src/qml/Messages.qml' | |||
439 | --- src/qml/Messages.qml 2013-09-27 17:22:42 +0000 | |||
440 | +++ src/qml/Messages.qml 2013-10-07 19:24:17 +0000 | |||
441 | @@ -69,8 +69,7 @@ | |||
442 | 69 | text: i18n.tr("Create new contact") | 69 | text: i18n.tr("Create new contact") |
443 | 70 | color: UbuntuColors.warmGrey | 70 | color: UbuntuColors.warmGrey |
444 | 71 | onClicked: { | 71 | onClicked: { |
447 | 72 | applicationUtils.switchToAddressbookApp("addressbook://create" + | 72 | Qt.openUrlExternally("addressbook:///create?phone=" + encodeURIComponent(contactWatcher.phoneNumber)); |
446 | 73 | "?phone=" + encodeURIComponent(contactWatcher.phoneNumber)) | ||
448 | 74 | PopupUtils.close(dialogue) | 73 | PopupUtils.close(dialogue) |
449 | 75 | } | 74 | } |
450 | 76 | } | 75 | } |
451 | @@ -104,9 +103,8 @@ | |||
452 | 104 | ContactListView { | 103 | ContactListView { |
453 | 105 | anchors.fill: parent | 104 | anchors.fill: parent |
454 | 106 | onContactClicked: { | 105 | onContactClicked: { |
458 | 107 | applicationUtils.switchToAddressbookApp("addressbook://addphone" + | 106 | Qt.openUrlExternally("addressbook:///addphone?id=" + encodeURIComponent(contact.contactId) + |
459 | 108 | "?id=" + encodeURIComponent(contact.contactId) + | 107 | "&phone=" + encodeURIComponent(contactWatcher.phoneNumber)) |
457 | 109 | "&phone=" + encodeURIComponent(contactWatcher.phoneNumber)) | ||
460 | 110 | PopupUtils.close(sheet) | 108 | PopupUtils.close(sheet) |
461 | 111 | } | 109 | } |
462 | 112 | } | 110 | } |
463 | @@ -179,7 +177,7 @@ | |||
464 | 179 | iconSource: Qt.resolvedUrl("assets/contact.svg") | 177 | iconSource: Qt.resolvedUrl("assets/contact.svg") |
465 | 180 | text: i18n.tr("Contact") | 178 | text: i18n.tr("Contact") |
466 | 181 | onTriggered: { | 179 | onTriggered: { |
468 | 182 | applicationUtils.switchToAddressbookApp("addressbook://contact?id=" + encodeURIComponent(contactWatcher.contactId)) | 180 | Qt.openUrlExternally("addressbook:///contact?id=" + encodeURIComponent(contactWatcher.contactId)) |
469 | 183 | messagesToolbar.opened = false | 181 | messagesToolbar.opened = false |
470 | 184 | } | 182 | } |
471 | 185 | } | 183 | } |
472 | @@ -191,7 +189,7 @@ | |||
473 | 191 | iconSource: Qt.resolvedUrl("assets/call-start.svg") | 189 | iconSource: Qt.resolvedUrl("assets/call-start.svg") |
474 | 192 | text: i18n.tr("Call") | 190 | text: i18n.tr("Call") |
475 | 193 | onTriggered: { | 191 | onTriggered: { |
477 | 194 | applicationUtils.switchToDialerApp("call://" + contactWatcher.phoneNumber) | 192 | Qt.openUrlExternally("tel:///" + encodeURIComponent(contactWatcher.phoneNumber)) |
478 | 195 | messagesToolbar.opened = false | 193 | messagesToolbar.opened = false |
479 | 196 | } | 194 | } |
480 | 197 | } | 195 | } |
481 | 198 | 196 | ||
482 | === modified file 'src/qml/messaging-app.qml' | |||
483 | --- src/qml/messaging-app.qml 2013-09-13 16:53:30 +0000 | |||
484 | +++ src/qml/messaging-app.qml 2013-10-07 19:24:17 +0000 | |||
485 | @@ -56,6 +56,15 @@ | |||
486 | 56 | mainStack.push(Qt.resolvedUrl("Messages.qml"), properties) | 56 | mainStack.push(Qt.resolvedUrl("Messages.qml"), properties) |
487 | 57 | } | 57 | } |
488 | 58 | 58 | ||
489 | 59 | Connections { | ||
490 | 60 | target: UriHandler | ||
491 | 61 | onOpened: { | ||
492 | 62 | for (var i = 0; i < uris.length; ++i) { | ||
493 | 63 | application.parseArgument(uris[i]) | ||
494 | 64 | } | ||
495 | 65 | } | ||
496 | 66 | } | ||
497 | 67 | |||
498 | 59 | Component { | 68 | Component { |
499 | 60 | id: newcontactPopover | 69 | id: newcontactPopover |
500 | 61 | 70 | ||
501 | @@ -72,7 +81,7 @@ | |||
502 | 72 | ListItem.Standard { | 81 | ListItem.Standard { |
503 | 73 | text: i18n.tr("Create new contact") | 82 | text: i18n.tr("Create new contact") |
504 | 74 | onClicked: { | 83 | onClicked: { |
506 | 75 | applicationUtils.switchToAddressbookApp("create://" + newPhoneNumber) | 84 | Qt.openUrlExternally("addressbook:///create?phone=" + encodeURIComponent(newPhoneNumber)) |
507 | 76 | popover.hide() | 85 | popover.hide() |
508 | 77 | } | 86 | } |
509 | 78 | } | 87 | } |
FAILED: Continuous integration, rev:48 10.97.0. 26:8080/ job/messaging- app-ci/ 66/ 10.97.0. 26:8080/ job/generic- mediumtests- saucy/4738 10.97.0. 26:8080/ job/generic- mediumtests- touch/2557 10.97.0. 26:8080/ job/messaging- app-saucy- amd64-ci/ 66 10.97.0. 26:8080/ job/messaging- app-saucy- armhf-ci/ 66 10.97.0. 26:8080/ job/messaging- app-saucy- armhf-ci/ 66/artifact/ work/output/ *zip*/output. zip 10.97.0. 26:8080/ job/messaging- app-saucy- i386-ci/ 66 10.97.0. 26:8080/ job/autopilot- testrunner- otto-saucy/ 922 10.97.0. 26:8080/ job/generic- mediumtests- builder- saucy-amd64/ 613 10.97.0. 26:8080/ job/generic- mediumtests- builder- saucy-amd64/ 613/artifact/ work/output/ *zip*/output. zip 10.97.0. 26:8080/ job/generic- mediumtests- builder- saucy-armhf/ 2559 10.97.0. 26:8080/ job/generic- mediumtests- builder- saucy-armhf/ 2559/artifact/ work/output/ *zip*/output. zip 10.97.0. 26:8080/ job/generic- mediumtests- runner- maguro/ 2111 10.97.0. 26:8080/ job/generic- mediumtests- runner- mako/2125
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
SUCCESS: http://
Click here to trigger a rebuild: 10.97.0. 26:8080/ job/messaging- app-ci/ 66/rebuild
http://