2018-10-11 21:52:42 +01:00
|
|
|
/**
|
|
|
|
* Copyright (C) 2018 Aleix Pol Gonzalez <aleixpol@kde.org>
|
2018-10-06 01:01:30 +01:00
|
|
|
* Copyright (C) 2018 Simon Redman <simon@ergotech.com>
|
2018-03-25 19:40:59 +01:00
|
|
|
*
|
2018-10-11 21:52:42 +01:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of
|
|
|
|
* the License or (at your option) version 3 or any later version
|
|
|
|
* accepted by the membership of KDE e.V. (or its successor approved
|
|
|
|
* by the membership of KDE e.V.), which shall act as a proxy
|
|
|
|
* defined in Section 14 of version 3 of the license.
|
2018-03-25 19:40:59 +01:00
|
|
|
*
|
2018-10-11 21:52:42 +01:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
2018-03-25 19:40:59 +01:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2018-10-11 21:52:42 +01:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2018-03-25 19:40:59 +01:00
|
|
|
*
|
2018-10-11 21:52:42 +01:00
|
|
|
* You should have received a copy of the GNU General Public License
|
2019-03-23 16:29:26 +00:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2018-03-25 19:40:59 +01:00
|
|
|
*/
|
|
|
|
|
(WIP) Upgrade Telephony plugin to read SMS history (KDE side)
Summary:
For real usecases of SMS support, we will almost always need access to the message history in some way
Specifically resolve T8338
Incidentally resolve T6651 since Telephony shall no longer create a notification
Test Plan:
Setup:
- Build corresponding Android-side diff (D11698)
- Build this diff
Step 1: Does anything at all work?
- Put a breakpoint in the handleBatchMessages method of the telephony plugin, ideally after constructing a Message object
- Use DBus to poke /modules/kdeconnect/devices/<deviceID>/telephony.requestAllConversations()
- Verify that the constructed Message is one you sent or received and that it is the most recent in the corresponding conversation
Step 2: DBus
- Open the Interface org.kde.kdeconnect.device.conversations of /modules/kdeconnect/devices/<deviceId>
- Poke activeConversations and verify an empty array is returned
- Poke requestAllConversationThreads
- Poke activeConversations and verify that a list of numbers has been returned. These are conversationIds
- Use a conversationId to call getFirstFromConversation
- Verify that the returned Message object is one which you recognize
- Note that if the message is an MMS it will be blank and meaningless. Try a different conversationId. MMS support "coming soon!"
Step 3: SMS App
- Use ccmake (or similar) to set SMSAPP_ENABLE to ON
- Build the project
- Run ./bin/kdeconnect-sms
- Verify that the app shows a list of everyone you have an SMS conversation with (MMS messages are stripped out)
- If you have the Contacts plugin working, verify that most contacts have their name and photo instead of their phone number
Reviewers: #kde_connect, nicolasfella, apol
Reviewed By: #kde_connect, nicolasfella, apol
Subscribers: andyholmes, apol, nicolasfella, #kde_connect
Tags: #kde_connect
Maniphest Tasks: T8338, T6651
Differential Revision: https://phabricator.kde.org/D11854
2018-05-25 15:21:56 +01:00
|
|
|
#include "conversationmodel.h"
|
|
|
|
#include "conversationlistmodel.h"
|
|
|
|
#include "kdeconnect-version.h"
|
|
|
|
|
2018-03-25 19:40:59 +01:00
|
|
|
#include <QApplication>
|
|
|
|
#include <QQmlApplicationEngine>
|
|
|
|
#include <QCommandLineParser>
|
|
|
|
#include <QQmlContext>
|
|
|
|
#include <KAboutData>
|
|
|
|
#include <KLocalizedString>
|
|
|
|
#include <KLocalizedContext>
|
|
|
|
#include <KDBusService>
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
QApplication app(argc, argv);
|
|
|
|
KAboutData aboutData("org.kde.kdeconnect.sms", i18n("SMS Instant Messaging"), QStringLiteral(KDECONNECT_VERSION_STRING), i18n("KDE Connect SMS"), KAboutLicense::GPL, i18n("(c) 2018, Aleix Pol Gonzalez"));
|
|
|
|
aboutData.addAuthor(i18n("Aleix Pol Gonzalez"), {}, "aleixpol@kde.org");
|
2018-10-06 01:01:30 +01:00
|
|
|
aboutData.addAuthor(i18n("Nicolas Fella"), {}, "nicolas.fella@gmx.de");
|
|
|
|
aboutData.addAuthor(i18n("Simon Redman"), {}, "simon@ergotech.com");
|
2018-03-25 19:40:59 +01:00
|
|
|
KAboutData::setApplicationData(aboutData);
|
|
|
|
|
[SMS App] Allow passing a message via args
Summary:
Add --message option to kdeconnect-sms to pass a message. The user only needs to choose a recepient and the message will be sent. Useful for integration with 3rd party
apps, e.g. via Purpose
Test Plan:
kdeconnect-sms --message "Hello World", choose chat, message is sent
Click another chat, no message sent
kdeconnect-sms without args, no message sent
Reviewers: #kde_connect, sredman
Reviewed By: #kde_connect, sredman
Subscribers: andyholmes, sredman, apol, kdeconnect
Tags: #kde_connect
Differential Revision: https://phabricator.kde.org/D17292
2019-03-09 21:32:36 +00:00
|
|
|
QString initialMessage;
|
|
|
|
|
2018-03-25 19:40:59 +01:00
|
|
|
{
|
|
|
|
QCommandLineParser parser;
|
|
|
|
aboutData.setupCommandLine(&parser);
|
|
|
|
parser.addVersionOption();
|
|
|
|
parser.addHelpOption();
|
[SMS App] Allow passing a message via args
Summary:
Add --message option to kdeconnect-sms to pass a message. The user only needs to choose a recepient and the message will be sent. Useful for integration with 3rd party
apps, e.g. via Purpose
Test Plan:
kdeconnect-sms --message "Hello World", choose chat, message is sent
Click another chat, no message sent
kdeconnect-sms without args, no message sent
Reviewers: #kde_connect, sredman
Reviewed By: #kde_connect, sredman
Subscribers: andyholmes, sredman, apol, kdeconnect
Tags: #kde_connect
Differential Revision: https://phabricator.kde.org/D17292
2019-03-09 21:32:36 +00:00
|
|
|
parser.addOption(QCommandLineOption(QStringLiteral("message"), i18n("Send a message"), i18n("message")));
|
2018-03-25 19:40:59 +01:00
|
|
|
parser.process(app);
|
|
|
|
aboutData.processCommandLine(&parser);
|
[SMS App] Allow passing a message via args
Summary:
Add --message option to kdeconnect-sms to pass a message. The user only needs to choose a recepient and the message will be sent. Useful for integration with 3rd party
apps, e.g. via Purpose
Test Plan:
kdeconnect-sms --message "Hello World", choose chat, message is sent
Click another chat, no message sent
kdeconnect-sms without args, no message sent
Reviewers: #kde_connect, sredman
Reviewed By: #kde_connect, sredman
Subscribers: andyholmes, sredman, apol, kdeconnect
Tags: #kde_connect
Differential Revision: https://phabricator.kde.org/D17292
2019-03-09 21:32:36 +00:00
|
|
|
|
|
|
|
if (parser.isSet(QStringLiteral("message"))) {
|
|
|
|
initialMessage = parser.value(QStringLiteral("message"));
|
|
|
|
}
|
2018-03-25 19:40:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
KDBusService service(KDBusService::Unique);
|
(WIP) Upgrade Telephony plugin to read SMS history (KDE side)
Summary:
For real usecases of SMS support, we will almost always need access to the message history in some way
Specifically resolve T8338
Incidentally resolve T6651 since Telephony shall no longer create a notification
Test Plan:
Setup:
- Build corresponding Android-side diff (D11698)
- Build this diff
Step 1: Does anything at all work?
- Put a breakpoint in the handleBatchMessages method of the telephony plugin, ideally after constructing a Message object
- Use DBus to poke /modules/kdeconnect/devices/<deviceID>/telephony.requestAllConversations()
- Verify that the constructed Message is one you sent or received and that it is the most recent in the corresponding conversation
Step 2: DBus
- Open the Interface org.kde.kdeconnect.device.conversations of /modules/kdeconnect/devices/<deviceId>
- Poke activeConversations and verify an empty array is returned
- Poke requestAllConversationThreads
- Poke activeConversations and verify that a list of numbers has been returned. These are conversationIds
- Use a conversationId to call getFirstFromConversation
- Verify that the returned Message object is one which you recognize
- Note that if the message is an MMS it will be blank and meaningless. Try a different conversationId. MMS support "coming soon!"
Step 3: SMS App
- Use ccmake (or similar) to set SMSAPP_ENABLE to ON
- Build the project
- Run ./bin/kdeconnect-sms
- Verify that the app shows a list of everyone you have an SMS conversation with (MMS messages are stripped out)
- If you have the Contacts plugin working, verify that most contacts have their name and photo instead of their phone number
Reviewers: #kde_connect, nicolasfella, apol
Reviewed By: #kde_connect, nicolasfella, apol
Subscribers: andyholmes, apol, nicolasfella, #kde_connect
Tags: #kde_connect
Maniphest Tasks: T8338, T6651
Differential Revision: https://phabricator.kde.org/D11854
2018-05-25 15:21:56 +01:00
|
|
|
|
|
|
|
qmlRegisterType<OurSortFilterProxyModel>("org.kde.kdeconnect.sms", 1, 0, "QSortFilterProxyModel");
|
2018-05-16 02:42:00 +01:00
|
|
|
qmlRegisterType<ConversationModel>("org.kde.kdeconnect.sms", 1, 0, "ConversationModel");
|
(WIP) Upgrade Telephony plugin to read SMS history (KDE side)
Summary:
For real usecases of SMS support, we will almost always need access to the message history in some way
Specifically resolve T8338
Incidentally resolve T6651 since Telephony shall no longer create a notification
Test Plan:
Setup:
- Build corresponding Android-side diff (D11698)
- Build this diff
Step 1: Does anything at all work?
- Put a breakpoint in the handleBatchMessages method of the telephony plugin, ideally after constructing a Message object
- Use DBus to poke /modules/kdeconnect/devices/<deviceID>/telephony.requestAllConversations()
- Verify that the constructed Message is one you sent or received and that it is the most recent in the corresponding conversation
Step 2: DBus
- Open the Interface org.kde.kdeconnect.device.conversations of /modules/kdeconnect/devices/<deviceId>
- Poke activeConversations and verify an empty array is returned
- Poke requestAllConversationThreads
- Poke activeConversations and verify that a list of numbers has been returned. These are conversationIds
- Use a conversationId to call getFirstFromConversation
- Verify that the returned Message object is one which you recognize
- Note that if the message is an MMS it will be blank and meaningless. Try a different conversationId. MMS support "coming soon!"
Step 3: SMS App
- Use ccmake (or similar) to set SMSAPP_ENABLE to ON
- Build the project
- Run ./bin/kdeconnect-sms
- Verify that the app shows a list of everyone you have an SMS conversation with (MMS messages are stripped out)
- If you have the Contacts plugin working, verify that most contacts have their name and photo instead of their phone number
Reviewers: #kde_connect, nicolasfella, apol
Reviewed By: #kde_connect, nicolasfella, apol
Subscribers: andyholmes, apol, nicolasfella, #kde_connect
Tags: #kde_connect
Maniphest Tasks: T8338, T6651
Differential Revision: https://phabricator.kde.org/D11854
2018-05-25 15:21:56 +01:00
|
|
|
qmlRegisterType<ConversationListModel>("org.kde.kdeconnect.sms", 1, 0, "ConversationListModel");
|
2018-05-16 02:42:00 +01:00
|
|
|
|
2018-03-25 19:40:59 +01:00
|
|
|
QQmlApplicationEngine engine;
|
|
|
|
engine.rootContext()->setContextObject(new KLocalizedContext(&engine));
|
[SMS App] Allow passing a message via args
Summary:
Add --message option to kdeconnect-sms to pass a message. The user only needs to choose a recepient and the message will be sent. Useful for integration with 3rd party
apps, e.g. via Purpose
Test Plan:
kdeconnect-sms --message "Hello World", choose chat, message is sent
Click another chat, no message sent
kdeconnect-sms without args, no message sent
Reviewers: #kde_connect, sredman
Reviewed By: #kde_connect, sredman
Subscribers: andyholmes, sredman, apol, kdeconnect
Tags: #kde_connect
Differential Revision: https://phabricator.kde.org/D17292
2019-03-09 21:32:36 +00:00
|
|
|
engine.rootContext()->setContextProperty(QStringLiteral("_initialMessage"), QVariant(initialMessage));
|
2018-03-25 19:40:59 +01:00
|
|
|
engine.load(QUrl("qrc:/qml/main.qml"));
|
|
|
|
|
|
|
|
return app.exec();
|
|
|
|
}
|