mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-18 19:06: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);
|
||||
if (!cf)
|
||||
{
|
||||
eprintf("QRCore::tryFile: Cannot open file?\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -305,32 +305,29 @@ bool NewFileDialog::fillProjectsList()
|
||||
|
||||
void NewFileDialog::loadFile(const QString &filename)
|
||||
{
|
||||
// Check that there is a file selected
|
||||
QFileInfo checkfile(filename);
|
||||
if (!checkfile.exists() || !checkfile.isFile())
|
||||
if(!Core()->tryFile(filename, false))
|
||||
{
|
||||
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();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add file to recent file list
|
||||
QSettings settings;
|
||||
QStringList files = settings.value("recentFileList").toStringList();
|
||||
files.removeAll(filename);
|
||||
files.prepend(filename);
|
||||
while (files.size() > MaxRecentFiles)
|
||||
files.removeLast();
|
||||
|
||||
settings.setValue("recentFileList", files);
|
||||
// Add file to recent file list
|
||||
QSettings settings;
|
||||
QStringList files = settings.value("recentFileList").toStringList();
|
||||
files.removeAll(filename);
|
||||
files.prepend(filename);
|
||||
while (files.size() > MaxRecentFiles)
|
||||
files.removeLast();
|
||||
|
||||
// Close dialog and open MainWindow/OptionsDialog
|
||||
MainWindow *main = new MainWindow();
|
||||
main->openNewFile(filename);
|
||||
settings.setValue("recentFileList", files);
|
||||
|
||||
close();
|
||||
}
|
||||
// Close dialog and open MainWindow/OptionsDialog
|
||||
MainWindow *main = new MainWindow();
|
||||
main->openNewFile(filename);
|
||||
|
||||
close();
|
||||
}
|
||||
|
||||
void NewFileDialog::loadProject(const QString &project)
|
||||
|
@ -67,8 +67,6 @@ OptionsDialog::OptionsDialog(MainWindow *main):
|
||||
connect(ui->cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
|
||||
|
||||
ui->programLineEdit->setText(main->getFilename());
|
||||
QFileInfo fi(this->main->getFilename());
|
||||
this->core->tryFile(fi.filePath(), fi.isWritable());
|
||||
}
|
||||
|
||||
OptionsDialog::~OptionsDialog() {}
|
||||
|
Loading…
Reference in New Issue
Block a user