Created V0.3.x branch and moved the head into the trunk directory.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@246 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2007-11-15 03:18:48 +00:00
commit 935745a08e
1318 changed files with 348809 additions and 0 deletions

View file

@ -0,0 +1,73 @@
/****************************************************************
* 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 "rshare.h"
#include "ChanCreateDialog.h"
#include "rsiface/rsiface.h"
#include <sstream>
#include <QContextMenuEvent>
#include <QMenu>
#include <QCursor>
#include <QPoint>
#include <QMouseEvent>
#include <QPixmap>
/** Constructor */
ChanCreateDialog::ChanCreateDialog(QWidget *parent, Qt::WFlags flags)
: QMainWindow(parent, flags)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
// connect up the buttons.
connect( ui.cancelButton, SIGNAL( clicked ( bool ) ), this, SLOT( cancelChan( ) ) );
connect( ui.createButton, SIGNAL( clicked ( bool ) ), this, SLOT( createChan( ) ) );
setFixedSize(QSize(392, 167));
/* Hide platform specific features */
#ifdef Q_WS_WIN
#endif
}
void ChanCreateDialog::newChan()
{
/* clear all */
}
void ChanCreateDialog::createChan()
{
hide();
return;
}
void ChanCreateDialog::cancelChan()
{
hide();
return;
}

View file

@ -0,0 +1,57 @@
/****************************************************************
* RShare 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 _CHAN_CREATE_DIALOG_H
#define _CHAN_CREATE_DIALOG_H
#include <QMainWindow>
//#include <config/rsharesettings.h>
#include "ui_ChanCreateDialog.h"
class ChanCreateDialog : public QMainWindow
{
Q_OBJECT
public:
/** Default Constructor */
ChanCreateDialog(QWidget *parent = 0, Qt::WFlags flags = 0);
/** Default Destructor */
void newChan(); /* cleanup */
private slots:
/* actions to take.... */
void createChan();
void cancelChan();
private:
/** Qt Designer generated object */
Ui::ChanCreateDialog ui;
};
#endif

View file

@ -0,0 +1,662 @@
<ui version="4.0" >
<class>ChanCreateDialog</class>
<widget class="QWidget" name="ChanCreateDialog" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>392</width>
<height>167</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<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>
<property name="windowTitle" >
<string>Create a new Broadcast Channel</string>
</property>
<property name="windowIcon" >
<iconset/>
</property>
<widget class="QLabel" name="label_2" >
<property name="geometry" >
<rect>
<x>10</x>
<y>0</y>
<width>391</width>
<height>31</height>
</rect>
</property>
<property name="font" >
<font>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Create A New Broadcast Channel</string>
</property>
</widget>
<widget class="QFrame" name="frame" >
<property name="geometry" >
<rect>
<x>0</x>
<y>20</y>
<width>401</width>
<height>151</height>
</rect>
</property>
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<widget class="QLabel" name="label_3" >
<property name="geometry" >
<rect>
<x>10</x>
<y>20</y>
<width>101</width>
<height>23</height>
</rect>
</property>
<property name="font" >
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Channel Name:</string>
</property>
</widget>
<widget class="QLabel" name="label_4" >
<property name="geometry" >
<rect>
<x>10</x>
<y>50</y>
<width>41</width>
<height>23</height>
</rect>
</property>
<property name="font" >
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Type:</string>
</property>
</widget>
<widget class="QLineEdit" name="channelName" >
<property name="geometry" >
<rect>
<x>120</x>
<y>20</y>
<width>261</width>
<height>23</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="cancelButton" >
<property name="geometry" >
<rect>
<x>150</x>
<y>110</y>
<width>111</width>
<height>26</height>
</rect>
</property>
<property name="text" >
<string>Cancel Channel</string>
</property>
</widget>
<widget class="QPushButton" name="createButton" >
<property name="geometry" >
<rect>
<x>270</x>
<y>110</y>
<width>111</width>
<height>26</height>
</rect>
</property>
<property name="text" >
<string>Create Channel</string>
</property>
<property name="default" >
<bool>true</bool>
</property>
</widget>
<widget class="QRadioButton" name="publicButton" >
<property name="geometry" >
<rect>
<x>120</x>
<y>50</y>
<width>271</width>
<height>23</height>
</rect>
</property>
<property name="text" >
<string>Public Channel (Signed)</string>
</property>
</widget>
<widget class="QRadioButton" name="privateButton" >
<property name="geometry" >
<rect>
<x>120</x>
<y>70</y>
<width>271</width>
<height>23</height>
</rect>
</property>
<property name="text" >
<string>Private Channel (Encrypted)</string>
</property>
</widget>
</widget>
</widget>
<tabstops>
<tabstop>channelName</tabstop>
<tabstop>publicButton</tabstop>
<tabstop>privateButton</tabstop>
<tabstop>cancelButton</tabstop>
<tabstop>createButton</tabstop>
</tabstops>
<resources>
<include location="../images.qrc" />
</resources>
<connections/>
</ui>

View file

@ -0,0 +1,474 @@
/****************************************************************
* 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 "rshare.h"
#include "ChanMsgDialog.h"
#include "rsiface/rsiface.h"
#include <sstream>
#include <QContextMenuEvent>
#include <QMenu>
#include <QCursor>
#include <QPoint>
#include <QMouseEvent>
#include <QPixmap>
/** Constructor */
ChanMsgDialog::ChanMsgDialog(bool msg, QWidget *parent, Qt::WFlags flags)
: mIsMsg(msg), QMainWindow(parent, flags)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
setAttribute ( Qt::WA_DeleteOnClose, true );
//connect( ui.channelstreeView, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( channelstreeViewCostumPopupMenu( QPoint ) ) );
//
// connect up the buttons.
connect( ui.actionSend, SIGNAL( triggered (bool)), this, SLOT( sendMessage( ) ) );
//connect( ui.actionReply, SIGNAL( triggered (bool)), this, SLOT( replyMessage( ) ) );
/* if Msg */
if (mIsMsg)
{
connect(ui.msgSendList, SIGNAL(itemChanged( QTreeWidgetItem *, int ) ),
this, SLOT(togglePersonItem( QTreeWidgetItem *, int ) ));
}
else
{
connect(ui.msgSendList, SIGNAL(itemChanged( QTreeWidgetItem *, int ) ),
this, SLOT(toggleChannelItem( QTreeWidgetItem *, int ) ));
}
connect(ui.msgFileList, SIGNAL(itemChanged( QTreeWidgetItem *, int ) ),
this, SLOT(toggleRecommendItem( QTreeWidgetItem *, int ) ));
/* hide the Tree +/- */
ui.msgSendList -> setRootIsDecorated( false );
/* Hide platform specific features */
#ifdef Q_WS_WIN
#endif
}
void ChanMsgDialog::channelstreeViewCostumPopupMenu( QPoint point )
{
QMenu contextMnu( this );
QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
deletechannelAct = new QAction( tr( "Delete Channel" ), this );
connect( deletechannelAct , SIGNAL( triggered() ), this, SLOT( deletechannel() ) );
createchannelmsgAct = new QAction( tr( "Create Channel MSG" ), this );
connect( createchannelmsgAct , SIGNAL( triggered() ), this, SLOT( createchannelmsg() ) );
contextMnu.clear();
contextMnu.addAction( deletechannelAct);
contextMnu.addAction( createchannelmsgAct);
contextMnu.exec( mevent->globalPos() );
}
void ChanMsgDialog::deletechannel()
{
}
void ChanMsgDialog::createchannelmsg()
{
}
void ChanMsgDialog::insertSendList()
{
rsiface->lockData(); /* Lock Interface */
std::map<RsCertId,NeighbourInfo>::const_iterator it;
const std::map<RsCertId,NeighbourInfo> &friends =
rsiface->getFriendMap();
/* get a link to the table */
QTreeWidget *sendWidget = ui.msgSendList;
/* remove old items ??? */
sendWidget->clear();
sendWidget->setColumnCount(6);
QList<QTreeWidgetItem *> items;
for(it = friends.begin(); it != friends.end(); it++)
{
if (it -> second.connectString == "Yourself")
{
/* ok */
continue;
}
/* make a widget per friend */
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
/* add all the labels */
/* (0) Person */
item -> setText(0, QString::fromStdString(it->second.name));
/* () Org */
item -> setText(1, QString::fromStdString(it->second.org));
/* () Location */
item -> setText(2, QString::fromStdString(it->second.loc));
/* () Country */
item -> setText(3, QString::fromStdString(it->second.country));
{
std::ostringstream out;
out << it->second.id;
item -> setText(4, QString::fromStdString(out.str()));
}
item -> setText(5, "Friend");
item -> setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
//item -> setCheckState(0, Qt::Checked);
//
if (it -> second.inMsg)
{
item -> setCheckState(0, Qt::Checked);
}
else
{
item -> setCheckState(0, Qt::Unchecked);
}
/* add to the list */
items.append(item);
}
/* add the items in! */
sendWidget->insertTopLevelItems(0, items);
rsiface->unlockData(); /* UnLock Interface */
sendWidget->update(); /* update display */
}
void ChanMsgDialog::insertChannelSendList()
{
rsiface->lockData(); /* Lock Interface */
std::map<RsChanId,ChannelInfo>::const_iterator it;
const std::map<RsChanId,ChannelInfo> &chans =
rsiface->getChannels();
/* get a link to the table */
QTreeWidget *sendWidget = ui.msgSendList;
/* remove old items ??? */
sendWidget->clear();
sendWidget->setColumnCount(4);
QList<QTreeWidgetItem *> items;
for(it = chans.begin(); it != chans.end(); it++)
{
/* make a widget per friend */
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
/* (0) Title */
item -> setText(0, QString::fromStdString(it->second.chanName));
if (it->second.publisher)
{
item -> setText(1, "Publisher");
}
else
{
item -> setText(1, "Listener");
}
{
std::ostringstream out;
out << it->second.chanId;
item -> setText(2, QString::fromStdString(out.str()));
}
item -> setText(3, "Channel");
item -> setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
item -> setCheckState(0, Qt::Unchecked);
if (it -> second.inBroadcast)
{
item -> setCheckState(0, Qt::Checked);
}
else
{
item -> setCheckState(0, Qt::Unchecked);
}
/* add to the list */
items.append(item);
}
/* add the items in! */
sendWidget->insertTopLevelItems(0, items);
rsiface->unlockData(); /* UnLock Interface */
sendWidget->update(); /* update display */
}
/* Utility Fns */
/***
RsCertId getSenderRsCertId(QTreeWidgetItem *i)
{
RsCertId id = (i -> text(3)).toStdString();
return id;
}
***/
/* get the list of peers from the RsIface. */
void ChanMsgDialog::insertFileList()
{
rsiface->lockData(); /* Lock Interface */
const std::list<FileInfo> &recList = rsiface->getRecommendList();
std::list<FileInfo>::const_iterator it;
/* get a link to the table */
QTreeWidget *tree = ui.msgFileList;
tree->clear();
tree->setColumnCount(5);
QList<QTreeWidgetItem *> items;
for(it = recList.begin(); it != recList.end(); it++)
{
/* make a widget per person */
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
/* (0) Filename */
item -> setText(0, QString::fromStdString(it->fname));
/* (1) Size */
{
std::ostringstream out;
out << it->size;
item -> setText(1, QString::fromStdString(out.str()));
}
/* (2) Rank */
{
std::ostringstream out;
out << it->rank;
item -> setText(2, QString::fromStdString(out.str()));
}
item -> setText(3, QString::fromStdString(it->hash));
item -> setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
if (it -> inRecommend)
{
item -> setCheckState(0, Qt::Checked);
}
else
{
item -> setCheckState(0, Qt::Unchecked);
}
/* add to the list */
items.append(item);
}
/* add the items in! */
tree->insertTopLevelItems(0, items);
rsiface->unlockData(); /* UnLock Interface */
tree->update(); /* update display */
}
void ChanMsgDialog::newMsg()
{
/* clear all */
ui.titleEdit->setText("No Title");
ui.msgText->setText("");
/* worker fns */
if (mIsMsg)
{
insertSendList();
}
else
{
insertChannelSendList();
}
insertFileList();
}
void ChanMsgDialog::insertTitleText(std::string title)
{
ui.titleEdit->setText(QString::fromStdString(title));
}
void ChanMsgDialog::insertMsgText(std::string msg)
{
ui.msgText->setText(QString::fromStdString(msg));
}
void ChanMsgDialog::sendMessage()
{
rsiface->lockData(); /* Lock Interface */
/* construct a message */
MessageInfo mi;
mi.title = ui.titleEdit->text().toStdString();
mi.msg = ui.msgText->toPlainText().toStdString();
/* filled in later */
//mi.msgId = rand();
const std::list<FileInfo> &recList = rsiface->getRecommendList();
std::list<FileInfo>::const_iterator it;
for(it = recList.begin(); it != recList.end(); it++)
{
if (it -> inRecommend)
{
mi.files.push_back(*it);
}
}
/* get a list of people to send it to */
std::map<RsCertId,NeighbourInfo>::const_iterator it2;
const std::map<RsCertId,NeighbourInfo> &friends =
rsiface->getFriendMap();
std::list<std::string> persons;
std::list<std::string>::iterator it3;
for(it2 = friends.begin(); it2 != friends.end(); it2++)
{
/* send to all listed + ourselves */
if ((it2 -> second.inMsg)
|| (it2 -> second.connectString == "Yourself"))
{
std::ostringstream out;
out << it2 -> second.id;
persons.push_back(out.str());
}
}
rsiface->unlockData(); /* UnLock Interface */
/* send message */
for(it3 = persons.begin(); it3 != persons.end(); it3++)
{
mi.id = *it3;
rsicontrol -> MessageSend(mi);
}
close();
return;
}
void ChanMsgDialog::cancelMessage()
{
close();
return;
}
/* Toggling .... Check Boxes.....
* This is dependent on whether we are a
*
* Chan or Msg Dialog.
*/
/* First the Msg (People) ones */
void ChanMsgDialog::togglePersonItem( QTreeWidgetItem *item, int col )
{
std::cerr << "TogglePersonItem()" << std::endl;
/* extract id */
std::string id = (item -> text(4)).toStdString();
/* get state */
bool inMsg = (Qt::Checked == item -> checkState(0)); /* alway column 0 */
/* call control fns */
rsicontrol -> SetInMsg(id, inMsg);
return;
}
/* Second the Channel ones */
void ChanMsgDialog::toggleChannelItem( QTreeWidgetItem *item, int col )
{
std::cerr << "ToggleChannelItem()" << std::endl;
/* extract id */
std::string id = (item -> text(2)).toStdString();
/* get state */
bool inBroad = (Qt::Checked == item -> checkState(0)); /* alway column 0 */
/* call control fns */
rsicontrol -> SetInBroadcast(id, inBroad);
return;
}
/* This is actually for both */
void ChanMsgDialog::toggleRecommendItem( QTreeWidgetItem *item, int col )
{
std::cerr << "ToggleRecommendItem()" << std::endl;
/* extract name */
std::string id = (item -> text(0)).toStdString();
/* get state */
bool inRecommend = (Qt::Checked == item -> checkState(0)); /* alway column 0 */
/* call control fns */
rsicontrol -> SetInRecommend(id, inRecommend);
return;
}

View file

@ -0,0 +1,90 @@
/****************************************************************
* 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 _CHAN_MSG_DIALOG_H
#define _CHAN_MSG_DIALOG_H
#include <QMainWindow>
#include "ui_ChanMsgDialog.h"
class ChanMsgDialog : public QMainWindow
{
Q_OBJECT
public:
/** Default Constructor */
ChanMsgDialog(bool isMsg, QWidget *parent = 0, Qt::WFlags flags = 0);
/** Default Destructor */
void newMsg();
/* worker fns */
void insertSendList(); /* for Msgs */
void insertChannelSendList(); /* for Channels */
void insertFileList(); /* for Both */
void insertTitleText(std::string title);
void insertMsgText(std::string msg);
public slots:
/* actions to take.... */
void sendMessage();
void cancelMessage();
private slots:
/** Create the context popup menu and it's submenus */
void channelstreeViewCostumPopupMenu( QPoint point );
/** Defines the context menu functions*/
void deletechannel();
void createchannelmsg();
/* for toggling flags */
void togglePersonItem( QTreeWidgetItem *item, int col );
void toggleChannelItem( QTreeWidgetItem *item, int col );
void toggleRecommendItem( QTreeWidgetItem *item, int col );
private:
/** Define the popup menus for the Context menu */
QMenu* contextMnu;
/** Defines the actions for the context menu */
QAction* deletechannelAct;
QAction* createchannelmsgAct;
QTreeView *channelstreeView;
bool mIsMsg; /* different behaviour for Msg or ChanMsg */
/** Qt Designer generated object */
Ui::ChanMsgDialog ui;
};
#endif

View file

@ -0,0 +1,271 @@
<ui version="4.0" >
<class>ChanMsgDialog</class>
<widget class="QMainWindow" name="ChanMsgDialog" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>599</width>
<height>411</height>
</rect>
</property>
<property name="contextMenuPolicy" >
<enum>Qt::NoContextMenu</enum>
</property>
<property name="windowTitle" >
<string>Compose</string>
</property>
<property name="windowIcon" >
<iconset resource="../images.qrc" >:/images/folder-draft.png</iconset>
</property>
<widget class="QWidget" name="centralwidget" >
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="QSplitter" name="splitter_2" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<widget class="QSplitter" name="splitter" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<widget class="QWidget" name="layoutWidget" >
<layout class="QGridLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="QLabel" name="label_14" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font" >
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Send To:</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2" >
<widget class="QTreeWidget" name="msgSendList" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>0</horstretch>
<verstretch>4</verstretch>
</sizepolicy>
</property>
<property name="sortingEnabled" >
<bool>true</bool>
</property>
<column>
<property name="text" >
<string>1</string>
</property>
</column>
</widget>
</item>
<item row="0" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>421</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget" >
<layout class="QGridLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="label" >
<property name="font" >
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'MS Shell Dlg 2'; font-size:10pt; font-weight:600; font-style:normal; text-decoration:none;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Arial'; font-weight:400;">&lt;span style=" font-weight:600;">Subject:&lt;/span>&lt;/p>&lt;/body>&lt;/html></string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="titleEdit" />
</item>
</layout>
</item>
<item row="1" column="0" >
<widget class="QTextEdit" name="msgText" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>4</horstretch>
<verstretch>4</verstretch>
</sizepolicy>
</property>
<property name="textInteractionFlags" >
<enum>Qt::TextEditorInteraction</enum>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QWidget" name="layoutWidget" >
<layout class="QGridLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="QLabel" name="label_13" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font" >
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Recommended Files</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QTreeWidget" name="msgFileList" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sortingEnabled" >
<bool>true</bool>
</property>
<column>
<property name="text" >
<string>1</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>599</width>
<height>24</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar" />
<widget class="QToolBar" name="toolBar" >
<property name="contextMenuPolicy" >
<enum>Qt::NoContextMenu</enum>
</property>
<property name="movable" >
<bool>false</bool>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="toolButtonStyle" >
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
<attribute name="toolBarArea" >
<number>4</number>
</attribute>
<addaction name="actionSend" />
</widget>
<action name="actionSend" >
<property name="icon" >
<iconset resource="../images.qrc" >:/images/send24.png</iconset>
</property>
<property name="text" >
<string>Send</string>
</property>
</action>
<action name="actionReply" >
<property name="icon" >
<iconset resource="../images.qrc" >:/images/replymail24.png</iconset>
</property>
<property name="text" >
<string>Reply</string>
</property>
</action>
</widget>
<tabstops>
<tabstop>msgSendList</tabstop>
<tabstop>titleEdit</tabstop>
<tabstop>msgText</tabstop>
<tabstop>msgFileList</tabstop>
</tabstops>
<resources>
<include location="../images.qrc" />
</resources>
<connections/>
</ui>