Browse Source

Reset projectIsDirty in fileSave_to if saving succeeded.
Only reset the dirty and new flags in fileSave_saveAs and fileSave_loadList if saving succeeded, display an error message otherwise.


git-svn-id: file:///var/svn/tigccpp/trunk@421 9552661e-59e3-4036-b4f2-dbe53926924f

kevinkofler 18 years ago
parent
commit
3e1488963c
1 changed files with 16 additions and 8 deletions
  1. 16 8
      ktigcc/mainform.ui.h

+ 16 - 8
ktigcc/mainform.ui.h

@@ -795,10 +795,13 @@ void MainForm::fileSave_saveAs(QListViewItem *theItem)
   if (saveFileName.isEmpty())
     return;
   ListViewFile *theFile=static_cast<ListViewFile *>(theItem);
-  theFile->fileName=saveFileName;
-  theFile->isNew=FALSE;
-  theFile->isDirty=FALSE;
-  saveFileText(saveFileName,theFile->textBuffer);
+  if (saveFileText(saveFileName,theFile->textBuffer))
+    KMessageBox::error(this,QString("Can't save to \'%1\'").arg(saveFileName));
+  else {
+    theFile->fileName=saveFileName;
+    theFile->isNew=FALSE;
+    theFile->isDirty=FALSE;
+  }
 }
 
 //loadList also saves the file contents
@@ -837,9 +840,12 @@ void MainForm::fileSave_loadList(QListViewItem *category,void *fileListV,void *d
         tmpPath=*new_dir;
         kurlNewFileName(tmpPath,relPath);
         theFile->fileName=tmpPath.path();
-        saveFileText(tmpPath.path(),theFile->textBuffer);
-        theFile->isNew=FALSE;
-        theFile->isDirty=FALSE;
+        if (saveFileText(tmpPath.path(),theFile->textBuffer))
+          KMessageBox::error(this,QString("Can't save to \'%1\'").arg(tmpPath.path()));
+        else {
+          theFile->isNew=FALSE;
+          theFile->isDirty=FALSE;
+        }
       }
       
       fileList->path << relPath;
@@ -910,8 +916,10 @@ void MainForm::fileSave_to(const QString &nextProj)
   
   if (saveTPR(nextProj,&TPRData))
     KMessageBox::error(this,QString("Can't save to \'%1\'").arg(nextProj));
-  else
+  else {
     projectFileName=nextProj;
+    projectIsDirty=FALSE;
+  }
 }
 
 void MainForm::fileSave()