Replace native file dialog with Qt's file dialog on Linux
This commit is contained in:
@@ -571,28 +571,8 @@ bool Document::saveAs(void)
|
||||
getMainWindow()->showMessage(QObject::tr("Save document under new filename..."));
|
||||
|
||||
QString exe = qApp->applicationName();
|
||||
QString fn = QFileDialog::getSaveFileName(getMainWindow(), QObject::tr("Save %1 Document").arg(exe),
|
||||
FileDialog::getWorkingDirectory(), QObject::tr("%1 document (*.FCStd)").arg(exe));
|
||||
if (!fn.isEmpty()) {
|
||||
FileDialog::setWorkingDirectory(fn);
|
||||
QString file = fn.toLower();
|
||||
if (!file.endsWith(QLatin1String(".fcstd"))) {
|
||||
fn += QLatin1String(".fcstd");
|
||||
QFileInfo fi;
|
||||
fi.setFile(fn);
|
||||
if (fi.exists()) {
|
||||
// if we auto-append the extension make sure that we don't override an existing file
|
||||
int ret = QMessageBox::question(getMainWindow(), QObject::tr("Save As"),
|
||||
QObject::tr("%1 already exists.\n"
|
||||
"Do you want to replace it?").arg(fn),
|
||||
QMessageBox::Yes|QMessageBox::Default,
|
||||
QMessageBox::No|QMessageBox::Escape);
|
||||
if (ret != QMessageBox::Yes)
|
||||
fn = QString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString fn = FileDialog::getSaveFileName(getMainWindow(), QObject::tr("Save %1 Document").arg(exe),
|
||||
QString(), QObject::tr("%1 document (*.FCStd)").arg(exe));
|
||||
if (!fn.isEmpty()) {
|
||||
QFileInfo fi;
|
||||
fi.setFile(fn);
|
||||
|
||||
Reference in New Issue
Block a user