2018-10-11 21:52:42 +01:00
|
|
|
/**
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-FileCopyrightText: 2018 Aleix Pol Gonzalez <aleixpol@kde.org>
|
|
|
|
* SPDX-FileCopyrightText: 2018 Simon Redman <simon@ergotech.com>
|
2018-03-25 19:40:59 +01:00
|
|
|
*
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
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 "conversationlistmodel.h"
|
2022-09-10 22:23:52 +01:00
|
|
|
#include "conversationmodel.h"
|
2020-03-29 19:25:07 +01:00
|
|
|
#include "conversationssortfilterproxymodel.h"
|
(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 "kdeconnect-version.h"
|
2022-09-10 22:23:52 +01:00
|
|
|
#include "thumbnailsprovider.h"
|
(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
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
#include <KAboutData>
|
|
|
|
#include <KColorSchemeManager>
|
|
|
|
#include <KDBusService>
|
|
|
|
#include <KLocalizedContext>
|
|
|
|
#include <KLocalizedString>
|
2018-03-25 19:40:59 +01:00
|
|
|
#include <QApplication>
|
|
|
|
#include <QCommandLineParser>
|
2022-09-10 22:23:52 +01:00
|
|
|
#include <QQmlApplicationEngine>
|
2018-03-25 19:40:59 +01:00
|
|
|
#include <QQmlContext>
|
2021-03-08 20:25:47 +00:00
|
|
|
#include <QQuickStyle>
|
2018-03-25 19:40:59 +01:00
|
|
|
|
2020-05-09 17:50:08 +01:00
|
|
|
#include "smshelper.h"
|
|
|
|
|
2022-05-12 19:34:24 +01:00
|
|
|
class AppData : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(QString initialMessage MEMBER m_initialMessage NOTIFY initialMessageChanged)
|
2022-05-30 21:29:17 +01:00
|
|
|
Q_PROPERTY(QString deviceId MEMBER m_deviceId NOTIFY deviceIdChanged)
|
2022-05-12 19:34:24 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
Q_SIGNAL void initialMessageChanged();
|
2022-05-30 21:29:17 +01:00
|
|
|
Q_SIGNAL void deviceIdChanged();
|
2022-05-12 19:34:24 +01:00
|
|
|
|
|
|
|
QString m_initialMessage;
|
2022-05-30 21:29:17 +01:00
|
|
|
QString m_deviceId;
|
2022-05-12 19:34:24 +01:00
|
|
|
};
|
|
|
|
|
2018-03-25 19:40:59 +01:00
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2021-07-27 22:03:51 +01:00
|
|
|
QIcon::setFallbackThemeName(QStringLiteral("breeze"));
|
|
|
|
|
2022-04-02 13:32:54 +01:00
|
|
|
QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
|
|
|
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
2018-03-25 19:40:59 +01:00
|
|
|
QApplication app(argc, argv);
|
2021-05-23 06:12:29 +01:00
|
|
|
app.setWindowIcon(QIcon::fromTheme(QStringLiteral("kdeconnect")));
|
2019-07-21 16:29:42 +01:00
|
|
|
KAboutData aboutData(QStringLiteral("kdeconnect.sms"),
|
|
|
|
i18n("KDE Connect SMS"),
|
2020-07-01 21:48:43 +01:00
|
|
|
QStringLiteral(KDECONNECT_VERSION_STRING),
|
|
|
|
i18n("SMS Instant Messaging"),
|
2019-07-22 18:42:32 +01:00
|
|
|
KAboutLicense::GPL_V3,
|
2022-07-20 16:15:21 +01:00
|
|
|
i18n("(C) 2018-2022, KDE Connect Team"));
|
2019-07-21 11:55:25 +01:00
|
|
|
aboutData.addAuthor(i18n("Simon Redman"), {}, QStringLiteral("simon@ergotech.com"));
|
2019-06-10 15:40:28 +01:00
|
|
|
aboutData.addAuthor(i18n("Aleix Pol Gonzalez"), {}, QStringLiteral("aleixpol@kde.org"));
|
|
|
|
aboutData.addAuthor(i18n("Nicolas Fella"), {}, QStringLiteral("nicolas.fella@gmx.de"));
|
2022-07-20 16:15:21 +01:00
|
|
|
aboutData.setBugAddress(QStringLiteral("https://bugs.kde.org/enter_bug.cgi?product=kdeconnect&component=messaging-application").toUtf8());
|
2018-03-25 19:40:59 +01:00
|
|
|
KAboutData::setApplicationData(aboutData);
|
|
|
|
|
2021-06-02 22:45:21 +01:00
|
|
|
#ifdef Q_OS_WIN
|
2021-06-13 09:19:12 +01:00
|
|
|
KColorSchemeManager manager;
|
2021-06-02 22:45:21 +01:00
|
|
|
QApplication::setStyle(QStringLiteral("breeze"));
|
|
|
|
#endif
|
|
|
|
|
2021-03-08 20:25:47 +00:00
|
|
|
// Default to org.kde.desktop style unless the user forces another style
|
|
|
|
if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE")) {
|
|
|
|
QQuickStyle::setStyle(QStringLiteral("org.kde.desktop"));
|
|
|
|
}
|
|
|
|
|
2022-05-12 19:34:24 +01:00
|
|
|
AppData data;
|
[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
|
|
|
|
2022-05-12 19:34:24 +01:00
|
|
|
QCommandLineParser parser;
|
|
|
|
aboutData.setupCommandLine(&parser);
|
|
|
|
parser.addOption(QCommandLineOption(QStringLiteral("device"), i18n("Select a device"), i18n("id")));
|
|
|
|
parser.addOption(QCommandLineOption(QStringLiteral("message"), i18n("Send a message"), i18n("message")));
|
|
|
|
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
|
|
|
|
2022-05-12 19:34:24 +01:00
|
|
|
data.m_initialMessage = parser.value(QStringLiteral("message"));
|
2022-05-30 21:29:17 +01:00
|
|
|
data.m_deviceId = parser.value(QStringLiteral("device"));
|
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
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
QObject::connect(&service, &KDBusService::activateRequested, &service, [&parser, &data](const QStringList &args, const QString & /*workDir*/) {
|
2022-05-12 19:34:24 +01:00
|
|
|
parser.parse(args);
|
|
|
|
|
|
|
|
data.m_initialMessage = parser.value(QStringLiteral("message"));
|
2022-05-30 21:29:17 +01:00
|
|
|
data.m_deviceId = parser.value(QStringLiteral("device"));
|
2022-05-12 19:34:24 +01:00
|
|
|
|
2022-05-30 21:29:17 +01:00
|
|
|
Q_EMIT data.deviceIdChanged();
|
2022-05-12 19:34:24 +01:00
|
|
|
Q_EMIT data.initialMessageChanged();
|
|
|
|
});
|
|
|
|
|
2020-03-29 19:25:07 +01:00
|
|
|
qmlRegisterType<ConversationsSortFilterProxyModel>("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
|
|
|
|
2020-05-09 17:50:08 +01:00
|
|
|
qmlRegisterSingletonType<SmsHelper>("org.kde.kdeconnect.sms", 1, 0, "SmsHelper", SmsHelper::singletonProvider);
|
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
qmlRegisterSingletonInstance<AppData>("org.kde.kdeconnect.sms", 1, 0, "AppData", &data);
|
2022-05-12 19:34:24 +01:00
|
|
|
|
2018-03-25 19:40:59 +01:00
|
|
|
QQmlApplicationEngine engine;
|
|
|
|
engine.rootContext()->setContextObject(new KLocalizedContext(&engine));
|
2020-08-09 20:00:57 +01:00
|
|
|
engine.addImageProvider(QStringLiteral("thumbnailsProvider"), new ThumbnailsProvider);
|
2022-09-10 22:23:52 +01:00
|
|
|
engine.rootContext()->setContextProperties({{QStringLiteral("aboutData"), QVariant::fromValue(KAboutData::applicationData())}});
|
2019-06-10 15:40:28 +01:00
|
|
|
engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml")));
|
2018-03-25 19:40:59 +01:00
|
|
|
|
|
|
|
return app.exec();
|
|
|
|
}
|
2022-05-12 19:34:24 +01:00
|
|
|
|
|
|
|
#include "main.moc"
|