mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-19 03:16:10 +00:00
Check file using CutterCore::tryFile() instead of QFileInfo
This commit is contained in:
parent
ec7cef1394
commit
266402095f
@ -414,7 +414,6 @@ bool CutterCore::tryFile(QString path, bool rw)
|
|||||||
cf = r_core_file_open(this->core_, path.toUtf8().constData(), flags, 0LL);
|
cf = r_core_file_open(this->core_, path.toUtf8().constData(), flags, 0LL);
|
||||||
if (!cf)
|
if (!cf)
|
||||||
{
|
{
|
||||||
eprintf("QRCore::tryFile: Cannot open file?\n");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,16 +305,14 @@ bool NewFileDialog::fillProjectsList()
|
|||||||
|
|
||||||
void NewFileDialog::loadFile(const QString &filename)
|
void NewFileDialog::loadFile(const QString &filename)
|
||||||
{
|
{
|
||||||
// Check that there is a file selected
|
if(!Core()->tryFile(filename, false))
|
||||||
QFileInfo checkfile(filename);
|
|
||||||
if (!checkfile.exists() || !checkfile.isFile())
|
|
||||||
{
|
{
|
||||||
QMessageBox msgBox(this);
|
QMessageBox msgBox(this);
|
||||||
msgBox.setText(tr("Select a new program or a previous one\nbefore continuing"));
|
msgBox.setText(tr("Select a new program or a previous one before continuing."));
|
||||||
msgBox.exec();
|
msgBox.exec();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// Add file to recent file list
|
// Add file to recent file list
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
QStringList files = settings.value("recentFileList").toStringList();
|
QStringList files = settings.value("recentFileList").toStringList();
|
||||||
@ -330,7 +328,6 @@ void NewFileDialog::loadFile(const QString &filename)
|
|||||||
main->openNewFile(filename);
|
main->openNewFile(filename);
|
||||||
|
|
||||||
close();
|
close();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewFileDialog::loadProject(const QString &project)
|
void NewFileDialog::loadProject(const QString &project)
|
||||||
|
@ -67,8 +67,6 @@ OptionsDialog::OptionsDialog(MainWindow *main):
|
|||||||
connect(ui->cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
|
connect(ui->cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
|
||||||
|
|
||||||
ui->programLineEdit->setText(main->getFilename());
|
ui->programLineEdit->setText(main->getFilename());
|
||||||
QFileInfo fi(this->main->getFilename());
|
|
||||||
this->core->tryFile(fi.filePath(), fi.isWritable());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OptionsDialog::~OptionsDialog() {}
|
OptionsDialog::~OptionsDialog() {}
|
||||||
|
Loading…
Reference in New Issue
Block a user