summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2013-04-04 16:46:18 +0200
committerJavier S. Pedro <maemo@javispedro.com>2013-04-04 16:46:18 +0200
commit256e7837ce8cb30b0c0a8c73306abdffa80365a6 (patch)
tree0246f39a00acb45ec3b3e0c7e99380837f609ab6
parent6c51fc938bdc764c0426eba6bed2d3a9c37563af (diff)
downloadtapasboard-256e7837ce8cb30b0c0a8c73306abdffa80365a6.tar.gz
tapasboard-256e7837ce8cb30b0c0a8c73306abdffa80365a6.zip
fix a few issues
-rw-r--r--board.cpp9
-rw-r--r--fetchpostsaction.cpp11
-rw-r--r--i18n/en.ts6
-rw-r--r--i18n/es.qmbin423 -> 423 bytes
-rw-r--r--i18n/es.ts14
-rw-r--r--main.cpp6
-rw-r--r--tapasboard.pro10
7 files changed, 26 insertions, 30 deletions
diff --git a/board.cpp b/board.cpp
index 7766088..b3c5bcb 100644
--- a/board.cpp
+++ b/board.cpp
@@ -212,17 +212,20 @@ QString Board::renderHumanDate(const QDateTime &dateTime)
QString Board::renderHumanTime(const QDateTime &dateTime)
{
+ const QDateTime now = QDateTime::currentDateTime();
QDateTime localDateTime = dateTime.toLocalTime();
- const int secs = localDateTime.secsTo(QDateTime::currentDateTime());
+ const int secs = localDateTime.secsTo(now);
if (secs < 1) {
return tr("Just now");
} else if (secs < 60) {
return tr("%n second(s) ago", 0, secs);
} else if (secs < 3600) {
- int mins = (secs + 10) / 3600; // + 10 to round a bit
+ int mins = (secs + 10) / 60; // + 10 to round a bit
return tr("%n minute(s) ago", 0, mins);
- } else {
+ } else if (localDateTime.daysTo(now) < 1) {
return localDateTime.time().toString(Qt::DefaultLocaleShortDate);
+ } else {
+ return localDateTime.toString(Qt::DefaultLocaleShortDate);
}
}
diff --git a/fetchpostsaction.cpp b/fetchpostsaction.cpp
index 714718c..e38e423 100644
--- a/fetchpostsaction.cpp
+++ b/fetchpostsaction.cpp
@@ -65,9 +65,7 @@ void FetchPostsAction::handleFinishedCall()
// Not fatal, just assume it's the one we requested
topic_id = _topicId;
}
- QString topic_title = map["topic_title"].toString();
- int unread_position = map["position"].toInt();
- qDebug() << "unread_position" << unread_position;
+ QString topic_title = unencodePostContent(map["topic_title"]);
QSqlQuery query(db);
query.prepare("INSERT OR REPLACE INTO posts (topic_id, post_id, post_title, post_content, post_author_id, post_author_name, can_edit, icon_url, post_time, last_update_time) "
@@ -105,10 +103,6 @@ void FetchPostsAction::handleFinishedCall()
_board->notifyTopicPostsChanged(_topicId,
_start, _start + posts.size() - 1);
}
- if (unread_position > 0) {
- // API says this is 1-indexed instead of 0-indexed.
- _board->notifyTopicPostsUnread(_topicId, unread_position - 1);
- }
if (_end == FetchAllPosts && posts.size() == MAX_TOPIC_PAGE_SIZE) {
// Ok, let's prepare to fetch the next block of posts because
// there are probably more of them
@@ -132,7 +126,8 @@ QString FetchPostsAction::unencodePostText(const QVariant &v)
QString FetchPostsAction::unencodePostTitle(const QVariant &v, const QString &topicTitle)
{
QString title = unencodePostText(v);
- if (QString::compare(title, "Re: " + topicTitle, Qt::CaseInsensitive)) {
+ if (QString::compare(title, "Re: " + topicTitle, Qt::CaseInsensitive) == 0) {
+ // Hack to disable the useless "Re: $TOPIC_TITLE" post titles everywhere
return QString();
}
return title;
diff --git a/i18n/en.ts b/i18n/en.ts
index b074b2f..104f908 100644
--- a/i18n/en.ts
+++ b/i18n/en.ts
@@ -14,12 +14,12 @@
<translation>Yesterday</translation>
</message>
<message>
- <location filename="../board.cpp" line="218"/>
+ <location filename="../board.cpp" line="219"/>
<source>Just now</source>
<translation>Just now</translation>
</message>
<message numerus="yes">
- <location filename="../board.cpp" line="220"/>
+ <location filename="../board.cpp" line="221"/>
<source>%n second(s) ago</source>
<translation>
<numerusform>%n seconds ago</numerusform>
@@ -27,7 +27,7 @@
</translation>
</message>
<message numerus="yes">
- <location filename="../board.cpp" line="223"/>
+ <location filename="../board.cpp" line="225"/>
<source>%n minute(s) ago</source>
<translation>
<numerusform>%n minute ago</numerusform>
diff --git a/i18n/es.qm b/i18n/es.qm
index 8a2f61f..a41c85c 100644
--- a/i18n/es.qm
+++ b/i18n/es.qm
Binary files differ
diff --git a/i18n/es.ts b/i18n/es.ts
index b408e68..47c3b9d 100644
--- a/i18n/es.ts
+++ b/i18n/es.ts
@@ -14,24 +14,24 @@
<translation>Ayer</translation>
</message>
<message>
- <location filename="../board.cpp" line="218"/>
+ <location filename="../board.cpp" line="219"/>
<source>Just now</source>
<translation>Ahora mismo</translation>
</message>
<message numerus="yes">
- <location filename="../board.cpp" line="220"/>
+ <location filename="../board.cpp" line="221"/>
<source>%n second(s) ago</source>
<translation>
- <numerusform>Hace %n segundo</numerusform>
- <numerusform>Hace %n segundos</numerusform>
+ <numerusform>hace %n segundo</numerusform>
+ <numerusform>hace %n segundos</numerusform>
</translation>
</message>
<message numerus="yes">
- <location filename="../board.cpp" line="223"/>
+ <location filename="../board.cpp" line="225"/>
<source>%n minute(s) ago</source>
<translation>
- <numerusform>Hace %n minuto</numerusform>
- <numerusform>Hace %n minutos</numerusform>
+ <numerusform>hace %n minuto</numerusform>
+ <numerusform>hace %n minutos</numerusform>
</translation>
</message>
</context>
diff --git a/main.cpp b/main.cpp
index 2d23694..5d7a619 100644
--- a/main.cpp
+++ b/main.cpp
@@ -45,7 +45,9 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
if (!(translator.load(locale, locale_path))) {
// Fallback to English
qDebug() << "Translation not available for" << locale;
- translator.load("en", locale_path);
+ if (!translator.load("en", locale_path)) {
+ qDebug() << "Translations not available in" << locale_path;
+ }
}
app->installTranslator(&translator);
@@ -67,7 +69,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
viewer.engine()->setNetworkAccessManagerFactory(image_nam_factory.data());
viewer.rootContext()->setContextProperty("boardManager", board_manager);
viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
- viewer.setMainQmlFile(QLatin1String("qml/tapasboard/main.qml"));
+ viewer.setMainQmlFile(QLatin1String("qml/main.qml"));
viewer.showExpanded();
return app->exec();
diff --git a/tapasboard.pro b/tapasboard.pro
index 4c16089..4189ff8 100644
--- a/tapasboard.pro
+++ b/tapasboard.pro
@@ -1,8 +1,8 @@
# Add more folders to ship with the application, here
qml_folder.source = qml
-qml_folder.target = qml
-i18n_folder.source = i18n/*.qm
-i18n_folder.target = i18n
+qml_folder.target = .
+i18n_folder.source = i18n
+i18n_folder.target = .
DEPLOYMENTFOLDERS = qml_folder i18n_folder
# Additional import path used to resolve QML modules in Creator's code model
@@ -74,10 +74,6 @@ HEADERS += \
TRANSLATIONS += i18n/en.ts i18n/es.ts
-evil_hack_to_fool_lupdate {
- SOURCES += qml/*.qml
-}
-
OTHER_FILES += \
qtc_packaging/debian_harmattan/rules \
qtc_packaging/debian_harmattan/README \