[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [marble] src/lib: flatten if-statement (bail out if returning false)
From: Bernhard Beschow <bbeschow () cs ! tu-berlin ! de>
Date: 2012-10-31 19:40:34
Message-ID: 20121031194034.A89F6A60D2 () git ! kde ! org
[Download RAW message or body]
Git commit 5460aac1ce958f153810dc7db0066f7c9bc85f39 by Bernhard Beschow.
Committed on 31/10/2012 at 13:53.
Pushed by beschow into branch 'master'.
flatten if-statement (bail out if returning false)
M +26 -25 src/lib/BookmarkManager.cpp
http://commits.kde.org/marble/5460aac1ce958f153810dc7db0066f7c9bc85f39
diff --git a/src/lib/BookmarkManager.cpp b/src/lib/BookmarkManager.cpp
index 05ad742..d77d64a 100644
--- a/src/lib/BookmarkManager.cpp
+++ b/src/lib/BookmarkManager.cpp
@@ -96,36 +96,37 @@ bool BookmarkManager::loadFile( const QString &relativeFilePath )
{
d->m_bookmarkFileRelativePath = relativeFilePath;
QString absoluteFilePath = bookmarkFile();
+
+ mDebug() << Q_FUNC_INFO << "Loading Bookmark File:" << absoluteFilePath;
+
if (absoluteFilePath.isEmpty())
return false;
- mDebug() << "Loading Bookmark File : " << absoluteFilePath;
- if ( ! relativeFilePath.isNull() ) {
- GeoDataDocument *document = openFile( absoluteFilePath );
- bool recover = false;
- if ( !document ) {
- mDebug() << "Could not parse file" << absoluteFilePath;
- mDebug() << "This could be caused by a previous broken bookmark file. Trying to recover.";
- /** @todo: Remove this workaround and return false around Marble 1.4 */
- recover = true;
- // return false;
- }
+ if ( relativeFilePath.isNull() )
+ return false;
- d->m_treeModel->removeDocument( d->m_bookmarkDocument );
- delete d->m_bookmarkDocument;
- d->m_bookmarkDocument = document;
+ GeoDataDocument *document = openFile( absoluteFilePath );
+ bool recover = false;
+ if ( !document ) {
+ mDebug() << "Could not parse file" << absoluteFilePath;
+ mDebug() << "This could be caused by a previous broken bookmark file. Trying to recover.";
+ /** @todo: Remove this workaround and return false around Marble 1.4 */
+ recover = true;
+ // return false;
+ }
- d->m_treeModel->addDocument( d->m_bookmarkDocument );
+ d->m_treeModel->removeDocument( d->m_bookmarkDocument );
+ delete d->m_bookmarkDocument;
+ d->m_bookmarkDocument = document;
- if ( recover ) {
- updateBookmarkFile();
- }
+ d->m_treeModel->addDocument( d->m_bookmarkDocument );
- emit bookmarksChanged();
- return true;
+ if ( recover ) {
+ updateBookmarkFile();
}
- return false;
+ emit bookmarksChanged();
+ return true;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic