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

[Sources] Webview on screen keyboard.

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