summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2013-04-04 21:09:08 +0200
committerJavier S. Pedro <maemo@javispedro.com>2013-04-04 21:09:08 +0200
commitd69a9c6657efb6f49b882cbf17ca0d83ca74e17a (patch)
treec6c003fb4122434d09e58d3ec2c0ac4fa32ba314
parentf690c7dde14a6f9c5fbf04ed94170c7648591cb6 (diff)
downloadtapasboard-d69a9c6657efb6f49b882cbf17ca0d83ca74e17a.tar.gz
tapasboard-d69a9c6657efb6f49b882cbf17ca0d83ca74e17a.zip
remove a few useless funcs
-rw-r--r--board.cpp24
-rw-r--r--board.h4
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<QString, QString> _smilies;
/** A regular expression that matches every possibly smilie. */
QRegExp _smilieRegexp;
- /** This timer helps delay marking topics/posts as read. */
- QTimer *_markReadDelay;
- QSet<int> _postsToMarkRead;
};
inline bool Board::busy() const