OSSP CVS Repository

ossp - Difference in ossp-pkg/as/as-gui/as_slot.cpp versions 1.65 and 1.66
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/as/as-gui/as_slot.cpp 1.65 -> 1.66

--- as_slot.cpp  2002/12/16 17:13:17     1.65
+++ as_slot.cpp  2002/12/16 17:37:39     1.66
@@ -455,11 +455,26 @@
 //
 void Titraqform::saveAs(void)
 {
+    int nResult = 0; // For checking user's answer
+
     // First get the selected file name to save to
     QString Filestring = QFileDialog::getSaveFileName(QString::null, QString::null, this);
     if (!Filestring.isEmpty()) {
         *m_szFilename = Filestring;
-        saveFile(); // Finish off by calling the save action
+        if (QFile::exists(*m_szFilename)) {
+            nResult = QMessageBox::warning(this, trUtf8(TITRAQ_APPTITLE),
+                      trUtf8(TITRAQ_OVERWRITE), trUtf8("&Yes"), trUtf8("&No"), NULL, 1, 1);
+            switch (nResult) {
+            case 0: // Overwrite contents
+                this->saveFile();
+                break;
+            case 1: // Don't overwrite
+            default:
+                break;
+            }
+        }
+        else
+            saveFile(); // Finish off by calling the save action
     }
     else {
         // User did not select a valid file and push okay button

CVSTrac 2.0.1