unify i/o error reporting in the model

- use Utils::FileSaver
- as a side effect, don't rewrite the desktop file with the same content
  if it already exists
- pop up message boxes on errors - this is likely to be more visible
  than qWarning()s/nothing
  - this is implemented in a somewhat strange way with the model itself
    doing the gui interaction, but that seems to be the simplest
    solution given the qt class design
This commit is contained in:
Oswald Buddenhagen
2011-03-30 15:57:28 +02:00
parent ff456bb4b6
commit 2be153ba37
3 changed files with 24 additions and 55 deletions

View File

@@ -120,11 +120,7 @@ void MaemoDeployConfigurationWidget::addDesktopFile()
return;
MaemoDeployableListModel *const model
= m_deployConfig->deployables()->modelAt(modelRow);
QString error;
if (!model->addDesktopFile(error)) {
QMessageBox::warning(this, tr("Could not create desktop file"),
tr("Error creating desktop file: %1").arg(error));
}
model->addDesktopFile();
ui->addDesktopFileButton->setEnabled(model->canAddDesktopFile());
ui->tableView->resizeRowsToContents();
}
@@ -161,11 +157,7 @@ void MaemoDeployConfigurationWidget::addIcon()
return;
}
QString error;
if (!model->addIcon(newFileName, error)) {
QMessageBox::critical(this, tr("Could Not Add Icon"),
tr("Error adding icon: %1").arg(error));
}
model->addIcon(newFileName);
ui->addIconButton->setEnabled(model->canAddIcon());
ui->tableView->resizeRowsToContents();
}