bookmarks/BookmarkResults.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 04 Oct 2010 00:29:21 +0300
changeset 13 8f58c9334c71
child 15 5ea3798f1248
permissions -rw-r--r--
Revision: 201037 Kit: 201039

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

#include <QString>
#include <QObject>
#include <QSqlDatabase>
#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");
//}
//