Коммит d20f8cc9 создал по автору Костерин Максим's avatar Костерин Максим Зафиксировано автором OMP Education
Просмотр файлов

[Sources] Webview on screen keyboard.

владелец 16a72366
......@@ -62,6 +62,7 @@ The configuration JSON-file contains:
5. [description] Full description.
6. [icon] Path to application icons in 86x86, 108x108, 128x128 and 172x172 resolutions.
7. [application_permission] List of application permissions (required).
8. [desktop_name] Application name displayed to the user.
2. [background_activity] Behavior of the application in the background (required):
* [true] Work in background, display WebView content on cover.
* [false] Don't run in background (clear webview by timeout when in background).
......
......@@ -62,6 +62,7 @@ python3 .\generator.py .\template\template.json -p .\template\
5. [description] Полное описание.
6. [icon] Путь к значкам приложения, доступных в разрешениях 86x86, 108x108, 128x128 и 172x172.
7. [application_permission] Список разрешений приложения (обязательное).
8. [desktop_name] Название приложения, отображаемое под иконкой.
2. [background_activity] Поведение приложения в фоновом режиме (обязательное):
* [true] Работа в фоновом режиме, отображение содержимого WebView на обложке приложения.
* [false] Отключение работы в фоновом режиме (очистка содержимого WebView по истечению заданного периода при нахождении приложения в фоновом режиме).
......
......@@ -56,8 +56,9 @@ public:
{
if (ncm.isOnline()) {
setRunning(true);
QNetworkRequest req(QUrl(TARGET_URL));
req.setRawHeader(QByteArray("Host"), TARGET_URL);
QUrl url(TARGET_URL);
QNetworkRequest req(url);
req.setRawHeader(QByteArray("Host"), url.host(QUrl::FullyEncoded).toUtf8());
nam.get(req);
} else {
setConnected(false);
......@@ -74,12 +75,10 @@ private slots:
* The lack of reply's content means the host is unreachable.
* \param reply HTTP reply to a request.
*/
void handleReply(QNetworkReply *reply)
{
quint64 size = reply->bytesAvailable();
reply->deleteLater();
void handleReply(QNetworkReply* reply) {
setRunning(false);
setConnected(size > 0);
setConnected(reply->error() == QNetworkReply::NoError);
reply->deleteLater();
}
private:
......
......@@ -61,7 +61,7 @@ f"""
QScopedPointer<QQuickView> view(Aurora::Application::createView());
view->rootContext()->setContextProperty("targetUrl", TARGET_URL);
view->setSource(
Aurora::Application::pathTo(QStringLiteral("qml/ru.auroraos.DevPortalWEB.qml")));
Aurora::Application::pathTo(QStringLiteral("qml/{self.config.full_name}.qml")));
view->show();
return application->exec();
......
......@@ -46,7 +46,7 @@ f"""
"""
else:
content +=\
"""
fr"""
%description
%{{summary}}.
"""
......
......@@ -39,6 +39,36 @@ Page {{
}}
}}
property real maxHeight: {{
switch (orientation) {{
case Orientation.Portrait:
return Screen.height;
case Orientation.Landscape:
return Screen.width;
case Orientation.PortraitInverted:
return Screen.height;
case Orientation.LandscapeInverted:
return Screen.width;
}}
}}
property real cutoutOffset: {{
switch (orientation) {{
case Orientation.Portrait:
return Math.max(SafeZoneRect.insets.top, SafeZoneRect.appInsets.top)
case Orientation.Landscape:
return Math.max(SafeZoneRect.insets.left,
SafeZoneRect.appInsets.top)
case Orientation.PortraitInverted:
return Math.max(SafeZoneRect.insets.bottom,
SafeZoneRect.appInsets.top)
case Orientation.LandscapeInverted:
return Math.max(SafeZoneRect.insets.right,
SafeZoneRect.appInsets.top)
}}
}}
backNavigation: false
ConnectionHeader {{
......@@ -73,8 +103,6 @@ Page {{
WebView {{
id: webView
property string destUrl: ""
"""
if self.config.background_activity:
content +=\
......@@ -92,9 +120,11 @@ fr"""
anchors {{
left: parent.left
right: parent.right
bottom: parent.bottom
top: connectionHeader.bottom
}}
height: (maxHeight - connectionHeader.height - cutoutOffset)
footerMargin: keyboardOpened ? cutoutOffset : 0
urlLoadingOverride: function (data) {{
"""
if self.config.frame_urls:
......
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать