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

#239 reencrypting after a drag and drop action #261

Merged
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
15 changes: 14 additions & 1 deletion src/imitatepass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ void ImitatePass::reencryptPath(QString dir) {

void ImitatePass::Move(const QString src, const QString dest, const bool force)
{
QFileInfo destFileInfo(dest);
if (QtPassSettings::isUseGit()) {
QStringList args;
args << "mv";
Expand All @@ -335,7 +336,6 @@ void ImitatePass::Move(const QString src, const QString dest, const bool force)
} else {
QDir qDir;
QFileInfo srcFileInfo(src);
QFileInfo destFileInfo(dest);
QString destCopy = dest;
if(srcFileInfo.isFile() && destFileInfo.isDir()){
destCopy = destFileInfo.absoluteFilePath() + QDir::separator() + srcFileInfo.fileName();
Expand All @@ -345,11 +345,18 @@ void ImitatePass::Move(const QString src, const QString dest, const bool force)
}
qDir.rename(src, destCopy);
}
// reecrypt all files under the new folder
if(destFileInfo.isDir()){
reencryptPath(destFileInfo.absoluteFilePath());
}else if(destFileInfo.isFile()){
reencryptPath(destFileInfo.dir().path());
}
}


void ImitatePass::Copy(const QString src, const QString dest, const bool force)
{
QFileInfo destFileInfo(dest);
if (QtPassSettings::isUseGit()) {
QStringList args;
args << "cp";
Expand All @@ -374,4 +381,10 @@ void ImitatePass::Copy(const QString src, const QString dest, const bool force)
}
QFile::copy(src, dest);
}
// reecrypt all files under the new folder
if(destFileInfo.isDir()){
reencryptPath(destFileInfo.absoluteFilePath());
}else if(destFileInfo.isFile()){
reencryptPath(destFileInfo.dir().path());
}
}