mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 05:00:33 +01:00
Prevented multiple messages from being displayed when opening a recent file.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@1998 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -915,10 +915,8 @@ void QETElementEditor::slot_openFile() {
|
|||||||
@see openElement
|
@see openElement
|
||||||
*/
|
*/
|
||||||
void QETElementEditor::openRecentFile(const QString &filepath) {
|
void QETElementEditor::openRecentFile(const QString &filepath) {
|
||||||
if (!QFile::exists ( filepath ))
|
// small hack to prevent all element editors from trying to topen the required
|
||||||
QMessageBox::warning(this, tr("Attention"),
|
// recent file at the same time
|
||||||
tr("Le fichier semble ne plus exister...")+"\n"+
|
|
||||||
tr("Fichier: ")+filepath+"\n");
|
|
||||||
if (qApp -> activeWindow() != this) return;
|
if (qApp -> activeWindow() != this) return;
|
||||||
openElement(filepath);
|
openElement(filepath);
|
||||||
}
|
}
|
||||||
@@ -932,6 +930,18 @@ void QETElementEditor::openRecentFile(const QString &filepath) {
|
|||||||
*/
|
*/
|
||||||
void QETElementEditor::openElement(const QString &filepath) {
|
void QETElementEditor::openElement(const QString &filepath) {
|
||||||
if (filepath.isEmpty()) return;
|
if (filepath.isEmpty()) return;
|
||||||
|
// we have to test the file existence here because QETApp::openElementFiles()
|
||||||
|
// will discard non-existent files through QFileInfo::canonicalFilePath()
|
||||||
|
if (!QFile::exists(filepath)) {
|
||||||
|
QET::MessageBox::critical(
|
||||||
|
this,
|
||||||
|
tr("Impossible d'ouvrir le fichier", "message box title"),
|
||||||
|
QString(
|
||||||
|
tr("Il semblerait que le fichier %1 que vous essayez d'ouvrir"
|
||||||
|
" n'existe pas ou plus.")
|
||||||
|
).arg(filepath)
|
||||||
|
);
|
||||||
|
}
|
||||||
QETApp::instance() -> openElementFiles(QStringList() << filepath);
|
QETApp::instance() -> openElementFiles(QStringList() << filepath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -637,10 +637,8 @@ bool QETDiagramEditor::newProject() {
|
|||||||
@see openAndAddDiagram
|
@see openAndAddDiagram
|
||||||
*/
|
*/
|
||||||
bool QETDiagramEditor::openRecentFile(const QString &filepath) {
|
bool QETDiagramEditor::openRecentFile(const QString &filepath) {
|
||||||
if (!QFile::exists ( filepath ))
|
// small hack to prevent all diagram editors from trying to topen the required
|
||||||
QMessageBox::warning(this, tr("Attention"),
|
// recent file at the same time
|
||||||
tr("Le fichier semble ne plus exister...")+"\n"+
|
|
||||||
tr("Fichier: ")+filepath+"\n");
|
|
||||||
if (qApp -> activeWindow() != this) return(false);
|
if (qApp -> activeWindow() != this) return(false);
|
||||||
return(openAndAddProject(filepath));
|
return(openAndAddProject(filepath));
|
||||||
}
|
}
|
||||||
@@ -735,12 +733,26 @@ bool QETDiagramEditor::openAndAddProject(const QString &filepath, bool interacti
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check the file exists
|
||||||
|
if (!filepath_info.exists()) {
|
||||||
|
if (interactive) {
|
||||||
|
QET::MessageBox::critical(
|
||||||
|
this,
|
||||||
|
tr("Impossible d'ouvrir le fichier", "message box title"),
|
||||||
|
QString(
|
||||||
|
tr("Il semblerait que le fichier %1 que vous essayez d'ouvrir"
|
||||||
|
" n'existe pas ou plus.")
|
||||||
|
).arg(filepath)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// verifie que le fichier est accessible en lecture
|
// verifie que le fichier est accessible en lecture
|
||||||
if (!filepath_info.isReadable()) {
|
if (!filepath_info.isReadable()) {
|
||||||
if (interactive) {
|
if (interactive) {
|
||||||
QET::MessageBox::critical(
|
QET::MessageBox::critical(
|
||||||
this,
|
this,
|
||||||
tr("Impossible d'ouvrir le fichier"),
|
tr("Impossible d'ouvrir le fichier", "message box title"),
|
||||||
tr("Il semblerait que le fichier que vous essayez d'ouvrir ne "
|
tr("Il semblerait que le fichier que vous essayez d'ouvrir ne "
|
||||||
"soit pas accessible en lecture. Il est donc impossible de "
|
"soit pas accessible en lecture. Il est donc impossible de "
|
||||||
"l'ouvrir. Veuillez v\351rifier les permissions du fichier.")
|
"l'ouvrir. Veuillez v\351rifier les permissions du fichier.")
|
||||||
@@ -754,7 +766,7 @@ bool QETDiagramEditor::openAndAddProject(const QString &filepath, bool interacti
|
|||||||
if (interactive) {
|
if (interactive) {
|
||||||
QET::MessageBox::warning(
|
QET::MessageBox::warning(
|
||||||
this,
|
this,
|
||||||
tr("Ouverture du projet en lecture seule"),
|
tr("Ouverture du projet en lecture seule", "message box title"),
|
||||||
tr("Il semblerait que le projet que vous essayez d'ouvrir ne "
|
tr("Il semblerait que le projet que vous essayez d'ouvrir ne "
|
||||||
"soit pas accessible en \351criture. Il sera donc ouvert en "
|
"soit pas accessible en \351criture. Il sera donc ouvert en "
|
||||||
"lecture seule.")
|
"lecture seule.")
|
||||||
|
|||||||
Reference in New Issue
Block a user