summaryrefslogtreecommitdiff
path: root/plugins/CopyEngine/Ultracopier/FolderExistsDialog.cpp
diff options
context:
space:
mode:
authorThomas Preud'homme <robotux@celest.fr>2018-02-24 00:13:45 +0000
committerThomas Preud'homme <robotux@celest.fr>2018-02-24 00:13:46 +0000
commit0fa6fb5a53789434e6ef57af39ab9024b7ec7d50 (patch)
tree9854613566cca815292f6fcad8e4d678afa30a9a /plugins/CopyEngine/Ultracopier/FolderExistsDialog.cpp
parent2124f782c35cd832460d070186eaf72d935c1bdb (diff)
parentb00b0c864574c3842effe1705b66066fa228f950 (diff)
merge patched into master
Diffstat (limited to 'plugins/CopyEngine/Ultracopier/FolderExistsDialog.cpp')
-rw-r--r--plugins/CopyEngine/Ultracopier/FolderExistsDialog.cpp36
1 files changed, 21 insertions, 15 deletions
diff --git a/plugins/CopyEngine/Ultracopier/FolderExistsDialog.cpp b/plugins/CopyEngine/Ultracopier/FolderExistsDialog.cpp
index ac1e74e..d05a715 100644
--- a/plugins/CopyEngine/Ultracopier/FolderExistsDialog.cpp
+++ b/plugins/CopyEngine/Ultracopier/FolderExistsDialog.cpp
@@ -2,11 +2,17 @@
#include "ui_folderExistsDialog.h"
#include "TransferThread.h"
+#ifdef Q_OS_WIN32
+#define CURRENTSEPARATOR "\\"
+#else
+#define CURRENTSEPARATOR "/"
+#endif
+
#include <QMessageBox>
#include <QFileInfo>
#include <QMessageBox>
-FolderExistsDialog::FolderExistsDialog(QWidget *parent,QFileInfo source,bool isSame,QFileInfo destination,QString firstRenamingRule,QString otherRenamingRule) :
+FolderExistsDialog::FolderExistsDialog(QWidget *parent, QFileInfo source, bool isSame, QFileInfo destination, std::string firstRenamingRule, std::string otherRenamingRule) :
QDialog(parent),
ui(new Ui::folderExistsDialog)
{
@@ -20,8 +26,8 @@ FolderExistsDialog::FolderExistsDialog(QWidget *parent,QFileInfo source,bool isS
ui->setupUi(this);
action=FolderExists_Cancel;
oldName=TransferThread::resolvedName(destination);
- ui->lineEditNewName->setText(oldName);
- ui->lineEditNewName->setPlaceholderText(oldName);
+ ui->lineEditNewName->setText(QString::fromStdString(oldName));
+ ui->lineEditNewName->setPlaceholderText(QString::fromStdString(oldName));
ui->label_content_source_modified->setText(source.lastModified().toString());
ui->label_content_source_folder_name->setText(source.fileName());
QString folder=source.absolutePath();
@@ -83,20 +89,20 @@ void FolderExistsDialog::changeEvent(QEvent *e)
}
}
-QString FolderExistsDialog::getNewName()
+std::string FolderExistsDialog::getNewName()
{
- if(oldName==ui->lineEditNewName->text() || ui->checkBoxAlways->isChecked())
+ if(oldName==ui->lineEditNewName->text().toStdString() || ui->checkBoxAlways->isChecked())
return "";
else
- return ui->lineEditNewName->text();
+ return ui->lineEditNewName->text().toStdString();
}
void FolderExistsDialog::on_SuggestNewName_clicked()
{
QFileInfo destinationInfo=this->destinationInfo;
QString absolutePath=destinationInfo.absolutePath();
- QString fileName=TransferThread::resolvedName(destinationInfo);
- QString suffix=QStringLiteral("");
+ QString fileName=QString::fromStdString(TransferThread::resolvedName(destinationInfo));
+ QString suffix;
QString destination;
QString newFileName;
//resolv the suffix
@@ -112,26 +118,26 @@ void FolderExistsDialog::on_SuggestNewName_clicked()
{
if(num==1)
{
- if(firstRenamingRule.isEmpty())
+ if(firstRenamingRule.empty())
newFileName=tr("%1 - copy").arg(fileName);
else
{
- newFileName=firstRenamingRule;
+ newFileName=QString::fromStdString(firstRenamingRule);
newFileName.replace(QStringLiteral("%name%"),fileName);
}
}
else
{
- if(otherRenamingRule.isEmpty())
+ if(otherRenamingRule.empty())
newFileName=tr("%1 - copy (%2)").arg(fileName).arg(num);
else
{
- newFileName=otherRenamingRule;
+ newFileName=QString::fromStdString(otherRenamingRule);
newFileName.replace(QStringLiteral("%name%"),fileName);
newFileName.replace(QStringLiteral("%number%"),QString::number(num));
}
}
- destination=absolutePath+QDir::separator()+newFileName+suffix;
+ destination=absolutePath+CURRENTSEPARATOR+newFileName+suffix;
destinationInfo.setFile(destination);
num++;
}
@@ -187,7 +193,7 @@ void FolderExistsDialog::on_lineEditNewName_returnPressed()
QMessageBox::warning(this,tr("Error"),tr("Try rename with using special characters"));
}
-void FolderExistsDialog::on_lineEditNewName_textChanged(const QString &arg1)
+void FolderExistsDialog::on_lineEditNewName_textChanged(const std::string &arg1)
{
Q_UNUSED(arg1);
updateRenameButton();
@@ -195,5 +201,5 @@ void FolderExistsDialog::on_lineEditNewName_textChanged(const QString &arg1)
void FolderExistsDialog::updateRenameButton()
{
- ui->Rename->setEnabled(ui->checkBoxAlways->isChecked() || (!ui->lineEditNewName->text().contains(QRegularExpression("[/\\\\\\*]")) && oldName!=ui->lineEditNewName->text() && !ui->lineEditNewName->text().isEmpty()));
+ ui->Rename->setEnabled(ui->checkBoxAlways->isChecked() || (!ui->lineEditNewName->text().contains(QRegularExpression("[/\\\\\\*]")) && oldName!=ui->lineEditNewName->text().toStdString() && !ui->lineEditNewName->text().isEmpty()));
}