1
0
Fork 0
mirror of https://github.com/seiichiro0185/sailotp.git synced 2024-05-06 12:18:27 +00:00

Added NotifyBanner component for showing notifications

Show notification after copying token to clipboard
This commit is contained in:
seiichiro 2014-02-02 11:26:22 +01:00
parent 0ea71dfb89
commit 9fe40ff767
6 changed files with 102 additions and 16 deletions

View file

@ -29,7 +29,8 @@ OTHER_FILES += qml/harbour-sailotp.qml \
qml/lib/sha.js \
qml/sailotp.png \
qml/pages/ExportPage.qml \
qml/lib/gibberish-aes.js
qml/lib/gibberish-aes.js \
qml/components/NotifyBanner.qml
HEADERS += \
src/fileio.h

View file

@ -0,0 +1,84 @@
/*
* Copyright (c) 2013, Stefan Brand <seiichiro@seiichiro0185.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. The names of the contributors may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
MouseArea {
id: notifyBanner
width: Screen.width
height: notifyText.height + 2*Theme.paddingMedium
visible: showBanner
property bool showBanner: false
function show(text, time) {
notifyText.text = text;
timeout.interval = time;
showBanner = true;
timeout.start();
}
Timer {
id: timeout
interval: 3000
onTriggered: {
interval = 3000
showBanner = false
}
}
Rectangle {
id: banner
anchors.fill: parent
color: Theme.secondaryHighlightColor
Text {
id: notifyText
anchors.left: parent.left
anchors.right: parent.right
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
anchors.margins: Theme.paddingLarge
font.pixelSize: Theme.fontSizeSmall
color: Theme.primaryColor
wrapMode: Text.Wrap
elide: Text.ElideRight
maximumLineCount: 3
}
}
onClicked: {
showBanner = false
timeout.stop()
timeout.interval = 3000
}
}

View file

@ -30,6 +30,7 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
import "pages"
import "components"
ApplicationWindow
{
@ -41,6 +42,8 @@ ApplicationWindow
property string coverType: ""
property string coverOTP: "------"
NotifyBanner { id: notify }
initialPage: Component { MainView { } }
cover: Qt.resolvedUrl("cover/CoverPage.qml")
}

View file

@ -163,6 +163,7 @@ Page {
onClicked: {
Clipboard.text = otp
notify.show("Token for " + title + " copied", 3000);
}
ListView.onRemove: animateRemoval()

View file

@ -1,7 +1,7 @@
Name: harbour-sailotp
Summary: SailOTP
Version: 0.4
Release: 2
Version: 0.5
Release: 1
Group: Security
URL: https://github.com/seiichiro0185/sailotp/
License: "BSD\t"
@ -15,19 +15,19 @@ QMakeOptions:
- VERSION=%{version}
- RELEASE=%{release}
PkgConfigBR:
- sailfishapp >= 0.0.10
- Qt5Core
- Qt5Qml
- Qt5Quick
- Qt5Qml
- Qt5Core
- sailfishapp >= 0.0.10
Requires:
- sailfishsilica-qt5 >= 0.10.9
Files:
- /usr/share/icons/hicolor/86x86/apps
- /usr/share/applications
- /usr/share/harbour-sailotp
- /usr/bin
- '%{_datadir}/icons/hicolor/86x86/apps/%{name}.png'
- '%{_datadir}/applications/%{name}.desktop'
- '%{_datadir}/%{name}/qml'
- '%{_bindir}'
- '%{_datadir}/%{name}/qml'
- '%{_datadir}/applications/%{name}.desktop'
- '%{_datadir}/icons/hicolor/86x86/apps/%{name}.png'
- /usr/bin
- /usr/share/harbour-sailotp
- /usr/share/applications
- /usr/share/icons/hicolor/86x86/apps
PkgBR: []

View file

@ -27,10 +27,7 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef QT_QML_DEBUG
#include <QtQuick>
#endif
#include <sailfishapp.h>
#include <QGuiApplication>
#include "fileio.h"