Added mark all as read/unread in forums tree.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3798 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-11-15 23:33:32 +00:00
parent 39907c1afc
commit 145c6775c4
4 changed files with 94 additions and 73 deletions

View File

@ -320,36 +320,29 @@ void ForumsDialog::forumListCustomPopupMenu( QPoint point )
{
QMenu contextMnu( this );
QAction *subForumAct = new QAction(QIcon(IMAGE_SUBSCRIBE), tr( "Subscribe to Forum" ), &contextMnu );
subForumAct->setDisabled (m_bIsForumSubscribed);
connect( subForumAct , SIGNAL( triggered() ), this, SLOT( subscribeToForum() ) );
QAction *action = contextMnu.addAction(QIcon(IMAGE_SUBSCRIBE), tr("Subscribe to Forum"), this, SLOT(subscribeToForum()));
action->setDisabled (m_bIsForumSubscribed);
QAction *unsubForumAct = new QAction(QIcon(IMAGE_UNSUBSCRIBE), tr( "Unsubscribe to Forum" ), &contextMnu );
unsubForumAct->setEnabled (m_bIsForumSubscribed);
connect( unsubForumAct , SIGNAL( triggered() ), this, SLOT( unsubscribeToForum() ) );
action = contextMnu.addAction(QIcon(IMAGE_UNSUBSCRIBE), tr("Unsubscribe to Forum"), this, SLOT(unsubscribeToForum()));
action->setEnabled (m_bIsForumSubscribed);
QAction *newForumAct = new QAction(QIcon(IMAGE_NEWFORUM), tr( "New Forum" ), &contextMnu );
connect( newForumAct , SIGNAL( triggered() ), this, SLOT( newforum() ) );
QAction *detailsForumAct = new QAction(QIcon(IMAGE_INFO), tr( "Show Forum Details" ), &contextMnu );
detailsForumAct->setDisabled (true);
connect( detailsForumAct , SIGNAL( triggered() ), this, SLOT( showForumDetails() ) );
QAction *editForumDetailsAct = new QAction(QIcon(":/images/settings16.png"), tr("Edit Forum Details"), this);
editForumDetailsAct->setDisabled (true);
connect( editForumDetailsAct, SIGNAL( triggered() ), this, SLOT( editForumDetails() ) );
if (!mCurrForumId.empty ()) {
detailsForumAct->setEnabled (true);
editForumDetailsAct->setEnabled(m_bIsForumAdmin);
}
contextMnu.addAction( subForumAct );
contextMnu.addAction( unsubForumAct );
contextMnu.addSeparator();
contextMnu.addAction( newForumAct );
contextMnu.addAction( detailsForumAct );
contextMnu.addAction( editForumDetailsAct );
contextMnu.addAction(QIcon(IMAGE_NEWFORUM), tr("New Forum"), this, SLOT(newforum()));
action = contextMnu.addAction(QIcon(IMAGE_INFO), tr("Show Forum Details"), this, SLOT(showForumDetails()));
action->setEnabled (!mCurrForumId.empty ());
action = contextMnu.addAction(QIcon(":/images/settings16.png"), tr("Edit Forum Details"), this, SLOT(editForumDetails()));
action->setEnabled (!mCurrForumId.empty () && m_bIsForumAdmin);
contextMnu.addSeparator();
action = contextMnu.addAction(QIcon(":/images/message-mail-read.png"), tr("Mark all as read"), this, SLOT(markMsgAsReadAll()));
action->setEnabled (!mCurrForumId.empty () && m_bIsForumSubscribed);
action = contextMnu.addAction(QIcon(":/images/message-mail.png"), tr("Mark all as unread"), this, SLOT(markMsgAsUnreadAll()));
action->setEnabled (!mCurrForumId.empty () && m_bIsForumSubscribed);
contextMnu.exec(QCursor::pos());
}
@ -377,14 +370,14 @@ void ForumsDialog::threadListCustomPopupMenu( QPoint point )
QAction *markMsgAsRead = new QAction(QIcon(":/images/message-mail-read.png"), tr("Mark as read"), &contextMnu);
connect(markMsgAsRead , SIGNAL(triggered()), this, SLOT(markMsgAsRead()));
QAction *markMsgAsReadAll = new QAction(QIcon(":/images/message-mail-read.png"), tr("Mark as read") + " (" + tr ("with children") + ")", &contextMnu);
connect(markMsgAsReadAll, SIGNAL(triggered()), this, SLOT(markMsgAsReadAll()));
QAction *markMsgAsReadChildren = new QAction(QIcon(":/images/message-mail-read.png"), tr("Mark as read") + " (" + tr ("with children") + ")", &contextMnu);
connect(markMsgAsReadChildren, SIGNAL(triggered()), this, SLOT(markMsgAsReadChildren()));
QAction *markMsgAsUnread = new QAction(QIcon(":/images/message-mail.png"), tr("Mark as unread"), &contextMnu);
connect(markMsgAsUnread , SIGNAL(triggered()), this, SLOT(markMsgAsUnread()));
QAction *markMsgAsUnreadAll = new QAction(QIcon(":/images/message-mail.png"), tr("Mark as unread") + " (" + tr ("with children") + ")", &contextMnu);
connect(markMsgAsUnreadAll , SIGNAL(triggered()), this, SLOT(markMsgAsUnreadAll()));
QAction *markMsgAsUnreadChildren = new QAction(QIcon(":/images/message-mail.png"), tr("Mark as unread") + " (" + tr ("with children") + ")", &contextMnu);
connect(markMsgAsUnreadChildren , SIGNAL(triggered()), this, SLOT(markMsgAsUnreadChildren()));
if (m_bIsForumSubscribed) {
QList<QTreeWidgetItem*> Rows;
@ -411,8 +404,8 @@ void ForumsDialog::threadListCustomPopupMenu( QPoint point )
bHasReadChildren = true;
}
}
markMsgAsReadAll->setEnabled(bHasUnreadChildren);
markMsgAsUnreadAll->setEnabled(bHasReadChildren);
markMsgAsReadChildren->setEnabled(bHasUnreadChildren);
markMsgAsUnreadChildren->setEnabled(bHasReadChildren);
if (nCount == 1) {
replyAct->setEnabled (true);
@ -423,9 +416,9 @@ void ForumsDialog::threadListCustomPopupMenu( QPoint point )
}
} else {
markMsgAsRead->setDisabled(true);
markMsgAsReadAll->setDisabled(true);
markMsgAsReadChildren->setDisabled(true);
markMsgAsUnread->setDisabled(true);
markMsgAsUnreadAll->setDisabled(true);
markMsgAsUnreadChildren->setDisabled(true);
replyAct->setDisabled (true);
replyauthorAct->setDisabled (true);
}
@ -435,9 +428,9 @@ void ForumsDialog::threadListCustomPopupMenu( QPoint point )
contextMnu.addAction( replyauthorAct);
contextMnu.addSeparator();
contextMnu.addAction(markMsgAsRead);
contextMnu.addAction(markMsgAsReadAll);
contextMnu.addAction(markMsgAsReadChildren);
contextMnu.addAction(markMsgAsUnread);
contextMnu.addAction(markMsgAsUnreadAll);
contextMnu.addAction(markMsgAsUnreadChildren);
contextMnu.addSeparator();
contextMnu.addAction( expandAll);
contextMnu.addAction( collapseAll);
@ -1536,7 +1529,7 @@ void ForumsDialog::setMsgAsReadUnread(QList<QTreeWidgetItem*> &Rows, bool bRead)
}
}
void ForumsDialog::markMsgAsReadUnread (bool bRead, bool bAll)
void ForumsDialog::markMsgAsReadUnread (bool bRead, bool bChildren, bool bForum)
{
if (mCurrForumId.empty() || m_bIsForumSubscribed == false) {
return;
@ -1544,9 +1537,16 @@ void ForumsDialog::markMsgAsReadUnread (bool bRead, bool bAll)
/* get selected messages */
QList<QTreeWidgetItem*> Rows;
getSelectedMsgCount (&Rows, NULL, NULL);
if (bForum) {
int itemCount = ui.threadTreeWidget->topLevelItemCount();
for (int item = 0; item < itemCount; item++) {
Rows.push_back(ui.threadTreeWidget->topLevelItem(item));
}
} else {
getSelectedMsgCount (&Rows, NULL, NULL);
}
if (bAll) {
if (bChildren) {
/* add children */
QList<QTreeWidgetItem*> AllRows;
@ -1580,22 +1580,32 @@ void ForumsDialog::markMsgAsReadUnread (bool bRead, bool bAll)
void ForumsDialog::markMsgAsRead()
{
markMsgAsReadUnread(true, false);
markMsgAsReadUnread(true, false, false);
}
void ForumsDialog::markMsgAsReadChildren()
{
markMsgAsReadUnread(true, true, false);
}
void ForumsDialog::markMsgAsReadAll()
{
markMsgAsReadUnread(true, true);
markMsgAsReadUnread(true, true, true);
}
void ForumsDialog::markMsgAsUnread()
{
markMsgAsReadUnread(false, false);
markMsgAsReadUnread(false, false, false);
}
void ForumsDialog::markMsgAsUnreadChildren()
{
markMsgAsReadUnread(false, true, false);
}
void ForumsDialog::markMsgAsUnreadAll()
{
markMsgAsReadUnread(false, true);
markMsgAsReadUnread(false, true, true);
}
void ForumsDialog::newforum()
@ -1604,7 +1614,6 @@ void ForumsDialog::newforum()
cf.exec ();
}
void ForumsDialog::createmessage()
{
if (mCurrForumId.empty () || m_bIsForumSubscribed == false) {

View File

@ -55,9 +55,11 @@ private slots:
//void removemessage();
void markMsgAsRead();
void markMsgAsReadChildren();
void markMsgAsReadAll();
void markMsgAsUnread();
void markMsgAsUnreadAll();
void markMsgAsUnreadChildren();
/* handle splitter */
void togglethreadview();
@ -93,7 +95,7 @@ private:
int getSelectedMsgCount(QList<QTreeWidgetItem*> *pRows, QList<QTreeWidgetItem*> *pRowsRead, QList<QTreeWidgetItem*> *pRowsUnread);
void setMsgAsReadUnread(QList<QTreeWidgetItem*> &Rows, bool bRead);
void markMsgAsReadUnread(bool bRead, bool bAll);
void markMsgAsReadUnread(bool bRead, bool bChildren, bool bForum);
void CalculateIconsAndFonts(QTreeWidgetItem *pItem = NULL);
void CalculateIconsAndFonts(QTreeWidgetItem *pItem, bool &bHasReadChilddren, bool &bHasUnreadChilddren);

View File

@ -3506,27 +3506,37 @@ p, li { white-space: pre-wrap; }
<translation>Forum abonnieren</translation>
</message>
<message>
<location line="+4"/>
<location line="+3"/>
<source>Unsubscribe to Forum</source>
<translation>Forum abbestellen</translation>
</message>
<message>
<location line="+4"/>
<location line="+5"/>
<source>New Forum</source>
<translation>Neues Forum</translation>
</message>
<message>
<location line="+3"/>
<location line="+2"/>
<source>Show Forum Details</source>
<translation>Zeige Foren-Details</translation>
</message>
<message>
<location line="+4"/>
<location line="+3"/>
<source>Edit Forum Details</source>
<translation>Forum-Details bearbeiten</translation>
</message>
<message>
<location line="+23"/>
<location line="+5"/>
<source>Mark all as read</source>
<translation>Alle als gelesen markieren</translation>
</message>
<message>
<location line="+3"/>
<source>Mark all as unread</source>
<translation>Alle als ungelesen markieren</translation>
</message>
<message>
<location line="+10"/>
<source>Reply</source>
<translation>Antwort</translation>
</message>
@ -3581,7 +3591,7 @@ p, li { white-space: pre-wrap; }
<translation>keine</translation>
</message>
<message>
<location line="+487"/>
<location line="+503"/>
<location line="+88"/>
<source>RetroShare</source>
<translation></translation>
@ -3597,7 +3607,7 @@ p, li { white-space: pre-wrap; }
<translation>Du kannst einem anonymen Autor nicht antworten</translation>
</message>
<message>
<location line="-1498"/>
<location line="-1507"/>
<source>Your Forums</source>
<translation>Deine Foren</translation>
</message>
@ -3739,8 +3749,8 @@ p, li { white-space: pre-wrap; }
<translation>Druckvorschau</translation>
</message>
<message>
<location filename="../gui/ForumsDialog.cpp" line="+127"/>
<location line="+1264"/>
<location filename="../gui/ForumsDialog.cpp" line="+120"/>
<location line="+1280"/>
<source>Start New Thread</source>
<translation>Erstelle neues Thema</translation>
</message>
@ -3768,7 +3778,7 @@ p, li { white-space: pre-wrap; }
<translation>Inhalt</translation>
</message>
<message>
<location filename="../gui/ForumsDialog.cpp" line="-1251"/>
<location filename="../gui/ForumsDialog.cpp" line="-1267"/>
<location line="+3"/>
<source>Mark as read</source>
<translation>Als gelesen markieren</translation>
@ -4252,7 +4262,7 @@ Fill in your GPG password when asked, to sign your new key.</source>
<context>
<name>GraphWidget</name>
<message>
<location filename="../gui/elastic/graphwidget.cpp" line="+372"/>
<location filename="../gui/elastic/graphwidget.cpp" line="+396"/>
<source>Click and drag the nodes around, and zoom with the mouse wheel or the &apos;+&apos; and &apos;-&apos; keys</source>
<translation type="unfinished"></translation>
</message>
@ -5860,7 +5870,7 @@ Willst Du die Nachricht speichern ?</translation>
<name>MessagesDialog</name>
<message>
<location filename="../gui/MessagesDialog.ui" line="+573"/>
<location filename="../gui/MessagesDialog.cpp" line="+670"/>
<location filename="../gui/MessagesDialog.cpp" line="+672"/>
<source>New Message</source>
<translation>Neue Nachricht</translation>
</message>
@ -5876,14 +5886,14 @@ Willst Du die Nachricht speichern ?</translation>
</message>
<message>
<location filename="../gui/MessagesDialog.ui" line="+372"/>
<location filename="../gui/MessagesDialog.cpp" line="-374"/>
<location filename="../gui/MessagesDialog.cpp" line="-376"/>
<source>Date</source>
<translation>Datum</translation>
</message>
<message>
<location line="-5"/>
<location filename="../gui/MessagesDialog.cpp" line="-1"/>
<location line="+843"/>
<location line="+845"/>
<source>From</source>
<translation>Von</translation>
</message>
@ -6056,7 +6066,7 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<location filename="../gui/MessagesDialog.ui" line="-886"/>
<location filename="../gui/MessagesDialog.cpp" line="-1577"/>
<location filename="../gui/MessagesDialog.cpp" line="-1579"/>
<source>Subject</source>
<translation>Betreff</translation>
</message>
@ -6096,7 +6106,7 @@ p, li { white-space: pre-wrap; }
<translation>Gewählte Nachricht weiterleiten</translation>
</message>
<message>
<location line="+319"/>
<location line="+321"/>
<source>Remove Messages</source>
<translation>Löschen</translation>
</message>
@ -6131,8 +6141,8 @@ p, li { white-space: pre-wrap; }
<translation>HTML-Dateien (*.htm *.html);;Alle Dateien (*)</translation>
</message>
<message>
<location line="-1561"/>
<location line="+272"/>
<location line="-1563"/>
<location line="+274"/>
<source>Reply to All</source>
<translation>Allen antworten</translation>
</message>
@ -6151,7 +6161,7 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<location line="-274"/>
<location filename="../gui/MessagesDialog.cpp" line="-324"/>
<location filename="../gui/MessagesDialog.cpp" line="-326"/>
<source>Content</source>
<translation>Inhalt</translation>
</message>
@ -6159,7 +6169,7 @@ p, li { white-space: pre-wrap; }
<location line="+5"/>
<location line="+8"/>
<location filename="../gui/MessagesDialog.cpp" line="-1"/>
<location line="+178"/>
<location line="+180"/>
<source>Tags</source>
<translation>Schlagwörter</translation>
</message>
@ -6461,7 +6471,7 @@ p, li { white-space: pre-wrap; }
<context>
<name>NetworkDialog</name>
<message>
<location filename="../gui/NetworkDialog.cpp" line="+312"/>
<location filename="../gui/NetworkDialog.cpp" line="+314"/>
<location line="+310"/>
<source>Select a pem/pqi File</source>
<translation>Wählen einer PEM- oder PQI-Datei</translation>
@ -6666,7 +6676,7 @@ p, li { white-space: pre-wrap; }
<translation>Unbekannt</translation>
</message>
<message>
<location line="-299"/>
<location line="-301"/>
<source>Authentication matrix</source>
<translation>Authentifizierungsmatrix</translation>
</message>
@ -6676,7 +6686,7 @@ p, li { white-space: pre-wrap; }
<translation>Netzwerk Ansicht</translation>
</message>
<message>
<location line="+287"/>
<location line="+289"/>
<source>Authenticated</source>
<translation>Authentifiziert</translation>
</message>
@ -6856,7 +6866,7 @@ p, li { white-space: pre-wrap; }
<translation>Erneuern</translation>
</message>
<message>
<location line="+21"/>
<location line="+24"/>
<source>Basic</source>
<translation type="unfinished"></translation>
</message>
@ -6871,12 +6881,12 @@ p, li { white-space: pre-wrap; }
<translation type="unfinished"></translation>
</message>
<message>
<location line="+8"/>
<location line="+11"/>
<source>Display mode:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+17"/>
<location line="+20"/>
<source>Friends level:</source>
<translation type="unfinished"></translation>
</message>
@ -7951,7 +7961,7 @@ p, li { white-space: pre-wrap; }
<translation>Nachrichten, die Du versendest gehen bei diesem Freund erst wieder ein wenn er Online ist</translation>
</message>
<message>
<location filename="../gui/chat/PopupChatDialog.ui" line="+564"/>
<location filename="../gui/chat/PopupChatDialog.ui" line="+567"/>
<location line="+263"/>
<source>Bold</source>
<translation>Fett</translation>