From d69a9c6657efb6f49b882cbf17ca0d83ca74e17a Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Thu, 4 Apr 2013 21:09:08 +0200 Subject: remove a few useless funcs --- board.cpp | 24 ++++++++++-------------- board.h | 4 ---- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/board.cpp b/board.cpp index 9a3d6cc..bc9f4e7 100644 --- a/board.cpp +++ b/board.cpp @@ -15,15 +15,14 @@ const QLatin1String Board::CURRENT_DB_VERSION("testing1"); Board::Board(QObject *parent) : - QObject(parent) + QObject(parent) { } Board::Board(const QUrl& url, const QString& username, const QString& password, QObject *parent) : - QObject(parent), _url(url), _slug(createSlug(url)), - _db(QSqlDatabase::addDatabase("QSQLITE", _slug)), - _iface(new XmlRpcInterface(QUrl(_url), this)), - _markReadDelay(new QTimer(this)) + QObject(parent), _url(url), _slug(createSlug(url)), + _db(QSqlDatabase::addDatabase("QSQLITE", _slug)), + _iface(new XmlRpcInterface(QUrl(_url), this)) { _db.setDatabaseName(QDir::toNativeSeparators(getDbPathFor(_slug))); qDebug() << "Opening database file" << _db.databaseName() << "for" << _url; @@ -49,7 +48,6 @@ Board::Board(const QUrl& url, const QString& username, const QString& password, fetchForumsIfOutdated(); initializeBbCode(); // TODO This might depend on board config initializeSmilies(); - initializeMarkRead(); } Board::~Board() @@ -600,13 +598,6 @@ void Board::initializeSmilies() Q_ASSERT(_smilieRegexp.isValid()); } -void Board::initializeMarkRead() -{ - _markReadDelay->setInterval(1000); // 1 sec - _markReadDelay->setSingleShot(true); - // TODO connect -} - void Board::fetchConfigIfOutdated() { if (_iface->isAccessible()) { @@ -642,7 +633,12 @@ void Board::updateForumReadState(int forumId) qWarning() << "Could not select unread topics from forum:" << q.lastError().text(); return; } - int unread_topics = q.value(0).toInt(); + + int unread_topics = 0; + if (q.next()) { + unread_topics = q.value(0).toInt(); + } + int new_post = (unread_topics > 0) ? 1 : 0; q.prepare("UPDATE forums SET new_post = :new_post WHERE forum_id = :forum_id AND new_post != :cur_new_post"); diff --git a/board.h b/board.h index bfb0d6e..be17d08 100644 --- a/board.h +++ b/board.h @@ -98,7 +98,6 @@ private: void executeActionFromQueue(); void initializeBbCode(); void initializeSmilies(); - void initializeMarkRead(); void fetchConfigIfOutdated(); void fetchForumsIfOutdated(); void updateForumReadState(int forumId); @@ -124,9 +123,6 @@ private: QHash _smilies; /** A regular expression that matches every possibly smilie. */ QRegExp _smilieRegexp; - /** This timer helps delay marking topics/posts as read. */ - QTimer *_markReadDelay; - QSet _postsToMarkRead; }; inline bool Board::busy() const -- cgit v1.2.3