patch.txt

Tim Baggett -, 2006-03-28 10:07 PM

Download (2.02 KB)

 
1
Index: src/gui/qgisapp.cpp
2
===================================================================
3
--- src/gui/qgisapp.cpp	(revision 5106)
4
+++ src/gui/qgisapp.cpp	(working copy)
5
@@ -2915,11 +2915,15 @@
6
   QString lastUsedDir = settings.readEntry("/UI/lastProjectDir", ".");
7
 
8
   auto_ptr<QFileDialog> saveFileDialog( new QFileDialog(this,
9
-      tr("Choose a QGIS project file"),
10
+      tr("Choose a filename to save the QGIS project file as"),
11
       lastUsedDir, QObject::tr("QGis files (*.qgs)")) );
12
 
13
   saveFileDialog->setMode(QFileDialog::AnyFile);
14
 
15
+  saveFileDialog->setAcceptMode(QFileDialog::AcceptSave);
16
+
17
+  saveFileDialog->setConfirmOverwrite( true );
18
+
19
   // if we don't have a filename, then obviously we need to get one; note
20
   // that the project file name is reset to null in fileNew()
21
   QFileInfo fullPath;
22
@@ -2952,29 +2956,6 @@
23
   }
24
 
25
 
26
-  //  Check to see if the file exists before just blasting it into
27
-  //  oblivion; abort saving the project if the user does not want to
28
-  //  over-write an existing file.
29
-
30
-  if ( fullPath.exists() )
31
-  {
32
-    if ( QMessageBox::No == QMessageBox::warning( 0x0, 
33
-          tr("Project file exists."),
34
-          tr("The given project file exists.  Do you wish to over-write it with a new one?"),
35
-          QMessageBox::Yes | QMessageBox::Default,
36
-          QMessageBox::No  | QMessageBox::Escape,
37
-          Qt::NoButton ) )
38
-    {
39
-      return;             // abort saving the file since the user
40
-      // doesn't want to over-write
41
-    }
42
-  }
43
-  else
44
-  {
45
-    QgsDebug( " project file does not already exist" );
46
-  }
47
-
48
-
49
   QgsProject::instance()->filename( fullPath.filePath() );
50
 
51
   if ( QgsProject::instance()->write() )
52
@@ -3165,6 +3146,11 @@
53
   // allow for selection of more than one file
54
   myQFileDialog->setMode(QFileDialog::AnyFile);
55
 
56
+  myQFileDialog->setAcceptMode(QFileDialog::AcceptSave);
57
+
58
+  myQFileDialog->setConfirmOverwrite( true );
59
+
60
+
61
   if (!myLastUsedFilter.isEmpty())       // set the filter to the last one used
62
   {
63
     myQFileDialog->selectFilter(myLastUsedFilter);