[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/work/akonadi-ports/kdepim/kmail
From:       Thomas McGuire <mcguire () kde ! org>
Date:       2010-01-16 14:54:14
Message-ID: 1263653654.936409.27578.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1075689 by tmcguire:

- Fix logic error I introduced myself
- Less and more helpful debug


 M  +14 -9     kmcomposewin.cpp  


--- branches/work/akonadi-ports/kdepim/kmail/kmcomposewin.cpp #1075688:1075689
@@ -674,21 +674,19 @@
     mAutoSaveUUID + "." + QString::number( msgNum );
   KSaveFile file( filename );
   QString errorMessage;
-  kDebug() << "Opening autosavefile" << filename;
+  kDebug() << "Writing message to disk as" << filename;
 
   if( file.open() ) {
-    kDebug() << "Succesfully opened autosave file.";
     file.setPermissions( QFile::ReadUser | QFile::WriteUser );
 
-    kDebug() << "autosaving message in" << filename;
     if( file.write( message->encodedContent() ) !=
         static_cast<qint64>( message->encodedContent().size() ) ) {
       errorMessage = i18n( "Could not write all data to file." );
     }
-
-    kDebug() << "closing autosave file.";
-    if( !file.finalize() ) {
-      errorMessage = i18n( "Could not finalize the file." );
+    else {
+      if( !file.finalize() ) {
+        errorMessage = i18n( "Could not finalize the file." );
+      }
     }
   }
   else {
@@ -696,7 +694,8 @@
   }
 
   if ( !errorMessage.isEmpty() ) {
-    if ( mAutoSaveErrorShown == false ) {
+    kWarning() << "Auto saving failed:" << errorMessage << file.errorString();
+    if ( !mAutoSaveErrorShown ) {
       KMessageBox::sorry( this, i18n( "Autosaving the message as %1 failed.\n"
                                       "%2\n"
                                       "Reason: %3",
@@ -704,9 +703,15 @@
                                       errorMessage,
                                       file.errorString() ),
                           i18n( "autosave" ) );
+
+      // Error dialog shown, hide the errors the next time
+      mAutoSaveErrorShown = true;
     }
   }
-  mAutoSaveErrorShown = true;
+  else {
+    // No error occurred, the next error should be shown again
+    mAutoSaveErrorShown = false;
+  }
 }
 
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic