diff --git a/qml/harbour-fernschreiber.qml b/qml/harbour-fernschreiber.qml
index ce2015b..2845f2c 100644
--- a/qml/harbour-fernschreiber.qml
+++ b/qml/harbour-fernschreiber.qml
@@ -1,3 +1,21 @@
+/*
+ Copyright (C) 2020 Sebastian J. Wolf
+
+ This file is part of Fernschreiber.
+
+ Fernschreiber 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 3 of the License, or
+ (at your option) any later version.
+
+ Fernschreiber is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Fernschreiber. If not, see .
+*/
import QtQuick 2.0
import Sailfish.Silica 1.0
import "pages"
diff --git a/qml/pages/AboutPage.qml b/qml/pages/AboutPage.qml
index 72c150f..82dd21d 100644
--- a/qml/pages/AboutPage.qml
+++ b/qml/pages/AboutPage.qml
@@ -3,12 +3,12 @@
This file is part of Fernschreiber.
- fernschreiber is free software: you can redistribute it and/or modify
+ Fernschreiber 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 3 of the License, or
(at your option) any later version.
- fernschreiber is distributed in the hope that it will be useful,
+ Fernschreiber is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
diff --git a/qml/pages/CoverPage.qml b/qml/pages/CoverPage.qml
index 0f02f8d..7ab7f72 100644
--- a/qml/pages/CoverPage.qml
+++ b/qml/pages/CoverPage.qml
@@ -3,12 +3,12 @@
This file is part of Fernschreiber.
- fernschreiber is free software: you can redistribute it and/or modify
+ Fernschreiber 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 3 of the License, or
(at your option) any later version.
- fernschreiber is distributed in the hope that it will be useful,
+ Fernschreiber is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
diff --git a/qml/pages/InitializationPage.qml b/qml/pages/InitializationPage.qml
index ccdcc4a..d0f68d5 100644
--- a/qml/pages/InitializationPage.qml
+++ b/qml/pages/InitializationPage.qml
@@ -3,12 +3,12 @@
This file is part of Fernschreiber.
- fernschreiber is free software: you can redistribute it and/or modify
+ Fernschreiber 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 3 of the License, or
(at your option) any later version.
- fernschreiber is distributed in the hope that it will be useful,
+ Fernschreiber is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
diff --git a/qml/pages/OverviewPage.qml b/qml/pages/OverviewPage.qml
index 1bb9b6a..49b885c 100644
--- a/qml/pages/OverviewPage.qml
+++ b/qml/pages/OverviewPage.qml
@@ -3,12 +3,12 @@
This file is part of Fernschreiber.
- fernschreiber is free software: you can redistribute it and/or modify
+ Fernschreiber 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 3 of the License, or
(at your option) any later version.
- fernschreiber is distributed in the hope that it will be useful,
+ Fernschreiber is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -37,6 +37,31 @@ Page {
running: overviewPage.loading
}
+ function setPageStatus() {
+ switch (overviewPage.connectionState) {
+ case TelegramAPI.WaitingForNetwork:
+ pageStatus.color = "red";
+ pageHeader.title = qsTr("Waiting for network");
+ break;
+ case TelegramAPI.Connecting:
+ pageStatus.color = "gold";
+ pageHeader.title = qsTr("Connecting to network");
+ break;
+ case TelegramAPI.ConnectingToProxy:
+ pageStatus.color = "gold";
+ pageHeader.title = qsTr("Connecting to proxy");
+ break;
+ case TelegramAPI.ConnectionReady:
+ pageStatus.color = "green";
+ pageHeader.title = qsTr("Fernschreiber");
+ break;
+ case TelegramAPI.Updating:
+ pageStatus.color = "lightblue";
+ pageHeader.title = qsTr("Updating content");
+ break;
+ }
+ }
+
Connections {
target: tdLibWrapper
onAuthorizationStateChanged: {
@@ -61,6 +86,7 @@ Page {
}
onConnectionStateChanged: {
overviewPage.connectionState = connectionState;
+ setPageStatus();
}
}
@@ -71,6 +97,7 @@ Page {
}
overviewPage.connectionState = tdLibWrapper.getConnectionState();
+ overviewPage.setPageStatus();
}
SilicaFlickable {
@@ -91,8 +118,24 @@ Page {
width: parent.width
spacing: Theme.paddingLarge
- PageHeader {
- title: qsTr("Welcome to Fernschreiber")
+ Row {
+ width: parent.width
+
+ GlassItem {
+ id: pageStatus
+ width: Theme.itemSizeMedium
+ height: Theme.itemSizeMedium
+ color: "red"
+ falloffRadius: 0.1
+ radius: 0.2
+ cache: false
+ }
+
+ PageHeader {
+ id: pageHeader
+ title: qsTr("Fernschreiber")
+ width: parent.width - pageStatus.width
+ }
}
VerticalScrollDecorator {}
diff --git a/src/harbour-fernschreiber.cpp b/src/harbour-fernschreiber.cpp
index b307378..2b91580 100644
--- a/src/harbour-fernschreiber.cpp
+++ b/src/harbour-fernschreiber.cpp
@@ -3,12 +3,12 @@
This file is part of Fernschreiber.
- fernschreiber is free software: you can redistribute it and/or modify
+ Fernschreiber 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 3 of the License, or
(at your option) any later version.
- fernschreiber is distributed in the hope that it will be useful,
+ Fernschreiber is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
diff --git a/src/tdlibreceiver.cpp b/src/tdlibreceiver.cpp
index 1dd7e3b..6f6abc7 100644
--- a/src/tdlibreceiver.cpp
+++ b/src/tdlibreceiver.cpp
@@ -3,12 +3,12 @@
This file is part of Fernschreiber.
- fernschreiber is free software: you can redistribute it and/or modify
+ Fernschreiber 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 3 of the License, or
(at your option) any later version.
- fernschreiber is distributed in the hope that it will be useful,
+ Fernschreiber is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -65,6 +65,10 @@ void TDLibReceiver::processReceivedDocument(const QJsonDocument &receivedJsonDoc
if (objectTypeName == "updateConnectionState") {
this->processUpdateConnectionState(receivedInformation);
}
+
+ if (objectTypeName == "updateUser") {
+ this->processUpdateUser(receivedInformation);
+ }
}
void TDLibReceiver::processUpdateOption(const QVariantMap &receivedInformation)
@@ -94,3 +98,10 @@ void TDLibReceiver::processUpdateConnectionState(const QVariantMap &receivedInfo
qDebug() << "[TDLibReceiver] Connection state changed: " << connectionState;
emit connectionStateChanged(connectionState);
}
+
+void TDLibReceiver::processUpdateUser(const QVariantMap &receivedInformation)
+{
+ QVariantMap userInformation = receivedInformation.value("user").toMap();
+ qDebug() << "[TDLibReceiver] User was updated: " << userInformation.value("username").toString() << userInformation.value("first_name").toString() << userInformation.value("last_name").toString();
+ emit userUpdated(userInformation);
+}
diff --git a/src/tdlibreceiver.h b/src/tdlibreceiver.h
index fa5d18d..1e1d016 100644
--- a/src/tdlibreceiver.h
+++ b/src/tdlibreceiver.h
@@ -3,12 +3,12 @@
This file is part of Fernschreiber.
- fernschreiber is free software: you can redistribute it and/or modify
+ Fernschreiber 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 3 of the License, or
(at your option) any later version.
- fernschreiber is distributed in the hope that it will be useful,
+ Fernschreiber is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -40,6 +40,7 @@ signals:
void authorizationStateChanged(const QString &authorizationState);
void optionUpdated(const QString &optionName, const QVariant &optionValue);
void connectionStateChanged(const QString &connectionState);
+ void userUpdated(const QVariantMap &userInformation);
private:
void *tdLibClient;
@@ -50,6 +51,7 @@ private:
void processUpdateOption(const QVariantMap &receivedInformation);
void processUpdateAuthorizationState(const QVariantMap &receivedInformation);
void processUpdateConnectionState(const QVariantMap &receivedInformation);
+ void processUpdateUser(const QVariantMap &receivedInformation);
};
#endif // TDLIBRECEIVER_H
diff --git a/src/tdlibwrapper.cpp b/src/tdlibwrapper.cpp
index 8b13f30..0813ad3 100644
--- a/src/tdlibwrapper.cpp
+++ b/src/tdlibwrapper.cpp
@@ -3,12 +3,12 @@
This file is part of Fernschreiber.
- fernschreiber is free software: you can redistribute it and/or modify
+ Fernschreiber 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 3 of the License, or
(at your option) any later version.
- fernschreiber is distributed in the hope that it will be useful,
+ Fernschreiber is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -40,6 +40,7 @@ TDLibWrapper::TDLibWrapper(QObject *parent) : QObject(parent)
connect(this->tdLibReceiver, SIGNAL(authorizationStateChanged(QString)), this, SLOT(handleAuthorizationStateChanged(QString)));
connect(this->tdLibReceiver, SIGNAL(optionUpdated(QString, QVariant)), this, SLOT(handleOptionUpdated(QString, QVariant)));
connect(this->tdLibReceiver, SIGNAL(connectionStateChanged(QString)), this, SLOT(handleConnectionStateChanged(QString)));
+ connect(this->tdLibReceiver, SIGNAL(userUpdated(QVariantMap)), this, SLOT(handleUserUpdated(QVariantMap)));
this->tdLibReceiver->start();
}
@@ -183,6 +184,16 @@ void TDLibWrapper::handleConnectionStateChanged(const QString &connectionState)
emit connectionStateChanged(this->connectionState);
}
+void TDLibWrapper::handleUserUpdated(const QVariantMap &userInformation)
+{
+ if (userInformation.value("id") == this->options.value("my_id")) {
+ qDebug() << "[TDLibWrapper] Own user information updated :)";
+ this->userInformation = userInformation;
+ } else {
+ qDebug() << "[TDLibWrapper] Other user information updated";
+ }
+}
+
void TDLibWrapper::setInitialParameters()
{
qDebug() << "[TDLibWrapper] Sending initial parameters to TD Lib";
@@ -192,6 +203,8 @@ void TDLibWrapper::setInitialParameters()
initialParameters.insert("api_id", TDLIB_API_ID);
initialParameters.insert("api_hash", TDLIB_API_HASH);
initialParameters.insert("database_directory", QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/tdlib");
+ initialParameters.insert("use_file_database", true);
+ initialParameters.insert("use_chat_info_database", true);
initialParameters.insert("use_message_database", true);
initialParameters.insert("use_secret_chats", false);
initialParameters.insert("system_language_code", QLocale::system().name());
diff --git a/src/tdlibwrapper.h b/src/tdlibwrapper.h
index 6540719..cf91bb2 100644
--- a/src/tdlibwrapper.h
+++ b/src/tdlibwrapper.h
@@ -3,12 +3,12 @@
This file is part of Fernschreiber.
- fernschreiber is free software: you can redistribute it and/or modify
+ Fernschreiber 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 3 of the License, or
(at your option) any later version.
- fernschreiber is distributed in the hope that it will be useful,
+ Fernschreiber is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -76,6 +76,7 @@ public slots:
void handleAuthorizationStateChanged(const QString &authorizationState);
void handleOptionUpdated(const QString &optionName, const QVariant &optionValue);
void handleConnectionStateChanged(const QString &connectionState);
+ void handleUserUpdated(const QVariantMap &userInformation);
private:
void *tdLibClient;
@@ -84,6 +85,7 @@ private:
TDLibWrapper::AuthorizationState authorizationState;
TDLibWrapper::ConnectionState connectionState;
QVariantMap options;
+ QVariantMap userInformation;
void setInitialParameters();
void setEncryptionKey();
diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts
index 599ee3d..7bf014d 100644
--- a/translations/harbour-fernschreiber-de.ts
+++ b/translations/harbour-fernschreiber-de.ts
@@ -106,11 +106,27 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts
index 599ee3d..7bf014d 100644
--- a/translations/harbour-fernschreiber.ts
+++ b/translations/harbour-fernschreiber.ts
@@ -106,11 +106,27 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+