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 ); QMenu contextMnu( this );
QAction *subForumAct = new QAction(QIcon(IMAGE_SUBSCRIBE), tr( "Subscribe to Forum" ), &contextMnu ); QAction *action = contextMnu.addAction(QIcon(IMAGE_SUBSCRIBE), tr("Subscribe to Forum"), this, SLOT(subscribeToForum()));
subForumAct->setDisabled (m_bIsForumSubscribed); action->setDisabled (m_bIsForumSubscribed);
connect( subForumAct , SIGNAL( triggered() ), this, SLOT( subscribeToForum() ) );
QAction *unsubForumAct = new QAction(QIcon(IMAGE_UNSUBSCRIBE), tr( "Unsubscribe to Forum" ), &contextMnu ); action = contextMnu.addAction(QIcon(IMAGE_UNSUBSCRIBE), tr("Unsubscribe to Forum"), this, SLOT(unsubscribeToForum()));
unsubForumAct->setEnabled (m_bIsForumSubscribed); action->setEnabled (m_bIsForumSubscribed);
connect( unsubForumAct , SIGNAL( triggered() ), this, SLOT( unsubscribeToForum() ) );
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.addSeparator();
contextMnu.addAction( newForumAct );
contextMnu.addAction( detailsForumAct ); contextMnu.addAction(QIcon(IMAGE_NEWFORUM), tr("New Forum"), this, SLOT(newforum()));
contextMnu.addAction( editForumDetailsAct );
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()); 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); QAction *markMsgAsRead = new QAction(QIcon(":/images/message-mail-read.png"), tr("Mark as read"), &contextMnu);
connect(markMsgAsRead , SIGNAL(triggered()), this, SLOT(markMsgAsRead())); 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); QAction *markMsgAsReadChildren = new QAction(QIcon(":/images/message-mail-read.png"), tr("Mark as read") + " (" + tr ("with children") + ")", &contextMnu);
connect(markMsgAsReadAll, SIGNAL(triggered()), this, SLOT(markMsgAsReadAll())); connect(markMsgAsReadChildren, SIGNAL(triggered()), this, SLOT(markMsgAsReadChildren()));
QAction *markMsgAsUnread = new QAction(QIcon(":/images/message-mail.png"), tr("Mark as unread"), &contextMnu); QAction *markMsgAsUnread = new QAction(QIcon(":/images/message-mail.png"), tr("Mark as unread"), &contextMnu);
connect(markMsgAsUnread , SIGNAL(triggered()), this, SLOT(markMsgAsUnread())); connect(markMsgAsUnread , SIGNAL(triggered()), this, SLOT(markMsgAsUnread()));
QAction *markMsgAsUnreadAll = 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(markMsgAsUnreadAll , SIGNAL(triggered()), this, SLOT(markMsgAsUnreadAll())); connect(markMsgAsUnreadChildren , SIGNAL(triggered()), this, SLOT(markMsgAsUnreadChildren()));
if (m_bIsForumSubscribed) { if (m_bIsForumSubscribed) {
QList<QTreeWidgetItem*> Rows; QList<QTreeWidgetItem*> Rows;
@ -411,8 +404,8 @@ void ForumsDialog::threadListCustomPopupMenu( QPoint point )
bHasReadChildren = true; bHasReadChildren = true;
} }
} }
markMsgAsReadAll->setEnabled(bHasUnreadChildren); markMsgAsReadChildren->setEnabled(bHasUnreadChildren);
markMsgAsUnreadAll->setEnabled(bHasReadChildren); markMsgAsUnreadChildren->setEnabled(bHasReadChildren);
if (nCount == 1) { if (nCount == 1) {
replyAct->setEnabled (true); replyAct->setEnabled (true);
@ -423,9 +416,9 @@ void ForumsDialog::threadListCustomPopupMenu( QPoint point )
} }
} else { } else {
markMsgAsRead->setDisabled(true); markMsgAsRead->setDisabled(true);
markMsgAsReadAll->setDisabled(true); markMsgAsReadChildren->setDisabled(true);
markMsgAsUnread->setDisabled(true); markMsgAsUnread->setDisabled(true);
markMsgAsUnreadAll->setDisabled(true); markMsgAsUnreadChildren->setDisabled(true);
replyAct->setDisabled (true); replyAct->setDisabled (true);
replyauthorAct->setDisabled (true); replyauthorAct->setDisabled (true);
} }
@ -435,9 +428,9 @@ void ForumsDialog::threadListCustomPopupMenu( QPoint point )
contextMnu.addAction( replyauthorAct); contextMnu.addAction( replyauthorAct);
contextMnu.addSeparator(); contextMnu.addSeparator();
contextMnu.addAction(markMsgAsRead); contextMnu.addAction(markMsgAsRead);
contextMnu.addAction(markMsgAsReadAll); contextMnu.addAction(markMsgAsReadChildren);
contextMnu.addAction(markMsgAsUnread); contextMnu.addAction(markMsgAsUnread);
contextMnu.addAction(markMsgAsUnreadAll); contextMnu.addAction(markMsgAsUnreadChildren);
contextMnu.addSeparator(); contextMnu.addSeparator();
contextMnu.addAction( expandAll); contextMnu.addAction( expandAll);
contextMnu.addAction( collapseAll); 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) { if (mCurrForumId.empty() || m_bIsForumSubscribed == false) {
return; return;
@ -1544,9 +1537,16 @@ void ForumsDialog::markMsgAsReadUnread (bool bRead, bool bAll)
/* get selected messages */ /* get selected messages */
QList<QTreeWidgetItem*> Rows; 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 */ /* add children */
QList<QTreeWidgetItem*> AllRows; QList<QTreeWidgetItem*> AllRows;
@ -1580,22 +1580,32 @@ void ForumsDialog::markMsgAsReadUnread (bool bRead, bool bAll)
void ForumsDialog::markMsgAsRead() void ForumsDialog::markMsgAsRead()
{ {
markMsgAsReadUnread(true, false); markMsgAsReadUnread(true, false, false);
}
void ForumsDialog::markMsgAsReadChildren()
{
markMsgAsReadUnread(true, true, false);
} }
void ForumsDialog::markMsgAsReadAll() void ForumsDialog::markMsgAsReadAll()
{ {
markMsgAsReadUnread(true, true); markMsgAsReadUnread(true, true, true);
} }
void ForumsDialog::markMsgAsUnread() void ForumsDialog::markMsgAsUnread()
{ {
markMsgAsReadUnread(false, false); markMsgAsReadUnread(false, false, false);
}
void ForumsDialog::markMsgAsUnreadChildren()
{
markMsgAsReadUnread(false, true, false);
} }
void ForumsDialog::markMsgAsUnreadAll() void ForumsDialog::markMsgAsUnreadAll()
{ {
markMsgAsReadUnread(false, true); markMsgAsReadUnread(false, true, true);
} }
void ForumsDialog::newforum() void ForumsDialog::newforum()
@ -1604,7 +1614,6 @@ void ForumsDialog::newforum()
cf.exec (); cf.exec ();
} }
void ForumsDialog::createmessage() void ForumsDialog::createmessage()
{ {
if (mCurrForumId.empty () || m_bIsForumSubscribed == false) { if (mCurrForumId.empty () || m_bIsForumSubscribed == false) {

View File

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

View File

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