Navigation Menu

Skip to content

Commit

Permalink
Fix for ticket #272 (warning message about not being able to delete a
Browse files Browse the repository at this point in the history
bookmark when qgis actually did).
Also now provides a gui message when it does fail


git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5829 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Sep 16, 2006
1 parent 9a869ad commit 5d4c9b0
Showing 1 changed file with 11 additions and 20 deletions.
31 changes: 11 additions & 20 deletions src/gui/qgsbookmarks.cpp
Expand Up @@ -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);
}
Expand Down

0 comments on commit 5d4c9b0

Please sign in to comment.