解决另存为和导出对话框,按下回车键未做同文件是否替换提醒;BUG-807
This commit is contained in:
parent
6e3db40cd0
commit
f13792d25e
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -190,18 +190,20 @@ void Dialog_Export::on_dialog_accepted()
|
|||
|
||||
assert(!extName.isEmpty());
|
||||
|
||||
bool warning = true;
|
||||
QString selectedFile = ui->fileDialog->selectedFiles()[0];
|
||||
int pos = selectedFile.lastIndexOf('/');
|
||||
if (-1 != pos)
|
||||
{
|
||||
QString path = selectedFile.left(pos + 1);
|
||||
QString name = selectedFile.right(selectedFile.count() - pos - 1);
|
||||
pos = name.lastIndexOf('.');
|
||||
if (-1 != pos
|
||||
&& is_support_file_type(name.right(name.length() - pos)))
|
||||
|
||||
#if defined (HG_CMP_MSC)
|
||||
if (name.endsWith(extName, Qt::CaseInsensitive))
|
||||
#else
|
||||
if (name.endsWith(extName, Qt::CaseSensitive))
|
||||
#endif
|
||||
{
|
||||
warning = false; // 带扩展名,系统已经警告同名文件
|
||||
pos = name.lastIndexOf('.');
|
||||
name = name.left(pos);
|
||||
}
|
||||
|
||||
|
@ -215,8 +217,11 @@ void Dialog_Export::on_dialog_accepted()
|
|||
QFile file(m_savePath + m_saveName + m_saveExt);
|
||||
if (file.exists())
|
||||
{
|
||||
int ret = QMessageBox::question(this, tr("Question"), tr("The file already exists. Do you want to overwrite it?"));
|
||||
if (ret != QMessageBox::Yes)
|
||||
QMessageBox msg(QMessageBox::Question, tr("Question"),
|
||||
tr("The file already exists. Do you want to overwrite it?"),
|
||||
QMessageBox::Yes | QMessageBox::No, this);
|
||||
msg.exec();
|
||||
if (msg.clickedButton() != msg.button(QMessageBox::Yes))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -198,7 +198,7 @@ void Dialog_SaveAs::on_dialog_accepted()
|
|||
if(checked)
|
||||
{
|
||||
QString dirName = NULL;
|
||||
dirName = path + QDateTime::currentDateTime().toString("yy-MM-dd hh.mm.ss");
|
||||
dirName = path + QDateTime::currentDateTime().toString("yy-MM-dd hh.mm.ss") + "/";
|
||||
QDir dir(dirName);
|
||||
if(!dir.exists())
|
||||
{
|
||||
|
@ -207,7 +207,11 @@ void Dialog_SaveAs::on_dialog_accepted()
|
|||
path = dirName;
|
||||
}
|
||||
|
||||
if(name.endsWith(extName))
|
||||
#if defined (HG_CMP_MSC)
|
||||
if (name.endsWith(extName, Qt::CaseInsensitive))
|
||||
#else
|
||||
if (name.endsWith(extName, Qt::CaseSensitive))
|
||||
#endif
|
||||
m_savePath = getStdFileName(path + name);
|
||||
else
|
||||
m_savePath = getStdFileName(path + name + extName);
|
||||
|
@ -216,8 +220,11 @@ void Dialog_SaveAs::on_dialog_accepted()
|
|||
QFile file(m_savePath);
|
||||
if (file.exists())
|
||||
{
|
||||
int ret = QMessageBox::question(this, tr("Question"), tr("The file already exists. Do you want to overwrite it?"));
|
||||
if (ret != QMessageBox::Yes)
|
||||
QMessageBox msg(QMessageBox::Question, tr("Question"),
|
||||
tr("The file already exists. Do you want to overwrite it?"),
|
||||
QMessageBox::Yes | QMessageBox::No, this);
|
||||
msg.exec();
|
||||
if (msg.clickedButton() != msg.button(QMessageBox::Yes))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue