From 53712d52c88eb57cfe0a44a05ec14a45d86e776c Mon Sep 17 00:00:00 2001 From: Martchus Date: Mon, 4 Jul 2016 23:29:49 +0200 Subject: [PATCH] Provide bash completion --- CMakeLists.txt | 1 + gui/mainwindow.cpp | 11 +++++++---- gui/mainwindow.h | 7 +++++-- main.cpp | 1 - 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a7f843..fa8a609 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,6 +92,7 @@ include(QtGuiConfig) include(QtConfig) include(WindowsResources) include(AppTarget) +include(ShellCompletion) # create desktop file using previously defined meta data add_desktop_file() diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 09d35c2..55ed7f3 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -109,7 +110,8 @@ void MainWindow::setSomethingChanged(bool somethingChanged) MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), m_ui(new Ui::MainWindow), - m_clearClipboardTimer(0) + m_clearClipboardTimer(0), + m_aboutDlg(nullptr) { // setup ui m_ui->setupUi(this); @@ -305,9 +307,10 @@ void MainWindow::timerEvent(QTimerEvent *event) */ void MainWindow::showAboutDialog() { - using namespace Dialogs; - AboutDialog* aboutDlg = new AboutDialog(this, tr("A simple password store using AES-256-CBC encryption via OpenSSL."), QImage(":/icons/hicolor/128x128/apps/passwordmanager.png")); - aboutDlg->show(); + if(!m_aboutDlg) { + m_aboutDlg = new AboutDialog(this, tr("A simple password store using AES-256-CBC encryption via OpenSSL."), QImage(":/icons/hicolor/128x128/apps/passwordmanager.png")); + } + m_aboutDlg->show(); } /*! diff --git a/gui/mainwindow.h b/gui/mainwindow.h index 701db21..3809530 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -5,8 +5,6 @@ #include -#include - #include #include @@ -29,6 +27,10 @@ namespace MiscUtils { class RecentMenuManager; } +namespace Dialogs { +class AboutDialog; +} + namespace QtGui { class FieldModel; @@ -121,6 +123,7 @@ private: bool m_dontUpdateSelection; int m_clearClipboardTimer; MiscUtils::RecentMenuManager *m_recentMgr; + Dialogs::AboutDialog *m_aboutDlg; }; } diff --git a/main.cpp b/main.cpp index e3d0e33..af22434 100644 --- a/main.cpp +++ b/main.cpp @@ -35,7 +35,6 @@ int main(int argc, char *argv[]) // setup argument parser SET_APPLICATION_INFO; ArgumentParser parser; - parser.setIgnoreUnknownArguments(true); // file argument Argument fileArg("file", 'f', "specifies the file to be opened (or created when using --modify)"); fileArg.setValueNames({"path"});