Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Password dialog decoupling from MW #242

Merged
merged 2 commits into from
Nov 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions datahelpers.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#ifndef DATAHELPERS_H
#define DATAHELPERS_H

#include <QDateTime>
#include <QString>

/*!
\struct passwordConfiguration
\brief holds the Password configuration settings
*/
struct passwordConfiguration {
/**
* @brief passwordConfiguration::selected character set.
*/
enum characterSet {
ALLCHARS = 0,
ALPHABETICAL,
ALPHANUMERIC,
CUSTOM,
CHARSETS_COUNT // have to be last, for easier initialization of arrays
} selected;
/**
* @brief passwordConfiguration::length of password.
*/
int length;
/**
* @brief passwordConfiguration::Characters the different character sets.
*/
QString Characters[CHARSETS_COUNT];
passwordConfiguration() : selected(ALLCHARS), length(16) {
Characters[ALLCHARS] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890~!@#$%^&"
"*()_-+={}[]|:;<>,.?"; /*AllChars*/
Characters[ALPHABETICAL] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstu"
"vwxyz"; /*Only Alphabetical*/
Characters[ALPHANUMERIC] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstu"
"vwxyz1234567890"; /*Alphabetical and Numerical*/
Characters[CUSTOM] = Characters[ALLCHARS]; // this may be redefined by user
}
};

/*!
\struct UserInfo
\brief Stores key info lines including validity, creation date and more.
*/
struct UserInfo {
UserInfo() : validity('-'), have_secret(false), enabled(false) {}

/**
* @brief UserInfo::fullyValid when validity is f or u.
* http://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=blob_plain;f=doc/DETAILS
*/
bool fullyValid() { return validity == 'f' || validity == 'u'; }
/**
* @brief UserInfo::marginallyValid when validity is m.
* http://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=blob_plain;f=doc/DETAILS
*/
bool marginallyValid() { return validity == 'm'; }
/**
* @brief UserInfo::isValid when fullyValid or marginallyValid.
*/
bool isValid() { return fullyValid() || marginallyValid(); }

/**
* @brief UserInfo::name full name
*/
QString name;
/**
* @brief UserInfo::key_id hexadecimal representation
*/
QString key_id;
/**
* @brief UserInfo::validity GnuPG representation of validity
* http://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=blob_plain;f=doc/DETAILS
*/
char validity;
/**
* @brief UserInfo::have_secret secret key is available
* (can decrypt with this key)
*/
bool have_secret;
/**
* @brief UserInfo::enabled
*/
bool enabled;
/**
* @brief UserInfo::expiry date/time key expires
*/
QDateTime expiry;
/**
* @brief UserInfo::created date/time key was created
*/
QDateTime created;
};

#endif // DATAHELPERS_H
13 changes: 0 additions & 13 deletions enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,6 @@ class Enums {
CLIPBOARD_ALWAYS = 1,
CLIPBOARD_ON_DEMAND = 2
};
/**
* @brief Enums::characterSet enum
* 0 All character
* 1 Alphabetical
* 2 Alphanumeric
* 3 Custon (from config)
*/
enum characterSet {
ALLCHARS = 0,
ALPHABETICAL = 1,
ALPHANUMERIC = 2,
CUSTOM = 3
};
};

#endif // ENUMS_H
96 changes: 48 additions & 48 deletions localization/localization_ar_MA.ts
Original file line number Diff line number Diff line change
Expand Up @@ -511,14 +511,14 @@ Expire-Date: 0
<message>
<location filename="../mainwindow.ui" line="72"/>
<location filename="../mainwindow.ui" line="75"/>
<location filename="../mainwindow.cpp" line="1359"/>
<location filename="../mainwindow.cpp" line="1362"/>
<source>Edit</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.ui" line="90"/>
<location filename="../mainwindow.ui" line="93"/>
<location filename="../mainwindow.cpp" line="1371"/>
<location filename="../mainwindow.cpp" line="1374"/>
<source>Delete</source>
<translation type="unfinished"></translation>
</message>
Expand Down Expand Up @@ -549,7 +549,7 @@ Expire-Date: 0
</message>
<message>
<location filename="../mainwindow.ui" line="179"/>
<location filename="../mainwindow.cpp" line="1353"/>
<location filename="../mainwindow.cpp" line="1356"/>
<source>Users</source>
<translation type="unfinished"></translation>
</message>
Expand Down Expand Up @@ -619,19 +619,19 @@ p, li { white-space: pre-wrap; }
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="526"/>
<location filename="../mainwindow.cpp" line="535"/>
<location filename="../mainwindow.cpp" line="530"/>
<location filename="../mainwindow.cpp" line="539"/>
<source>Updating password-store</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="1398"/>
<location filename="../mainwindow.cpp" line="1401"/>
<source>New Folder:
(Will be placed in %1 )</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="679"/>
<location filename="../mainwindow.cpp" line="683"/>
<source>Password hidden</source>
<translation type="unfinished"></translation>
</message>
Expand All @@ -646,90 +646,90 @@ p, li { white-space: pre-wrap; }
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="683"/>
<location filename="../mainwindow.cpp" line="687"/>
<source>Content hidden</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="770"/>
<location filename="../mainwindow.cpp" line="774"/>
<source>Clipboard cleared</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="772"/>
<location filename="../mainwindow.cpp" line="776"/>
<source>Clipboard not cleared</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="786"/>
<location filename="../mainwindow.cpp" line="790"/>
<source>Password and Content hidden</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="842"/>
<location filename="../mainwindow.cpp" line="846"/>
<source>QProcess::FailedToStart</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="845"/>
<location filename="../mainwindow.cpp" line="849"/>
<source>QProcess::Crashed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="848"/>
<location filename="../mainwindow.cpp" line="852"/>
<source>QProcess::Timedout</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="851"/>
<location filename="../mainwindow.cpp" line="855"/>
<source>QProcess::ReadError</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="854"/>
<location filename="../mainwindow.cpp" line="858"/>
<source>QProcess::WriteError</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="857"/>
<location filename="../mainwindow.cpp" line="861"/>
<source>QProcess::UnknownError</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="880"/>
<location filename="../mainwindow.cpp" line="884"/>
<source>Looking for: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="617"/>
<location filename="../mainwindow.cpp" line="1046"/>
<location filename="../mainwindow.cpp" line="621"/>
<location filename="../mainwindow.cpp" line="1049"/>
<source>Can not edit</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="993"/>
<location filename="../mainwindow.cpp" line="1397"/>
<location filename="../mainwindow.cpp" line="996"/>
<location filename="../mainwindow.cpp" line="1400"/>
<source>New file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="1022"/>
<location filename="../mainwindow.cpp" line="1025"/>
<source>Delete password?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="1023"/>
<location filename="../mainwindow.cpp" line="1026"/>
<source>Are you sure you want to delete %1?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="1022"/>
<location filename="../mainwindow.cpp" line="1025"/>
<source>Delete folder?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="618"/>
<location filename="../mainwindow.cpp" line="1047"/>
<location filename="../mainwindow.cpp" line="622"/>
<location filename="../mainwindow.cpp" line="1050"/>
<source>Selected password file does not exist, not able to edit</source>
<translation type="unfinished"></translation>
</message>
Expand All @@ -739,77 +739,77 @@ p, li { white-space: pre-wrap; }
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="723"/>
<location filename="../mainwindow.cpp" line="1510"/>
<location filename="../mainwindow.cpp" line="727"/>
<location filename="../mainwindow.cpp" line="1489"/>
<source>Password</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="994"/>
<location filename="../mainwindow.cpp" line="997"/>
<source>New password file:
(Will be placed in %1 )</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="1076"/>
<location filename="../mainwindow.cpp" line="1079"/>
<source>Can not get key list</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="1077"/>
<location filename="../mainwindow.cpp" line="1080"/>
<source>Unable to get list of available gpg keys</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="1108"/>
<location filename="../mainwindow.cpp" line="1111"/>
<source>Key not found in keyring</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="1185"/>
<location filename="../mainwindow.cpp" line="1188"/>
<source>Generating GPG key pair</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="1228"/>
<location filename="../mainwindow.cpp" line="1231"/>
<source>Profile changed to %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="1351"/>
<location filename="../mainwindow.cpp" line="1354"/>
<source>Add folder</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="1352"/>
<location filename="../mainwindow.cpp" line="1355"/>
<source>Add password</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="1447"/>
<source>No characters chosen</source>
<location filename="../mainwindow.cpp" line="1455"/>
<source>Copied to clipboard</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Pass</name>
<message>
<location filename="../mainwindow.cpp" line="1448"/>
<source>Can&apos;t generate password, there are no characters to choose from set in the configuration!</source>
<location filename="../pass.cpp" line="73"/>
<source>No characters chosen</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="1476"/>
<source>Copied to clipboard</source>
<location filename="../pass.cpp" line="74"/>
<source>Can&apos;t generate password, there are no characters to choose from set in the configuration!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Pass</name>
<message>
<location filename="../pass.cpp" line="143"/>
<location filename="../pass.cpp" line="148"/>
<source>Timed out</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../pass.cpp" line="144"/>
<location filename="../pass.cpp" line="149"/>
<source>Can&apos;t start process, previous one is still running!</source>
<translation type="unfinished"></translation>
</message>
Expand Down
Loading