[Marble-commits] KDE/kdeedu/marble/src/lib
Dennis Nienhüser
earthwings at gentoo.org
Tue Jan 18 21:19:09 CET 2011
SVN commit 1215464 by nienhueser:
Make simple editing (renaming of folders and bookmarks) work.
M +1 -0 BookmarkManager.h
M +20 -11 BookmarkManagerDialog.cpp
M +5 -0 BookmarkManagerDialog.h
--- trunk/KDE/kdeedu/marble/src/lib/BookmarkManager.h #1215463:1215464
@@ -76,6 +76,7 @@
void bookmarksChanged();
private:
+ friend class BookmarkManagerDialog;
/**
* @brief updates bookmark file and return true if updated successfully
--- trunk/KDE/kdeedu/marble/src/lib/BookmarkManagerDialog.cpp #1215463:1215464
@@ -11,6 +11,7 @@
#include "BookmarkManagerDialog.h"
#include "BookmarkManager.h"
+#include "BookmarkManager_p.h"
#include "FileManager.h"
#include "GeoDataCoordinates.h"
#include "GeoDataExtendedData.h"
@@ -88,6 +89,8 @@
void renameFolder();
void editBookmark();
+
+ void discardChanges();
};
BranchFilterModel::BranchFilterModel( QObject *parent ) :
@@ -165,6 +168,11 @@
}
}
+void BookmarkManagerDialogPrivate::discardChanges()
+{
+ m_manager->loadFile( "bookmarks/bookmarks.kml" );
+}
+
void BookmarkManagerDialogPrivate::initializeFoldersView( GeoDataTreeModel* treeModel )
{
// Set up the folders view chain
@@ -216,19 +224,15 @@
{
setupUi( this );
- // @todo: Consider using a GeoDataDocument* directly (from BookmarkManager)
- // instead of using the kml file
- QString bookmarksFile = MarbleDirs::path( "bookmarks/bookmarks.kml" );
+ GeoDataTreeModel* treeModel = new GeoDataTreeModel( this );
+ treeModel->setRootDocument( model->bookmarkManager()->d->bookmarkDocument() );
- // File manager opens the kml file, the data facade provides the tree model
- FileManager *fileManager = new FileManager( this );
- MarbleDataFacade* facade = new MarbleDataFacade( model );
- fileManager->setDataFacade( facade );
- fileManager->addFile( bookmarksFile );
+ d->initializeFoldersView( treeModel );
+ d->initializeBookmarksView( treeModel );
+ d->updateButtonState();
- d->initializeFoldersView( facade->treeModel() );
- d->initializeBookmarksView( facade->treeModel() );
- d->updateButtonState();
+ connect( this, SIGNAL( accepted() ), SLOT( saveBookmarks() ) );
+ connect( this, SIGNAL( rejected() ), SLOT( discardChanges() ) );
}
BookmarkManagerDialog::~BookmarkManagerDialog()
@@ -236,6 +240,11 @@
delete d;
}
+void BookmarkManagerDialog::saveBookmarks()
+{
+ d->m_manager->updateBookmarkFile();
}
+}
+
#include "BookmarkManagerDialog.moc"
--- trunk/KDE/kdeedu/marble/src/lib/BookmarkManagerDialog.h #1215463:1215464
@@ -33,6 +33,9 @@
/** Destructor */
~BookmarkManagerDialog();
+private Q_SLOTS:
+ void saveBookmarks();
+
private:
Q_PRIVATE_SLOT( d, void updateButtonState() );
@@ -42,6 +45,8 @@
Q_PRIVATE_SLOT( d, void filterBookmarksByFolder( const QModelIndex &index ) );
+ Q_PRIVATE_SLOT( d, void discardChanges() );
+
Q_DISABLE_COPY( BookmarkManagerDialog )
BookmarkManagerDialogPrivate* const d;
friend class BookmarkManagerDialogPrivate;
More information about the Marble-commits
mailing list