update keepassx with yubikey support

This commit is contained in:
Jörg Deckert 2016-06-16 11:04:32 +02:00
parent 3c9c8382e1
commit 57d189b2ab
4 changed files with 14 additions and 334 deletions

View File

@ -1,3 +1 @@
AUX tray.patch 9101 SHA256 082189d6ca322195b9c43a52f5a5b09050cb73fbcc5548a8c0e59bbb6d981430 SHA512 68b71763184b2f0820fa528d44a32f57f10166ff06458eae7208e3399932b806a1eb0310a42bfa16107e9e6c4e641d3224694c9563f183119786ce7134998a0c WHIRLPOOL 970fdc6c8f24eb95cf6a9b6d98a155f0d2f5a1bb9670fbef200be1dd74977188b076fda5b99993acb63577a3dd6793627bf14dda8ec915214f90e2c6530a5faa
EBUILD keepassx-2.0_alpha20140908-r1.ebuild 1151 SHA256 e6115f97f4f4f8364dfa5953b2f2b8df92e15134dee763be27f5dafd369c52b5 SHA512 2a3a536990cad078a27fa44a775779c10a570014450bad0c68735125652c3e1701abaeb6f684d92404528056d0dd3cb655bbc0daa43320575a7ce42169b710dc WHIRLPOOL 09d1d50a089b1e6ed1ec862caeff61a3387be63d90cf475ac9c1971801222b6dc3945090c621dc44898958efc18ec47ea25de10ef775ca7c74938577a6cdc55b
EBUILD keepassx-2.0_alpha20140908.ebuild 1120 SHA256 4fcf59070802144970f4c7be826c0252d94c1940c8a5696873f82732b198341a SHA512 74670de2ee4ca1c76b6b6eaa35bbb50dad24d394cb7c4ab9b549d6bf8e51a84192ec374eb62fb46bb4e0705ced967d1f992b8ac55564c4f2e17c15f6b2f67080 WHIRLPOOL 2b1dbc3d8b37d4ee43e8cd5f0c61064fb4a0d63bc1a92a09409b80475992266fa6a6dd61dba0128e8fb095b92b015478b935a3a076c40a93d4ed5b97b8a1b47e
EBUILD keepassx-2.0.2-r90.ebuild 951 SHA256 7b67c0c801441e2024a934a0346ba0413f988c16770548981f1fcc3260582348 SHA512 8feac3d0be545a78c4209b058a27f2495794fd1bf0935457d24a6d9ea68167a73f3d648ceb892cd25b1359d769436829924983947ac0f362ff3f4ed010a5e0c7 WHIRLPOOL 9af70d03c6823d2b8bee7602764513830c3dfdbf28c9101d2e8b670a909317d9f4504656a5cae76d4e141d5c074df928edab769236fdce826ebdc8e426210511

View File

@ -1,274 +0,0 @@
From 4cdb9a645d8af65ea37e3af41e668540f8a1b30c Mon Sep 17 00:00:00 2001
From: Felix Geyer <debfx@fobos.de>
Date: Sun, 2 Nov 2014 10:15:44 +0100
Subject: [PATCH] Add an option to display a tray icon.
Also implement "Minimize to tray" functionality.
---
src/core/Config.cpp | 2 ++
src/gui/MainWindow.cpp | 73 ++++++++++++++++++++++++++++++++++++++++
src/gui/MainWindow.h | 7 ++++
src/gui/SettingsWidget.cpp | 9 +++++
src/gui/SettingsWidgetGeneral.ui | 19 ++++++++++-
src/main.cpp | 2 ++
6 files changed, 111 insertions(+), 1 deletion(-)
diff --git a/src/core/Config.cpp b/src/core/Config.cpp
index d47541e..03b5129 100644
--- a/src/core/Config.cpp
+++ b/src/core/Config.cpp
@@ -104,6 +104,8 @@ void Config::init(const QString& fileName)
m_defaults.insert("security/passwordscleartext", false);
m_defaults.insert("security/autotypeask", true);
m_defaults.insert("GUI/Language", "system");
+ m_defaults.insert("GUI/ShowTrayIcon", false);
+ m_defaults.insert("GUI/MinimizeToTray", false);
}
Config* Config::instance()
diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp
index 48baa4c..dd77989 100644
--- a/src/gui/MainWindow.cpp
+++ b/src/gui/MainWindow.cpp
@@ -33,6 +33,7 @@ const QString MainWindow::BaseWindowTitle = "KeePassX";
MainWindow::MainWindow()
: m_ui(new Ui::MainWindow())
+ , m_trayIcon(Q_NULLPTR)
{
m_ui->setupUi(this);
@@ -201,6 +202,8 @@ MainWindow::MainWindow()
m_actionMultiplexer.connect(m_ui->actionSearch, SIGNAL(triggered()),
SLOT(toggleSearch()));
+
+ updateTrayIcon();
}
MainWindow::~MainWindow()
@@ -429,12 +432,26 @@ void MainWindow::closeEvent(QCloseEvent* event)
saveWindowInformation();
event->accept();
+ QApplication::quit();
}
else {
event->ignore();
}
}
+void MainWindow::changeEvent(QEvent *event)
+{
+ if ((event->type() == QEvent::WindowStateChange) && isMinimized()
+ && isTrayIconEnabled() && config()->get("GUI/MinimizeToTray").toBool())
+ {
+ event->ignore();
+ hide();
+ }
+ else {
+ QMainWindow::changeEvent(event);
+ }
+}
+
void MainWindow::saveWindowInformation()
{
config()->set("GUI/MainWindowGeometry", saveGeometry());
@@ -467,6 +484,35 @@ bool MainWindow::saveLastDatabases()
return accept;
}
+void MainWindow::updateTrayIcon()
+{
+ if (isTrayIconEnabled()) {
+ if (!m_trayIcon) {
+ m_trayIcon = new QSystemTrayIcon(filePath()->applicationIcon(), this);
+
+ QMenu* menu = new QMenu(this);
+
+ QAction* actionToggle = new QAction(tr("Toggle window"), menu);
+ menu->addAction(actionToggle);
+
+ menu->addAction(m_ui->actionQuit);
+
+ connect(m_trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
+ SLOT(trayIconTriggered(QSystemTrayIcon::ActivationReason)));
+ connect(actionToggle, SIGNAL(triggered()), SLOT(toggleWindow()));
+
+ m_trayIcon->setContextMenu(menu);
+ m_trayIcon->show();
+ }
+ }
+ else {
+ if (m_trayIcon) {
+ delete m_trayIcon;
+ m_trayIcon = Q_NULLPTR;
+ }
+ }
+}
+
void MainWindow::showEntryContextMenu(const QPoint& globalPos)
{
m_ui->menuEntries->popup(globalPos);
@@ -511,4 +557,31 @@ void MainWindow::applySettingsChanges()
else {
m_inactivityTimer->deactivate();
}
+
+ updateTrayIcon();
+}
+
+void MainWindow::trayIconTriggered(QSystemTrayIcon::ActivationReason reason)
+{
+ if (reason == QSystemTrayIcon::Trigger) {
+ toggleWindow();
+ }
+}
+
+void MainWindow::toggleWindow()
+{
+ if (QApplication::activeWindow() == this) {
+ hide();
+ }
+ else {
+ show();
+ raise();
+ activateWindow();
+ }
+}
+
+bool MainWindow::isTrayIconEnabled() const
+{
+ return config()->get("GUI/ShowTrayIcon").toBool()
+ && QSystemTrayIcon::isSystemTrayAvailable();
}
diff --git a/src/gui/MainWindow.h b/src/gui/MainWindow.h
index e904426..b966703 100644
--- a/src/gui/MainWindow.h
+++ b/src/gui/MainWindow.h
@@ -20,6 +20,7 @@
#include <QActionGroup>
#include <QMainWindow>
+#include <QSystemTrayIcon>
#include "core/SignalMultiplexer.h"
#include "gui/DatabaseWidget.h"
@@ -44,6 +45,7 @@ public Q_SLOTS:
protected:
void closeEvent(QCloseEvent* event) Q_DECL_OVERRIDE;
+ void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
private Q_SLOTS:
void setMenuActionState(DatabaseWidget::Mode mode = DatabaseWidget::None);
@@ -61,6 +63,8 @@ private Q_SLOTS:
void saveToolbarState(bool value);
void rememberOpenDatabases(const QString& filePath);
void applySettingsChanges();
+ void trayIconTriggered(QSystemTrayIcon::ActivationReason reason);
+ void toggleWindow();
private:
static void setShortcut(QAction* action, QKeySequence::StandardKey standard, int fallback = 0);
@@ -69,6 +73,8 @@ private Q_SLOTS:
void saveWindowInformation();
bool saveLastDatabases();
+ void updateTrayIcon();
+ bool isTrayIconEnabled() const;
const QScopedPointer<Ui::MainWindow> m_ui;
SignalMultiplexer m_actionMultiplexer;
@@ -78,6 +84,7 @@ private Q_SLOTS:
QStringList m_openDatabases;
InactivityTimer* m_inactivityTimer;
int m_countDefaultAttributes;
+ QSystemTrayIcon* m_trayIcon;
Q_DISABLE_COPY(MainWindow)
};
diff --git a/src/gui/SettingsWidget.cpp b/src/gui/SettingsWidget.cpp
index 929db37..a7863ea 100644
--- a/src/gui/SettingsWidget.cpp
+++ b/src/gui/SettingsWidget.cpp
@@ -47,6 +47,8 @@ SettingsWidget::SettingsWidget(QWidget* parent)
connect(m_generalUi->autoSaveAfterEveryChangeCheckBox, SIGNAL(toggled(bool)),
this, SLOT(enableAutoSaveOnExit(bool)));
+ connect(m_generalUi->systrayShowCheckBox, SIGNAL(toggled(bool)),
+ m_generalUi->systrayMinimizeToTrayCheckBox, SLOT(setEnabled(bool)));
connect(m_secUi->clearClipboardCheckBox, SIGNAL(toggled(bool)),
m_secUi->clearClipboardSpinBox, SLOT(setEnabled(bool)));
@@ -80,6 +82,9 @@ void SettingsWidget::loadSettings()
m_generalUi->languageComboBox->setCurrentIndex(defaultIndex);
}
+ m_generalUi->systrayShowCheckBox->setChecked(config()->get("GUI/ShowTrayIcon").toBool());
+ m_generalUi->systrayMinimizeToTrayCheckBox->setChecked(config()->get("GUI/MinimizeToTray").toBool());
+
if (autoType()->isAvailable()) {
m_globalAutoTypeKey = static_cast<Qt::Key>(config()->get("GlobalAutoTypeKey").toInt());
m_globalAutoTypeModifiers = static_cast<Qt::KeyboardModifiers>(config()->get("GlobalAutoTypeModifiers").toInt());
@@ -118,6 +123,10 @@ void SettingsWidget::saveSettings()
m_generalUi->autoTypeEntryTitleMatchCheckBox->isChecked());
int currentLangIndex = m_generalUi->languageComboBox->currentIndex();
config()->set("GUI/Language", m_generalUi->languageComboBox->itemData(currentLangIndex).toString());
+
+ config()->set("GUI/ShowTrayIcon", m_generalUi->systrayShowCheckBox->isChecked());
+ config()->set("GUI/MinimizeToTray", m_generalUi->systrayMinimizeToTrayCheckBox->isChecked());
+
if (autoType()->isAvailable()) {
config()->set("GlobalAutoTypeKey", m_generalUi->autoTypeShortcutWidget->key());
config()->set("GlobalAutoTypeModifiers",
diff --git a/src/gui/SettingsWidgetGeneral.ui b/src/gui/SettingsWidgetGeneral.ui
index f3dc079..cbad7e5 100644
--- a/src/gui/SettingsWidgetGeneral.ui
+++ b/src/gui/SettingsWidgetGeneral.ui
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>456</width>
- <height>288</height>
+ <height>340</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout">
@@ -96,6 +96,23 @@
<item row="9" column="1">
<widget class="QComboBox" name="languageComboBox"/>
</item>
+ <item row="10" column="0">
+ <widget class="QCheckBox" name="systrayShowCheckBox">
+ <property name="text">
+ <string>Show a system tray icon</string>
+ </property>
+ </widget>
+ </item>
+ <item row="11" column="0">
+ <widget class="QCheckBox" name="systrayMinimizeToTrayCheckBox">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Hide window to system tray when minimized</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
<customwidgets>
diff --git a/src/main.cpp b/src/main.cpp
index b9659e4..2bdef5b 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -39,6 +39,8 @@ int main(int argc, char** argv)
// don't set organizationName as that changes the return value of
// QDesktopServices::storageLocation(QDesktopServices::DataLocation)
+ QApplication::setQuitOnLastWindowClosed(false);
+
if (!Crypto::init()) {
QString error = QCoreApplication::translate("Main",
"Fatal error while testing the cryptographic functions.");

View File

@ -1,30 +1,30 @@
# Copyright 1999-2014 Gentoo Foundation
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-admin/keepassx/keepassx-2.0_alpha6.ebuild,v 1.1 2014/04/15 12:02:27 polynomial-c Exp $
# $Id$
EAPI=5
inherit git-2 cmake-utils
EAPI=6
EGIT_REPO_URI="https://github.com/kylemanna/keepassx"
##EGIT_PROJECT="xbmc-pvr-addons${PVRADDONS_EGIT_PROJECT:-}.git"
EGIT_COMMIT="b7fd29b8aa5c2df1ce413baffe5c40d2b7c146d2"
EGIT_COMMIT="e0e96ce0fb053d2ec58ec8257136f100683ffe63"
EGIT_BRANCH="yubikey"
inherit git-r3 cmake-utils
DESCRIPTION="Qt password manager compatible with its Win32 and Pocket PC versions"
HOMEPAGE="http://www.keepassx.org/"
SRC_URI=""
LICENSE="|| ( GPL-2 GPL-3 ) BSD GPL-2 LGPL-2.1 LGPL-3+ CC0-1.0 public-domain || ( LGPL-2.1 GPL-3 )"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~x86 ~amd64-linux ~x86-linux"
KEYWORDS="amd64 ~arm ~ppc ~x86 ~amd64-linux ~x86-linux"
IUSE="test yubikey"
DEPEND="
dev-libs/libgcrypt:0=
dev-qt/qtcore:4
dev-qt/qtdbus:4
dev-qt/qtgui:4
dev-qt/qttest:4
dev-qt/qtcore:5
dev-qt/qtgui:5
dev-qt/qttest:5
dev-qt/qtx11extras:5
sys-libs/zlib
x11-libs/libX11
x11-libs/libXtst
@ -37,7 +37,7 @@ DOCS=(CHANGELOG)
src_configure() {
local mycmakeargs=(
$(cmake-utils_use_with test TESTS)
-DWITH_TESTS="$(usex test)"
)
cmake-utils_src_configure
}

View File

@ -1,44 +0,0 @@
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-admin/keepassx/keepassx-2.0_alpha6.ebuild,v 1.1 2014/04/15 12:02:27 polynomial-c Exp $
EAPI=5
inherit git-2 cmake-utils
EGIT_REPO_URI="https://github.com/kylemanna/keepassx"
##EGIT_PROJECT="xbmc-pvr-addons${PVRADDONS_EGIT_PROJECT:-}.git"
EGIT_COMMIT="b7fd29b8aa5c2df1ce413baffe5c40d2b7c146d2"
EGIT_BRANCH="yubikey"
DESCRIPTION="Qt password manager compatible with its Win32 and Pocket PC versions"
HOMEPAGE="http://www.keepassx.org/"
LICENSE="|| ( GPL-2 GPL-3 ) BSD GPL-2 LGPL-2.1 LGPL-3+ CC0-1.0 public-domain || ( LGPL-2.1 GPL-3 )"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~x86 ~amd64-linux ~x86-linux"
IUSE="test yubikey"
DEPEND="
dev-libs/libgcrypt:0=
dev-qt/qtcore:4
dev-qt/qtdbus:4
dev-qt/qtgui:4
dev-qt/qttest:4
sys-libs/zlib
x11-libs/libX11
x11-libs/libXtst
yubikey? ( sys-auth/libyubikey
sys-auth/ykpers )
"
RDEPEND="${DEPEND}"
DOCS=(CHANGELOG)
src_configure() {
epatch ${FILESDIR}/tray.patch
local mycmakeargs=(
$(cmake-utils_use_with test TESTS)
)
cmake-utils_src_configure
}