~ubuntu-branches/ubuntu/wily/qgis/wily

« back to all changes in this revision

Viewing changes to src/gui/qgsprojectbadlayerguihandler.cpp

  • Committer: Package Import Robot
  • Author(s): Francesco Paolo Lovergine
  • Date: 2012-04-24 15:12:20 UTC
  • mfrom: (3.1.9 sid)
  • Revision ID: package-import@ubuntu.com-20120424151220-r88g00af5fpn5fc3
Tags: 1.7.4+1.7.5~20120320-1
The "Sometimes they come back" release.

* Branching from Qgis tree and adapting to current Debian Policy and
  standards. The target tree is currently set to release-1.7.
  (closes: #661491, #606304, #615683, #616182, #600308)
* Policy bumped to 3.9.3.
* Moving to debhelper compatibility level 9.
* Source format is now 3.0 with quilt support.
* Merged with 2bf42287 upstream git snapshot.
* Migrated to dh_python2 instead of python-central.
  (closes: #617048)
* Snapshot in qgis.org release-1.7: c936d031
* Added an automagic creation of a lintian override for sqlite embedding.
  This is required for uploading currently.
* Added missing ${misc:Depends} to make lintian happy.
* Copyright notes updated and debian/copyright moved to format 1.0.
* More licenses notices now reported in debian/copyright. Thanks ftpmasters.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
#include <QDomDocument>
5
5
#include <QFileInfo>
6
6
#include <QMessageBox>
 
7
#include <QPushButton>
7
8
 
8
9
#include "qgslogger.h"
9
10
#include "qgisgui.h"
13
14
{
14
15
}
15
16
 
 
17
bool QgsProjectBadLayerGuiHandler::mIgnore = false;
16
18
 
17
19
void QgsProjectBadLayerGuiHandler::handleBadLayers( QList<QDomNode> layers, QDomDocument projectDom )
18
20
{
19
 
 
20
21
  QgsDebugMsg( QString( "%1 bad layers found" ).arg( layers.size() ) );
21
22
 
22
23
  // make sure we have arrow cursor (and not a wait cursor)
23
24
  QApplication::setOverrideCursor( Qt::ArrowCursor );
24
25
 
25
 
  if ( QMessageBox::Ok == QMessageBox::critical( NULL,
26
 
       tr( "QGIS Project Read Error" ),
27
 
       tr( "Unable to open one or more project layers\nTry to find missing layers?" ),
28
 
       QMessageBox::Ok | QMessageBox::Cancel ) )
 
26
  QMessageBox messageBox;
 
27
 
 
28
  QAbstractButton *ignoreButton =
 
29
    messageBox.addButton( tr( "Ignore" ), QMessageBox::ActionRole );
 
30
 
 
31
  QAbstractButton *okButton = messageBox.addButton( QMessageBox :: Ok );
 
32
 
 
33
  messageBox.addButton( QMessageBox :: Cancel );
 
34
 
 
35
  messageBox.setWindowTitle( tr( "QGIS Project Read Error" ) );
 
36
  messageBox.setText( tr( "Unable to open one or more project layers.\nChoose "
 
37
                          "ignore to continue loading without the missing layers. Choose cancel to "
 
38
                          "return to your pre-project load state. Choose OK to try to find the "
 
39
                          "missing layers." ) );
 
40
  messageBox.setIcon( QMessageBox::Critical );
 
41
  messageBox.exec();
 
42
 
 
43
  QgsProjectBadLayerGuiHandler::mIgnore = false;
 
44
 
 
45
  if ( messageBox.clickedButton() == okButton )
29
46
  {
30
47
    QgsDebugMsg( "want to find missing layers is true" );
31
48
 
35
52
    QString filter = QgsProviderRegistry::instance()->fileVectorFilters();
36
53
    findLayers( filter, layers );
37
54
  }
 
55
  else if ( messageBox.clickedButton() == ignoreButton )
 
56
  {
 
57
    QgsProjectBadLayerGuiHandler::mIgnore = true;
 
58
  }
 
59
  else
 
60
  {
 
61
    // Do nothing
 
62
  }
38
63
 
39
64
  QApplication::restoreOverrideCursor();
40
65
}
41
66
 
42
 
 
43
67
QgsProjectBadLayerGuiHandler::DataType QgsProjectBadLayerGuiHandler::dataType( QDomNode & layerNode )
44
68
{
45
69
  QString type = layerNode.toElement().attribute( "type" );