bookmarks/BookmarkResults.cpp
author hgs
Fri, 15 Oct 2010 17:29:22 -0400
changeset 15 5ea3798f1248
parent 9 1d51612454b5
permissions -rw-r--r--
201041

/*
 * BookmarkResults.cpp
 *
 *  Created on: Aug 13, 2010
 *      Author: mmoretti
 */

#include <QString>
#include <QObject>
#include <QSqlQuery>
#include <QSqlError>
#include <QWidget>
#include <QVariant>

#include "BookmarkResults.h"
#include "BookmarkFav.h"

BookmarkResults::BookmarkResults(QSqlQuery *query/*, QWidget *parent*/) : 
    /*QObject(parent), */m_query(query)
{
//    setObjectName("bookmarkResults");
}

BookmarkFav *BookmarkResults::nextBookmark()
{
    if (!m_query->isActive())
        return NULL;
    if (!m_query->next()) {
        m_query->clear();
        return NULL;
    }
    bool dummy;
    return
        new BookmarkFav(m_query->value(0).toInt(&dummy),
            m_query->value(1).toString(),
            m_query->value(2).toString(),
            m_query->value(3).toInt(&dummy));
}

BookmarkResults::~BookmarkResults()
{
    delete m_query;
}

bool BookmarkResults::isMoreBookmarks()
{
	//return (m_query->isValid());
	return (m_query->isActive());
}

//void BookmarkResults::registerMetaType()
//{
//    qRegisterMetaType<BookmarkResults>("BookmarkResults");
//}
//