From 4fdd328e9d5005c7841dc375d3f7d6d84297cdee Mon Sep 17 00:00:00 2001 From: Martchus Date: Mon, 25 Apr 2016 22:06:24 +0200 Subject: [PATCH] overall cleanup --- deprecated/draganddroptablewidget.cpp | 81 --------- deprecated/draganddroptablewidget.h | 33 ---- gui/initiatequi.cpp | 3 - gui/mainwindow.cpp | 5 +- main.cpp | 3 - quickgui/initiatequick.cpp | 5 +- translations/passwordmanager_de_DE.ts | 241 ++++++++++++-------------- translations/passwordmanager_en_US.ts | 241 ++++++++++++-------------- 8 files changed, 224 insertions(+), 388 deletions(-) delete mode 100644 deprecated/draganddroptablewidget.cpp delete mode 100644 deprecated/draganddroptablewidget.h diff --git a/deprecated/draganddroptablewidget.cpp b/deprecated/draganddroptablewidget.cpp deleted file mode 100644 index a00c27d..0000000 --- a/deprecated/draganddroptablewidget.cpp +++ /dev/null @@ -1,81 +0,0 @@ -#include "draganddroptablewidget.h" - -#include -#include -#include - -namespace QtGui { - -DragAndDropTableWidget::DragAndDropTableWidget(QWidget *parent) : - QTableWidget(parent), - m_insertEmptyRowAtEnd(false) -{ - connect(this, &DragAndDropTableWidget::cellChanged, - this, &DragAndDropTableWidget::processCellChanged); -} - -void DragAndDropTableWidget::insertEmptyRowAtEndAutomatically(bool value) -{ - m_insertEmptyRowAtEnd = value; - if(value) { - processCellChanged(0,0); - } -} - -bool DragAndDropTableWidget::hasEmptyRowAtEnd() const -{ - bool hasEmptyRow = false; - int rowCount = this->rowCount(); - if(rowCount > 0) { - if(QTableWidgetItem *item = this->item(rowCount - 1, 0)) { - hasEmptyRow = item->text().isEmpty(); - } else { - hasEmptyRow = true; - } - } - return hasEmptyRow; -} - -bool DragAndDropTableWidget::dropMimeData(int row, int column, const QMimeData *data, Qt::DropAction action) -{ - if(data->hasText()) { - if(QTableWidgetItem *item = this->item(row, column)) - item->setText(data->text()); - return false; - } else { - return QTableWidget::dropMimeData(row, column, data, action); - } -} - -QStringList DragAndDropTableWidget::mimeTypes() const -{ - return QTableWidget::mimeTypes() << QStringLiteral("text/plain"); -} - -QMimeData *DragAndDropTableWidget::mimeData(const QList items) const -{ - QString text; - if(items.count() > 0) { - QTableWidgetItem *lastItem = items.last(); - foreach(QTableWidgetItem *item, items) { - if(!item->text().isEmpty()) { - text.append(item->text()); - if(item != lastItem) { - text.append(QStringLiteral("\n")); - } - } - } - } - QMimeData *data = QTableWidget::mimeData(items); - data->setText(text); - return data; -} - -void DragAndDropTableWidget::processCellChanged(int, int) -{ - if(m_insertEmptyRowAtEnd && !hasEmptyRowAtEnd()) { - insertRow(rowCount()); - } -} - -} diff --git a/deprecated/draganddroptablewidget.h b/deprecated/draganddroptablewidget.h deleted file mode 100644 index bdea393..0000000 --- a/deprecated/draganddroptablewidget.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef DRAGANDDROPTABLEWIDGET_H -#define DRAGANDDROPTABLEWIDGET_H - -#include - -namespace QtGui { - -class DragAndDropTableWidget : public QTableWidget -{ - Q_OBJECT -public: - explicit DragAndDropTableWidget(QWidget *parent = nullptr); - - void insertEmptyRowAtEndAutomatically(bool value); - bool hasEmptyRowAtEnd() const; - -protected: - virtual bool dropMimeData(int row, int column, const QMimeData * data, Qt::DropAction action); - virtual QStringList mimeTypes() const; - virtual QMimeData *mimeData(const QList items) const; - -private slots: - void processCellChanged(int, int); - -private: - bool m_insertEmptyRowAtEnd; - - -}; - -} - -#endif // DRAGANDDROPTABLEWIDGET_H diff --git a/gui/initiatequi.cpp b/gui/initiatequi.cpp index 9d4b580..caf89f4 100644 --- a/gui/initiatequi.cpp +++ b/gui/initiatequi.cpp @@ -2,10 +2,7 @@ #include "./gui/mainwindow.h" -// include configuration from separate header file when building with CMake -#ifndef APP_METADATA_AVAIL #include "resources/config.h" -#endif #include #include diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 2731eac..6bc796e 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -7,10 +7,7 @@ #include "ui_mainwindow.h" -// include configuration from separate header file when building with CMake -#ifndef APP_METADATA_AVAIL -# include "resources/config.h" -#endif +#include "resources/config.h" #include #include diff --git a/main.cpp b/main.cpp index db0e3d8..773250e 100644 --- a/main.cpp +++ b/main.cpp @@ -6,10 +6,7 @@ # include "./quickgui/initiatequick.h" #endif -// include configuration from separate header file when building with CMake -#ifndef APP_METADATA_AVAIL #include "resources/config.h" -#endif #include diff --git a/quickgui/initiatequick.cpp b/quickgui/initiatequick.cpp index ccc01e8..9abe440 100644 --- a/quickgui/initiatequick.cpp +++ b/quickgui/initiatequick.cpp @@ -5,10 +5,7 @@ #include "../model/entrymodel.h" #include "../model/fieldmodel.h" -// include configuration from separate header file when building with CMake -#ifndef APP_METADATA_AVAIL -# include "resources/config.h" -#endif +#include "resources/config.h" #include #include diff --git a/translations/passwordmanager_de_DE.ts b/translations/passwordmanager_de_DE.ts index 06e716d..56d4d35 100644 --- a/translations/passwordmanager_de_DE.ts +++ b/translations/passwordmanager_de_DE.ts @@ -12,12 +12,12 @@ QtGui::FieldModel - + Name - + Value @@ -45,475 +45,456 @@ - - &Recent - - - - + &Tools - + &View - + Sets the visibility of fields marked as "password field" - + Password &visibility - + &Open ... - + &Quit - + &About - + &Save - + &New ... - + &Close - + Change &password ... - + &Add new account - + Sa&ve as ... - + &Insert field - + Remove selected &field(s) - + &Password generator - - &Clear list - - - - + &Always create backup - + &Export ... - + Export passwords to plain text files - + Show containing &directory - + &Undo - + &Redo - + Add &new category - + &Show undo stack - + &show always - + show &only when editing - + &hide always - + ? - + Edit - + Ctrl+O - + Ctrl+Q - + Ctrl+S - + Ctrl+N - + Ctrl+Shift+Q - + Ctrl+Shift+A - + Ctrl+Shift+S - - + + Remove selected entry - + A simple password store using AES-256-CBC encryption via OpenSSL. - + Select a password list - - The selected file can't be found anymore. Do you want to delete the obsolete entry from the list? - - - - - keep entry - - - - - delete entry - - - - + Undo stack - + An IO error occured when opening the specified file "%1". (%2) - + The file you want to load seems to be very big. Do you really want to open it? - - + + A password is needed to open the file. - + The file couldn't be decrypted. OpenSSL error queue: %1 - + Unable to parse the file. %1 - + The file <i>%1</i> couldn't be created. - + A new password list has been created. - + The password list has been load. - + Exactly one fields needs to be selected (top-left corner for insertion). - + Select where you want to save the password list - - All files (*.*) - - - - + The file was not be saved. - + There is no password list opened. - + There's no account selected. - + The password file has been modified. - + Do you want to save the changes before closing? - + The password list has been closed. - + Opening file - + + + Password Manager files (*.pwmgr);;All files (*) + + + + Enter the password to open the file "%1" - + The backup file couldn't be created because in IO error occured: %1 - + Saving file - + Enter a password to save the file - + The file hasn't been saved. - + The password list couldn't be saved due to encryption failure. OpenSSL error queue: %1 - + The password list has been saved. - + + Plain text document (*.txt);;All files (*.*) + + + + The password list couldn't be exported. %1 - + The password list has been exported. - + The currently opened file hasn't been saved yet. - - + + Add account - - + + Add category - + Enter the entry name - + new entry - + Unable to create new entry. - + You didn't enter text. - + No node element selected. - + Unable to remove the entry. - + No entry selected. - + A field has to be selected since new fields are always inserted before the currently selected field. - + No fields have been removed since there are currently no fields selected. - + No fields have been changed since there are currently no fields selected. - + Changing password - + You didn't enter a password. <strong>No encryption</strong> will be used when saving the file next time. - + The new password will be used next time you save the file. - + You aborted. The old password will still be used when saving the file next time. - + Remove entry - + Expanded by default - + Insert field - + Remove field(s) @@ -521,37 +502,37 @@ OpenSSL error queue: %1 - + Mark as password field - + Mark as normal field - + Copy - + Paste - + Open URL - + The selection is empty. - + Copy for 5 seconds diff --git a/translations/passwordmanager_en_US.ts b/translations/passwordmanager_en_US.ts index 731ec34..5f9dbc6 100644 --- a/translations/passwordmanager_en_US.ts +++ b/translations/passwordmanager_en_US.ts @@ -12,12 +12,12 @@ QtGui::FieldModel - + Name - + Value @@ -45,475 +45,456 @@ - - &Recent - - - - + &Tools - + &View - + Sets the visibility of fields marked as "password field" - + Password &visibility - + &Open ... - + &Quit - + &About - + &Save - + &New ... - + &Close - + Change &password ... - + &Add new account - + Sa&ve as ... - + &Insert field - + Remove selected &field(s) - + &Password generator - - &Clear list - - - - + &Always create backup - + &Export ... - + Export passwords to plain text files - + Show containing &directory - + &Undo - + &Redo - + Add &new category - + &Show undo stack - + &show always - + show &only when editing - + &hide always - + ? - + Edit - + Ctrl+O - + Ctrl+Q - + Ctrl+S - + Ctrl+N - + Ctrl+Shift+Q - + Ctrl+Shift+A - + Ctrl+Shift+S - - + + Remove selected entry - + A simple password store using AES-256-CBC encryption via OpenSSL. - + Select a password list - - The selected file can't be found anymore. Do you want to delete the obsolete entry from the list? - - - - - keep entry - - - - - delete entry - - - - + Undo stack - + An IO error occured when opening the specified file "%1". (%2) - + The file you want to load seems to be very big. Do you really want to open it? - - + + A password is needed to open the file. - + The file couldn't be decrypted. OpenSSL error queue: %1 - + Unable to parse the file. %1 - + The file <i>%1</i> couldn't be created. - + A new password list has been created. - + The password list has been load. - + Exactly one fields needs to be selected (top-left corner for insertion). - + Select where you want to save the password list - - All files (*.*) - - - - + The file was not be saved. - + There is no password list opened. - + There's no account selected. - + The password file has been modified. - + Do you want to save the changes before closing? - + The password list has been closed. - + Opening file - + + + Password Manager files (*.pwmgr);;All files (*) + + + + Enter the password to open the file "%1" - + The backup file couldn't be created because in IO error occured: %1 - + Saving file - + Enter a password to save the file - + The file hasn't been saved. - + The password list couldn't be saved due to encryption failure. OpenSSL error queue: %1 - + The password list has been saved. - + + Plain text document (*.txt);;All files (*.*) + + + + The password list couldn't be exported. %1 - + The password list has been exported. - + The currently opened file hasn't been saved yet. - - + + Add account - - + + Add category - + Enter the entry name - + new entry - + Unable to create new entry. - + You didn't enter text. - + No node element selected. - + Unable to remove the entry. - + No entry selected. - + A field has to be selected since new fields are always inserted before the currently selected field. - + No fields have been removed since there are currently no fields selected. - + No fields have been changed since there are currently no fields selected. - + Changing password - + You didn't enter a password. <strong>No encryption</strong> will be used when saving the file next time. - + The new password will be used next time you save the file. - + You aborted. The old password will still be used when saving the file next time. - + Remove entry - + Expanded by default - + Insert field - + Remove field(s) Remove field @@ -521,37 +502,37 @@ OpenSSL error queue: %1 - + Mark as password field - + Mark as normal field - + Copy - + Paste - + Open URL - + The selection is empty. - + Copy for 5 seconds