Commit aa66d1f5 authored by Andrea Scarpino's avatar Andrea Scarpino

Initial commit

parents
*~
*.pro.user
*.pro.user.*
*.autosave
[main]
host = https://www.transifex.com
[harbour-SailHN.harbour-sailhnts]
file_filter = translations/harbour-mpw-<lang>.ts
source_file = translations/harbour-mpw.ts
source_lang = en
type = QT
The MIT License (MIT)
Copyright (c) [year] [fullname]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
TARGET = harbour-mpw
CONFIG += sailfishapp
SOURCES += \
src/main.cpp \
src/mpwmanager.cpp
HEADERS += \
src/mpwmanager.h
OTHER_FILES += \
qml/cover/CoverPage.qml \
qml/pages/MainPage.qml \
qml/pages/Settings.qml \
qml/MPW.qml \
harbour-mpw.desktop \
harbour-mpw.png \
rpm/harbour-mpw.changes \
rpm/harbour-mpw.spec \
rpm/harbour-mpw.yaml \
translations/*.ts
CONFIG += sailfishapp_i18n
INCLUDEPATH += "/usr/include/mpw"
LIBS += -lmpw -lcrypto
# harbour-MPW
A [MasterPassword](http://masterpasswordapp.com/) client for [Sailfish OS](https://sailfishos.org).
[![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=ascarpino&url=https://gitlab.com/ascarpino/harbour-MPW&title=harbour-MPW&language=&tags=jolla&category=software)
Translations via [Transifex](https://www.transifex.com/organization/ilpianista-harbour/dashboard/harbour-MPW), thank you!
[Build status](https://build.merproject.org/package/live_build_log/home:ilpianista/harbour-MPW/sailfish_latest_armv7hl/armv8el)
[Desktop Entry]
Type=Application
X-Nemo-Application-Type=silica-qt5
Categories=Utility;
Icon=harbour-mpw
Exec=harbour-mpw
Name=MPW
Comment=MasterPassword client
/*
The MIT License (MIT)
Copyright (c) 2016 Andrea Scarpino <me@andreascarpino.it>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
import "pages"
ApplicationWindow {
initialPage: Component { MainPage { } }
cover: Qt.resolvedUrl("cover/CoverPage.qml")
}
/*
The MIT License (MIT)
Copyright (c) 2016 Andrea Scarpino <me@andreascarpino.it>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
CoverBackground {
CoverPlaceholder {
text: "SailHN"
icon.source: "/usr/share/icons/hicolor/86x86/apps/harbour-mpw.png"
}
}
/*
The MIT License (MIT)
Copyright (c) 2016 Andrea Scarpino <me@andreascarpino.it>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
import harbour.mpw 1.0
Page {
allowedOrientations: Orientation.All
SilicaFlickable {
anchors.fill: parent
contentHeight: column.height
PullDownMenu {
MenuItem {
text: qsTr("Settings")
onClicked: pageStack.push(Qt.resolvedUrl("Settings.qml"))
}
MenuItem {
text: qsTr("Copy to clipboard")
onClicked: {
Clipboard.text = password.text;
}
}
MenuItem {
text: qsTr("Clear")
onClicked: clear()
}
}
Column {
id: column
x: Theme.horizontalPageMargin
width: parent.width - Theme.horizontalPageMargin * 2
PageHeader {
id: header
}
TextField {
id: site
width: parent.width
inputMethodHints: Qt.ImhUrlCharactersOnly
placeholderText: qsTr("Site name (e.g. google.com)")
EnterKey.enabled: site.text.length > 0 && counter.text.length > 0
EnterKey.onClicked: getPassword()
}
TextField {
id: counter
width: parent.width
text: "1"
inputMethodHints: Qt.ImhDigitsOnly
placeholderText: qsTr("Counter")
EnterKey.enabled: site.text.length > 0 && counter.text.length > 0
EnterKey.onClicked: getPassword()
}
ComboBox {
id: type
label: qsTr("Password type")
currentIndex: 1
menu: ContextMenu {
MenuItem { text: qsTr("Maximum") }
MenuItem { text: qsTr("Long") }
MenuItem { text: qsTr("Medium") }
MenuItem { text: qsTr("Basic") }
MenuItem { text: qsTr("Short") }
MenuItem { text: qsTr("PIN") }
MenuItem { text: qsTr("Name") }
MenuItem { text: qsTr("Phrase") }
}
}
Text {
id: password
width: parent.width
color: Theme.secondaryColor
horizontalAlignment: TextInput.AlignHCenter
wrapMode: Text.Wrap
}
}
VerticalScrollDecorator {}
}
onStatusChanged: {
if (status === PageStatus.Activating) {
var isReady = manager.getName() !== "" && manager.getKey() !== "";
site.enabled = isReady;
if (!isReady) {
password.text = qsTr("Please fill your name and master key in the Settings page!");
} else {
password.text = "";
}
}
}
function getPassword() {
password.text = manager.getPassword(site.text, type.currentIndex, counter.text);
}
function clear() {
site.text = "";
site.forceActiveFocus();
counter.text = "1"
type.currentIndex = 1;
password.text = "";
}
}
/*
The MIT License (MIT)
Copyright (c) 2016 Andrea Scarpino <me@andreascarpino.it>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distrite, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
Page {
allowedOrientations: Orientation.All
Column {
id: column
x: Theme.horizontalPageMargin
width: parent.width - Theme.horizontalPageMargin * 2
PageHeader {
title: qsTr("Settings")
}
TextField {
id: name
width: parent.width
focus: true
placeholderText: qsTr("Name")
}
TextField {
id: password
width: parent.width
placeholderText: qsTr("Master Password")
echoMode: TextInput.Password
}
Button {
id: save
text: qsTr("Save");
anchors.horizontalCenter: parent.horizontalCenter
onClicked: {
if (name.text.length > 0 && password.text.length > 0) {
manager.setUserData(name.text, password.text);
pageStack.pop();
}
}
}
}
Component.onCompleted: {
name.text = manager.getName();
}
}
* Thu Apr 21 2016 Andrea Scarpino <me@andreascarpino.it> 0.1-1
- Initial version
#
# Do NOT Edit the Auto-generated Part!
# Generated by: spectacle version 0.27
#
Name: harbour-mpw
# >> macros
# << macros
%{!?qtc_qmake:%define qtc_qmake %qmake}
%{!?qtc_qmake5:%define qtc_qmake5 %qmake5}
%{!?qtc_make:%define qtc_make make}
%{?qtc_builddir:%define _builddir %qtc_builddir}
Summary: MasterPassword client
Version: 0.1
Release: 1
Group: Qt/Qt
License: MIT
URL: http://www.andreascarpino.it
Source0: %{name}-%{version}.tar.bz2
Source100: harbour-mpw.yaml
Requires: sailfishsilica-qt5 >= 0.10.9
Requires: libmpw
BuildRequires: pkgconfig(sailfishapp) >= 1.0.2
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Qml)
BuildRequires: pkgconfig(Qt5Quick)
BuildRequires: libmpw
BuildRequires: desktop-file-utils
%description
MasterPassword client
%prep
%setup -q -n %{name}-%{version}
# >> setup
# << setup
%build
# >> build pre
# << build pre
%qtc_qmake5
%qtc_make %{?_smp_mflags}
# >> build post
# << build post
%install
rm -rf %{buildroot}
# >> install pre
# << install pre
%qmake5_install
# >> install post
# << install post
desktop-file-install --delete-original \
--dir %{buildroot}%{_datadir}/applications \
%{buildroot}%{_datadir}/applications/*.desktop
%files
%defattr(-,root,root,-)
%{_bindir}
%{_datadir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/86x86/apps/%{name}.png
# >> files
# << files
Name: harbour-mpw
Summary: MasterPassword client
Version: 0.1
Release: 1
# The contents of the Group field should be one of the groups listed here:
# http://gitorious.org/meego-developer-tools/spectacle/blobs/master/data/GROUPS
Group: Qt/Qt
URL: http://www.andreascarpino.it
License: MIT
# This must be generated before uploading a package to a remote build service.
# Usually this line does not need to be modified.
Sources:
- '%{name}-%{version}.tar.bz2'
Description: |
MasterPassword client
Configure: none
# The qtc5 builder inserts macros to allow QtCreator to have fine
# control over qmake/make execution
Builder: qtc5
# This section specifies build dependencies that are resolved using pkgconfig.
# This is the preferred way of specifying build dependencies for your package.
PkgConfigBR:
- sailfishapp >= 1.0.2
- Qt5Core
- Qt5Qml
- Qt5Quick
# Build dependencies without a pkgconfig setup can be listed here
PkgBR:
- libmpw
# Runtime dependencies which are not automatically detected
Requires:
- sailfishsilica-qt5 >= 0.10.9
- libmpw
# All installed files
Files:
- '%{_bindir}'
- '%{_datadir}/%{name}'
- '%{_datadir}/applications/%{name}.desktop'
- '%{_datadir}/icons/hicolor/86x86/apps/%{name}.png'
# For more information about yaml and what's supported in Sailfish OS
# build system, please see https://wiki.merproject.org/wiki/Spectacle
/*
The MIT License (MIT)
Copyright (c) 2016 Andrea Scarpino <me@andreascarpino.it>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include <QtQuick>
#include <sailfishapp.h>
#include "mpwmanager.h"
int main(int argc, char *argv[])
{
QScopedPointer<QGuiApplication> app(SailfishApp::application(argc, argv));
QScopedPointer<QQuickView> view(SailfishApp::createView());
QCoreApplication::setApplicationName(QStringLiteral("MPW"));
qmlRegisterType<MPWManager>("harbour.mpw", 1, 0, "MPWManager");
MPWManager manager;
view->rootContext()->setContextProperty("manager", &manager);
view->setSource(SailfishApp::pathTo("qml/MPW.qml"));
view->show();
return app->exec();
}
/*
The MIT License (MIT)
Copyright (c) 2016 Andrea Scarpino <me@andreascarpino.it>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "mpwmanager.h"
#include <QDebug>
extern "C"
{
#include <mpw-algorithm.h>
}
MPWManager::MPWManager(QObject *parent) :
QObject(parent)
{
}
MPWManager::~MPWManager()
{
}
QString MPWManager::getKey() const
{
return m_key;
}
QString MPWManager::getName() const
{
return m_name;
}
void MPWManager::setUserData(const QString &name, const QString &password)
{
m_name = name;
m_key = QString::fromLatin1((const char*) mpw_masterKeyForUser(name.toLatin1().data(),
password.toLatin1().data(), MPAlgorithmVersionCurrent));
}
QString MPWManager::getPassword(const QString &site, PasswordType type, const int counter) const
{
MPSiteType t = 0;
switch (type) {
case Maximum: t = MPSiteTypeGeneratedMaximum; break;
case Long: t = MPSiteTypeGeneratedLong; break;
case Medium: t = MPSiteTypeGeneratedMedium; break;
case Basic: t = MPSiteTypeGeneratedBasic; break;
case Short: t = MPSiteTypeGeneratedShort; break;
case PIN: t = MPSiteTypeGeneratedPIN; break;
case Name: t = MPSiteTypeGeneratedName; break;
case Phrase: t = MPSiteTypeGeneratedPhrase; break;
default: qCritical() << "Unrecognized password type" << type;
}
return QString::fromLatin1(mpw_passwordForSite((const unsigned char*) m_key.toLatin1().data(),
site.toLatin1().data(), t, counter, MPSiteVariantPassword, NULL,
MPAlgorithmVersionCurrent));
}
/*
The MIT License (MIT)
Copyright (c) 2016 Andrea Scarpino <me@andreascarpino.it>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef MPWMANAGER_H
#define MPWMANAGER_H
#include <QObject>
class MPWManager : public QObject
{
Q_OBJECT
public:
enum PasswordType {
Maximum, Long, Medium, Basic, Short, PIN, Name, Phrase
};
Q_ENUMS(PasswordType)
explicit MPWManager(QObject *parent = 0);
virtual ~MPWManager();
Q_INVOKABLE QString getKey() const;
Q_INVOKABLE QString getName() const;
Q_INVOKABLE void setUserData(const QString &name, const QString &password);
Q_INVOKABLE QString getPassword(const QString &site, PasswordType type, const int counter) const;
private:
QString m_key;
QString m_name;
};
#endif // MPWMANAGER_H
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>MainPage</name>
<message>
<location filename="../qml/pages/MainPage.qml" line="40"/>
<source>Settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/MainPage.qml" line="46"/>
<source>Copy to clipboard</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/MainPage.qml" line="54"/>
<source>Clear</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/MainPage.qml" line="73"/>
<source>Site name (e.g. google.com)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/MainPage.qml" line="84"/>
<source>Counter</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/MainPage.qml" line="93"/>
<source>Password type</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/MainPage.qml" line="102"/>
<source>PIN</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/MainPage.qml" line="128"/>
<source>Please fill your name and master key in the Settings page!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/MainPage.qml" line="101"/>
<source>Short</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/MainPage.qml" line="100"/>
<source>Basic</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/MainPage.qml" line="99"/>
<source>Medium</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/MainPage.qml" line="98"/>
<source>Long</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/MainPage.qml" line="97"/>
<source>Maximum</source>
<translation type="unfinished"></translation>