mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-28 17:09:34 -05:00
Set the focus the subject input when creating a new forum/channel or channel message.
Set the forum/channel message to read when expanding the message feed. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4891 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
549fdf9daa
commit
3b1c26de35
@ -742,6 +742,8 @@ void ForumsDialog::fillThreadFinished()
|
||||
#ifdef DEBUG_FORUMS
|
||||
std::cerr << "ForumsDialog::fillThreadFinished Add messages" << std::endl;
|
||||
#endif
|
||||
ui.threadTreeWidget->setSortingEnabled(false);
|
||||
|
||||
/* add all messages in! */
|
||||
if (lastViewType != thread->viewType || lastForumID != mCurrForumId) {
|
||||
ui.threadTreeWidget->clear();
|
||||
@ -758,6 +760,8 @@ void ForumsDialog::fillThreadFinished()
|
||||
CleanupItems (thread->items);
|
||||
}
|
||||
|
||||
ui.threadTreeWidget->setSortingEnabled(true);
|
||||
|
||||
if (thread->focusMsgId.empty() == false) {
|
||||
/* Search exisiting item */
|
||||
QTreeWidgetItemIterator itemIterator(ui.threadTreeWidget);
|
||||
|
@ -82,6 +82,8 @@ void CreateChannel::newChannel()
|
||||
ui.msgAnon->setChecked(true);
|
||||
ui.msgAuth->setEnabled(false);
|
||||
ui.msgGroupBox->hide();
|
||||
|
||||
ui.channelName->setFocus();
|
||||
}
|
||||
|
||||
void CreateChannel::createChannel()
|
||||
|
@ -529,7 +529,6 @@ void CreateChannelMsg::cancelMsg()
|
||||
|
||||
void CreateChannelMsg::newChannelMsg()
|
||||
{
|
||||
|
||||
if (!rsChannels)
|
||||
return;
|
||||
|
||||
@ -541,9 +540,9 @@ void CreateChannelMsg::newChannelMsg()
|
||||
}
|
||||
|
||||
channelName->setText(QString::fromStdWString(ci.channelName));
|
||||
subjectEdit->setFocus();
|
||||
}
|
||||
|
||||
|
||||
void CreateChannelMsg::sendMsg()
|
||||
{
|
||||
std::cerr << "CreateChannelMsg::sendMsg()";
|
||||
|
@ -44,38 +44,38 @@ ChanMsgItem::ChanMsgItem(FeedHolder *parent, uint32_t feedId, const std::string
|
||||
:QWidget(NULL), mParent(parent), mFeedId(feedId),
|
||||
mChanId(chanId), mMsgId(msgId), mIsHome(isHome)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
setupUi(this);
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
setupUi(this);
|
||||
|
||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||
|
||||
m_inUpdateItemStatic = false;
|
||||
m_inUpdateItemStatic = false;
|
||||
|
||||
/* general ones */
|
||||
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
|
||||
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );
|
||||
/* general ones */
|
||||
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
|
||||
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );
|
||||
|
||||
/* specific */
|
||||
connect( unsubscribeButton, SIGNAL( clicked( void ) ), this, SLOT( unsubscribeChannel ( void ) ) );
|
||||
connect( downloadButton, SIGNAL( clicked( void ) ), this, SLOT( download ( void ) ) );
|
||||
connect( playButton, SIGNAL( clicked( void ) ), this, SLOT( play ( void ) ) );
|
||||
connect( copyLinkButton, SIGNAL( clicked( void ) ), this, SLOT( copyLink ( void ) ) );
|
||||
/* specific */
|
||||
connect( unsubscribeButton, SIGNAL( clicked( void ) ), this, SLOT( unsubscribeChannel ( void ) ) );
|
||||
connect( downloadButton, SIGNAL( clicked( void ) ), this, SLOT( download ( void ) ) );
|
||||
connect( playButton, SIGNAL( clicked( void ) ), this, SLOT( play ( void ) ) );
|
||||
connect( copyLinkButton, SIGNAL( clicked( void ) ), this, SLOT( copyLink ( void ) ) );
|
||||
|
||||
connect( readButton, SIGNAL( toggled(bool) ), this, SLOT( readToggled(bool) ) );
|
||||
connect( NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)), Qt::QueuedConnection);
|
||||
connect( readButton, SIGNAL( toggled(bool) ), this, SLOT( readToggled(bool) ) );
|
||||
connect( NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)), Qt::QueuedConnection);
|
||||
|
||||
downloadButton->hide();
|
||||
playButton->hide();
|
||||
warn_image_label->hide();
|
||||
warning_label->hide();
|
||||
downloadButton->hide();
|
||||
playButton->hide();
|
||||
warn_image_label->hide();
|
||||
warning_label->hide();
|
||||
|
||||
titleLabel->setMinimumWidth(100);
|
||||
subjectLabel->setMinimumWidth(100);
|
||||
warning_label->setMinimumWidth(100);
|
||||
titleLabel->setMinimumWidth(100);
|
||||
subjectLabel->setMinimumWidth(100);
|
||||
warning_label->setMinimumWidth(100);
|
||||
|
||||
small();
|
||||
updateItemStatic();
|
||||
updateItem();
|
||||
small();
|
||||
updateItemStatic();
|
||||
updateItem();
|
||||
}
|
||||
|
||||
void ChanMsgItem::updateItemStatic()
|
||||
@ -311,6 +311,10 @@ void ChanMsgItem::toggle()
|
||||
expandFrame->show();
|
||||
expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
|
||||
expandButton->setToolTip(tr("Hide"));
|
||||
|
||||
if (!mIsHome) {
|
||||
readToggled(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -374,27 +378,27 @@ void ChanMsgItem::play()
|
||||
|
||||
void ChanMsgItem::readToggled(bool checked)
|
||||
{
|
||||
if (m_inUpdateItemStatic) {
|
||||
return;
|
||||
}
|
||||
if (m_inUpdateItemStatic) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* set always as read ... */
|
||||
uint32_t statusNew = CHANNEL_MSG_STATUS_READ;
|
||||
if (checked) {
|
||||
/* ... and as unread by user */
|
||||
statusNew |= CHANNEL_MSG_STATUS_UNREAD_BY_USER;
|
||||
} else {
|
||||
/* ... and as read by user */
|
||||
statusNew &= ~CHANNEL_MSG_STATUS_UNREAD_BY_USER;
|
||||
}
|
||||
rsChannels->setMessageStatus(mChanId, mMsgId, statusNew, CHANNEL_MSG_STATUS_READ | CHANNEL_MSG_STATUS_UNREAD_BY_USER);
|
||||
/* set always as read ... */
|
||||
uint32_t statusNew = CHANNEL_MSG_STATUS_READ;
|
||||
if (checked) {
|
||||
/* ... and as unread by user */
|
||||
statusNew |= CHANNEL_MSG_STATUS_UNREAD_BY_USER;
|
||||
} else {
|
||||
/* ... and as read by user */
|
||||
statusNew &= ~CHANNEL_MSG_STATUS_UNREAD_BY_USER;
|
||||
}
|
||||
rsChannels->setMessageStatus(mChanId, mMsgId, statusNew, CHANNEL_MSG_STATUS_READ | CHANNEL_MSG_STATUS_UNREAD_BY_USER);
|
||||
}
|
||||
|
||||
void ChanMsgItem::channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int /*status*/)
|
||||
{
|
||||
if (channelId.toStdString() == mChanId && msgId.toStdString() == mMsgId) {
|
||||
updateItemStatic();
|
||||
}
|
||||
if (channelId.toStdString() == mChanId && msgId.toStdString() == mMsgId) {
|
||||
updateItemStatic();
|
||||
}
|
||||
}
|
||||
|
||||
void ChanMsgItem::copyLink()
|
||||
|
@ -30,13 +30,10 @@
|
||||
#include <retroshare/rsmsgs.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
|
||||
#include "gui/notifyqt.h"
|
||||
|
||||
#include "gui/forums/CreateForumMsg.h"
|
||||
#include "gui/chat/HandleRichText.h"
|
||||
#include "gui/common/AvatarDefs.h"
|
||||
|
||||
#include <algorithm>
|
||||
//#include "gui/settings/rsharesettings.h"
|
||||
|
||||
/****
|
||||
* #define DEBUG_ITEM 1
|
||||
@ -46,31 +43,30 @@
|
||||
ForumMsgItem::ForumMsgItem(FeedHolder *parent, uint32_t feedId, const std::string &forumId, const std::string &postId, bool isHome)
|
||||
:QWidget(NULL), mParent(parent), mFeedId(feedId), mForumId(forumId), mPostId(postId), mIsHome(isHome), mIsTop(false)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
setupUi(this);
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
setupUi(this);
|
||||
|
||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||
|
||||
/* general ones */
|
||||
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
|
||||
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );
|
||||
/* general ones */
|
||||
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
|
||||
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );
|
||||
|
||||
/* specific ones */
|
||||
connect( unsubscribeButton, SIGNAL( clicked( void ) ), this, SLOT( unsubscribeForum ( void ) ) );
|
||||
connect( replyButton, SIGNAL( clicked( void ) ), this, SLOT( replyToPost ( void ) ) );
|
||||
connect( sendButton, SIGNAL( clicked( ) ), this, SLOT( sendMsg() ) );
|
||||
/* specific ones */
|
||||
connect( unsubscribeButton, SIGNAL( clicked( void ) ), this, SLOT( unsubscribeForum ( void ) ) );
|
||||
connect( replyButton, SIGNAL( clicked( void ) ), this, SLOT( replyToPost ( void ) ) );
|
||||
connect( sendButton, SIGNAL( clicked( ) ), this, SLOT( sendMsg() ) );
|
||||
|
||||
subjectLabel->setMinimumWidth(20);
|
||||
subjectLabel->setMinimumWidth(20);
|
||||
|
||||
small();
|
||||
updateItemStatic();
|
||||
updateItem();
|
||||
textEdit->hide();
|
||||
sendButton->hide();
|
||||
signedcheckBox->hide();
|
||||
small();
|
||||
updateItemStatic();
|
||||
updateItem();
|
||||
textEdit->hide();
|
||||
sendButton->hide();
|
||||
signedcheckBox->hide();
|
||||
}
|
||||
|
||||
|
||||
void ForumMsgItem::updateItemStatic()
|
||||
{
|
||||
if (!rsForums)
|
||||
@ -157,10 +153,10 @@ void ForumMsgItem::updateItemStatic()
|
||||
prevSubLabel->setText(link.toHtml());
|
||||
prevMsgLabel->setText(RsHtml::formatText(QString::fromStdWString(msg.msg), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
|
||||
|
||||
QDateTime qtime;
|
||||
qtime.setTime_t(msg.ts);
|
||||
QString timestamp = qtime.toString("dd.MMMM yyyy hh:mm");
|
||||
timestamplabel->setText(timestamp);
|
||||
QDateTime qtime;
|
||||
qtime.setTime_t(msg.ts);
|
||||
QString timestamp = qtime.toString("dd.MMMM yyyy hh:mm");
|
||||
timestamplabel->setText(timestamp);
|
||||
|
||||
nextFrame->hide();
|
||||
}
|
||||
@ -183,9 +179,9 @@ void ForumMsgItem::updateItemStatic()
|
||||
nextMsgLabel->setText(RsHtml::formatText(QString::fromStdWString(msg.msg), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
|
||||
|
||||
QDateTime qtime;
|
||||
qtime.setTime_t(msg.ts);
|
||||
QString timestamp = qtime.toString("dd.MMMM yyyy hh:mm");
|
||||
timestamplabel->setText(timestamp);
|
||||
qtime.setTime_t(msg.ts);
|
||||
QString timestamp = qtime.toString("dd.MMMM yyyy hh:mm");
|
||||
timestamplabel->setText(timestamp);
|
||||
|
||||
prevSHLabel->setText(tr("In Reply to") + ": ");
|
||||
|
||||
@ -234,7 +230,6 @@ void ForumMsgItem::updateItemStatic()
|
||||
unsubscribeButton->hide();
|
||||
}
|
||||
|
||||
|
||||
void ForumMsgItem::updateItem()
|
||||
{
|
||||
/* fill in */
|
||||
@ -242,10 +237,8 @@ void ForumMsgItem::updateItem()
|
||||
std::cerr << "ForumMsgItem::updateItem()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ForumMsgItem::small()
|
||||
{
|
||||
nextFrame->hide();
|
||||
@ -261,11 +254,32 @@ void ForumMsgItem::toggle()
|
||||
sendButton->setVisible(canReply);
|
||||
signedcheckBox->setVisible(canReply);
|
||||
expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
|
||||
expandButton->setToolTip("Hide");
|
||||
expandButton->setToolTip("Hide");
|
||||
if (!mIsTop)
|
||||
{
|
||||
nextFrame->show();
|
||||
}
|
||||
|
||||
uint32_t status;
|
||||
rsForums->getMessageStatus(mForumId, mPostId, status);
|
||||
|
||||
if (canReply) {
|
||||
/* set always to read ... */
|
||||
uint32_t statusNew = status | FORUM_MSG_STATUS_READ;
|
||||
|
||||
// bool setToReadOnActive = Settings->getForumMsgSetToReadOnActivate();
|
||||
// if (setToReadOnActive) {
|
||||
/* ... and to read by user */
|
||||
statusNew &= ~FORUM_MSG_STATUS_UNREAD_BY_USER;
|
||||
// } else {
|
||||
// /* ... and to unread by user */
|
||||
// statusNew |= FORUM_MSG_STATUS_UNREAD_BY_USER;
|
||||
// }
|
||||
|
||||
if (status != statusNew) {
|
||||
rsForums->setMessageStatus(mForumId, mPostId, statusNew, FORUM_MSG_STATUS_READ | FORUM_MSG_STATUS_UNREAD_BY_USER);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -275,11 +289,10 @@ void ForumMsgItem::toggle()
|
||||
sendButton->hide();
|
||||
signedcheckBox->hide();
|
||||
expandButton->setIcon(QIcon(QString(":/images/edit_add24.png")));
|
||||
expandButton->setToolTip("Expand");
|
||||
expandButton->setToolTip("Expand");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ForumMsgItem::removeItem()
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
@ -295,7 +308,6 @@ void ForumMsgItem::removeItem()
|
||||
|
||||
/*********** SPECIFIC FUNCTIOSN ***********************/
|
||||
|
||||
|
||||
void ForumMsgItem::unsubscribeForum()
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
@ -309,7 +321,6 @@ void ForumMsgItem::unsubscribeForum()
|
||||
updateItemStatic();
|
||||
}
|
||||
|
||||
|
||||
void ForumMsgItem::subscribeForum()
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
@ -338,7 +349,6 @@ void ForumMsgItem::replyToPost()
|
||||
CreateForumMsg *cfm = new CreateForumMsg(mForumId, mPostId);
|
||||
cfm->show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ForumMsgItem::sendMsg()
|
||||
|
@ -359,6 +359,9 @@ border-radius: 10px}</string>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -520,6 +523,9 @@ border-radius: 10px}</string>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -73,6 +73,8 @@ void CreateForum::newForum()
|
||||
|
||||
ui.forumName->clear();
|
||||
ui.forumDesc->clear();
|
||||
|
||||
ui.forumName->setFocus();
|
||||
}
|
||||
|
||||
void CreateForum::createForum()
|
||||
|
Loading…
Reference in New Issue
Block a user