Commit f256e32f authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

smsapp: add main contextual actions

Includes an about page and a refresh button for the conversations.
parent ed9e3028
Pipeline #5642 passed with stage
in 17 minutes and 11 seconds
......@@ -89,8 +89,18 @@ void ConversationListModel::setDeviceId(const QString& deviceId)
m_conversationsInterface = new DeviceConversationsDbusInterface(deviceId, this);
connect(m_conversationsInterface, SIGNAL(conversationCreated(QDBusVariant)), this, SLOT(handleCreatedConversation(QDBusVariant)));
connect(m_conversationsInterface, SIGNAL(conversationUpdated(QDBusVariant)), this, SLOT(handleConversationUpdated(QDBusVariant)));
prepareConversationsList();
refresh();
}
void ConversationListModel::refresh()
{
if (m_deviceId.isEmpty()) {
qWarning() << "refreshing null device";
return;
}
prepareConversationsList();
m_conversationsInterface->requestAllConversationThreads();
}
......
......@@ -90,6 +90,8 @@ public:
QString deviceId() const { return m_deviceId; }
void setDeviceId(const QString &/*deviceId*/);
Q_SCRIPTABLE void refresh();
public Q_SLOTS:
void handleCreatedConversation(const QDBusVariant& msg);
void handleConversationUpdated(const QDBusVariant& msg);
......
......@@ -36,9 +36,9 @@ int main(int argc, char *argv[])
{
QApplication app(argc, argv);
KAboutData aboutData(QStringLiteral("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("Simon Redman"), {}, QStringLiteral("simon@ergotech.com"));
aboutData.addAuthor(i18n("Aleix Pol Gonzalez"), {}, QStringLiteral("aleixpol@kde.org"));
aboutData.addAuthor(i18n("Nicolas Fella"), {}, QStringLiteral("nicolas.fella@gmx.de"));
aboutData.addAuthor(i18n("Simon Redman"), {}, QStringLiteral("simon@ergotech.com"));
KAboutData::setApplicationData(aboutData);
QString initialMessage;
......@@ -67,6 +67,7 @@ int main(int argc, char *argv[])
QQmlApplicationEngine engine;
engine.rootContext()->setContextObject(new KLocalizedContext(&engine));
engine.rootContext()->setContextProperty(QStringLiteral("_initialMessage"), QVariant(initialMessage));
engine.rootContext()->setContextProperty(QStringLiteral("aboutData"), QVariant::fromValue(KAboutData::applicationData()));
engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml")));
return app.exec();
......
......@@ -24,7 +24,7 @@ import QtQuick 2.5
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.1
import org.kde.people 1.0
import org.kde.kirigami 2.4 as Kirigami
import org.kde.kirigami 2.6 as Kirigami
import org.kde.kdeconnect 1.0
import org.kde.kdeconnect.sms 1.0
......@@ -49,6 +49,29 @@ Kirigami.ScrollablePage
}
}
contextualActions: [
Kirigami.Action {
text: i18n("Refresh")
icon.name: "view-refresh"
enabled: devicesCombo.count > 0
onTriggered: {
conversationListModel.refresh()
}
},
Kirigami.Action {
text: i18n("About...")
icon.name: "help-about"
onTriggered: {
applicationWindow().pageStack.push(aboutPageComponent, { aboutData: aboutData });
}
}
]
Component {
id: aboutPageComponent
Kirigami.AboutPage {}
}
property string initialMessage
header: Kirigami.InlineMessage {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment