[Marble-commits] KDE/kdeedu/marble/src
Dennis Nienhüser
earthwings at gentoo.org
Wed Sep 29 22:45:02 CEST 2010
SVN commit 1181022 by nienhueser:
If there is just one bookmark folder (default), place all bookmarks directly in the bookmarks menu.
M +12 -2 QtMainWindow.cpp
--- trunk/KDE/kdeedu/marble/src/QtMainWindow.cpp #1181021:1181022
@@ -419,7 +419,7 @@
void MainWindow::createBookmarksListMenu( QMenu *m_bookmarksListMenu, const GeoDataFolder &folder )
{
- m_bookmarksListMenu->clear();
+ //m_bookmarksListMenu->clear();
QVector<GeoDataPlacemark*> bookmarks = folder.placemarkList();
QVector<GeoDataPlacemark*>::const_iterator i = bookmarks.constBegin();
@@ -464,6 +464,12 @@
QVector<GeoDataFolder*>::const_iterator i = folders.constBegin();
QVector<GeoDataFolder*>::const_iterator end = folders.constEnd();
+ if ( folders.size() == 1 ) {
+ createBookmarksListMenu( m_bookmarkMenu, *folders.first() );
+ connect( m_bookmarkMenu, SIGNAL( triggered ( QAction *) ),
+ this, SLOT( lookAtBookmark( QAction *) ) );
+ }
+ else {
for (; i != end; ++i ) {
QMenu *m_bookmarksListMenu = m_bookmarkMenu->addMenu( QIcon( ":/icons/folder-bookmark.png" ), (*i)->name() );
@@ -471,12 +477,16 @@
connect( m_bookmarksListMenu, SIGNAL( triggered ( QAction *) ),
this, SLOT( lookAtBookmark( QAction *) ) );
}
-
}
+}
void MainWindow::lookAtBookmark( QAction *action)
{
+ if ( action->data().isNull() ) {
+ return;
+ }
+
GeoDataLookAt temp = qvariant_cast<GeoDataLookAt>( action->data() ) ;
m_controlView->marbleWidget()->flyTo( temp ) ;
mDebug() << " looking at bookmark having longitude : "<< temp.longitude(GeoDataCoordinates::Degree)
More information about the Marble-commits
mailing list