Skip to content

Commit

Permalink
Merge pull request #169 from ahippo/fixes
Browse files Browse the repository at this point in the history
Remove path to password store in commit message and a leading space.
  • Loading branch information
annejan committed Mar 7, 2016
2 parents f519a1f + 69eac00 commit 32de6bc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
15 changes: 7 additions & 8 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -614,11 +614,11 @@ QString MainWindow::getDir(const QModelIndex &index, bool forPass) {
return forPass ? "" : abspath;
QFileInfo info = model.fileInfo(proxyModel.mapToSource(index));
QString filePath =
(info.isFile() ? info.absolutePath() : info.absoluteFilePath()) + '/';
(info.isFile() ? info.absolutePath() : info.absoluteFilePath());
if (forPass) {
filePath.replace(QRegExp("^" + passStore), "");
filePath.replace(QRegExp("^" + abspath), "");
filePath = QDir(abspath).relativeFilePath(filePath);
}
filePath += '/';
return filePath;
}

Expand All @@ -628,8 +628,8 @@ QString MainWindow::getFile(const QModelIndex &index, bool forPass) {
return QString();
QString filePath = model.filePath(proxyModel.mapToSource(index));
if (forPass) {
filePath = QDir(passStore).relativeFilePath(filePath);
filePath.replace(QRegExp("\\.gpg$"), "");
filePath.replace(QRegExp("^" + passStore), "");
}
return filePath;
}
Expand Down Expand Up @@ -1131,9 +1131,8 @@ void MainWindow::setPassword(QString file, bool overwrite, bool isNew = false) {
if (!useWebDav && useGit) {
if (!overwrite)
executeWrapper(gitExecutable, "add \"" + file + '"');
QString path = file;
QString path = QDir(passStore).relativeFilePath(file);
path.replace(QRegExp("\\.gpg$"), "");
path.replace(QRegExp("^" + passStore), "");
executeWrapper(gitExecutable, "commit \"" + file + "\" -m \"" +
(overwrite ? "Edit" : "Add") + " for " +
path + " using QtPass.\"");
Expand Down Expand Up @@ -1205,7 +1204,7 @@ void MainWindow::on_deleteButton_clicked() {
if (useGit) {
executeWrapper(gitExecutable, "rm -f \"" + file + '"');
executeWrapper(gitExecutable,
"commit \"" + file + "\" -m \" Remove for " +
"commit \"" + file + "\" -m \"Remove for " +
getFile(ui->treeView->currentIndex(), true) +
" using QtPass.\"");
if (autoPush)
Expand All @@ -1228,7 +1227,7 @@ void MainWindow::on_deleteButton_clicked() {
if (useGit) {
executeWrapper(gitExecutable, "rm -rf \"" + file + '"');
executeWrapper(gitExecutable,
"commit \"" + file + "\" -m \" Remove for " +
"commit \"" + file + "\" -m \"Remove for " +
getFile(ui->treeView->currentIndex(), true) +
" using QtPass.\"");
if (autoPush)
Expand Down
2 changes: 1 addition & 1 deletion storemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ bool StoreModel::ShowThis(const QModelIndex index) const {
} else {
QModelIndex useIndex = sourceModel()->index(index.row(), 0, index.parent());
QString path = fs->filePath(useIndex);
path = QDir(store).relativeFilePath(path);
path.replace(QRegExp("\\.gpg$"), "");
path.replace(QRegExp("^" + store), "");
retVal = path.contains(filterRegExp());
}
return retVal;
Expand Down

0 comments on commit 32de6bc

Please sign in to comment.