summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2018-08-30 01:29:08 +0200
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2018-11-04 18:38:05 +0100
commitc0da481e65df399a6a7250b58b466df4741c855e (patch)
tree4f9e05c06b8f0faf56ab9fb82cb773b15fece7e1
parent32ea1ad39a51b0d1b7e7b24351ae1139c3f5dbec (diff)
Fix incorrect use of / as path separator.
This fixes the password store path growing an endless set of / at the end on Windows. Also disable delete and edit buttons when entry is deselected.
-rw-r--r--src/mainwindow.cpp6
-rw-r--r--src/qtpasssettings.cpp4
-rw-r--r--src/util.cpp4
3 files changed, 8 insertions, 6 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index c92f74dc..bbfff3a6 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -351,9 +351,11 @@ void MainWindow::on_treeView_doubleClicked(const QModelIndex &index) {
* @brief MainWindow::deselect clear the selection, password and copy buffer
*/
void MainWindow::deselect() {
- currentDir = "/";
+ currentDir = "";
m_qtPass->clearClipboard();
ui->passwordName->setText("");
+ ui->actionDelete->setEnabled(false);
+ ui->actionEdit->setEnabled(false);
clearPanel(false);
}
@@ -626,7 +628,7 @@ void MainWindow::onDelete() {
QString dirMessage = tr(" and the whole content?");
if (isDir) {
- QDirIterator it(model.rootPath() + "/" + file,
+ QDirIterator it(model.rootPath() + QDir::separator() + file,
QDirIterator::Subdirectories);
bool okDir = true;
while (it.hasNext() && okDir) {
diff --git a/src/qtpasssettings.cpp b/src/qtpasssettings.cpp
index fadb37fc..f5e3bc85 100644
--- a/src/qtpasssettings.cpp
+++ b/src/qtpasssettings.cpp
@@ -263,8 +263,8 @@ QString QtPassSettings::getPassStore(const QString &defaultValue) {
}
// ensure path ends in /
- if (!returnValue.endsWith("/")) {
- returnValue += "/";
+ if (!returnValue.endsWith("/") && !returnValue.endsWith(QDir::separator())) {
+ returnValue += QDir::separator();
}
return returnValue;
diff --git a/src/util.cpp b/src/util.cpp
index ac69bae7..1c670b71 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -136,7 +136,7 @@ bool Util::checkConfig() {
QString Util::getDir(const QModelIndex &index, bool forPass,
const QFileSystemModel &model,
const StoreModel &storeModel) {
- QString abspath = QDir(QtPassSettings::getPassStore()).absolutePath() + '/';
+ QString abspath = QDir(QtPassSettings::getPassStore()).absolutePath() + QDir::separator();
if (!index.isValid())
return forPass ? "" : abspath;
QFileInfo info = model.fileInfo(storeModel.mapToSource(index));
@@ -145,7 +145,7 @@ QString Util::getDir(const QModelIndex &index, bool forPass,
if (forPass) {
filePath = QDir(abspath).relativeFilePath(filePath);
}
- filePath += '/';
+ filePath += QDir::separator();
return filePath;
}