summaryrefslogtreecommitdiff
path: root/plugins/CopyEngine/Ultracopier/FolderExistsDialog.cpp
diff options
context:
space:
mode:
authorThomas Preud'homme <robotux@celest.fr>2018-02-23 23:49:48 +0000
committerThomas Preud'homme <robotux@celest.fr>2018-02-23 23:49:48 +0000
commitbd56579c7d9de94c17287adefa118290e6b7ba33 (patch)
tree666d7d0b6945b442573b7a3145969f66a53aa460 /plugins/CopyEngine/Ultracopier/FolderExistsDialog.cpp
parentb3c8bdcc0d1e4b2ab298847a7902b6d60410a5bc (diff)
New upstream version 1.4.0.3
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()));
}