Skip to content

Commit

Permalink
fix #3243
Browse files Browse the repository at this point in the history
Richard Duivenvoorde (from pull request #78)
- crs taking into account, bookmarklist is now editable qtreeview
- set better column names the column names from the table

Juergen Fischer added refactoring:
- move adding bookmarks into QgsBookmarks
- make QgsBookmarks a singleton
- delete multiple entries at once
  • Loading branch information
rduivenvoorde authored and jef-n committed Jan 28, 2012
1 parent 65f32bc commit 3c45355
Show file tree
Hide file tree
Showing 8 changed files with 193 additions and 477 deletions.
1 change: 0 additions & 1 deletion src/app/CMakeLists.txt
Expand Up @@ -12,7 +12,6 @@ SET(QGIS_APP_SRCS
qgsattributetypedialog.cpp
qgsattributetypeloaddialog.cpp
qgsattributetabledialog.cpp
qgsbookmarkitem.cpp
qgsbookmarks.cpp
qgsbrowserdockwidget.cpp
qgsclipboard.cpp
Expand Down
44 changes: 5 additions & 39 deletions src/app/qgisapp.cpp
Expand Up @@ -101,7 +101,6 @@
#include "qgsapplication.h"
#include "qgsattributeaction.h"
#include "qgsattributetabledialog.h"
#include "qgsbookmarkitem.h"
#include "qgsbookmarks.h"
#include "qgsbrowserdockwidget.h"
#include "qgsclipboard.h"
Expand Down Expand Up @@ -6751,48 +6750,15 @@ void QgisApp::customProjection()
myDialog->setAttribute( Qt::WA_DeleteOnClose );
myDialog->show();
}
void QgisApp::showBookmarks()
{
// Create or show the single instance of the Bookmarks modeless dialog.
// Closing a QWidget only hides it so it can be shown again later.
static QgsBookmarks *bookmarks = NULL;
if ( bookmarks == NULL )
{
bookmarks = new QgsBookmarks( this, Qt::WindowMinMaxButtonsHint );
}
bookmarks->show();
bookmarks->raise();
bookmarks->setWindowState( bookmarks->windowState() & ~Qt::WindowMinimized );
bookmarks->activateWindow();
}

void QgisApp::newBookmark()
{
// Get the name for the bookmark. Everything else we fetch from
// the mapcanvas
QgsBookmarks::newBookmark();
}

bool ok;
QString bookmarkName = QInputDialog::getText( this, tr( "New Bookmark" ),
tr( "Enter a name for the new bookmark:" ), QLineEdit::Normal,
QString::null, &ok );
if ( ok && !bookmarkName.isEmpty() )
{
if ( createDB() )
{
// create the bookmark
QgsBookmarkItem *bmi = new QgsBookmarkItem( bookmarkName,
QgsProject::instance()->title(), mMapCanvas->extent(), -1,
QgsApplication::qgisUserDbFilePath() );
bmi->store();
delete bmi;
// emit a signal to indicate that the bookmark was added
emit bookmarkAdded();
}
else
{
QMessageBox::warning( this, tr( "Error" ), tr( "Unable to create the bookmark. Your user database may be missing or corrupted" ) );
}
}
void QgisApp::showBookmarks()
{
QgsBookmarks::showBookmarks();
}

// Slot that gets called when the project file was saved with an older
Expand Down
3 changes: 0 additions & 3 deletions src/app/qgisapp.h
Expand Up @@ -856,9 +856,6 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
*/
void newProject();

//! emitted when a new bookmark is added
void bookmarkAdded();

/** Signal emitted when the current theme is changed so plugins
* can change there tool button icons.
* @note This was added in QGIS 1.1
Expand Down
82 changes: 0 additions & 82 deletions src/app/qgsbookmarkitem.cpp

This file was deleted.

54 changes: 0 additions & 54 deletions src/app/qgsbookmarkitem.h

This file was deleted.

0 comments on commit 3c45355

Please sign in to comment.