From b65ab2398dcbc2f5c9b1ec33ac0bbf863e3df0ca Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 13 Oct 2018 05:10:14 +0200 Subject: Print destination file when adding sources Use a function to generate the path, so we can reuse it when actually copying files :) --- copydialog.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'copydialog.cpp') diff --git a/copydialog.cpp b/copydialog.cpp index 38a5b9f..f16fda0 100644 --- a/copydialog.cpp +++ b/copydialog.cpp @@ -81,6 +81,26 @@ void CopyDialog::setDestFolder(const QString &dst){ void CopyDialog::setSources(const QStringList &sources){ mSources = sources; + refresh(); +} + +void CopyDialog::refresh(){ + QString res; + for(const QString &p : mSources){ + res.append(QString("%1 %2\n").arg(QChar(0x2b9a)).arg(p)); + res.append(QString("%1 %2\n").arg(QChar(0x2b98)).arg(getDestinationFile(p))); + } + mResultL->setText(res); +} + +QString CopyDialog::getDestinationFile(const QString &srcFn){ + QFileInfo fi(srcFn); + if(fi.exists()){ + QString fn = fi.fileName(); + QString destPath = QString("%1/%2/%3").arg(mDstE->text()).arg(mFolderE->text()).arg(fn); + return destPath; + } + return QString(); } void CopyDialog::closeEvent(QCloseEvent *e){ -- cgit v1.2.3-70-g09d2