mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Fixed sorting of date in forums.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5804 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
bdc275e15f
commit
a1abb0e3c6
@ -37,6 +37,7 @@
|
|||||||
#include "common/Emoticons.h"
|
#include "common/Emoticons.h"
|
||||||
#include "common/RSItemDelegate.h"
|
#include "common/RSItemDelegate.h"
|
||||||
#include "common/PopularityDefs.h"
|
#include "common/PopularityDefs.h"
|
||||||
|
#include "common/RSTreeWidgetItem.h"
|
||||||
#include "RetroShareLink.h"
|
#include "RetroShareLink.h"
|
||||||
#include "channels/ShareKey.h"
|
#include "channels/ShareKey.h"
|
||||||
#include "notifyqt.h"
|
#include "notifyqt.h"
|
||||||
@ -91,6 +92,7 @@
|
|||||||
// no need to copy, don't count in ROLE_THREAD_COUNT
|
// no need to copy, don't count in ROLE_THREAD_COUNT
|
||||||
#define ROLE_THREAD_READCHILDREN Qt::UserRole + 3
|
#define ROLE_THREAD_READCHILDREN Qt::UserRole + 3
|
||||||
#define ROLE_THREAD_UNREADCHILDREN Qt::UserRole + 4
|
#define ROLE_THREAD_UNREADCHILDREN Qt::UserRole + 4
|
||||||
|
#define ROLE_THREAD_SORT Qt::UserRole + 5
|
||||||
|
|
||||||
#define ROLE_THREAD_COUNT 3
|
#define ROLE_THREAD_COUNT 3
|
||||||
|
|
||||||
@ -109,6 +111,9 @@ ForumsDialog::ForumsDialog(QWidget *parent)
|
|||||||
subscribeFlags = 0;
|
subscribeFlags = 0;
|
||||||
inMsgAsReadUnread = false;
|
inMsgAsReadUnread = false;
|
||||||
|
|
||||||
|
threadCompareRole = new RSTreeWidgetItemCompareRole;
|
||||||
|
threadCompareRole->setRole(COLUMN_THREAD_DATE, ROLE_THREAD_SORT);
|
||||||
|
|
||||||
connect( ui.forumTreeWidget, SIGNAL( treeCustomContextMenuRequested( QPoint ) ), this, SLOT( forumListCustomPopupMenu( QPoint ) ) );
|
connect( ui.forumTreeWidget, SIGNAL( treeCustomContextMenuRequested( QPoint ) ), this, SLOT( forumListCustomPopupMenu( QPoint ) ) );
|
||||||
connect( ui.threadTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( threadListCustomPopupMenu( QPoint ) ) );
|
connect( ui.threadTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( threadListCustomPopupMenu( QPoint ) ) );
|
||||||
|
|
||||||
@ -206,6 +211,8 @@ ForumsDialog::~ForumsDialog()
|
|||||||
fillThread = NULL;
|
fillThread = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete(threadCompareRole);
|
||||||
|
|
||||||
// save settings
|
// save settings
|
||||||
processSettings(false);
|
processSettings(false);
|
||||||
}
|
}
|
||||||
@ -886,6 +893,7 @@ void ForumsDialog::insertThreads()
|
|||||||
fillThread = new ForumsFillThread(this);
|
fillThread = new ForumsFillThread(this);
|
||||||
|
|
||||||
// set data
|
// set data
|
||||||
|
fillThread->compareRole = threadCompareRole;
|
||||||
fillThread->forumId = mCurrForumId;
|
fillThread->forumId = mCurrForumId;
|
||||||
fillThread->filterColumn = ui.filterLineEdit->currentFilter();
|
fillThread->filterColumn = ui.filterLineEdit->currentFilter();
|
||||||
fillThread->subscribeFlags = subscribeFlags;
|
fillThread->subscribeFlags = subscribeFlags;
|
||||||
@ -1745,6 +1753,7 @@ ForumsFillThread::ForumsFillThread(ForumsDialog *parent)
|
|||||||
: QThread(parent)
|
: QThread(parent)
|
||||||
{
|
{
|
||||||
stopped = false;
|
stopped = false;
|
||||||
|
compareRole = NULL;
|
||||||
|
|
||||||
expandNewMessages = Settings->getExpandNewMessages();
|
expandNewMessages = Settings->getExpandNewMessages();
|
||||||
fillComplete = false;
|
fillComplete = false;
|
||||||
@ -1824,25 +1833,31 @@ void ForumsFillThread::run()
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
QTreeWidgetItem *item = new RSTreeWidgetItem(compareRole);
|
||||||
|
|
||||||
QString text;
|
QString text;
|
||||||
|
|
||||||
{
|
{
|
||||||
QDateTime qtime;
|
QDateTime qtime;
|
||||||
|
QString sort;
|
||||||
|
|
||||||
if (useChildTS)
|
if (useChildTS)
|
||||||
qtime.setTime_t(tit->childTS);
|
qtime.setTime_t(tit->childTS);
|
||||||
else
|
else
|
||||||
qtime.setTime_t(tit->ts);
|
qtime.setTime_t(tit->ts);
|
||||||
|
|
||||||
text = qtime.toString(Qt::DefaultLocaleShortDate);
|
text = qtime.toString(Qt::DefaultLocaleShortDate);
|
||||||
|
sort = qtime.toString("yyyyMMdd_hhmmss");
|
||||||
|
|
||||||
if (useChildTS)
|
if (useChildTS)
|
||||||
{
|
{
|
||||||
qtime.setTime_t(tit->ts);
|
qtime.setTime_t(tit->ts);
|
||||||
text += " / ";
|
text += " / ";
|
||||||
text += qtime.toString(Qt::DefaultLocaleShortDate);
|
text += qtime.toString(Qt::DefaultLocaleShortDate);
|
||||||
|
sort += "_" + qtime.toString("yyyyMMdd_hhmmss");
|
||||||
}
|
}
|
||||||
item->setText(COLUMN_THREAD_DATE, text);
|
item->setText(COLUMN_THREAD_DATE, text);
|
||||||
|
item->setData(COLUMN_THREAD_DATE, ROLE_THREAD_SORT, sort);
|
||||||
}
|
}
|
||||||
|
|
||||||
item->setText(COLUMN_THREAD_TITLE, ForumsDialog::titleFromInfo(msginfo));
|
item->setText(COLUMN_THREAD_TITLE, ForumsDialog::titleFromInfo(msginfo));
|
||||||
@ -1932,29 +1947,34 @@ void ForumsFillThread::run()
|
|||||||
QTreeWidgetItem *child = NULL;
|
QTreeWidgetItem *child = NULL;
|
||||||
if (flatView)
|
if (flatView)
|
||||||
{
|
{
|
||||||
child = new QTreeWidgetItem();
|
child = new RSTreeWidgetItem(compareRole);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
child = new QTreeWidgetItem(parent);
|
child = new RSTreeWidgetItem(compareRole, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
QDateTime qtime;
|
QDateTime qtime;
|
||||||
|
QString sort;
|
||||||
|
|
||||||
if (useChildTS)
|
if (useChildTS)
|
||||||
qtime.setTime_t(mit->childTS);
|
qtime.setTime_t(mit->childTS);
|
||||||
else
|
else
|
||||||
qtime.setTime_t(mit->ts);
|
qtime.setTime_t(mit->ts);
|
||||||
|
|
||||||
text = qtime.toString(Qt::DefaultLocaleShortDate);
|
text = qtime.toString(Qt::DefaultLocaleShortDate);
|
||||||
|
sort = qtime.toString("yyyyMMdd_hhmmss");
|
||||||
|
|
||||||
if (useChildTS)
|
if (useChildTS)
|
||||||
{
|
{
|
||||||
qtime.setTime_t(mit->ts);
|
qtime.setTime_t(mit->ts);
|
||||||
text += " / ";
|
text += " / ";
|
||||||
text += qtime.toString(Qt::DefaultLocaleShortDate);
|
text += qtime.toString(Qt::DefaultLocaleShortDate);
|
||||||
|
sort += "_" + qtime.toString("yyyyMMdd_hhmmss");
|
||||||
}
|
}
|
||||||
child->setText(COLUMN_THREAD_DATE, text);
|
child->setText(COLUMN_THREAD_DATE, text);
|
||||||
|
child->setData(COLUMN_THREAD_DATE, ROLE_THREAD_SORT, sort);
|
||||||
}
|
}
|
||||||
|
|
||||||
child->setText(COLUMN_THREAD_TITLE, ForumsDialog::titleFromInfo(msginfo));
|
child->setText(COLUMN_THREAD_TITLE, ForumsDialog::titleFromInfo(msginfo));
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
class ForumInfo;
|
class ForumInfo;
|
||||||
class ForumsFillThread;
|
class ForumsFillThread;
|
||||||
class ForumMsgInfo;
|
class ForumMsgInfo;
|
||||||
|
class RSTreeWidgetItemCompareRole;
|
||||||
|
|
||||||
class ForumsDialog : public RsAutoUpdatePage
|
class ForumsDialog : public RsAutoUpdatePage
|
||||||
{
|
{
|
||||||
@ -138,6 +139,7 @@ private:
|
|||||||
QTreeWidgetItem *popularForums;
|
QTreeWidgetItem *popularForums;
|
||||||
QTreeWidgetItem *otherForums;
|
QTreeWidgetItem *otherForums;
|
||||||
|
|
||||||
|
RSTreeWidgetItemCompareRole *threadCompareRole;
|
||||||
std::string mCurrForumId;
|
std::string mCurrForumId;
|
||||||
std::string mCurrThreadId;
|
std::string mCurrThreadId;
|
||||||
int subscribeFlags;
|
int subscribeFlags;
|
||||||
@ -174,6 +176,7 @@ public:
|
|||||||
int viewType;
|
int viewType;
|
||||||
bool expandNewMessages;
|
bool expandNewMessages;
|
||||||
std::string focusMsgId;
|
std::string focusMsgId;
|
||||||
|
RSTreeWidgetItemCompareRole *compareRole;
|
||||||
|
|
||||||
QList<QTreeWidgetItem*> items;
|
QList<QTreeWidgetItem*> items;
|
||||||
QList<QTreeWidgetItem*> itemToExpand;
|
QList<QTreeWidgetItem*> itemToExpand;
|
||||||
|
Loading…
Reference in New Issue
Block a user