diff --git a/harbour-sailotp.pro b/harbour-sailotp.pro index 87ee289..c8511ac 100644 --- a/harbour-sailotp.pro +++ b/harbour-sailotp.pro @@ -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 diff --git a/qml/components/NotifyBanner.qml b/qml/components/NotifyBanner.qml new file mode 100644 index 0000000..ec60069 --- /dev/null +++ b/qml/components/NotifyBanner.qml @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2013, Stefan Brand + * 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 + } +} diff --git a/qml/harbour-sailotp.qml b/qml/harbour-sailotp.qml index db90a21..fb555f1 100644 --- a/qml/harbour-sailotp.qml +++ b/qml/harbour-sailotp.qml @@ -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") } diff --git a/qml/pages/MainView.qml b/qml/pages/MainView.qml index 90bd4cd..bb58f35 100644 --- a/qml/pages/MainView.qml +++ b/qml/pages/MainView.qml @@ -163,6 +163,7 @@ Page { onClicked: { Clipboard.text = otp + notify.show("Token for " + title + " copied", 3000); } ListView.onRemove: animateRemoval() diff --git a/rpm/harbour-sailotp.yaml b/rpm/harbour-sailotp.yaml index e77d78d..92484d7 100644 --- a/rpm/harbour-sailotp.yaml +++ b/rpm/harbour-sailotp.yaml @@ -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: [] diff --git a/src/harbour-sailotp.cpp b/src/harbour-sailotp.cpp index 5e680dc..16a6177 100644 --- a/src/harbour-sailotp.cpp +++ b/src/harbour-sailotp.cpp @@ -27,10 +27,7 @@ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifdef QT_QML_DEBUG #include -#endif - #include #include #include "fileio.h"