summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dialog.cpp40
-rw-r--r--dialog.h4
-rw-r--r--dialog.ui70
-rw-r--r--main.cpp2
-rw-r--r--mainwindow.cpp45
-rw-r--r--mainwindow.h4
-rw-r--r--mainwindow.ui19
7 files changed, 140 insertions, 44 deletions
diff --git a/dialog.cpp b/dialog.cpp
index 350e4ecd..09a2adda 100644
--- a/dialog.cpp
+++ b/dialog.cpp
@@ -215,6 +215,8 @@ void Dialog::on_checkBoxClipboard_clicked()
{
if (ui->checkBoxClipboard->isChecked()) {
ui->checkBoxAutoclear->setEnabled(true);
+ ui->checkBoxHidePassword->setEnabled(true);
+ ui->checkBoxHideContent->setEnabled(true);
if (ui->checkBoxAutoclear->isChecked()) {
ui->spinBoxAutoclearSeconds->setEnabled(true);
ui->labelSeconds->setEnabled(true);
@@ -226,6 +228,8 @@ void Dialog::on_checkBoxClipboard_clicked()
ui->checkBoxAutoclear->setEnabled(false);
ui->spinBoxAutoclearSeconds->setEnabled(false);
ui->labelSeconds->setEnabled(false);
+ ui->checkBoxHidePassword->setEnabled(false);
+ ui->checkBoxHideContent->setEnabled(false);
}
}
@@ -291,3 +295,39 @@ void Dialog::on_checkBoxAutoclear_clicked()
{
on_checkBoxClipboard_clicked();
}
+
+/**
+ * @brief Dialog::hidePassword
+ * @return
+ */
+bool Dialog::hidePassword()
+{
+ return ui->checkBoxHidePassword->isChecked();
+}
+
+/**
+ * @brief Dialog::hideContent
+ * @return
+ */
+bool Dialog::hideContent()
+{
+ return ui->checkBoxHideContent->isChecked();
+}
+
+/**
+ * @brief Dialog::hidePassword
+ * @param hidePassword
+ */
+void Dialog::hidePassword(bool hidePassword)
+{
+ ui->checkBoxHidePassword->setChecked(hidePassword);
+}
+
+/**
+ * @brief Dialog::hideContent
+ * @param hideContent
+ */
+void Dialog::hideContent(bool hideContent)
+{
+ ui->checkBoxHideContent->setChecked(hideContent);
+}
diff --git a/dialog.h b/dialog.h
index f189e767..01307a1b 100644
--- a/dialog.h
+++ b/dialog.h
@@ -23,6 +23,8 @@ public:
void useClipboard(bool);
void useAutoclear(bool);
void setAutoclear(int);
+ void hidePassword(bool);
+ void hideContent(bool);
QString getPassPath();
QString getGitPath();
QString getGpgPath();
@@ -31,6 +33,8 @@ public:
bool useClipboard();
bool useAutoclear();
int getAutoclear();
+ bool hidePassword();
+ bool hideContent();
private slots:
void on_radioButtonNative_clicked();
diff --git a/dialog.ui b/dialog.ui
index c797629a..ff24e8a9 100644
--- a/dialog.ui
+++ b/dialog.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>469</width>
- <height>370</height>
+ <width>507</width>
+ <height>446</height>
</rect>
</property>
<property name="windowTitle">
@@ -20,9 +20,6 @@
<string>Pass</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="1">
- <widget class="QLineEdit" name="passPath"/>
- </item>
<item row="0" column="2">
<widget class="QToolButton" name="toolButtonPass">
<property name="text">
@@ -37,6 +34,9 @@
</property>
</widget>
</item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="passPath"/>
+ </item>
</layout>
</widget>
</item>
@@ -101,13 +101,23 @@
</item>
</layout>
</item>
+ <item row="5" column="0">
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
<item row="3" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Other</string>
</property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
+ <layout class="QGridLayout" name="gridLayout_6">
+ <item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QLabel" name="labelStorePath">
@@ -116,6 +126,9 @@
</property>
</widget>
</item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="storePath"/>
+ </item>
<item row="0" column="2">
<widget class="QToolButton" name="toolButtonStore">
<property name="text">
@@ -123,52 +136,53 @@
</property>
</widget>
</item>
- <item row="0" column="1">
- <widget class="QLineEdit" name="storePath"/>
- </item>
</layout>
</item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
+ <item row="1" column="0">
+ <layout class="QGridLayout" name="gridLayout_7">
+ <item row="0" column="0">
<widget class="QCheckBox" name="checkBoxClipboard">
<property name="text">
<string>Clipboard</string>
</property>
</widget>
</item>
- <item>
+ <item row="0" column="1">
<widget class="QCheckBox" name="checkBoxAutoclear">
<property name="text">
<string>Autoclear</string>
</property>
</widget>
</item>
- <item>
- <widget class="QSpinBox" name="spinBoxAutoclearSeconds"/>
- </item>
- <item>
+ <item row="0" column="3">
<widget class="QLabel" name="labelSeconds">
<property name="text">
<string>Seconds</string>
</property>
</widget>
</item>
+ <item row="0" column="2">
+ <widget class="QSpinBox" name="spinBoxAutoclearSeconds"/>
+ </item>
+ <item row="1" column="0">
+ <widget class="QCheckBox" name="checkBoxHidePassword">
+ <property name="text">
+ <string>Hide password</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QCheckBox" name="checkBoxHideContent">
+ <property name="text">
+ <string>Hide content</string>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
</layout>
</widget>
</item>
- <item row="5" column="0">
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
</layout>
</widget>
<resources/>
diff --git a/main.cpp b/main.cpp
index b604afb7..d4a97f7e 100644
--- a/main.cpp
+++ b/main.cpp
@@ -9,7 +9,7 @@ int main(int argc, char *argv[])
QCoreApplication::setOrganizationName("IJHack");
QCoreApplication::setOrganizationDomain("ijhack.org");
QCoreApplication::setApplicationName("QtPass");
- QCoreApplication::setApplicationVersion("0.0.1");
+ QCoreApplication::setApplicationVersion("0.1.0");
//Setup and load translator for localization
QTranslator translator;
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 61434024..bdf35e8f 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -12,7 +12,7 @@ MainWindow::MainWindow(QWidget *parent) :
ui(new Ui::MainWindow)
{
process = new QProcess(this);
- connect(process, SIGNAL(readyReadStandardOutput()), this, SLOT(readyRead()));
+// connect(process, SIGNAL(readyReadStandardOutput()), this, SLOT(readyRead()));
connect(process, SIGNAL(error(QProcess::ProcessError)), this, SLOT(processError(QProcess::ProcessError)));
connect(process, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(processFinished(int, QProcess::ExitStatus)));
ui->setupUi(this);
@@ -38,6 +38,8 @@ void MainWindow::checkConfig() {
useClipboard = (settings.value("useClipboard") == "true");
useAutoclear = (settings.value("useAutoclear") == "true");
autoclearSeconds = settings.value("autoclearSeconds").toInt();
+ hidePassword = (settings.value("hidePassword") == "true");
+ hideContent = (settings.value("hideContent") == "true");
passStore = settings.value("passStore").toString();
if (passStore == "") {
@@ -103,6 +105,8 @@ void MainWindow::checkConfig() {
ui->treeView->setHeaderHidden(true);
ui->treeView->setIndentation(15);
ui->treeView->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
+
+ ui->textBrowser->setOpenExternalLinks(true);
}
/**
@@ -120,6 +124,8 @@ void MainWindow::config() {
d->useClipboard(useClipboard);
d->useAutoclear(useAutoclear);
d->setAutoclear(autoclearSeconds);
+ d->hidePassword(hidePassword);
+ d->hideContent(hideContent);
if (d->exec()) {
if (d->result() == QDialog::Accepted) {
@@ -131,6 +137,8 @@ void MainWindow::config() {
useClipboard = d->useClipboard();
useAutoclear = d->useAutoclear();
autoclearSeconds = d->getAutoclear();
+ hidePassword = d->hidePassword();
+ hideContent = d->hideContent();
QSettings settings("IJHack", "QtPass");
@@ -142,6 +150,8 @@ void MainWindow::config() {
settings.setValue("useClipboard", useClipboard ? "true" : "false");
settings.setValue("useAutoclear", useAutoclear ? "true" : "false");
settings.setValue("autoclearSeconds", autoclearSeconds);
+ settings.setValue("hidePassword", hidePassword ? "true" : "false");
+ settings.setValue("hideContent", hideContent ? "true" : "false");
ui->treeView->setRootIndex(model.setRootPath(passStore));
}
@@ -206,7 +216,7 @@ void MainWindow::executeWrapper(QString app, QString args) {
/**
* @brief MainWindow::readyRead
*/
-void MainWindow::readyRead() {
+void MainWindow::readyRead(bool finished = false) {
QString output = ui->textBrowser->document()->toPlainText();
QString error = process->readAllStandardError();
if (error.size() > 0) {
@@ -214,6 +224,24 @@ void MainWindow::readyRead() {
output += error;
} else {
output += process->readAllStandardOutput();
+ if (finished && currentAction == GPG) {
+ QClipboard *clip = QApplication::clipboard();
+ QStringList tokens = output.split("\n");
+ if (useClipboard) {
+ clip->setText(tokens[0]);
+ ui->statusBar->showMessage(tr("Password copied to clipboard"), 3000);
+ if (useAutoclear) {
+ QTimer::singleShot(1000*autoclearSeconds, this, SLOT(clearClipboard()));
+ }
+ }
+ if (hidePassword) {
+ tokens.pop_front();
+ output = tokens.join("\n");
+ }
+ if (hideContent) {
+ output = tr("Content hidden");
+ }
+ }
}
ui->textBrowser->setText(output);
}
@@ -238,18 +266,9 @@ void MainWindow::processFinished(int exitCode, QProcess::ExitStatus exitStatus)
if (exitStatus != QProcess::NormalExit || exitCode > 0) {
ui->textBrowser->setTextColor(Qt::red);
}
- readyRead();
+ readyRead(true);
enableUiElements(true);
- if (currentAction == GPG && useClipboard) {
- //Copy first line to clipboard
- QClipboard *clip = QApplication::clipboard();
- QStringList tokens = ui->textBrowser->document()->toPlainText().split("\n",QString::SkipEmptyParts);
- clip->setText(tokens[0]);
- ui->statusBar->showMessage(tr("Password copied to clipboard"), 3000);
- if (useAutoclear) {
- QTimer::singleShot(1000*autoclearSeconds, this, SLOT(clearClipboard()));
- }
- }
+
}
/**
diff --git a/mainwindow.h b/mainwindow.h
index 33c17eef..33725c3c 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -31,7 +31,7 @@ private slots:
void on_updateButton_clicked();
void on_treeView_clicked(const QModelIndex &index);
void on_configButton_clicked();
- void readyRead();
+ void readyRead(bool finished);
void processFinished(int, QProcess::ExitStatus);
void processError(QProcess::ProcessError);
void clearClipboard();
@@ -50,6 +50,8 @@ private:
bool usePass;
bool useClipboard;
bool useAutoclear;
+ bool hidePassword;
+ bool hideContent;
int autoclearSeconds;
QString passStore;
QString passExecutable;
diff --git a/mainwindow.ui b/mainwindow.ui
index dc57ca75..48899d0e 100644
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -53,7 +53,24 @@
</layout>
</item>
<item>
- <widget class="QTextBrowser" name="textBrowser"/>
+ <widget class="QTextBrowser" name="textBrowser">
+ <property name="html">
+ <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'.Helvetica Neue DeskInterface'; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:16px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; line-height:25.6px;&quot;&gt;&lt;span style=&quot; font-family:'Helvetica Neue,Helvetica,Segoe UI,Arial,freesans,sans-serif'; font-size:16px; color:#333333;&quot;&gt;QtPass is a gui forĀ &lt;/span&gt;&lt;a href=&quot;http://www.passwordstore.org/&quot;&gt;&lt;span style=&quot; font-family:'Helvetica Neue,Helvetica,Segoe UI,Arial,freesans,sans-serif'; font-size:16px; text-decoration: underline; color:#4183c4; background-color:transparent;&quot;&gt;pass&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Helvetica Neue,Helvetica,Segoe UI,Arial,freesans,sans-serif'; font-size:x-large; font-weight:600; color:#333333;&quot;&gt;ALPHA release&lt;/span&gt;&lt;/p&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Helvetica Neue,Helvetica,Segoe UI,Arial,freesans,sans-serif'; font-size:x-large; font-weight:600; color:#333333;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Helvetica Neue,Helvetica,Segoe UI,Arial,freesans,sans-serif'; font-size:x-large; font-weight:600; color:#333333;&quot;&gt;TODO&lt;/span&gt;&lt;/p&gt;
+&lt;ol style=&quot;margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;&quot;&gt;&lt;li style=&quot; font-family:'Helvetica Neue,Helvetica,Segoe UI,Arial,freesans,sans-serif'; font-size:16px; color:#333333;&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16px;&quot;&gt;edit&lt;/span&gt;&lt;/li&gt;
+&lt;li style=&quot; font-family:'Helvetica Neue,Helvetica,Segoe UI,Arial,freesans,sans-serif'; font-size:16px; color:#333333;&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16px;&quot;&gt;insert&lt;/span&gt;&lt;/li&gt;
+&lt;li style=&quot; font-family:'Helvetica Neue,Helvetica,Segoe UI,Arial,freesans,sans-serif'; font-size:16px; color:#333333;&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16px;&quot;&gt;gpg-id management&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Helvetica Neue,Helvetica,Segoe UI,Arial,freesans,sans-serif'; font-size:16px; color:#333333;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:16px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; line-height:25.6px;&quot;&gt;&lt;a href=&quot;http://ijhack.github.io/qtpass/&quot;&gt;&lt;span style=&quot; font-family:'Helvetica Neue,Helvetica,Segoe UI,Arial,freesans,sans-serif'; font-size:16px; text-decoration: underline; color:#4183c4; background-color:transparent;&quot;&gt;Documentation&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; line-height:25.6px;&quot;&gt;&lt;a href=&quot;https://github.com/IJHack/qtpass&quot;&gt;&lt;span style=&quot; font-family:'Helvetica Neue,Helvetica,Segoe UI,Arial,freesans,sans-serif'; font-size:16px; text-decoration: underline; color:#4183c4; background-color:transparent;&quot;&gt;Source code&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
</item>
</layout>
</item>