[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:47:52
Message-ID: 1263653272.170973.27085.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1075686 by tmcguire:
Remove code duplication a bit by only calling KMessageBox::sorry() once
M +19 -20 kmcomposewin.cpp
--- branches/work/akonadi-ports/kdepim/kmail/kmcomposewin.cpp #1075685:1075686
@@ -673,6 +673,7 @@
const QString filename = KMKernel::localDataPath() + "autosave/" +
mAutoSaveUUID + "." + QString::number( msgNum );
KSaveFile file( filename );
+ QString errorMessage;
kDebug() << "Opening autosavefile" << filename;
if( file.open() ) {
@@ -681,33 +682,31 @@
kDebug() << "autosaving message in" << filename;
if( file.write( message->encodedContent() ) !=
- static_cast<qint64>( message->encodedContent().size() ) ) {
- KMessageBox::sorry( this, i18n("Autosaving the message as %1 "
- "failed. Could not write all data to file.\n"
- "Reason: %2",
- filename,
- file.errorString() ), i18n( "autosave" ) );
+ static_cast<qint64>( message->encodedContent().size() ) ) {
+ errorMessage = i18n( "Could not write all data to file." );
}
kDebug() << "closing autosave file.";
if( !file.finalize() ) {
- KMessageBox::sorry( this, i18n("Autosaving the message as %1 "
- "failed. Could not finalize the file.\n"
- "Reason: %2",
- filename,
- file.errorString() ), i18n( "autosave" ) );
+ errorMessage = i18n( "Could not finalize the file." );
}
- } else {
- if( mAutoSaveErrorShown == false ) {
- KMessageBox::sorry( this, i18n("Autosaving the message as %1 "
- "failed. Could not open file. \n"
- "Reason: %2",
- filename,
- file.errorString() ), i18n( "autosave" ) );
- // Prevent the error message being shown twice
- mAutoSaveErrorShown = true;
+ }
+ else {
+ errorMessage = i18n( "Could not open file." );
+ }
+
+ if ( !errorMessage.isEmpty() ) {
+ if ( mAutoSaveErrorShown == false ) {
+ KMessageBox::sorry( this, i18n( "Autosaving the message as %1 failed.\n"
+ "%2\n"
+ "Reason: %3",
+ filename,
+ errorMessage,
+ file.errorString() ),
+ i18n( "autosave" ) );
}
}
+ mAutoSaveErrorShown = true;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic