diff --git a/qml/components/chatInformationPage/ChatInformationPageContent.qml b/qml/components/chatInformationPage/ChatInformationPageContent.qml index 0d63419..f8470fb 100644 --- a/qml/components/chatInformationPage/ChatInformationPageContent.qml +++ b/qml/components/chatInformationPage/ChatInformationPageContent.qml @@ -192,9 +192,6 @@ SilicaFlickable { id: membersList } - AppNotification { - id: infoNotification - } PullDownMenu { MenuItem { visible: (chatInformationPage.isSuperGroup || chatInformationPage.isBasicGroup) && chatInformationPage.groupInformation && chatInformationPage.groupInformation.status["@type"] !== "chatMemberStatusBanned" @@ -420,7 +417,7 @@ SilicaFlickable { anchors.verticalCenter: inviteLinkItem.verticalCenter onClicked: { Clipboard.text = chatInformationPage.groupFullInformation.invite_link - infoNotification.show(qsTr("The Invite Link has been copied to the clipboard.")); + appNotification.show(qsTr("The Invite Link has been copied to the clipboard.")); } } } diff --git a/qml/harbour-fernschreiber.qml b/qml/harbour-fernschreiber.qml index 761ba3b..f2b8cdb 100644 --- a/qml/harbour-fernschreiber.qml +++ b/qml/harbour-fernschreiber.qml @@ -19,6 +19,8 @@ import QtQuick 2.6 import Sailfish.Silica 1.0 import "pages" +import "components" +import "./js/functions.js" as Functions ApplicationWindow { @@ -37,4 +39,16 @@ ApplicationWindow appWindow.activate(); } } + + AppNotification { + id: appNotification + parent: pageStack.currentPage + } + + Component.onCompleted: { + Functions.setGlobals({ + tdLibWrapper: tdLibWrapper, + appNotification: appNotification + }); + } } diff --git a/qml/js/functions.js b/qml/js/functions.js index aa12234..b1b9735 100644 --- a/qml/js/functions.js +++ b/qml/js/functions.js @@ -21,6 +21,13 @@ .import "debug.js" as Debug .import Sailfish.Silica 1.0 as Silica +var tdLibWrapper; +var appNotification; +function setGlobals(globals) { + tdLibWrapper = globals.tdLibWrapper; + appNotification = globals.appNotification; +} + function getUserName(userInformation) { var firstName = typeof userInformation.first_name !== "undefined" ? userInformation.first_name : ""; var lastName = typeof userInformation.last_name !== "undefined" ? userInformation.last_name : ""; diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index 70bb91d..0c77e58 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -579,10 +579,6 @@ Page { } } - AppNotification { - id: appNotification - } - BackgroundItem { id: headerMouseArea height: headerRow.height diff --git a/qml/pages/ImagePage.qml b/qml/pages/ImagePage.qml index b0d67cf..eb301d7 100644 --- a/qml/pages/ImagePage.qml +++ b/qml/pages/ImagePage.qml @@ -82,11 +82,11 @@ Page { } } onCopyToDownloadsSuccessful: { - imageNotification.show(qsTr("Download of %1 successful.").arg(fileName), filePath); + appNotification.show(qsTr("Download of %1 successful.").arg(fileName), filePath); } onCopyToDownloadsError: { - imageNotification.show(qsTr("Download failed.")); + appNotification.show(qsTr("Download failed.")); } } @@ -105,10 +105,6 @@ Page { } } - AppNotification { - id: imageNotification - } - SilicaFlickable { id: imageFlickable anchors.fill: parent diff --git a/qml/pages/OverviewPage.qml b/qml/pages/OverviewPage.qml index 4560355..5f3dde6 100644 --- a/qml/pages/OverviewPage.qml +++ b/qml/pages/OverviewPage.qml @@ -187,10 +187,6 @@ Page { } } - AppNotification { - id: appNotification - } - Column { id: column width: parent.width diff --git a/qml/pages/VideoPage.qml b/qml/pages/VideoPage.qml index b6c1e81..ee4922d 100644 --- a/qml/pages/VideoPage.qml +++ b/qml/pages/VideoPage.qml @@ -74,18 +74,14 @@ Page { } } onCopyToDownloadsSuccessful: { - videoNotification.show(qsTr("Download of %1 successful.").arg(fileName), filePath); + appNotification.show(qsTr("Download of %1 successful.").arg(fileName), filePath); } onCopyToDownloadsError: { - videoNotification.show(qsTr("Download failed.")); + appNotification.show(qsTr("Download failed.")); } } - AppNotification { - id: videoNotification - } - Item { width: videoPage.videoWidth * videoPage.sizingFactor height: videoPage.videoHeight * videoPage.sizingFactor