The forum details (name and description) can be edited by the owner.

Recompile of the gui needed.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3488 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-09-14 19:38:47 +00:00
parent 0b63a4be86
commit dbb21e0b16
11 changed files with 384 additions and 26 deletions

View File

@ -130,6 +130,14 @@ virtual bool forumsChanged(std::list<std::string> &forumIds) = 0;
virtual std::string createForum(std::wstring forumName, std::wstring forumDesc, uint32_t forumFlags) = 0;
virtual bool getForumInfo(std::string fId, ForumInfo &fi) = 0;
/*!
* allows peers to change information for the forum:
* can only change name and descriptions
*
*/
virtual bool setForumInfo(std::string fId, ForumInfo &fi) = 0;
virtual bool getForumList(std::list<ForumInfo> &forumList) = 0;
virtual bool getForumThreadList(std::string fId, std::list<ThreadInfoSummary> &msgs) = 0;
virtual bool getForumThreadMsgList(std::string fId, std::string pId, std::list<ThreadInfoSummary> &msgs) = 0;

View File

@ -128,6 +128,22 @@ bool p3Forums::getForumInfo(std::string fId, ForumInfo &fi)
return true;
}
/*!
* allows peers to change information for the forum:
* can only change name and descriptions
*
*/
bool p3Forums::setForumInfo(std::string fId, ForumInfo &fi)
{
GroupInfo gi;
RsStackMutex stack(distribMtx);
gi.grpName = fi.forumName;
gi.grpDesc = fi.forumDesc;
return locked_editGroup(fId, gi);
}
bool p3Forums::getForumList(std::list<ForumInfo> &forumList)
{

View File

@ -50,6 +50,7 @@ virtual bool forumsChanged(std::list<std::string> &forumIds);
virtual std::string createForum(std::wstring forumName, std::wstring forumDesc, uint32_t forumFlags);
virtual bool getForumInfo(std::string fId, ForumInfo &fi);
virtual bool setForumInfo(std::string fId, ForumInfo &fi);
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);

View File

@ -182,6 +182,7 @@ HEADERS += rshare.h \
gui/LinksDialog.h \
gui/ForumsDialog.h \
gui/forums/ForumDetails.h \
gui/forums/EditForumDetails.h \
gui/forums/CreateForum.h \
gui/forums/CreateForumMsg.h \
gui/NetworkView.h \
@ -325,6 +326,7 @@ FORMS += gui/StartDialog.ui \
gui/forums/CreateForum.ui \
gui/forums/CreateForumMsg.ui \
gui/forums/ForumDetails.ui \
gui/forums/EditForumDetails.ui \
gui/NetworkView.ui \
gui/TrustView.ui \
gui/MessengerWindow.ui \
@ -405,6 +407,7 @@ SOURCES += main.cpp \
gui/LinksDialog.cpp \
gui/ForumsDialog.cpp \
gui/forums/ForumDetails.cpp \
gui/forums/EditForumDetails.cpp \
gui/forums/CreateForum.cpp \
gui/forums/CreateForumMsg.cpp \
gui/NetworkView.cpp \

View File

@ -30,6 +30,7 @@
#include "forums/CreateForum.h"
#include "forums/CreateForumMsg.h"
#include "forums/ForumDetails.h"
#include "forums/EditForumDetails.h"
#include "msgs/MessageComposer.h"
#include "settings/rsharesettings.h"
#include "common/Emoticons.h"
@ -168,6 +169,7 @@ ForumsDialog::ForumsDialog(QWidget *parent)
m_bProcessSettings = false;
m_bIsForumSubscribed = false;
m_bIsForumAdmin = false;
connect( ui.forumTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( forumListCustomPopupMenu( QPoint ) ) );
connect( ui.threadTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( threadListCustomPopupMenu( QPoint ) ) );
@ -356,8 +358,13 @@ void ForumsDialog::forumListCustomPopupMenu( QPoint point )
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 );
@ -365,6 +372,7 @@ void ForumsDialog::forumListCustomPopupMenu( QPoint point )
contextMnu.addSeparator();
contextMnu.addAction( newForumAct );
contextMnu.addAction( detailsForumAct );
contextMnu.addAction( editForumDetailsAct );
contextMnu.exec(QCursor::pos());
}
@ -896,6 +904,7 @@ void ForumsDialog::insertThreads()
std::cerr << "ForumsDialog::insertThreads()" << std::endl;
m_bIsForumSubscribed = false;
m_bIsForumAdmin = false;
QTreeWidgetItem *forumItem = ui.forumTreeWidget->currentItem();
if ((!forumItem) || (forumItem->parent() == NULL))
@ -924,6 +933,9 @@ void ForumsDialog::insertThreads()
ForumInfo fi;
if (rsForums->getForumInfo (fId, fi)) {
if (fi.subscribeFlags & RS_DISTRIB_ADMIN) {
m_bIsForumAdmin = true;
}
if (fi.subscribeFlags & (RS_DISTRIB_ADMIN | RS_DISTRIB_SUBSCRIBED)) {
m_bIsForumSubscribed = true;
}
@ -1628,7 +1640,7 @@ void ForumsDialog::createmessage()
void ForumsDialog::createthread()
{
if (mCurrForumId.empty ()) {
QMessageBox::information(this, tr("RetroShare"),tr("No Forum Selected!"));
QMessageBox::information(this, tr("RetroShare"), tr("No Forum Selected!"));
return;
}
@ -1676,6 +1688,17 @@ void ForumsDialog::showForumDetails()
fui.exec ();
}
void ForumsDialog::editForumDetails()
{
if (mCurrForumId == "")
{
return;
}
EditForumDetails editUi(mCurrForumId, this);
editUi.exec();
}
void ForumsDialog::replytomessage()
{
if (mCurrForumId.empty()) {

View File

@ -69,6 +69,7 @@ private slots:
void unsubscribeToForum();
void showForumDetails();
void editForumDetails();
void previousMessage ();
void nextMessage ();
@ -112,6 +113,7 @@ private:
std::string mCurrForumId;
std::string mCurrThreadId;
bool m_bIsForumSubscribed;
bool m_bIsForumAdmin;
QFont m_ForumNameFont;
QFont m_ItemFont;

View File

@ -0,0 +1,79 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2010 RetroShare Team
*
* 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 "EditForumDetails.h"
#include <retroshare/rsforums.h>
#include <list>
#include <iostream>
#include <string>
/** Default constructor */
EditForumDetails::EditForumDetails(std::string forumId, QWidget *parent, Qt::WFlags flags)
: QDialog(parent, flags), m_forumId(forumId)
{
/* Invoke Qt Designer generated QObject setup routine */
ui.setupUi(this);
connect(ui.applyButton, SIGNAL(clicked()), this, SLOT(applyDialog()));
loadForum();
}
void EditForumDetails::loadForum()
{
if (!rsForums) {
return;
}
ForumInfo info;
rsForums->getForumInfo(m_forumId, info);
// set name
ui.nameline->setText(QString::fromStdWString(info.forumName));
// set description
ui.DescriptiontextEdit->setText(QString::fromStdWString(info.forumDesc));
}
void EditForumDetails::applyDialog()
{
if (!rsForums) {
return;
}
// if text boxes have not been edited leave alone
if (!ui.nameline->isModified() && !ui.DescriptiontextEdit->document()->isModified()) {
return;
}
ForumInfo info;
info.forumName = ui.nameline->text().toStdWString();
info.forumDesc = ui.DescriptiontextEdit->document()->toPlainText().toStdWString();
rsForums->setForumInfo(m_forumId, info);
/* close the Dialog after the Changes applied */
close();
}

View File

@ -0,0 +1,53 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2010 RetroShare Team
*
* 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 _EDITFORUMDETAILS_H
#define _EDITFORUMDETAILS_H
#include <QDialog>
#include "ui_EditForumDetails.h"
class EditForumDetails : public QDialog
{
Q_OBJECT
public:
/** Default constructor */
EditForumDetails(std::string forumId = "", QWidget *parent = 0, Qt::WFlags flags = 0);
signals:
void configChanged();
private slots:
void applyDialog();
private:
void loadForum();
std::string m_forumId;
/** Qt Designer generated object */
Ui::EditForumDetails ui;
};
#endif

View File

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EditForumDetails</class>
<widget class="QDialog" name="EditForumDetails">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>436</width>
<height>355</height>
</rect>
</property>
<property name="windowTitle">
<string>Forum Details</string>
</property>
<property name="windowIcon">
<iconset resource="../images.qrc">
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="0">
<layout class="QGridLayout" name="_2">
<item row="0" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>311</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="applyButton">
<property name="text">
<string>OK</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QTabWidget" name="stabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/info16.png</normaloff>:/images/info16.png</iconset>
</attribute>
<attribute name="title">
<string>Edit Forum Details</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Forum Info</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Forum Name</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="nameline"/>
</item>
<item row="1" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Forum Description</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTextEdit" name="DescriptiontextEdit"/>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../images.qrc"/>
</resources>
<connections>
<connection>
<sender>cancelButton</sender>
<signal>clicked()</signal>
<receiver>EditForumDetails</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>307</x>
<y>333</y>
</hint>
<hint type="destinationlabel">
<x>217</x>
<y>177</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -1150,7 +1150,7 @@ Keine Beschreibung</translation>
<translation>Abbrechen</translation>
</message>
<message>
<location filename="../gui/feeds/ChatMsgItem.cpp" line="+273"/>
<location filename="../gui/feeds/ChatMsgItem.cpp" line="+272"/>
<source>Quick Message</source>
<translation>Schnelle Nachrricht</translation>
</message>
@ -1244,7 +1244,7 @@ Keine Beschreibung</translation>
<translation>Verlauf</translation>
</message>
<message>
<location filename="../gui/settings/ChatPage.cpp" line="+211"/>
<location filename="../gui/settings/ChatPage.cpp" line="+210"/>
<source>Incoming message in history</source>
<translation>Eingehehende Nachricht aus dem Verlauf</translation>
</message>
@ -1267,7 +1267,7 @@ Keine Beschreibung</translation>
<context>
<name>ChatStyle</name>
<message>
<location filename="../gui/chat/ChatStyle.cpp" line="+531"/>
<location filename="../gui/chat/ChatStyle.cpp" line="+374"/>
<source>Standard style for group chat</source>
<translation>Standard Stil für den Gruppenchat</translation>
</message>
@ -2344,7 +2344,7 @@ p, li { white-space: pre-wrap; }
<translation>Erstelle Forumbeitrag</translation>
</message>
<message>
<location filename="../gui/forums/CreateForumMsg.cpp" line="+71"/>
<location filename="../gui/forums/CreateForumMsg.cpp" line="+70"/>
<source>Paste retroshare Link</source>
<translation>RetroShare Link einfügen</translation>
</message>
@ -2364,7 +2364,7 @@ p, li { white-space: pre-wrap; }
<translation>Bitte einen Betreff und eine Beitrag eingeben</translation>
</message>
<message>
<location line="+177"/>
<location line="+53"/>
<source>Add Extra File</source>
<translation>Zusätzliche Datei hinzufügen</translation>
</message>
@ -2731,6 +2731,44 @@ p, li { white-space: pre-wrap; }
<translation>Kanal Logo hinzufügen</translation>
</message>
</context>
<context>
<name>EditForumDetails</name>
<message>
<location filename="../gui/forums/EditForumDetails.ui" line="+14"/>
<source>Forum Details</source>
<translation>Forum-Details</translation>
</message>
<message>
<location line="+25"/>
<source>Cancel</source>
<translation>Abbrechen</translation>
</message>
<message>
<location line="+7"/>
<source>OK</source>
<translation>OK</translation>
</message>
<message>
<location line="+23"/>
<source>Edit Forum Details</source>
<translation>Forum-Details bearbeiten</translation>
</message>
<message>
<location line="+6"/>
<source>Forum Info</source>
<translation>Forum Info</translation>
</message>
<message>
<location line="+6"/>
<source>Forum Name</source>
<translation>Forum Name</translation>
</message>
<message>
<location line="+10"/>
<source>Forum Description</source>
<translation>Forum Beschreibung</translation>
</message>
</context>
<context>
<name>EmailPage</name>
<message>
@ -3111,12 +3149,12 @@ p, li { white-space: pre-wrap; }
<location filename="../gui/forums/ForumDetails.ui" line="+14"/>
<location line="+18"/>
<source>Forum Details</source>
<translation></translation>
<translation>Forum Details</translation>
</message>
<message>
<location line="+6"/>
<source>Forum Info</source>
<translation></translation>
<translation>Forum Info</translation>
</message>
<message>
<location line="+6"/>
@ -3258,7 +3296,7 @@ p, li { white-space: pre-wrap; }
<context>
<name>ForumsDialog</name>
<message>
<location filename="../gui/ForumsDialog.cpp" line="+345"/>
<location filename="../gui/ForumsDialog.cpp" line="+346"/>
<source>Subscribe to Forum</source>
<translation>Forum abonnieren</translation>
</message>
@ -3278,7 +3316,12 @@ p, li { white-space: pre-wrap; }
<translation>Zeige Foren-Details</translation>
</message>
<message>
<location line="+21"/>
<location line="+4"/>
<source>Edit Forum Details</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+23"/>
<source>Reply</source>
<translation>Antwort</translation>
</message>
@ -3298,7 +3341,7 @@ p, li { white-space: pre-wrap; }
<translation>Alle reduzieren</translation>
</message>
<message>
<location line="+84"/>
<location line="+87"/>
<source>Hide</source>
<translation>Verbergen</translation>
</message>
@ -3315,7 +3358,7 @@ p, li { white-space: pre-wrap; }
<translation>Beliebtheit:</translation>
</message>
<message>
<location line="+332"/>
<location line="+336"/>
<location line="+107"/>
<source>Anonymous</source>
<translation>Anonym</translation>
@ -3333,18 +3376,18 @@ p, li { white-space: pre-wrap; }
<translation>keine</translation>
</message>
<message>
<location line="+491"/>
<location line="+142"/>
<location line="+487"/>
<location line="+91"/>
<source>RetroShare</source>
<translation></translation>
</message>
<message>
<location line="-142"/>
<location line="-91"/>
<source>No Forum Selected!</source>
<translation>Kein Forum ausgewählt!</translation>
</message>
<message>
<location line="+127"/>
<location line="+76"/>
<source>Re:</source>
<translation></translation>
</message>
@ -3354,7 +3397,7 @@ p, li { white-space: pre-wrap; }
<translation>Du kannst einem anonymen Autor nicht antworten</translation>
</message>
<message>
<location line="-1540"/>
<location line="-1498"/>
<source>Your Forums</source>
<translation>Deine Foren</translation>
</message>
@ -3496,8 +3539,8 @@ p, li { white-space: pre-wrap; }
<translation>Druckvorschau</translation>
</message>
<message>
<location filename="../gui/ForumsDialog.cpp" line="+121"/>
<location line="+1258"/>
<location filename="../gui/ForumsDialog.cpp" line="+127"/>
<location line="+1261"/>
<source>Start New Thread</source>
<translation>Erstelle neues Thema</translation>
</message>
@ -3525,7 +3568,7 @@ p, li { white-space: pre-wrap; }
<translation>Inhalt</translation>
</message>
<message>
<location filename="../gui/ForumsDialog.cpp" line="-1245"/>
<location filename="../gui/ForumsDialog.cpp" line="-1248"/>
<location line="+3"/>
<source>Mark as read</source>
<translation>Als gelesen markieren</translation>
@ -4337,7 +4380,7 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<location line="+32"/>
<location filename="../gui/im_history/ImHistoryBrowser.cpp" line="+262"/>
<location filename="../gui/im_history/ImHistoryBrowser.cpp" line="+261"/>
<source>Copy</source>
<translation>Kopieren</translation>
</message>
@ -6794,7 +6837,7 @@ p, li { white-space: pre-wrap; }
<translation>Verbinde zum Freund</translation>
</message>
<message>
<location line="-214"/>
<location line="-213"/>
<source>Profile</source>
<translation>Profil</translation>
</message>
@ -6804,7 +6847,7 @@ p, li { white-space: pre-wrap; }
<translation>RetroShare Link einfügen</translation>
</message>
<message>
<location line="+26"/>
<location line="+25"/>
<source>Welcome to RetroShare&apos;s group chat.</source>
<translation>Willkommen bei RetroShare&apos;s Gruppenchat.</translation>
</message>
@ -7067,12 +7110,12 @@ p, li { white-space: pre-wrap; }
<translation>Status Spalte ausblenden</translation>
</message>
<message>
<location filename="../gui/PeersDialog.cpp" line="-1525"/>
<location filename="../gui/PeersDialog.cpp" line="-1524"/>
<source>Friends Storm</source>
<translation>Aktivitäten</translation>
</message>
<message>
<location line="+227"/>
<location line="+226"/>
<source>Recomend this Friend to...</source>
<translation>Freund weiterempfehlen...</translation>
</message>
@ -8071,7 +8114,7 @@ p, li { white-space: pre-wrap; }
<translation>Prüfsumme</translation>
</message>
<message>
<location filename="../main.cpp" line="+142"/>
<location filename="../main.cpp" line="+143"/>
<location line="+6"/>
<source>Multiple instances</source>
<translation>Mehrere Instanzen</translation>