mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-25 15:35:49 -04:00
Tweaks to the GUI stuff to make it conform to the new interface. The major changes were:
* New Async/Token Group/Msg Creation (required for Key generation/group Id determination). This means that creating a group, and posting messages are two steps... (see PhotoAddDialog). * Moved some MACROS from ForumV2 to libretroshare/rsidentity for generic MsgStatus stuff (e.g. MSG_READ) git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-new_cache_system@5277 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
8387c538f1
commit
388bd5da9f
6 changed files with 197 additions and 114 deletions
|
@ -92,12 +92,6 @@
|
||||||
|
|
||||||
#define ROLE_THREAD_COUNT 3
|
#define ROLE_THREAD_COUNT 3
|
||||||
|
|
||||||
#define IS_UNREAD(status) ((status & RSGXS_MSG_STATUS_READ) == 0 || (status & RSGXS_MSG_STATUS_UNREAD_BY_USER))
|
|
||||||
#define IS_FORUM_ADMIN(subscribeFlags) (subscribeFlags & RS_DISTRIB_ADMIN)
|
|
||||||
#define IS_FORUM_SUBSCRIBED(subscribeFlags) (subscribeFlags & (RS_DISTRIB_ADMIN | RS_DISTRIB_SUBSCRIBED))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int FilterColumnFromComboBox(int nIndex)
|
static int FilterColumnFromComboBox(int nIndex)
|
||||||
{
|
{
|
||||||
|
@ -292,10 +286,10 @@ void ForumsV2Dialog::forumListCustomPopupMenu( QPoint /*point*/ )
|
||||||
QMenu contextMnu( this );
|
QMenu contextMnu( this );
|
||||||
|
|
||||||
QAction *action = contextMnu.addAction(QIcon(IMAGE_SUBSCRIBE), tr("Subscribe to Forum"), this, SLOT(subscribeToForum()));
|
QAction *action = contextMnu.addAction(QIcon(IMAGE_SUBSCRIBE), tr("Subscribe to Forum"), this, SLOT(subscribeToForum()));
|
||||||
action->setDisabled (mCurrForumId.empty() || IS_FORUM_SUBSCRIBED(subscribeFlags));
|
action->setDisabled (mCurrForumId.empty() || IS_GROUP_SUBSCRIBED(subscribeFlags));
|
||||||
|
|
||||||
action = contextMnu.addAction(QIcon(IMAGE_UNSUBSCRIBE), tr("Unsubscribe to Forum"), this, SLOT(unsubscribeToForum()));
|
action = contextMnu.addAction(QIcon(IMAGE_UNSUBSCRIBE), tr("Unsubscribe to Forum"), this, SLOT(unsubscribeToForum()));
|
||||||
action->setEnabled (!mCurrForumId.empty() && IS_FORUM_SUBSCRIBED(subscribeFlags));
|
action->setEnabled (!mCurrForumId.empty() && IS_GROUP_SUBSCRIBED(subscribeFlags));
|
||||||
|
|
||||||
contextMnu.addSeparator();
|
contextMnu.addSeparator();
|
||||||
|
|
||||||
|
@ -305,16 +299,16 @@ void ForumsV2Dialog::forumListCustomPopupMenu( QPoint /*point*/ )
|
||||||
action->setEnabled (!mCurrForumId.empty ());
|
action->setEnabled (!mCurrForumId.empty ());
|
||||||
|
|
||||||
action = contextMnu.addAction(QIcon(":/images/settings16.png"), tr("Edit Forum Details"), this, SLOT(editForumDetails()));
|
action = contextMnu.addAction(QIcon(":/images/settings16.png"), tr("Edit Forum Details"), this, SLOT(editForumDetails()));
|
||||||
action->setEnabled (!mCurrForumId.empty () && IS_FORUM_ADMIN(subscribeFlags));
|
action->setEnabled (!mCurrForumId.empty () && IS_GROUP_ADMIN(subscribeFlags));
|
||||||
|
|
||||||
QAction *shareKeyAct = new QAction(QIcon(":/images/gpgp_key_generate.png"), tr("Share Forum"), &contextMnu);
|
QAction *shareKeyAct = new QAction(QIcon(":/images/gpgp_key_generate.png"), tr("Share Forum"), &contextMnu);
|
||||||
connect( shareKeyAct, SIGNAL( triggered() ), this, SLOT( shareKey() ) );
|
connect( shareKeyAct, SIGNAL( triggered() ), this, SLOT( shareKey() ) );
|
||||||
shareKeyAct->setEnabled(!mCurrForumId.empty() && IS_FORUM_ADMIN(subscribeFlags));
|
shareKeyAct->setEnabled(!mCurrForumId.empty() && IS_GROUP_ADMIN(subscribeFlags));
|
||||||
contextMnu.addAction( shareKeyAct);
|
contextMnu.addAction( shareKeyAct);
|
||||||
|
|
||||||
QAction *restoreKeysAct = new QAction(QIcon(":/images/settings16.png"), tr("Restore Publish Rights for Forum" ), &contextMnu);
|
QAction *restoreKeysAct = new QAction(QIcon(":/images/settings16.png"), tr("Restore Publish Rights for Forum" ), &contextMnu);
|
||||||
connect( restoreKeysAct , SIGNAL( triggered() ), this, SLOT( restoreForumKeys() ) );
|
connect( restoreKeysAct , SIGNAL( triggered() ), this, SLOT( restoreForumKeys() ) );
|
||||||
restoreKeysAct->setEnabled(!mCurrForumId.empty() && !IS_FORUM_ADMIN(subscribeFlags));
|
restoreKeysAct->setEnabled(!mCurrForumId.empty() && !IS_GROUP_ADMIN(subscribeFlags));
|
||||||
contextMnu.addAction( restoreKeysAct);
|
contextMnu.addAction( restoreKeysAct);
|
||||||
|
|
||||||
action = contextMnu.addAction(QIcon(IMAGE_COPYLINK), tr("Copy RetroShare Link"), this, SLOT(copyForumLink()));
|
action = contextMnu.addAction(QIcon(IMAGE_COPYLINK), tr("Copy RetroShare Link"), this, SLOT(copyForumLink()));
|
||||||
|
@ -323,15 +317,15 @@ void ForumsV2Dialog::forumListCustomPopupMenu( QPoint /*point*/ )
|
||||||
contextMnu.addSeparator();
|
contextMnu.addSeparator();
|
||||||
|
|
||||||
action = contextMnu.addAction(QIcon(":/images/message-mail-read.png"), tr("Mark all as read"), this, SLOT(markMsgAsReadAll()));
|
action = contextMnu.addAction(QIcon(":/images/message-mail-read.png"), tr("Mark all as read"), this, SLOT(markMsgAsReadAll()));
|
||||||
action->setEnabled (!mCurrForumId.empty () && IS_FORUM_SUBSCRIBED(subscribeFlags));
|
action->setEnabled (!mCurrForumId.empty () && IS_GROUP_SUBSCRIBED(subscribeFlags));
|
||||||
|
|
||||||
action = contextMnu.addAction(QIcon(":/images/message-mail.png"), tr("Mark all as unread"), this, SLOT(markMsgAsUnreadAll()));
|
action = contextMnu.addAction(QIcon(":/images/message-mail.png"), tr("Mark all as unread"), this, SLOT(markMsgAsUnreadAll()));
|
||||||
action->setEnabled (!mCurrForumId.empty () && IS_FORUM_SUBSCRIBED(subscribeFlags));
|
action->setEnabled (!mCurrForumId.empty () && IS_GROUP_SUBSCRIBED(subscribeFlags));
|
||||||
|
|
||||||
#ifdef DEBUG_FORUMS
|
#ifdef DEBUG_FORUMS
|
||||||
contextMnu.addSeparator();
|
contextMnu.addSeparator();
|
||||||
action = contextMnu.addAction("Generate mass data", this, SLOT(generateMassData()));
|
action = contextMnu.addAction("Generate mass data", this, SLOT(generateMassData()));
|
||||||
action->setEnabled (!mCurrForumId.empty() && IS_FORUM_SUBSCRIBED(subscribeFlags));
|
action->setEnabled (!mCurrForumId.empty() && IS_GROUP_SUBSCRIBED(subscribeFlags));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
contextMnu.exec(QCursor::pos());
|
contextMnu.exec(QCursor::pos());
|
||||||
|
@ -349,7 +343,7 @@ void ForumsV2Dialog::threadListCustomPopupMenu( QPoint /*point*/ )
|
||||||
connect( replyAct , SIGNAL( triggered() ), this, SLOT( createmessage() ) );
|
connect( replyAct , SIGNAL( triggered() ), this, SLOT( createmessage() ) );
|
||||||
|
|
||||||
QAction *newthreadAct = new QAction(QIcon(IMAGE_DOWNLOADALL), tr( "Start New Thread" ), &contextMnu );
|
QAction *newthreadAct = new QAction(QIcon(IMAGE_DOWNLOADALL), tr( "Start New Thread" ), &contextMnu );
|
||||||
newthreadAct->setEnabled (IS_FORUM_SUBSCRIBED(subscribeFlags));
|
newthreadAct->setEnabled (IS_GROUP_SUBSCRIBED(subscribeFlags));
|
||||||
connect( newthreadAct , SIGNAL( triggered() ), this, SLOT( createthread() ) );
|
connect( newthreadAct , SIGNAL( triggered() ), this, SLOT( createthread() ) );
|
||||||
|
|
||||||
QAction *replyauthorAct = new QAction(QIcon(IMAGE_MESSAGEREPLY), tr( "Reply to Author" ), &contextMnu );
|
QAction *replyauthorAct = new QAction(QIcon(IMAGE_MESSAGEREPLY), tr( "Reply to Author" ), &contextMnu );
|
||||||
|
@ -373,7 +367,7 @@ void ForumsV2Dialog::threadListCustomPopupMenu( QPoint /*point*/ )
|
||||||
QAction *markMsgAsUnreadChildren = new QAction(QIcon(":/images/message-mail.png"), tr("Mark as unread") + " (" + tr ("with children") + ")", &contextMnu);
|
QAction *markMsgAsUnreadChildren = new QAction(QIcon(":/images/message-mail.png"), tr("Mark as unread") + " (" + tr ("with children") + ")", &contextMnu);
|
||||||
connect(markMsgAsUnreadChildren , SIGNAL(triggered()), this, SLOT(markMsgAsUnreadChildren()));
|
connect(markMsgAsUnreadChildren , SIGNAL(triggered()), this, SLOT(markMsgAsUnreadChildren()));
|
||||||
|
|
||||||
if (IS_FORUM_SUBSCRIBED(subscribeFlags)) {
|
if (IS_GROUP_SUBSCRIBED(subscribeFlags)) {
|
||||||
QList<QTreeWidgetItem*> Rows;
|
QList<QTreeWidgetItem*> Rows;
|
||||||
QList<QTreeWidgetItem*> RowsRead;
|
QList<QTreeWidgetItem*> RowsRead;
|
||||||
QList<QTreeWidgetItem*> RowsUnread;
|
QList<QTreeWidgetItem*> RowsUnread;
|
||||||
|
@ -484,6 +478,7 @@ void ForumsV2Dialog::updateDisplay()
|
||||||
if (!rsForumsV2)
|
if (!rsForumsV2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#if 0
|
||||||
// TODO groupsChanged... HACK XXX.
|
// TODO groupsChanged... HACK XXX.
|
||||||
if ((rsForumsV2->groupsChanged(forumIds)) || (rsForumsV2->updated()))
|
if ((rsForumsV2->groupsChanged(forumIds)) || (rsForumsV2->updated()))
|
||||||
{
|
{
|
||||||
|
@ -497,6 +492,16 @@ void ForumsV2Dialog::updateDisplay()
|
||||||
insertThreads();
|
insertThreads();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The proper version (above) can be done with a data request -> TODO */
|
||||||
|
if (rsForumsV2->updated())
|
||||||
|
{
|
||||||
|
/* update Forums List */
|
||||||
|
insertForums();
|
||||||
|
/* update threads as well */
|
||||||
|
insertThreads();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CleanupItems (QList<QTreeWidgetItem *> &Items)
|
static void CleanupItems (QList<QTreeWidgetItem *> &Items)
|
||||||
|
@ -560,9 +565,9 @@ void ForumsV2Dialog::insertForumsData(const std::list<RsGroupMetaData> &forumLis
|
||||||
GroupItemInfo groupItemInfo;
|
GroupItemInfo groupItemInfo;
|
||||||
forumInfoToGroupItemInfo(*it, groupItemInfo);
|
forumInfoToGroupItemInfo(*it, groupItemInfo);
|
||||||
|
|
||||||
if (flags & RS_DISTRIB_ADMIN) {
|
if (flags & RSGXS_GROUP_SUBSCRIBE_ADMIN) {
|
||||||
adminList.push_back(groupItemInfo);
|
adminList.push_back(groupItemInfo);
|
||||||
} else if (flags & RS_DISTRIB_SUBSCRIBED) {
|
} else if (flags & RSGXS_GROUP_SUBSCRIBE_SUBSCRIBED) {
|
||||||
/* subscribed forum */
|
/* subscribed forum */
|
||||||
subList.push_back(groupItemInfo);
|
subList.push_back(groupItemInfo);
|
||||||
} else {
|
} else {
|
||||||
|
@ -629,7 +634,7 @@ void ForumsV2Dialog::changedThread ()
|
||||||
|
|
||||||
void ForumsV2Dialog::clickedThread (QTreeWidgetItem *item, int column)
|
void ForumsV2Dialog::clickedThread (QTreeWidgetItem *item, int column)
|
||||||
{
|
{
|
||||||
if (mCurrForumId.empty() || !IS_FORUM_SUBSCRIBED(subscribeFlags)) {
|
if (mCurrForumId.empty() || !IS_GROUP_SUBSCRIBED(subscribeFlags)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -641,7 +646,7 @@ void ForumsV2Dialog::clickedThread (QTreeWidgetItem *item, int column)
|
||||||
QList<QTreeWidgetItem*> Rows;
|
QList<QTreeWidgetItem*> Rows;
|
||||||
Rows.append(item);
|
Rows.append(item);
|
||||||
uint32_t status = item->data(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toUInt();
|
uint32_t status = item->data(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toUInt();
|
||||||
setMsgAsReadUnread(Rows, IS_UNREAD(status));
|
setMsgAsReadUnread(Rows, IS_MSG_UNREAD(status));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -650,7 +655,7 @@ void ForumsV2Dialog::CalculateIconsAndFonts(QTreeWidgetItem *pItem, bool &bHasRe
|
||||||
{
|
{
|
||||||
uint32_t status = pItem->data(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toUInt();
|
uint32_t status = pItem->data(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toUInt();
|
||||||
|
|
||||||
bool bUnread = IS_UNREAD(status);
|
bool bUnread = IS_MSG_UNREAD(status);
|
||||||
bool missing = pItem->data(COLUMN_THREAD_DATA, ROLE_THREAD_MISSING).toBool();
|
bool missing = pItem->data(COLUMN_THREAD_DATA, ROLE_THREAD_MISSING).toBool();
|
||||||
|
|
||||||
// set icon
|
// set icon
|
||||||
|
@ -684,7 +689,7 @@ void ForumsV2Dialog::CalculateIconsAndFonts(QTreeWidgetItem *pItem, bool &bHasRe
|
||||||
for (int i = 0; i < COLUMN_THREAD_COUNT; i++) {
|
for (int i = 0; i < COLUMN_THREAD_COUNT; i++) {
|
||||||
QFont qf = pItem->font(i);
|
QFont qf = pItem->font(i);
|
||||||
|
|
||||||
if (!IS_FORUM_SUBSCRIBED(subscribeFlags)) {
|
if (!IS_GROUP_SUBSCRIBED(subscribeFlags)) {
|
||||||
qf.setBold(false);
|
qf.setBold(false);
|
||||||
pItem->setTextColor(i, Qt::black);
|
pItem->setTextColor(i, Qt::black);
|
||||||
} else if (bUnread) {
|
} else if (bUnread) {
|
||||||
|
@ -805,7 +810,7 @@ void ForumsV2Dialog::fillThreadFinished()
|
||||||
insertPost ();
|
insertPost ();
|
||||||
CalculateIconsAndFonts();
|
CalculateIconsAndFonts();
|
||||||
|
|
||||||
ui.newthreadButton->setEnabled (IS_FORUM_SUBSCRIBED(subscribeFlags));
|
ui.newthreadButton->setEnabled (IS_GROUP_SUBSCRIBED(subscribeFlags));
|
||||||
|
|
||||||
mThreadLoading = false;
|
mThreadLoading = false;
|
||||||
|
|
||||||
|
@ -944,7 +949,7 @@ void ForumsV2Dialog::FillThreads(QList<QTreeWidgetItem *> &ThreadList, bool expa
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t status = Thread->data (COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toUInt();
|
uint32_t status = Thread->data (COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toUInt();
|
||||||
if (expandNewMessages && IS_UNREAD(status)) {
|
if (expandNewMessages && IS_MSG_UNREAD(status)) {
|
||||||
QTreeWidgetItem *pParent = Thread;
|
QTreeWidgetItem *pParent = Thread;
|
||||||
while ((pParent = pParent->parent()) != NULL) {
|
while ((pParent = pParent->parent()) != NULL) {
|
||||||
if (std::find(itemToExpand.begin(), itemToExpand.end(), pParent) == itemToExpand.end()) {
|
if (std::find(itemToExpand.begin(), itemToExpand.end(), pParent) == itemToExpand.end()) {
|
||||||
|
@ -1027,7 +1032,7 @@ void ForumsV2Dialog::FillChildren(QTreeWidgetItem *Parent, QTreeWidgetItem *NewP
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t status = Child->data (COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toUInt();
|
uint32_t status = Child->data (COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toUInt();
|
||||||
if (expandNewMessages && IS_UNREAD(status)) {
|
if (expandNewMessages && IS_MSG_UNREAD(status)) {
|
||||||
QTreeWidgetItem *pParent = Child;
|
QTreeWidgetItem *pParent = Child;
|
||||||
while ((pParent = pParent->parent()) != NULL) {
|
while ((pParent = pParent->parent()) != NULL) {
|
||||||
if (std::find(itemToExpand.begin(), itemToExpand.end(), pParent) == itemToExpand.end()) {
|
if (std::find(itemToExpand.begin(), itemToExpand.end(), pParent) == itemToExpand.end()) {
|
||||||
|
@ -1064,7 +1069,7 @@ void ForumsV2Dialog::insertPost()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.newmessageButton->setEnabled (IS_FORUM_SUBSCRIBED(subscribeFlags) && mCurrThreadId.empty() == false);
|
ui.newmessageButton->setEnabled (IS_GROUP_SUBSCRIBED(subscribeFlags) && mCurrThreadId.empty() == false);
|
||||||
|
|
||||||
/* blank text, incase we get nothing */
|
/* blank text, incase we get nothing */
|
||||||
ui.postText->setText("");
|
ui.postText->setText("");
|
||||||
|
@ -1185,7 +1190,7 @@ void ForumsV2Dialog::nextUnreadMessage()
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
uint32_t status = currentItem->data(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toUInt();
|
uint32_t status = currentItem->data(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toUInt();
|
||||||
if( IS_UNREAD(status) )
|
if( IS_MSG_UNREAD(status) )
|
||||||
{
|
{
|
||||||
ui.threadTreeWidget->setCurrentItem(currentItem);
|
ui.threadTreeWidget->setCurrentItem(currentItem);
|
||||||
return;
|
return;
|
||||||
|
@ -1222,7 +1227,7 @@ int ForumsV2Dialog::getSelectedMsgCount(QList<QTreeWidgetItem*> *pRows, QList<QT
|
||||||
if (pRows) pRows->append(*it);
|
if (pRows) pRows->append(*it);
|
||||||
if (pRowsRead || pRowsUnread) {
|
if (pRowsRead || pRowsUnread) {
|
||||||
uint32_t status = (*it)->data(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toUInt();
|
uint32_t status = (*it)->data(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toUInt();
|
||||||
if (IS_UNREAD(status)) {
|
if (IS_MSG_UNREAD(status)) {
|
||||||
if (pRowsUnread) pRowsUnread->append(*it);
|
if (pRowsUnread) pRowsUnread->append(*it);
|
||||||
} else {
|
} else {
|
||||||
if (pRowsRead) pRowsRead->append(*it);
|
if (pRowsRead) pRowsRead->append(*it);
|
||||||
|
@ -1281,7 +1286,7 @@ void ForumsV2Dialog::setMsgAsReadUnread(QList<QTreeWidgetItem*> &Rows, bool bRea
|
||||||
|
|
||||||
void ForumsV2Dialog::markMsgAsReadUnread (bool bRead, bool bChildren, bool bForum)
|
void ForumsV2Dialog::markMsgAsReadUnread (bool bRead, bool bChildren, bool bForum)
|
||||||
{
|
{
|
||||||
if (mCurrForumId.empty() || !IS_FORUM_SUBSCRIBED(subscribeFlags)) {
|
if (mCurrForumId.empty() || !IS_GROUP_SUBSCRIBED(subscribeFlags)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1305,7 +1310,7 @@ void ForumsV2Dialog::markMsgAsReadUnread (bool bRead, bool bChildren, bool bForu
|
||||||
|
|
||||||
/* add only items with the right state or with not RSGXS_MSG_STATUS_READ */
|
/* add only items with the right state or with not RSGXS_MSG_STATUS_READ */
|
||||||
uint32_t status = pRow->data(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toUInt();
|
uint32_t status = pRow->data(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toUInt();
|
||||||
if (IS_UNREAD(status) == bRead || (status & RSGXS_MSG_STATUS_READ) == 0) {
|
if (IS_MSG_UNREAD(status) == bRead || (status & RSGXS_MSG_STATUS_READ) == 0) {
|
||||||
AllRows.append(pRow);
|
AllRows.append(pRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1436,7 +1441,7 @@ void ForumsV2Dialog::newforum()
|
||||||
|
|
||||||
void ForumsV2Dialog::createmessage()
|
void ForumsV2Dialog::createmessage()
|
||||||
{
|
{
|
||||||
if (mCurrForumId.empty () || !IS_FORUM_SUBSCRIBED(subscribeFlags)) {
|
if (mCurrForumId.empty () || !IS_GROUP_SUBSCRIBED(subscribeFlags)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1480,7 +1485,14 @@ void ForumsV2Dialog::forumSubscribe(bool subscribe)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rsForumsV2->groupSubscribe(mCurrForumId, subscribe);
|
uint32_t flags = RSGXS_GROUP_SUBSCRIBE_SUBSCRIBED;
|
||||||
|
if (!subscribe)
|
||||||
|
{
|
||||||
|
flags = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
rsForumsV2->setGroupSubscribeFlags(mCurrForumId, flags, RSGXS_GROUP_SUBSCRIBE_SUBSCRIBED);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ForumsV2Dialog::showForumDetails()
|
void ForumsV2Dialog::showForumDetails()
|
||||||
|
@ -2023,7 +2035,7 @@ bool ForumsV2Dialog::convertMsgToThreadWidget(const RsForumV2Msg &msgInfo, std::
|
||||||
item->setData(COLUMN_THREAD_DATA, ROLE_THREAD_MSGID, QString::fromStdString(msgInfo.mMeta.mMsgId));
|
item->setData(COLUMN_THREAD_DATA, ROLE_THREAD_MSGID, QString::fromStdString(msgInfo.mMeta.mMsgId));
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (IS_FORUM_SUBSCRIBED(subscribeFlags) && !(msginfo.mMsgFlags & RS_DISTRIB_MISSING_MSG)) {
|
if (IS_GROUP_SUBSCRIBED(subscribeFlags) && !(msginfo.mMsgFlags & RS_DISTRIB_MISSING_MSG)) {
|
||||||
rsForumsV2->getMessageStatus(msginfo.forumId, msginfo.msgId, status);
|
rsForumsV2->getMessageStatus(msginfo.forumId, msginfo.msgId, status);
|
||||||
} else {
|
} else {
|
||||||
// show message as read
|
// show message as read
|
||||||
|
@ -2154,7 +2166,7 @@ void ForumsV2Dialog::loadForumChildMsg(const RsForumV2Msg &msg, QTreeWidgetItem
|
||||||
mThreadLoad.MsgTokens[token] = child;
|
mThreadLoad.MsgTokens[token] = child;
|
||||||
|
|
||||||
// Leave this here... BUT IT WILL NEED TO BE FIXED.
|
// Leave this here... BUT IT WILL NEED TO BE FIXED.
|
||||||
if (mThreadLoad.FillComplete && mThreadLoad.ExpandNewMessages && IS_UNREAD(msg.mMeta.mMsgStatus))
|
if (mThreadLoad.FillComplete && mThreadLoad.ExpandNewMessages && IS_MSG_UNREAD(msg.mMeta.mMsgStatus))
|
||||||
{
|
{
|
||||||
QTreeWidgetItem *pParent = child;
|
QTreeWidgetItem *pParent = child;
|
||||||
while ((pParent = pParent->parent()) != NULL)
|
while ((pParent = pParent->parent()) != NULL)
|
||||||
|
|
|
@ -318,25 +318,32 @@ void PhotoAddDialog::publishAlbum()
|
||||||
item->getPhotoThumbnail(album.mThumbnail);
|
item->getPhotoThumbnail(album.mThumbnail);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isAlbumOk = false;
|
|
||||||
|
|
||||||
// For the moment, only submit albums Once.
|
// For the moment, only submit albums Once.
|
||||||
if (mAlbumEdit)
|
if (mAlbumEdit)
|
||||||
{
|
{
|
||||||
std::cerr << "PhotoAddDialog::publishAlbum() AlbumEdit Mode";
|
std::cerr << "PhotoAddDialog::publishAlbum() AlbumEdit Mode";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
isAlbumOk = true;
|
/* call publishPhotos directly */
|
||||||
|
publishPhotos(album.mMeta.mGroupId);
|
||||||
}
|
}
|
||||||
else if (rsPhoto->submitAlbumDetails(album, true))
|
|
||||||
{
|
|
||||||
std::cerr << "PhotoAddDialog::publishAlbum() New Album Mode";
|
std::cerr << "PhotoAddDialog::publishAlbum() New Album Mode Submitting.....";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
isAlbumOk = true;
|
uint32_t token;
|
||||||
|
rsPhoto->submitAlbumDetails(token, album, true);
|
||||||
|
|
||||||
|
// tell tokenQueue to expect results from submission.
|
||||||
|
mPhotoQueue->queueRequest(token, TOKENREQ_GROUPINFO, RS_TOKREQ_ANSTYPE_SUMMARY, 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isAlbumOk)
|
|
||||||
|
|
||||||
|
|
||||||
|
void PhotoAddDialog::publishPhotos(std::string albumId)
|
||||||
{
|
{
|
||||||
/* now have path and album id */
|
/* now have path and album id */
|
||||||
int photoCount = ui.scrollAreaWidgetContents->getPhotoCount();
|
int photoCount = ui.scrollAreaWidgetContents->getPhotoCount();
|
||||||
|
@ -366,7 +373,7 @@ void PhotoAddDialog::publishAlbum()
|
||||||
{
|
{
|
||||||
/* new photo - flag in mods */
|
/* new photo - flag in mods */
|
||||||
photo.mModFlags |= RSPHOTO_FLAGS_ATTRIB_PHOTO;
|
photo.mModFlags |= RSPHOTO_FLAGS_ATTRIB_PHOTO;
|
||||||
photo.mMeta.mGroupId = album.mMeta.mGroupId;
|
photo.mMeta.mGroupId = albumId;
|
||||||
isNewPhoto = true;
|
isNewPhoto = true;
|
||||||
}
|
}
|
||||||
else if (photo.mModFlags)
|
else if (photo.mModFlags)
|
||||||
|
@ -377,7 +384,7 @@ void PhotoAddDialog::publishAlbum()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* new album - update GroupId, all photos are new */
|
/* new album - update GroupId, all photos are new */
|
||||||
photo.mMeta.mGroupId = album.mMeta.mGroupId;
|
photo.mMeta.mGroupId = albumId;
|
||||||
isNewPhoto = true;
|
isNewPhoto = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,25 +395,30 @@ void PhotoAddDialog::publishAlbum()
|
||||||
std::cerr << " mModFlags: " << photo.mModFlags;
|
std::cerr << " mModFlags: " << photo.mModFlags;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* scale photo if needed */
|
/* scale photo if needed */
|
||||||
if (album.mShareOptions.mResizeMode)
|
if (album.mShareOptions.mResizeMode)
|
||||||
{
|
{
|
||||||
/* */
|
/* */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* save image to album path */
|
/* save image to album path */
|
||||||
photo.path = "unknown";
|
photo.path = "unknown";
|
||||||
|
|
||||||
std::cerr << "PhotoAddDialog::publishAlbum() Photo(" << i << ") ";
|
std::cerr << "PhotoAddDialog::publishAlbum() Photo(" << i << ") ";
|
||||||
|
|
||||||
|
uint32_t token;
|
||||||
if (isNewPhoto)
|
if (isNewPhoto)
|
||||||
{
|
{
|
||||||
std::cerr << "Is a New Photo";
|
std::cerr << "Is a New Photo";
|
||||||
rsPhoto->submitPhoto(photo, true);
|
rsPhoto->submitPhoto(token, photo, true);
|
||||||
}
|
}
|
||||||
else if (isModifiedPhoto)
|
else if (isModifiedPhoto)
|
||||||
{
|
{
|
||||||
std::cerr << "Is Updated";
|
std::cerr << "Is Updated";
|
||||||
rsPhoto->submitPhoto(photo, false);
|
rsPhoto->submitPhoto(token, photo, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -414,7 +426,6 @@ void PhotoAddDialog::publishAlbum()
|
||||||
}
|
}
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
clearDialog();
|
clearDialog();
|
||||||
|
|
||||||
|
@ -535,6 +546,34 @@ bool PhotoAddDialog::loadAlbumData(const uint32_t &token)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PhotoAddDialog::loadCreatedAlbum(const uint32_t &token)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoAddDialog::loadCreatedAlbum()";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
std::list<RsGroupMetaData> groupInfo;
|
||||||
|
if (!rsPhoto->getGroupSummary(token, groupInfo))
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoAddDialog::loadCreatedAlbum() ERROR Getting MetaData";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (groupInfo.size() != 1)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoAddDialog::loadCreatedAlbum() ERROR Too much Info";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cerr << "PhotoAddDialog::loadCreatedAlbum() publishing Photos";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
publishPhotos(groupInfo.front().mGroupId);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void PhotoAddDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
void PhotoAddDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||||
{
|
{
|
||||||
|
@ -547,13 +586,24 @@ void PhotoAddDialog::loadRequest(const TokenQueue *queue, const TokenRequest &re
|
||||||
switch(req.mType)
|
switch(req.mType)
|
||||||
{
|
{
|
||||||
case TOKENREQ_GROUPINFO:
|
case TOKENREQ_GROUPINFO:
|
||||||
|
switch(req.mAnsType)
|
||||||
|
{
|
||||||
|
case RS_TOKREQ_ANSTYPE_DATA:
|
||||||
loadAlbumData(req.mToken);
|
loadAlbumData(req.mToken);
|
||||||
break;
|
break;
|
||||||
|
case RS_TOKREQ_ANSTYPE_SUMMARY:
|
||||||
|
loadCreatedAlbum(req.mToken);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
std::cerr << "PhotoAddDialog::loadRequest() ERROR: GROUP: INVALID ANS TYPE";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case TOKENREQ_MSGINFO:
|
case TOKENREQ_MSGINFO:
|
||||||
loadPhotoData(req.mToken);
|
loadPhotoData(req.mToken);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
std::cerr << "PhotoAddDialog::loadRequest() ERROR: GROUP: INVALID ANS TYPE";
|
std::cerr << "PhotoAddDialog::loadRequest() ERROR: INVALID TYPE";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,10 +59,14 @@ private slots:
|
||||||
void deletePhoto();
|
void deletePhoto();
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
void publishPhotos(std::string albumId);
|
||||||
|
|
||||||
bool updateAlbumDetails(const RsPhotoAlbum &album);
|
bool updateAlbumDetails(const RsPhotoAlbum &album);
|
||||||
bool setAlbumDataToPhotos();
|
bool setAlbumDataToPhotos();
|
||||||
bool loadPhotoData(const uint32_t &token);
|
bool loadPhotoData(const uint32_t &token);
|
||||||
bool loadAlbumData(const uint32_t &token);
|
bool loadAlbumData(const uint32_t &token);
|
||||||
|
bool loadCreatedAlbum(const uint32_t &token);
|
||||||
|
|
||||||
TokenQueue *mPhotoQueue;
|
TokenQueue *mPhotoQueue;
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
|
@ -147,6 +147,7 @@ void PostedListDialog::updateDisplay()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// TODO groupsChanged... HACK XXX.
|
// TODO groupsChanged... HACK XXX.
|
||||||
|
#if 0
|
||||||
if ((rsPosted->groupsChanged(groupIds)) || (rsPosted->updated()))
|
if ((rsPosted->groupsChanged(groupIds)) || (rsPosted->updated()))
|
||||||
{
|
{
|
||||||
/* update Forums List */
|
/* update Forums List */
|
||||||
|
@ -159,6 +160,15 @@ void PostedListDialog::updateDisplay()
|
||||||
insertThreads();
|
insertThreads();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (rsPosted->updated())
|
||||||
|
{
|
||||||
|
/* update Forums List */
|
||||||
|
insertGroups();
|
||||||
|
insertThreads();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostedListDialog::changedTopic(const QString &id)
|
void PostedListDialog::changedTopic(const QString &id)
|
||||||
|
|
|
@ -64,7 +64,12 @@ void WikiAddDialog::createGroup()
|
||||||
group.mMeta.mGroupName = ui.lineEdit_Name->text().toStdString();
|
group.mMeta.mGroupName = ui.lineEdit_Name->text().toStdString();
|
||||||
group.mCategory = "Unknown";
|
group.mCategory = "Unknown";
|
||||||
|
|
||||||
rsWiki->createGroup(group);
|
uint32_t token;
|
||||||
|
bool isNew = true;
|
||||||
|
// Don't worry about getting the response?
|
||||||
|
rsWiki->createGroup(token, group, isNew);
|
||||||
|
|
||||||
|
|
||||||
clearDialog();
|
clearDialog();
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,9 @@ void WikiEditDialog::submitEdit()
|
||||||
mWikiPage.mMeta.mMsgName = ui.lineEdit_Page->text().toStdString();
|
mWikiPage.mMeta.mMsgName = ui.lineEdit_Page->text().toStdString();
|
||||||
mWikiPage.mPage = ui.textEdit->toPlainText().toStdString();
|
mWikiPage.mPage = ui.textEdit->toPlainText().toStdString();
|
||||||
|
|
||||||
rsWiki->createPage(mWikiPage);
|
uint32_t token;
|
||||||
|
bool isNew = mNewPage;
|
||||||
|
rsWiki->createPage(token, mWikiPage, isNew);
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue