Skip to content
Permalink
Browse files
Fix for ticket #272 (warning message about not being able to delete a
bookmark when qgis actually did).
Also now provides a gui message when it does fail


git-svn-id: http://svn.osgeo.org/qgis/trunk@5829 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Sep 16, 2006
1 parent 76e09e1 commit 410781c9fdd203cab7552214887917a5b801d4ac
Showing with 11 additions and 20 deletions.
  1. +11 −20 src/gui/qgsbookmarks.cpp
@@ -134,30 +134,21 @@ void QgsBookmarks::on_btnDelete_clicked()
int rc = connectDb();
if(rc == SQLITE_OK)
{
sqlite3_stmt *ppStmt;
const char *pzTail;
char *errmsg;
// build the sql statement
QString sql = "delete from tbl_bookmarks where bookmark_id = " + lvi->text(3);
rc = sqlite3_prepare(db, sql.utf8(), sql.length(), &ppStmt, &pzTail);
if(rc == SQLITE_OK)
rc = sqlite3_exec(db, sql.utf8(), NULL, NULL, &errmsg);
if(rc != SQLITE_OK)
{
rc = sqlite3_step(ppStmt);
if(rc != SQLITE_OK)
{
// XXX Provide popup message on failure?
std::cout << "Failed to delete " << lvi->text(0).toLocal8Bit().data()
<< " bookmark from the database" << std::endl;
}
else
{
// XXX Provide popup message on failure?
std::cout << "Failed to delete " << lvi->text(0).toLocal8Bit().data()
<< " bookmark from the database" << std::endl;
}
// XXX Provide popup message on failure?
QMessageBox::warning(this, tr("Error deleting bookmark"),
tr("Failed to delete the ") +
lvi->text(0) +
tr(" bookmark from the database. The "
"database said:\n") + QString(errmsg),
QMessageBox::Ok, QMessageBox::NoButton);
sqlite3_free(errmsg);
}

// close the statement
sqlite3_finalize(ppStmt);
// close the database
sqlite3_close(db);
}

0 comments on commit 410781c

Please sign in to comment.