New read status for forum messages.

New mail messages are marked with a new icon in front of the title.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3352 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-08-08 22:58:10 +00:00
parent 1ad871a3e9
commit 86ae9983d1
22 changed files with 1425 additions and 355 deletions

View File

@ -34,11 +34,9 @@
#include "rstypes.h"
#include "rsdistrib.h" /* For FLAGS */
#define RS_FORUMMSG_NEW 0x0010
#define FORUM_MSG_STATUS_MASK 0x000f
#define FORUM_MSG_STATUS_READ 0x0001
#define FORUM_MSG_STATUS_UNREADY_BY_USER 0x0002
#define FORUM_MSG_STATUS_MASK 0x000f
#define FORUM_MSG_STATUS_READ 0x0001
#define FORUM_MSG_STATUS_UNREAD_BY_USER 0x0002
class ForumInfo
{
@ -137,7 +135,7 @@ virtual bool getForumThreadList(std::string fId, std::list<ThreadInfoSummary> &m
virtual bool getForumThreadMsgList(std::string fId, std::string pId, std::list<ThreadInfoSummary> &msgs) = 0;
virtual bool getForumMessage(std::string fId, std::string mId, ForumMsgInfo &msg) = 0;
virtual bool setMessageStatus(const std::string& fId,const std::string& mId, const uint32_t status, const uint32_t statusMask) = 0;
virtual bool getMessageStatus(const std::string& fId, const std::string& mId, uint32_t& status, const uint32_t statusMask) = 0;
virtual bool getMessageStatus(const std::string& fId, const std::string& mId, uint32_t& status) = 0;
virtual bool ForumMessageSend(ForumMsgInfo &info) = 0;
virtual bool forumSubscribe(std::string fId, bool subscribe) = 0;

View File

@ -271,14 +271,43 @@ bool p3Forums::ForumMessageSend(ForumMsgInfo &info)
bool p3Forums::setMessageStatus(const std::string& fId,const std::string& mId,const uint32_t status, const uint32_t statusMask)
{
setReadStatus(fId, mId, (status & statusMask));
RsStackMutex stack(distribMtx);
std::list<RsForumReadStatus *>::iterator lit = mReadStatus.begin();
for(; lit != mReadStatus.end(); lit++)
{
if((*lit)->forumId == fId)
{
RsForumReadStatus* rsi = *lit;
rsi->msgReadStatus[mId] &= ~statusMask;
rsi->msgReadStatus[mId] |= (status & statusMask);
break;
}
}
// if forum id does not exist create one
if(lit == mReadStatus.end())
{
RsForumReadStatus* rsi = new RsForumReadStatus();
rsi->forumId = fId;
rsi->msgReadStatus[mId] = status & statusMask;
mReadStatus.push_back(rsi);
mSaveList.push_back(rsi);
}
IndicateConfigChanged();
return true;
}
bool p3Forums::getMessageStatus(const std::string& fId, const std::string& mId, uint32_t& status, uint32_t statusMask)
bool p3Forums::getMessageStatus(const std::string& fId, const std::string& mId, uint32_t& status)
{
status = 0;
RsStackMutex stack(distribMtx);
std::list<RsForumReadStatus *>::iterator lit = mReadStatus.begin();
@ -293,22 +322,17 @@ bool p3Forums::getMessageStatus(const std::string& fId, const std::string& mId,
}
std::map<std::string, uint32_t >::iterator mit;
if(lit == mReadStatus.end())
{
return false;
}
else
std::map<std::string, uint32_t >::iterator mit = (*lit)->msgReadStatus.find(mId);
if(mit != (*lit)->msgReadStatus.end())
{
mit = (*lit)->msgReadStatus.find(mId);
if(mit != (*lit)->msgReadStatus.end())
{
status = (mit->second & statusMask);
return true;
}
status = mit->second;
return true;
}
return false;
@ -573,36 +597,6 @@ std::list<RsItem* > p3Forums::childSaveList()
return mSaveList;
}
void p3Forums::setReadStatus(const std::string& forumId, const std::string& msgId, const uint32_t status)
{
RsStackMutex stack(distribMtx);
std::list<RsForumReadStatus *>::iterator lit = mReadStatus.begin();
for(; lit != mReadStatus.end(); lit++)
{
if((*lit)->forumId == forumId)
{
(*lit)->msgReadStatus[msgId] = status;
break;
}
}
// if forum id does not exist create one
if(lit == mReadStatus.end())
{
RsForumReadStatus* rsi = new RsForumReadStatus();
rsi->forumId = forumId;
rsi->msgReadStatus[msgId] = status;
mReadStatus.push_back(rsi);
mSaveList.push_back(rsi);
}
return;
}
bool p3Forums::childLoadList(std::list<RsItem* >& configSaves)
{
RsForumReadStatus* drs = NULL;

View File

@ -54,10 +54,9 @@ virtual bool getForumList(std::list<ForumInfo> &forumList);
virtual bool getForumThreadList(std::string fId, std::list<ThreadInfoSummary> &msgs);
virtual bool getForumThreadMsgList(std::string fId, std::string tId, std::list<ThreadInfoSummary> &msgs);
virtual bool getForumMessage(std::string fId, std::string mId, ForumMsgInfo &msg);
virtual void setReadStatus(const std::string& forumId,const std::string& msgId,const uint32_t status);
virtual bool ForumMessageSend(ForumMsgInfo &info);
virtual bool setMessageStatus(const std::string& fId, const std::string& mId, const uint32_t status, const uint32_t statusMask);
virtual bool getMessageStatus(const std::string& fId, const std::string& mId, uint32_t& status, const uint32_t statusMask);
virtual bool getMessageStatus(const std::string& fId, const std::string& mId, uint32_t& status);
virtual bool forumSubscribe(std::string fId, bool subscribe);

View File

@ -247,6 +247,7 @@ HEADERS += rshare.h \
gui/settings/CryptoPage.h \
gui/settings/MessagePage.h \
gui/settings/NewTag.h \
gui/settings/ForumPage.h \
gui/settings/AppearancePage.h \
gui/settings/FileAssociationsPage.h \
gui/settings/SoundPage.h \
@ -342,6 +343,7 @@ FORMS += gui/StartDialog.ui \
gui/settings/CryptoPage.ui \
gui/settings/MessagePage.ui \
gui/settings/NewTag.ui \
gui/settings/ForumPage.ui \
gui/settings/AppearancePage.ui \
gui/settings/TransferPage.ui \
gui/settings/SoundPage.ui \
@ -455,6 +457,7 @@ SOURCES += main.cpp \
gui/settings/CryptoPage.cpp \
gui/settings/MessagePage.cpp \
gui/settings/NewTag.cpp \
gui/settings/ForumPage.cpp \
gui/settings/AppearancePage.cpp \
gui/settings/FileAssociationsPage.cpp \
gui/settings/SoundPage.cpp \

File diff suppressed because it is too large Load Diff

View File

@ -31,95 +31,98 @@ class ForumsDialog : public RsAutoUpdatePage
Q_OBJECT
public:
ForumsDialog(QWidget *parent = 0);
~ForumsDialog();
ForumsDialog(QWidget *parent = 0);
~ForumsDialog();
/* overloaded from RsAuthUpdatePage */
virtual void updateDisplay();
void insertForums();
void insertPost();
void loadForumEmoticons();
/* overloaded from RsAuthUpdatePage */
virtual void updateDisplay();
private slots:
void anchorClicked (const QUrl &);
/** Create the context popup menu and it's submenus */
void forumListCustomPopupMenu( QPoint point );
void threadListCustomPopupMenu( QPoint point );
void anchorClicked (const QUrl &);
void insertThreads();
/** Create the context popup menu and it's submenus */
void forumListCustomPopupMenu( QPoint point );
void threadListCustomPopupMenu( QPoint point );
void newforum();
void newforum();
void changedForum( QTreeWidgetItem *curr, QTreeWidgetItem *prev );
void changedThread();
void clickedThread (QTreeWidgetItem *item, int column);
void replytomessage();
//void print();
//void printpreview();
void changedForum( QTreeWidgetItem *curr, QTreeWidgetItem *prev );
void changedThread();
//void removemessage();
void markMsgAsRead();
void markMsgAsReadAll();
void markMsgAsUnread();
void markMsgAsUnreadAll();
void replytomessage();
//void print();
//void printpreview();
void removemessage();
void markMsgAsRead();
/* handle splitter */
void togglethreadview();
/* handle splitter */
void togglethreadview();
void showthread();
void createmessage();
void createthread();
void createmessage();
void subscribeToForum();
void unsubscribeToForum();
void subscribeToForum();
void unsubscribeToForum();
void showForumDetails();
void showForumDetails();
void previousMessage ();
void nextMessage ();
void previousMessage ();
void nextMessage ();
void changedViewBox();
void changedViewBox();
void filterColumnChanged();
void filterRegExpChanged();
void clearFilter();
void filterColumnChanged();
void filterRegExpChanged();
void clearFilter();
private:
void insertForums();
void insertThreads();
void insertPost();
void forumSubscribe(bool subscribe);
bool getCurrentMsg(std::string &cid, std::string &mid);
void FillForums(QTreeWidgetItem *Forum, QList<QTreeWidgetItem *> &ChildList);
void FillThreads(QList<QTreeWidgetItem *> &ThreadList);
void FillChildren(QTreeWidgetItem *Parent, QTreeWidgetItem *NewParent);
void loadForumEmoticons();
void processSettings(bool bLoad);
void togglethreadview_internal();
void forumSubscribe(bool subscribe);
void FillForums(QTreeWidgetItem *Forum, QList<QTreeWidgetItem *> &ChildList);
void FillThreads(QList<QTreeWidgetItem *> &ThreadList, bool bExpandNewMessages, std::list<QTreeWidgetItem*> &itemToExpand);
void FillChildren(QTreeWidgetItem *Parent, QTreeWidgetItem *NewParent, bool bExpandNewMessages, std::list<QTreeWidgetItem*> &itemToExpand);
void FilterItems();
bool FilterItem(QTreeWidgetItem *pItem, QString &sPattern, int nFilterColumn);
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 CalculateIconsAndFonts(QTreeWidgetItem *pItem = NULL);
void CalculateIconsAndFonts(QTreeWidgetItem *pItem, bool &bHasReadChilddren, bool &bHasUnreadChilddren);
bool m_bProcessSettings;
void processSettings(bool bLoad);
void togglethreadview_internal();
QTreeWidgetItem *YourForums;
QTreeWidgetItem *SubscribedForums;
QTreeWidgetItem *PopularForums;
QTreeWidgetItem *OtherForums;
void FilterItems();
bool FilterItem(QTreeWidgetItem *pItem, QString &sPattern, int nFilterColumn);
std::string mCurrForumId;
std::string mCurrThreadId;
std::string mCurrPostId;
bool m_bProcessSettings;
QFont m_ForumNameFont;
QFont m_ItemFont;
int m_LastViewType;
std::string m_LastForumID;
QTreeWidgetItem *YourForums;
QTreeWidgetItem *SubscribedForums;
QTreeWidgetItem *PopularForums;
QTreeWidgetItem *OtherForums;
QHash<QString, QString> smileys;
std::string mCurrForumId;
std::string mCurrThreadId;
bool m_bIsForumSubscribed;
std::string fId;
std::string pId;
QFont m_ForumNameFont;
QFont m_ItemFont;
int m_LastViewType;
std::string m_LastForumID;
/** Qt Designer generated object */
Ui::ForumsDialog ui;
QHash<QString, QString> smileys;
/** Qt Designer generated object */
Ui::ForumsDialog ui;
};
#endif

View File

@ -878,6 +878,15 @@ background: white;}</string>
<string>Title</string>
</property>
</column>
<column>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/message-state-header.png</normaloff>:/images/message-state-header.png</iconset>
</property>
</column>
<column>
<property name="text">
<string>Date</string>

View File

@ -55,7 +55,7 @@
#define COLUMN_COUNT 7
#define COLUMN_ATTACHEMENTS 0
#define COLUMN_SUBJECT 1
#define COLUMN_READ 2
#define COLUMN_UNREAD 2
#define COLUMN_FROM 3
#define COLUMN_DATE 4
#define COLUMN_CONTENT 5
@ -63,9 +63,10 @@
#define COLUMN_DATA 0 // column for storing the userdata like msgid and srcid
#define ROLE_SORT Qt::UserRole
#define ROLE_MSGID Qt::UserRole + 1
#define ROLE_SRCID Qt::UserRole + 2
#define ROLE_SORT Qt::UserRole
#define ROLE_MSGID Qt::UserRole + 1
#define ROLE_SRCID Qt::UserRole + 2
#define ROLE_UNREAD Qt::UserRole + 3
#define ROW_INBOX 0
#define ROW_OUTBOX 1
@ -93,10 +94,10 @@
#define CONFIG_SECTION_TAG "Tag"
#define CONFIG_KEY_TAG "Tag"
class MyItemDelegate : public QItemDelegate
class MessagesItemDelegate : public QItemDelegate
{
public:
MyItemDelegate(QObject *parent = 0) : QItemDelegate(parent)
MessagesItemDelegate(QObject *parent = 0) : QItemDelegate(parent)
{
}
@ -104,7 +105,7 @@ public:
{
QStyleOptionViewItem ownOption (option);
if (index.column() == COLUMN_READ) {
if (index.column() == COLUMN_UNREAD) {
ownOption.state &= ~QStyle::State_HasFocus; // don't show text and focus rectangle
}
@ -115,7 +116,7 @@ public:
{
QStyleOptionViewItem ownOption (option);
if (index.column() == COLUMN_READ) {
if (index.column() == COLUMN_UNREAD) {
ownOption.state &= ~QStyle::State_HasFocus; // don't show text and focus rectangle
}
@ -123,10 +124,10 @@ public:
}
};
class MyMenu : public QMenu
class MessagesMenu : public QMenu
{
public:
MyMenu(const QString &title, QWidget *parent) : QMenu (title, parent)
MessagesMenu(const QString &title, QWidget *parent) : QMenu (title, parent)
{
}
@ -287,7 +288,7 @@ MessagesDialog::MessagesDialog(QWidget *parent)
MessagesModel = new QStandardItemModel(0, COLUMN_COUNT);
MessagesModel->setHeaderData(COLUMN_ATTACHEMENTS, Qt::Horizontal, QIcon(":/images/attachment.png"), Qt::DecorationRole);
MessagesModel->setHeaderData(COLUMN_SUBJECT, Qt::Horizontal, tr("Subject"));
MessagesModel->setHeaderData(COLUMN_READ, Qt::Horizontal, QIcon(":/images/message-mail-state-header.png"), Qt::DecorationRole);
MessagesModel->setHeaderData(COLUMN_UNREAD, Qt::Horizontal, QIcon(":/images/message-state-header.png"), Qt::DecorationRole);
MessagesModel->setHeaderData(COLUMN_FROM, Qt::Horizontal, tr("From"));
MessagesModel->setHeaderData(COLUMN_DATE, Qt::Horizontal, tr("Date"));
MessagesModel->setHeaderData(COLUMN_TAGS, Qt::Horizontal, tr("Tags"));
@ -301,7 +302,7 @@ MessagesDialog::MessagesDialog(QWidget *parent)
ui.messagestreeView->setModel(proxyModel);
ui.messagestreeView->setSelectionBehavior(QTreeView::SelectRows);
QItemDelegate *pDelegate = new MyItemDelegate(this);
QItemDelegate *pDelegate = new MessagesItemDelegate(this);
ui.messagestreeView->setItemDelegate(pDelegate);
ui.messagestreeView->setRootIsDecorated(false);
@ -326,7 +327,7 @@ MessagesDialog::MessagesDialog(QWidget *parent)
QHeaderView * msgwheader = ui.messagestreeView->header () ;
msgwheader->resizeSection (COLUMN_ATTACHEMENTS, 24);
msgwheader->resizeSection (COLUMN_SUBJECT, 250);
msgwheader->resizeSection (COLUMN_READ, 16);
msgwheader->resizeSection (COLUMN_UNREAD, 16);
msgwheader->resizeSection (COLUMN_FROM, 140);
msgwheader->resizeSection (COLUMN_DATE, 140);
@ -372,8 +373,8 @@ MessagesDialog::MessagesDialog(QWidget *parent)
/* Set header sizes for the fixed columns and resize modes, must be set after processSettings */
msgwheader->setResizeMode (COLUMN_ATTACHEMENTS, QHeaderView::Fixed);
msgwheader->setResizeMode (COLUMN_DATE, QHeaderView::Interactive);
msgwheader->setResizeMode (COLUMN_READ, QHeaderView::Fixed);
msgwheader->resizeSection (COLUMN_READ, 24);
msgwheader->setResizeMode (COLUMN_UNREAD, QHeaderView::Fixed);
msgwheader->resizeSection (COLUMN_UNREAD, 24);
// fill folder list
updateMessageSummaryList();
@ -622,7 +623,7 @@ void MessagesDialog::fillTags()
getTagItems(TagItems);
// create tag menu
QMenu *pMenu = new MyMenu (tr("Tag"), this);
QMenu *pMenu = new MessagesMenu (tr("Tag"), this);
connect(pMenu, SIGNAL(triggered (QAction*)), this, SLOT(tagTriggered(QAction*)));
connect(pMenu, SIGNAL(aboutToShow()), this, SLOT(tagAboutToShow()));
@ -735,7 +736,7 @@ int MessagesDialog::getSelectedMsgCount (QList<int> *pRows, QList<int> *pRowsRea
if (pRows) pRows->append(mappedRow);
if (MessagesModel->item(mappedRow, COLUMN_SUBJECT)->font().bold()) {
if (MessagesModel->item(mappedRow, COLUMN_DATA)->data(ROLE_UNREAD).toBool()) {
if (pRowsUnread) pRowsUnread->append(mappedRow);
} else {
if (pRowsRead) pRowsRead->append(mappedRow);
@ -750,8 +751,8 @@ int MessagesDialog::getSelectedMsgCount (QList<int> *pRows, QList<int> *pRowsRea
bool MessagesDialog::isMessageRead(int nRow)
{
QStandardItem *item;
item = MessagesModel->item(nRow,COLUMN_SUBJECT);
return !item->font().bold();
item = MessagesModel->item(nRow,COLUMN_DATA);
return !item->data(ROLE_UNREAD).toBool();
}
void MessagesDialog::messageslistWidgetCostumPopupMenu( QPoint point )
@ -1226,6 +1227,7 @@ static void InitIconAndFont(RSettings *pConfig, QStandardItem *pItem [COLUMN_COU
} else {
pItem[COLUMN_SUBJECT]->setIcon(QIcon(":/images/message-mail.png"));
}
pItem[COLUMN_SUBJECT]->setIcon(QIcon(":/images/message-state-new.png"));
} else {
// Change Message icon when Subject is Re: or Fwd:
if (sText.startsWith("Re:", Qt::CaseInsensitive)) {
@ -1235,6 +1237,7 @@ static void InitIconAndFont(RSettings *pConfig, QStandardItem *pItem [COLUMN_COU
} else {
pItem[COLUMN_SUBJECT]->setIcon(QIcon(":/images/message-mail-read.png"));
}
pItem[COLUMN_SUBJECT]->setIcon(QIcon());
}
// show the locale "New" state
@ -1245,10 +1248,11 @@ static void InitIconAndFont(RSettings *pConfig, QStandardItem *pItem [COLUMN_COU
pConfig->endGroup();
}
// set icon
if (bNew) {
pItem[COLUMN_READ]->setIcon(QIcon(":/images/message-mail-state-unread.png"));
pItem[COLUMN_UNREAD]->setIcon(QIcon(":/images/message-state-unread.png"));
} else {
pItem[COLUMN_READ]->setIcon(QIcon(":/images/message-mail-state-read.png"));
pItem[COLUMN_UNREAD]->setIcon(QIcon(":/images/message-state-read.png"));
}
// set font
@ -1257,6 +1261,8 @@ static void InitIconAndFont(RSettings *pConfig, QStandardItem *pItem [COLUMN_COU
qf.setBold(bNew);
pItem[i]->setFont(qf);
}
pItem[COLUMN_DATA]->setData(bNew, ROLE_UNREAD);
}
void MessagesDialog::insertMessages()
@ -1596,7 +1602,7 @@ void MessagesDialog::insertMessages()
ui.messagestreeView->showColumn(COLUMN_ATTACHEMENTS);
ui.messagestreeView->showColumn(COLUMN_SUBJECT);
ui.messagestreeView->showColumn(COLUMN_READ);
ui.messagestreeView->showColumn(COLUMN_UNREAD);
ui.messagestreeView->showColumn(COLUMN_FROM);
ui.messagestreeView->showColumn(COLUMN_DATE);
ui.messagestreeView->showColumn(COLUMN_TAGS);
@ -1620,7 +1626,7 @@ void MessagesDialog::clicked(const QModelIndex &index )
return;
}
if (index.column() == COLUMN_READ) {
if (index.column() == COLUMN_UNREAD) {
int mappedRow = proxyModel->mapToSource(index).row();
QList<int> Rows;

View File

@ -172,9 +172,9 @@ void CreateForumMsg::createMsg()
if ((msgInfo.msg == L"") && (msgInfo.title == L""))
return; /* do nothing */
rsForums->ForumMessageSend(msgInfo);
close();
if (rsForums->ForumMessageSend(msgInfo) == true) {
close();
}
}
void CreateForumMsg::closeEvent (QCloseEvent * event)

View File

@ -263,9 +263,10 @@
<file>images/message-mail-forwarded-read.png</file>
<file>images/message-mail-replied.png</file>
<file>images/message-mail-forwarded.png</file>
<file>images/message-mail-state-read.png</file>
<file>images/message-mail-state-unread.png</file>
<file>images/message-mail-state-header.png</file>
<file>images/message-state-read.png</file>
<file>images/message-state-unread.png</file>
<file>images/message-state-header.png</file>
<file>images/message-state-new.png</file>
<file>images/message-news.png</file>
<file>images/message.png</file>
<file>images/messages_new.png</file>

View File

Before

Width:  |  Height:  |  Size: 383 B

After

Width:  |  Height:  |  Size: 383 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 B

View File

Before

Width:  |  Height:  |  Size: 208 B

After

Width:  |  Height:  |  Size: 208 B

View File

Before

Width:  |  Height:  |  Size: 302 B

After

Width:  |  Height:  |  Size: 302 B

View File

@ -0,0 +1,62 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2006, crypton
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include "ForumPage.h"
#include "rshare.h"
#include "rsharesettings.h"
#include "../MainWindow.h"
#include "../ForumsDialog.h"
ForumPage::ForumPage(QWidget * parent, Qt::WFlags flags)
: ConfigPage(parent, flags)
{
ui.setupUi(this);
setAttribute(Qt::WA_QuitOnClose, false);
}
ForumPage::~ForumPage()
{
}
void
ForumPage::closeEvent (QCloseEvent * event)
{
QWidget::closeEvent(event);
}
/** Saves the changes on this page */
bool
ForumPage::save(QString &errmsg)
{
Settings->setForumMsgSetToReadOnActivate(ui.setMsgToReadOnActivate->isChecked());
Settings->setExpandNewMessages(ui.expandNewMessages->isChecked());
return true;
}
/** Loads the settings for this page */
void
ForumPage::load()
{
ui.setMsgToReadOnActivate->setChecked(Settings->getForumMsgSetToReadOnActivate());
ui.expandNewMessages->setChecked(Settings->getExpandNewMessages());
}

View File

@ -0,0 +1,52 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2006, crypton
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef FORUMPAGE_H
#define FORUMPAGE_H
#include <QtGui/QWidget>
#include "configpage.h"
#include "ui_ForumPage.h"
#include "NewTag.h"
class ForumPage : public ConfigPage
{
Q_OBJECT
public:
ForumPage(QWidget * parent = 0, Qt::WFlags flags = 0);
~ForumPage();
/** Saves the changes on this page */
bool save(QString &errmsg);
/** Loads the settings for this page */
void load();
private:
void closeEvent (QCloseEvent * event);
Ui::ForumPage ui;
};
#endif // !FORUMPAGE_H

View File

@ -0,0 +1,543 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ForumPage</class>
<widget class="QWidget" name="ForumPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>423</width>
<height>340</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>208</red>
<green>208</green>
<blue>208</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>247</red>
<green>247</green>
<blue>247</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>139</red>
<green>139</green>
<blue>139</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>208</red>
<green>208</green>
<blue>208</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>247</red>
<green>247</green>
<blue>247</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>139</red>
<green>139</green>
<blue>139</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>192</red>
<green>192</green>
<blue>192</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>208</red>
<green>208</green>
<blue>208</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>247</red>
<green>247</green>
<blue>247</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>139</red>
<green>139</green>
<blue>139</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>104</red>
<green>104</green>
<blue>104</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>128</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Link">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="LinkVisited">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>231</red>
<green>231</green>
<blue>231</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>8</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
<underline>false</underline>
<strikeout>false</strikeout>
</font>
</property>
<property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Misc</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QCheckBox" name="setMsgToReadOnActivate">
<property name="text">
<string>Set message to read on activate</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="expandNewMessages">
<property name="text">
<string>Expand new messages</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -33,6 +33,7 @@
#include "TransferPage.h"
#include "ChatPage.h"
#include "MessagePage.h"
#include "ForumPage.h"
#define IMAGE_GENERAL ":/images/kcmsystem24.png"
@ -109,6 +110,7 @@ RSettingsWin::initStackedWidget()
stackedWidget->addWidget(new NotifyPage());
stackedWidget->addWidget(new CryptoPage());
stackedWidget->addWidget(new MessagePage());
stackedWidget->addWidget(new ForumPage());
stackedWidget->addWidget(new ChatPage());
stackedWidget->addWidget(new AppearancePage());
stackedWidget->addWidget(new SoundPage() );
@ -153,6 +155,10 @@ RSettingsWin::setNewPage(int page)
text = tr("Message");
pageicon->setPixmap(QPixmap(":/images/evolution.png"));
break;
case Forum:
text = tr("Forum");
pageicon->setPixmap(QPixmap(":/images/konversation.png"));
break;
case Chat:
text = tr("Chat");
pageicon->setPixmap(QPixmap(":/images/chat_24.png"));

View File

@ -32,7 +32,7 @@ class RSettingsWin: public QDialog, private Ui::Settings
public:
enum PageType { General = 0, Server, Transfer,
Directories, Notify, Security, Message, Chat, Appearance, Sound, Fileassociations };
Directories, Notify, Security, Message, Forum, Chat, Appearance, Sound, Fileassociations };
static void showYourself(QWidget *parent);
static void postModDirectories(bool update_local);

View File

@ -378,6 +378,27 @@ void RshareSettings::setMsgSetToReadOnActivate (bool bValue)
setValueToGroup("MessageDialog", "SetMsgToReadOnActivate", bValue);
}
/* Forums */
bool RshareSettings::getForumMsgSetToReadOnActivate ()
{
return valueFromGroup("ForumDialog", "SetMsgToReadOnActivate", true).toBool();
}
void RshareSettings::setForumMsgSetToReadOnActivate (bool bValue)
{
setValueToGroup("ForumDialog", "SetMsgToReadOnActivate", bValue);
}
bool RshareSettings::getExpandNewMessages()
{
return valueFromGroup("ForumDialog", "ExpandNewMessages", true).toBool();
}
void RshareSettings::setExpandNewMessages (bool bValue)
{
setValueToGroup("ForumDialog", "ExpandNewMessages", bValue);
}
/* time before idle */
uint RshareSettings::getMaxTimeBeforeIdle()
{

View File

@ -133,6 +133,12 @@ public:
bool getMsgSetToReadOnActivate ();
void setMsgSetToReadOnActivate (bool bValue);
/* Forums */
bool getForumMsgSetToReadOnActivate ();
void setForumMsgSetToReadOnActivate (bool bValue);
bool getExpandNewMessages ();
void setExpandNewMessages (bool bValue);
/* time before idle */
uint getMaxTimeBeforeIdle();
void setMaxTimeBeforeIdle(uint nValue);

View File

@ -140,6 +140,15 @@
<normaloff>:/images/evolution.png</normaloff>:/images/evolution.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Forum</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/konversation.png</normaloff>:/images/konversation.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Chat</string>