Skip to content
Snippets Groups Projects
Commit 9facf21d authored by Nicolas Werner's avatar Nicolas Werner
Browse files

Bind mxidEntered to slot

parent 749cf25b
No related branches found
No related tags found
No related merge requests found
......@@ -35,7 +35,8 @@ DEFINES += "BOOST_MPL_LIMIT_LIST_SIZE=30"
CONFIG += sailfishapp
CONFIG += c++14
SOURCES += src/harbour-matrix.cpp
SOURCES += src/harbour-matrix.cpp \
src/login.cpp
DISTFILES += qml/harbour-matrix.qml \
qml/cover/CoverPage.qml \
......@@ -60,3 +61,6 @@ CONFIG += sailfishapp_i18n
# following TRANSLATIONS line. And also do not forget to
# modify the localized app name in the the .desktop file.
TRANSLATIONS += translations/harbour-matrix-de.ts
HEADERS += \
src/login.h
......@@ -50,7 +50,7 @@ Page {
placeholderText: label
EnterKey.enabled: text || inputMethodComposing
EnterKey.iconSource: "image://theme/icon-m-enter-next"
EnterKey.onClicked: password.focus = true
EnterKey.onClicked: {login.mxidEntered(text); password.focus = true;}
validator: RegExpValidator {
regExp: /@[a-z0-9\._=\-/]+:.+/
}
......
......@@ -6,6 +6,8 @@
#include <mtx.hpp>
#include "login.h"
int main(int argc, char *argv[])
{
// SailfishApp::main() will display "qml/harbour-matrix.qml", if you need more
......@@ -23,6 +25,8 @@ int main(int argc, char *argv[])
// Set up QML engine.
QScopedPointer<QGuiApplication> app(SailfishApp::application(argc, argv));
QScopedPointer<QQuickView> v(SailfishApp::createView());
Login login;
v->rootContext()->setContextProperty("login", &login);
// If you wish to publish your app on the Jolla harbour, it is recommended
// that you prefix your internal namespaces with "harbour.".
......
#include "login.h"
#include <iostream>
#include <exception>
Login::Login(QObject *parent) : QObject(parent)
{
}
void Login::mxidEntered(QString mxid)
{
std::cout << mxid.toStdString();
}
#ifndef LOGIN_H
#define LOGIN_H
#include <QObject>
class Login : public QObject
{
Q_OBJECT
public:
explicit Login(QObject *parent = nullptr);
signals:
public slots:
void mxidEntered(QString mxid);
};
#endif // LOGIN_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment