mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-29 09:26:18 -05:00
Added new common widget FriendSelectionWidget for selecting friends and use it in CreateLobbyDialog, ShareKey (forums and channels) and MessageComposer.
Fixed german language. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4850 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
a3a0690cb4
commit
e6816c9d6f
@ -337,6 +337,7 @@ HEADERS += rshare.h \
|
|||||||
gui/common/RSTreeView.h \
|
gui/common/RSTreeView.h \
|
||||||
gui/common/AvatarWidget.h \
|
gui/common/AvatarWidget.h \
|
||||||
gui/common/FriendList.h \
|
gui/common/FriendList.h \
|
||||||
|
gui/common/FriendSelectionWidget.h \
|
||||||
gui/common/HashBox.h \
|
gui/common/HashBox.h \
|
||||||
gui/style/RSStyle.h \
|
gui/style/RSStyle.h \
|
||||||
gui/style/StyleDialog.h \
|
gui/style/StyleDialog.h \
|
||||||
@ -464,6 +465,7 @@ FORMS += gui/StartDialog.ui \
|
|||||||
gui/common/GroupTreeWidget.ui \
|
gui/common/GroupTreeWidget.ui \
|
||||||
gui/common/AvatarWidget.ui \
|
gui/common/AvatarWidget.ui \
|
||||||
gui/common/FriendList.ui \
|
gui/common/FriendList.ui \
|
||||||
|
gui/common/FriendSelectionWidget.ui \
|
||||||
gui/common/HashBox.ui \
|
gui/common/HashBox.ui \
|
||||||
gui/common/RsCollectionDialog.ui \
|
gui/common/RsCollectionDialog.ui \
|
||||||
gui/style/StyleDialog.ui \
|
gui/style/StyleDialog.ui \
|
||||||
@ -578,6 +580,7 @@ SOURCES += main.cpp \
|
|||||||
gui/common/RSTreeView.cpp \
|
gui/common/RSTreeView.cpp \
|
||||||
gui/common/AvatarWidget.cpp \
|
gui/common/AvatarWidget.cpp \
|
||||||
gui/common/FriendList.cpp \
|
gui/common/FriendList.cpp \
|
||||||
|
gui/common/FriendSelectionWidget.cpp \
|
||||||
gui/common/HashBox.cpp \
|
gui/common/HashBox.cpp \
|
||||||
gui/style/RSStyle.cpp \
|
gui/style/RSStyle.cpp \
|
||||||
gui/style/StyleDialog.cpp \
|
gui/style/StyleDialog.cpp \
|
||||||
|
@ -47,97 +47,29 @@ CreateChannel::CreateChannel(QWidget *parent)
|
|||||||
connect( ui.LogoButton, SIGNAL(clicked() ), this , SLOT(addChannelLogo()));
|
connect( ui.LogoButton, SIGNAL(clicked() ), this , SLOT(addChannelLogo()));
|
||||||
connect( ui.ChannelLogoButton, SIGNAL(clicked() ), this , SLOT(addChannelLogo()));
|
connect( ui.ChannelLogoButton, SIGNAL(clicked() ), this , SLOT(addChannelLogo()));
|
||||||
connect( ui.pubKeyShare_cb, SIGNAL( clicked() ), this, SLOT( setShareList( ) ));
|
connect( ui.pubKeyShare_cb, SIGNAL( clicked() ), this, SLOT( setShareList( ) ));
|
||||||
connect( ui.keyShareList, SIGNAL(itemChanged( QTreeWidgetItem *, int ) ),
|
|
||||||
this, SLOT(togglePersonItem( QTreeWidgetItem *, int ) ));
|
|
||||||
|
|
||||||
if(!ui.pubKeyShare_cb->isChecked()){
|
|
||||||
|
|
||||||
|
if (!ui.pubKeyShare_cb->isChecked()) {
|
||||||
ui.contactsdockWidget->hide();
|
ui.contactsdockWidget->hide();
|
||||||
this->resize(this->size().width() - ui.contactsdockWidget->size().width(),
|
this->resize(this->size().width() - ui.contactsdockWidget->size().width(), this->size().height());
|
||||||
this->size().height());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* initialize key share list */
|
||||||
|
ui.keyShareList->setHeaderText(tr("Contacts:"));
|
||||||
|
ui.keyShareList->setModus(FriendSelectionWidget::MODUS_CHECK);
|
||||||
|
ui.keyShareList->start();
|
||||||
|
|
||||||
newChannel();
|
newChannel();
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void CreateChannel::show()
|
|
||||||
{
|
|
||||||
//loadSettings();
|
|
||||||
if(!this->isVisible()) {
|
|
||||||
QWidget::show();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateChannel::setShareList(){
|
void CreateChannel::setShareList(){
|
||||||
|
|
||||||
if(ui.pubKeyShare_cb->isChecked()){
|
if (ui.pubKeyShare_cb->isChecked()){
|
||||||
this->resize(this->size().width() + ui.contactsdockWidget->size().width(),
|
this->resize(this->size().width() + ui.contactsdockWidget->size().width(), this->size().height());
|
||||||
this->size().height());
|
|
||||||
ui.contactsdockWidget->show();
|
ui.contactsdockWidget->show();
|
||||||
|
} else {
|
||||||
|
|
||||||
if (!rsPeers)
|
|
||||||
{
|
|
||||||
/* not ready yet! */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::list<std::string> peers;
|
|
||||||
std::list<std::string>::iterator it;
|
|
||||||
|
|
||||||
rsPeers->getFriendList(peers);
|
|
||||||
|
|
||||||
/* get a link to the table */
|
|
||||||
QTreeWidget *shareWidget = ui.keyShareList;
|
|
||||||
|
|
||||||
QList<QTreeWidgetItem *> items;
|
|
||||||
|
|
||||||
for(it = peers.begin(); it != peers.end(); it++)
|
|
||||||
{
|
|
||||||
|
|
||||||
RsPeerDetails detail;
|
|
||||||
if (!rsPeers->getPeerDetails(*it, detail))
|
|
||||||
{
|
|
||||||
continue; /* BAD */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* make a widget per friend */
|
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
|
|
||||||
|
|
||||||
item -> setText(0, PeerDefs::nameWithLocation(detail));
|
|
||||||
if (detail.state & RS_PEER_STATE_CONNECTED) {
|
|
||||||
item -> setTextColor(0,(Qt::darkBlue));
|
|
||||||
}
|
|
||||||
item -> setSizeHint(0, QSize( 17,17 ) );
|
|
||||||
|
|
||||||
item -> setText(1, QString::fromStdString(detail.id));
|
|
||||||
|
|
||||||
item -> setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
|
|
||||||
item -> setCheckState(0, Qt::Unchecked);
|
|
||||||
|
|
||||||
|
|
||||||
/* add to the list */
|
|
||||||
items.append(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* remove old items */
|
|
||||||
shareWidget->clear();
|
|
||||||
shareWidget->setColumnCount(1);
|
|
||||||
|
|
||||||
/* add the items in! */
|
|
||||||
shareWidget->insertTopLevelItems(0, items);
|
|
||||||
|
|
||||||
shareWidget->update(); /* update display */
|
|
||||||
|
|
||||||
}else{
|
|
||||||
ui.contactsdockWidget->hide();
|
ui.contactsdockWidget->hide();
|
||||||
this->resize(this->size().width() - ui.contactsdockWidget->size().width(),
|
this->resize(this->size().width() - ui.contactsdockWidget->size().width(), this->size().height());
|
||||||
this->size().height());
|
|
||||||
mShareList.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateChannel::newChannel()
|
void CreateChannel::newChannel()
|
||||||
@ -158,87 +90,49 @@ void CreateChannel::createChannel()
|
|||||||
QString desc = ui.channelDesc->toPlainText();
|
QString desc = ui.channelDesc->toPlainText();
|
||||||
uint32_t flags = 0;
|
uint32_t flags = 0;
|
||||||
|
|
||||||
if(name.isEmpty())
|
if (name.isEmpty()) {
|
||||||
{ /* error message */
|
/* error message */
|
||||||
QMessageBox::warning(this, tr("RetroShare"),tr("Please add a Name"),
|
QMessageBox::warning(this, "RetroShare", tr("Please add a Name"), QMessageBox::Ok, QMessageBox::Ok);
|
||||||
QMessageBox::Ok, QMessageBox::Ok);
|
|
||||||
|
|
||||||
return; //Don't add a empty name!!
|
return; //Don't add a empty name!!
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
|
||||||
if (ui.typePrivate->isChecked())
|
if (ui.typePrivate->isChecked()) {
|
||||||
{
|
|
||||||
flags |= RS_DISTRIB_PRIVATE;
|
flags |= RS_DISTRIB_PRIVATE;
|
||||||
}
|
} else if (ui.typeEncrypted->isChecked()) {
|
||||||
else if (ui.typeEncrypted->isChecked())
|
|
||||||
{
|
|
||||||
flags |= RS_DISTRIB_ENCRYPTED;
|
flags |= RS_DISTRIB_ENCRYPTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ui.msgAuth->isChecked())
|
if (ui.msgAuth->isChecked()) {
|
||||||
{
|
|
||||||
flags |= RS_DISTRIB_AUTHEN_REQ;
|
flags |= RS_DISTRIB_AUTHEN_REQ;
|
||||||
}
|
} else if (ui.msgAnon->isChecked()) {
|
||||||
else if (ui.msgAnon->isChecked())
|
|
||||||
{
|
|
||||||
flags |= RS_DISTRIB_AUTHEN_ANON;
|
flags |= RS_DISTRIB_AUTHEN_ANON;
|
||||||
}
|
}
|
||||||
QByteArray ba;
|
QByteArray ba;
|
||||||
QBuffer buffer(&ba);
|
QBuffer buffer(&ba);
|
||||||
|
|
||||||
if(!picture.isNull()){
|
if (!picture.isNull()) {
|
||||||
// send chan image
|
// send chan image
|
||||||
|
|
||||||
buffer.open(QIODevice::WriteOnly);
|
buffer.open(QIODevice::WriteOnly);
|
||||||
picture.save(&buffer, "PNG"); // writes image into ba in PNG format
|
picture.save(&buffer, "PNG"); // writes image into ba in PNG format
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rsChannels)
|
if (rsChannels) {
|
||||||
{
|
|
||||||
std::string chId = rsChannels->createChannel(name.toStdWString(), desc.toStdWString(), flags, (unsigned char*)ba.data(), ba.size());
|
std::string chId = rsChannels->createChannel(name.toStdWString(), desc.toStdWString(), flags, (unsigned char*)ba.data(), ba.size());
|
||||||
|
|
||||||
if(ui.pubKeyShare_cb->isChecked())
|
if (ui.pubKeyShare_cb->isChecked()) {
|
||||||
rsChannels->channelShareKeys(chId, mShareList);
|
std::list<std::string> shareList;
|
||||||
|
ui.keyShareList->selectedSslIds(shareList, false);
|
||||||
|
rsChannels->channelShareKeys(chId, shareList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
close();
|
close();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CreateChannel::togglePersonItem( QTreeWidgetItem *item, int /*col*/ )
|
|
||||||
{
|
|
||||||
|
|
||||||
/* extract id */
|
|
||||||
std::string id = (item -> text(1)).toStdString();
|
|
||||||
|
|
||||||
/* get state */
|
|
||||||
bool checked = (Qt::Checked == item -> checkState(0)); /* alway column 0 */
|
|
||||||
|
|
||||||
/* call control fns */
|
|
||||||
std::list<std::string>::iterator lit = std::find(mShareList.begin(), mShareList.end(), id);
|
|
||||||
|
|
||||||
if(checked && (lit == mShareList.end())){
|
|
||||||
|
|
||||||
// make sure ids not added already
|
|
||||||
mShareList.push_back(id);
|
|
||||||
|
|
||||||
}else
|
|
||||||
if(lit != mShareList.end()){
|
|
||||||
|
|
||||||
mShareList.erase(lit);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateChannel::cancelChannel()
|
void CreateChannel::cancelChannel()
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateChannel::addChannelLogo() // the same function as in EditChanDetails
|
void CreateChannel::addChannelLogo() // the same function as in EditChanDetails
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
* Boston, MA 02110-1301, USA.
|
* Boston, MA 02110-1301, USA.
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#ifndef _CREATE_CHANNEL_DIALOG_H
|
#ifndef _CREATE_CHANNEL_DIALOG_H
|
||||||
#define _CREATE_CHANNEL_DIALOG_H
|
#define _CREATE_CHANNEL_DIALOG_H
|
||||||
|
|
||||||
@ -32,31 +31,21 @@ class CreateChannel : public QDialog
|
|||||||
public:
|
public:
|
||||||
CreateChannel(QWidget *parent = 0);
|
CreateChannel(QWidget *parent = 0);
|
||||||
|
|
||||||
void newChannel(); /* cleanup */
|
void newChannel(); /* cleanup */
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
/* actions to take.... */
|
||||||
|
void createChannel();
|
||||||
|
void cancelChannel();
|
||||||
|
|
||||||
|
void addChannelLogo();
|
||||||
|
void setShareList();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QPixmap picture;
|
||||||
|
|
||||||
/** Qt Designer generated object */
|
/** Qt Designer generated object */
|
||||||
Ui::CreateChannel ui;
|
Ui::CreateChannel ui;
|
||||||
|
|
||||||
QPixmap picture;
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
/** Overloaded QWidget.show */
|
|
||||||
void show();
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
|
|
||||||
/* actions to take.... */
|
|
||||||
void createChannel();
|
|
||||||
void cancelChannel();
|
|
||||||
|
|
||||||
void addChannelLogo();
|
|
||||||
void setShareList();
|
|
||||||
void togglePersonItem(QTreeWidgetItem* item, int col);
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
std::list<std::string> mShareList;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -159,7 +159,7 @@
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QTreeWidget" name="keyShareList">
|
<widget class="FriendSelectionWidget" name="keyShareList" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
@ -190,14 +190,6 @@
|
|||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="sortingEnabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<column>
|
|
||||||
<property name="text">
|
|
||||||
<string>Contacts:</string>
|
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -475,6 +467,14 @@ border-radius: 10px;
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>FriendSelectionWidget</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>gui/common/FriendSelectionWidget.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../images.qrc"/>
|
<include location="../images.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -106,7 +106,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>1</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab">
|
<widget class="QWidget" name="tab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
@ -426,10 +426,6 @@ background: white;}</string>
|
|||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../images.qrc"/>
|
<include location="../images.qrc"/>
|
||||||
<include location="../images.qrc"/>
|
|
||||||
<include location="../images.qrc"/>
|
|
||||||
<include location="../images.qrc"/>
|
|
||||||
<include location="../../../../../../../../.designer/images.qrc"/>
|
|
||||||
</resources>
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
@ -30,35 +30,26 @@
|
|||||||
|
|
||||||
#include "gui/common/PeerDefs.h"
|
#include "gui/common/PeerDefs.h"
|
||||||
|
|
||||||
ShareKey::ShareKey(QWidget *parent, Qt::WFlags flags, std::string grpId,
|
ShareKey::ShareKey(QWidget *parent, Qt::WFlags flags, std::string grpId, int grpType) :
|
||||||
int grpType) :
|
|
||||||
QDialog(parent, flags), mGrpId(grpId), mGrpType(grpType)
|
QDialog(parent, flags), mGrpId(grpId), mGrpType(grpType)
|
||||||
{
|
{
|
||||||
ui = new Ui::ShareKey();
|
ui = new Ui::ShareKey();
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
|
||||||
connect( ui->shareButton, SIGNAL( clicked ( bool ) ), this, SLOT( shareKey( ) ) );
|
connect( ui->shareButton, SIGNAL( clicked ( bool ) ), this, SLOT( shareKey( ) ) );
|
||||||
connect( ui->cancelButton, SIGNAL( clicked ( bool ) ), this, SLOT( cancel( ) ) );
|
connect( ui->cancelButton, SIGNAL( clicked ( bool ) ), this, SLOT( cancel( ) ) );
|
||||||
|
|
||||||
connect(ui->keyShareList, SIGNAL(itemChanged( QTreeWidgetItem *, int ) ),
|
/* initialize key share list */
|
||||||
this, SLOT(togglePersonItem( QTreeWidgetItem *, int ) ));
|
ui->keyShareList->setHeaderText(tr("Contacts:"));
|
||||||
|
ui->keyShareList->setModus(FriendSelectionWidget::MODUS_CHECK);
|
||||||
setShareList();
|
ui->keyShareList->start();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ShareKey::~ShareKey()
|
ShareKey::~ShareKey()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShareKey::closeEvent (QCloseEvent * event)
|
|
||||||
{
|
|
||||||
QWidget::closeEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ShareKey::changeEvent(QEvent *e)
|
void ShareKey::changeEvent(QEvent *e)
|
||||||
{
|
{
|
||||||
QDialog::changeEvent(e);
|
QDialog::changeEvent(e);
|
||||||
@ -73,140 +64,40 @@ void ShareKey::changeEvent(QEvent *e)
|
|||||||
|
|
||||||
void ShareKey::shareKey()
|
void ShareKey::shareKey()
|
||||||
{
|
{
|
||||||
|
std::list<std::string> shareList;
|
||||||
|
ui->keyShareList->selectedSslIds(shareList, false);
|
||||||
|
|
||||||
|
if (shareList.empty()) {
|
||||||
|
QMessageBox::warning(this, "RetroShare", tr("Please select at least one peer"), QMessageBox::Ok, QMessageBox::Ok);
|
||||||
if(mShareList.empty())
|
|
||||||
{
|
|
||||||
QMessageBox::warning(this, tr("RetroShare"),tr("Please select at least one peer"),
|
|
||||||
QMessageBox::Ok, QMessageBox::Ok);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mGrpType & CHANNEL_KEY_SHARE)
|
if (mGrpType & CHANNEL_KEY_SHARE) {
|
||||||
{
|
if (!rsChannels)
|
||||||
if(!rsChannels)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!rsChannels->channelShareKeys(mGrpId, mShareList)){
|
if (!rsChannels->channelShareKeys(mGrpId, shareList)) {
|
||||||
|
|
||||||
std::cerr << "Failed to share keys!" << std::endl;
|
std::cerr << "Failed to share keys!" << std::endl;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
} else if(mGrpType & FORUM_KEY_SHARE) {
|
||||||
}else if(mGrpType & FORUM_KEY_SHARE)
|
|
||||||
{
|
|
||||||
if(!rsForums)
|
if(!rsForums)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!rsForums->forumShareKeys(mGrpId, mShareList)){
|
if (!rsForums->forumShareKeys(mGrpId, shareList)) {
|
||||||
|
|
||||||
std::cerr << "Failed to share keys!" << std::endl;
|
std::cerr << "Failed to share keys!" << std::endl;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
}else{
|
|
||||||
|
|
||||||
// incorrect type
|
// incorrect type
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
close();
|
close();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShareKey::cancel()
|
void ShareKey::cancel()
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShareKey::setShareList(){
|
|
||||||
|
|
||||||
if (!rsPeers)
|
|
||||||
{
|
|
||||||
/* not ready yet! */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::list<std::string> peers;
|
|
||||||
std::list<std::string>::iterator it;
|
|
||||||
|
|
||||||
rsPeers->getFriendList(peers);
|
|
||||||
|
|
||||||
/* get a link to the table */
|
|
||||||
QTreeWidget *shareWidget = ui->keyShareList;
|
|
||||||
|
|
||||||
QList<QTreeWidgetItem *> items;
|
|
||||||
|
|
||||||
for(it = peers.begin(); it != peers.end(); it++)
|
|
||||||
{
|
|
||||||
|
|
||||||
RsPeerDetails detail;
|
|
||||||
if (!rsPeers->getPeerDetails(*it, detail))
|
|
||||||
{
|
|
||||||
continue; /* BAD */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* make a widget per friend */
|
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
|
|
||||||
|
|
||||||
item -> setText(0, PeerDefs::nameWithLocation(detail));
|
|
||||||
if (detail.state & RS_PEER_STATE_CONNECTED) {
|
|
||||||
item -> setTextColor(0,(Qt::darkBlue));
|
|
||||||
}
|
|
||||||
item -> setSizeHint(0, QSize( 17,17 ) );
|
|
||||||
|
|
||||||
item -> setText(1, QString::fromStdString(detail.id));
|
|
||||||
|
|
||||||
item -> setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
|
|
||||||
item -> setCheckState(0, Qt::Unchecked);
|
|
||||||
|
|
||||||
|
|
||||||
/* add to the list */
|
|
||||||
items.append(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* remove old items */
|
|
||||||
shareWidget->clear();
|
|
||||||
shareWidget->setColumnCount(1);
|
|
||||||
|
|
||||||
/* add the items in! */
|
|
||||||
shareWidget->insertTopLevelItems(0, items);
|
|
||||||
|
|
||||||
shareWidget->update(); /* update display */
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void ShareKey::togglePersonItem( QTreeWidgetItem *item, int /*col*/ )
|
|
||||||
{
|
|
||||||
|
|
||||||
/* extract id */
|
|
||||||
std::string id = (item -> text(1)).toStdString();
|
|
||||||
|
|
||||||
/* get state */
|
|
||||||
bool checked = (Qt::Checked == item -> checkState(0)); /* alway column 0 */
|
|
||||||
|
|
||||||
/* call control fns */
|
|
||||||
std::list<std::string>::iterator lit = std::find(mShareList.begin(), mShareList.end(), id);
|
|
||||||
|
|
||||||
if(checked && (lit == mShareList.end())){
|
|
||||||
|
|
||||||
// make sure ids not added already
|
|
||||||
mShareList.push_back(id);
|
|
||||||
|
|
||||||
}else
|
|
||||||
if(lit != mShareList.end()){
|
|
||||||
|
|
||||||
mShareList.erase(lit);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -8,39 +8,29 @@
|
|||||||
#define CHANNEL_KEY_SHARE 0x00000001
|
#define CHANNEL_KEY_SHARE 0x00000001
|
||||||
#define FORUM_KEY_SHARE 0x00000002
|
#define FORUM_KEY_SHARE 0x00000002
|
||||||
|
|
||||||
class ShareKey : public QDialog {
|
class ShareKey : public QDialog
|
||||||
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/*
|
/*
|
||||||
*@param chanId The channel id to send request for
|
*@param chanId The channel id to send request for
|
||||||
*/
|
*/
|
||||||
ShareKey(QWidget *parent = 0, Qt::WFlags flags = 0,
|
ShareKey(QWidget *parent = 0, Qt::WFlags flags = 0, std::string grpId = "", int grpType = 0);
|
||||||
std::string grpId = "", int grpType = 0);
|
|
||||||
~ShareKey();
|
~ShareKey();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void changeEvent(QEvent *e);
|
void changeEvent(QEvent *e);
|
||||||
void closeEvent (QCloseEvent * event);
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
void setShareList();
|
|
||||||
|
|
||||||
Ui::ShareKey *ui;
|
|
||||||
|
|
||||||
std::string mGrpId;
|
|
||||||
std::list<std::string> mShareList;
|
|
||||||
int mGrpType;
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void shareKey();
|
void shareKey();
|
||||||
void cancel();
|
void cancel();
|
||||||
void togglePersonItem(QTreeWidgetItem* item, int col);
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string mGrpId;
|
||||||
|
int mGrpType;
|
||||||
|
|
||||||
|
Ui::ShareKey *ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SHAREKEY_H
|
#endif // SHAREKEY_H
|
||||||
|
@ -138,7 +138,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QTreeWidget" name="keyShareList">
|
<widget class="FriendSelectionWidget" name="keyShareList" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
@ -169,20 +169,6 @@ p, li { white-space: pre-wrap; }
|
|||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>16</width>
|
|
||||||
<height>16</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="sortingEnabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<column>
|
|
||||||
<property name="text">
|
|
||||||
<string>Contacts:</string>
|
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -242,10 +228,16 @@ p, li { white-space: pre-wrap; }
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>FriendSelectionWidget</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>gui/common/FriendSelectionWidget.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../images.qrc"/>
|
<include location="../images.qrc"/>
|
||||||
<include location="../images.qrc"/>
|
|
||||||
<include location="../images.qrc"/>
|
|
||||||
</resources>
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
@ -30,8 +30,8 @@
|
|||||||
#include "gui/common/PeerDefs.h"
|
#include "gui/common/PeerDefs.h"
|
||||||
#include "ChatDialog.h"
|
#include "ChatDialog.h"
|
||||||
|
|
||||||
CreateLobbyDialog::CreateLobbyDialog(const std::list<std::string>& peer_list,QWidget *parent, Qt::WFlags flags, std::string grpId, int grpType) :
|
CreateLobbyDialog::CreateLobbyDialog(const std::list<std::string>& peer_list,QWidget *parent, Qt::WFlags flags) :
|
||||||
QDialog(parent, flags), mGrpId(grpId), mGrpType(grpType)
|
QDialog(parent, flags)
|
||||||
{
|
{
|
||||||
ui = new Ui::CreateLobbyDialog() ;
|
ui = new Ui::CreateLobbyDialog() ;
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
@ -50,10 +50,13 @@ CreateLobbyDialog::CreateLobbyDialog(const std::list<std::string>& peer_list,QWi
|
|||||||
connect( ui->lobbyName_LE, SIGNAL( textChanged ( QString ) ), this, SLOT( checkTextFields( ) ) );
|
connect( ui->lobbyName_LE, SIGNAL( textChanged ( QString ) ), this, SLOT( checkTextFields( ) ) );
|
||||||
connect( ui->nickName_LE, SIGNAL( textChanged ( QString ) ), this, SLOT( checkTextFields( ) ) );
|
connect( ui->nickName_LE, SIGNAL( textChanged ( QString ) ), this, SLOT( checkTextFields( ) ) );
|
||||||
|
|
||||||
connect(ui->keyShareList, SIGNAL(itemChanged( QTreeWidgetItem *, int ) ), this, SLOT(togglePersonItem( QTreeWidgetItem *, int ) ));
|
/* initialize key share list */
|
||||||
|
ui->keyShareList->setHeaderText(tr("Contacts:"));
|
||||||
|
ui->keyShareList->setModus(FriendSelectionWidget::MODUS_CHECK);
|
||||||
|
ui->keyShareList->start();
|
||||||
|
ui->keyShareList->setSelectedSslIds(peer_list, false);
|
||||||
|
|
||||||
setShareList(peer_list);
|
checkTextFields();
|
||||||
checkTextFields() ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateLobbyDialog::~CreateLobbyDialog()
|
CreateLobbyDialog::~CreateLobbyDialog()
|
||||||
@ -83,8 +86,10 @@ void CreateLobbyDialog::checkTextFields()
|
|||||||
|
|
||||||
void CreateLobbyDialog::createLobby()
|
void CreateLobbyDialog::createLobby()
|
||||||
{
|
{
|
||||||
if(mShareList.empty())
|
std::list<std::string> shareList;
|
||||||
{
|
ui->keyShareList->selectedSslIds(shareList, false);
|
||||||
|
|
||||||
|
if (shareList.empty()) {
|
||||||
QMessageBox::warning(this, "RetroShare", tr("Please select at least one friend"), QMessageBox::Ok, QMessageBox::Ok);
|
QMessageBox::warning(this, "RetroShare", tr("Please select at least one friend"), QMessageBox::Ok, QMessageBox::Ok);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -96,7 +101,7 @@ void CreateLobbyDialog::createLobby()
|
|||||||
|
|
||||||
int lobby_privacy_type = (ui->security_CB->currentIndex() == 0)?RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC:RS_CHAT_LOBBY_PRIVACY_LEVEL_PRIVATE ;
|
int lobby_privacy_type = (ui->security_CB->currentIndex() == 0)?RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC:RS_CHAT_LOBBY_PRIVACY_LEVEL_PRIVATE ;
|
||||||
|
|
||||||
ChatLobbyId id = rsMsgs->createChatLobby(lobby_name, mShareList, lobby_privacy_type);
|
ChatLobbyId id = rsMsgs->createChatLobby(lobby_name, shareList, lobby_privacy_type);
|
||||||
|
|
||||||
std::cerr << "gui: Created chat lobby " << std::hex << id << std::endl ;
|
std::cerr << "gui: Created chat lobby " << std::hex << id << std::endl ;
|
||||||
|
|
||||||
@ -117,84 +122,3 @@ void CreateLobbyDialog::cancel()
|
|||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateLobbyDialog::setShareList(const std::list<std::string>& friend_list)
|
|
||||||
{
|
|
||||||
if (!rsPeers)
|
|
||||||
{
|
|
||||||
/* not ready yet! */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::list<std::string> peers;
|
|
||||||
std::list<std::string>::iterator it;
|
|
||||||
|
|
||||||
mShareList.clear() ;
|
|
||||||
rsPeers->getFriendList(peers);
|
|
||||||
|
|
||||||
/* get a link to the table */
|
|
||||||
QTreeWidget *shareWidget = ui->keyShareList;
|
|
||||||
|
|
||||||
QList<QTreeWidgetItem *> items;
|
|
||||||
|
|
||||||
for(it = peers.begin(); it != peers.end(); it++)
|
|
||||||
{
|
|
||||||
RsPeerDetails detail;
|
|
||||||
if (!rsPeers->getPeerDetails(*it, detail))
|
|
||||||
{
|
|
||||||
continue; /* BAD */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* make a widget per friend */
|
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
|
|
||||||
|
|
||||||
item -> setText(0, PeerDefs::nameWithLocation(detail));
|
|
||||||
if (detail.state & RS_PEER_STATE_CONNECTED) {
|
|
||||||
item -> setTextColor(0,(Qt::darkBlue));
|
|
||||||
}
|
|
||||||
item -> setSizeHint(0, QSize( 17,17 ) );
|
|
||||||
item -> setText(1, QString::fromStdString(detail.id));
|
|
||||||
item -> setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
|
|
||||||
|
|
||||||
item -> setCheckState(0, Qt::Unchecked);
|
|
||||||
|
|
||||||
for(std::list<std::string>::const_iterator it2(friend_list.begin());it2!=friend_list.end();++it2)
|
|
||||||
if(*it == *it2)
|
|
||||||
{
|
|
||||||
item -> setCheckState(0, Qt::Checked);
|
|
||||||
mShareList.push_back(*it) ;
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* add to the list */
|
|
||||||
items.append(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* remove old items */
|
|
||||||
shareWidget->clear();
|
|
||||||
shareWidget->setColumnCount(1);
|
|
||||||
|
|
||||||
/* add the items in! */
|
|
||||||
shareWidget->insertTopLevelItems(0, items);
|
|
||||||
|
|
||||||
shareWidget->update(); /* update display */
|
|
||||||
}
|
|
||||||
|
|
||||||
void CreateLobbyDialog::togglePersonItem( QTreeWidgetItem *item, int /*col*/ )
|
|
||||||
{
|
|
||||||
/* extract id */
|
|
||||||
std::string id = (item -> text(1)).toStdString();
|
|
||||||
|
|
||||||
/* get state */
|
|
||||||
bool checked = (Qt::Checked == item -> checkState(0)); /* alway column 0 */
|
|
||||||
|
|
||||||
/* call control fns */
|
|
||||||
std::list<std::string>::iterator lit = std::find(mShareList.begin(), mShareList.end(), id);
|
|
||||||
|
|
||||||
if(checked && (lit == mShareList.end()))
|
|
||||||
mShareList.push_back(id); // make sure ids not added already
|
|
||||||
else if(lit != mShareList.end())
|
|
||||||
mShareList.erase(lit);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
@ -11,26 +11,19 @@ public:
|
|||||||
/*
|
/*
|
||||||
*@param chanId The channel id to send request for
|
*@param chanId The channel id to send request for
|
||||||
*/
|
*/
|
||||||
CreateLobbyDialog(const std::list<std::string>& friends_list,QWidget *parent = 0, Qt::WFlags flags = 0, std::string grpId = "", int grpType = 0);
|
CreateLobbyDialog(const std::list<std::string>& friends_list,QWidget *parent = 0, Qt::WFlags flags = 0);
|
||||||
~CreateLobbyDialog();
|
~CreateLobbyDialog();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void changeEvent(QEvent *e);
|
void changeEvent(QEvent *e);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setShareList(const std::list<std::string>&);
|
|
||||||
|
|
||||||
Ui::CreateLobbyDialog *ui;
|
Ui::CreateLobbyDialog *ui;
|
||||||
|
|
||||||
std::string mGrpId;
|
|
||||||
std::list<std::string> mShareList;
|
|
||||||
int mGrpType;
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void createLobby();
|
void createLobby();
|
||||||
void checkTextFields();
|
void checkTextFields();
|
||||||
void cancel();
|
void cancel();
|
||||||
void togglePersonItem(QTreeWidgetItem* item, int col);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CREATELOBBYDIALOG_H
|
#endif // CREATELOBBYDIALOG_H
|
||||||
|
@ -225,7 +225,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QTreeWidget" name="keyShareList">
|
<widget class="FriendSelectionWidget" name="keyShareList" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
@ -256,20 +256,6 @@ p, li { white-space: pre-wrap; }
|
|||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>16</width>
|
|
||||||
<height>16</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="sortingEnabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<column>
|
|
||||||
<property name="text">
|
|
||||||
<string>Contacts:</string>
|
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -342,6 +328,14 @@ p, li { white-space: pre-wrap; }
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>FriendSelectionWidget</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>gui/common/FriendSelectionWidget.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../images.qrc"/>
|
<include location="../images.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
|
521
retroshare-gui/src/gui/common/FriendSelectionWidget.cpp
Normal file
521
retroshare-gui/src/gui/common/FriendSelectionWidget.cpp
Normal file
@ -0,0 +1,521 @@
|
|||||||
|
/****************************************************************
|
||||||
|
*
|
||||||
|
* RetroShare is distributed under the following license:
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012, 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 "FriendSelectionWidget.h"
|
||||||
|
#include "ui_FriendSelectionWidget.h"
|
||||||
|
#include "gui/notifyqt.h"
|
||||||
|
#include "gui/common/RSTreeWidgetItem.h"
|
||||||
|
#include "gui/common/StatusDefs.h"
|
||||||
|
#include "gui/common/PeerDefs.h"
|
||||||
|
#include "gui/common/GroupDefs.h"
|
||||||
|
|
||||||
|
#include <retroshare/rspeers.h>
|
||||||
|
#include <retroshare/rsstatus.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
#define COLUMN_NAME 0
|
||||||
|
#define COLUMN_CHECK 0
|
||||||
|
#define COLUMN_DATA 0
|
||||||
|
|
||||||
|
#define ROLE_ID Qt::UserRole
|
||||||
|
#define ROLE_SORT Qt::UserRole + 1
|
||||||
|
|
||||||
|
#define COLOR_CONNECT Qt::blue
|
||||||
|
|
||||||
|
#define IMAGE_GROUP16 ":/images/user/group16.png"
|
||||||
|
#define IMAGE_FRIENDINFO ":/images/peerdetails_16x16.png"
|
||||||
|
|
||||||
|
static bool isSelected(FriendSelectionWidget::Modus modus, QTreeWidgetItem *item)
|
||||||
|
{
|
||||||
|
switch (modus) {
|
||||||
|
case FriendSelectionWidget::MODUS_SINGLE:
|
||||||
|
case FriendSelectionWidget::MODUS_MULTI:
|
||||||
|
return item->isSelected();
|
||||||
|
case FriendSelectionWidget::MODUS_CHECK:
|
||||||
|
return (item->checkState(COLUMN_CHECK) == Qt::Checked);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void setSelected(FriendSelectionWidget::Modus modus, QTreeWidgetItem *item, bool select)
|
||||||
|
{
|
||||||
|
switch (modus) {
|
||||||
|
case FriendSelectionWidget::MODUS_SINGLE:
|
||||||
|
case FriendSelectionWidget::MODUS_MULTI:
|
||||||
|
item->setSelected(select);
|
||||||
|
break;
|
||||||
|
case FriendSelectionWidget::MODUS_CHECK:
|
||||||
|
item->setCheckState(COLUMN_CHECK, select ? Qt::Checked : Qt::Unchecked);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FriendSelectionWidget::FriendSelectionWidget(QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::FriendSelectionWidget)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
started = false;
|
||||||
|
listModus = MODUS_SINGLE;
|
||||||
|
showGroups = true;
|
||||||
|
inItemChanged = false;
|
||||||
|
|
||||||
|
connect(ui->friendList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequested(QPoint)));
|
||||||
|
connect(ui->friendList, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(itemDoubleClicked(QTreeWidgetItem*,int)));
|
||||||
|
connect(ui->friendList, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(itemChanged(QTreeWidgetItem*,int)));
|
||||||
|
connect(ui->filterEdit, SIGNAL(textChanged(const QString &)), this, SLOT(filterChanged()));
|
||||||
|
connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clearFilter()));
|
||||||
|
|
||||||
|
connect(NotifyQt::getInstance(), SIGNAL(groupsChanged(int)), this, SLOT(fillList()));
|
||||||
|
connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(const QString&,int)), this, SLOT(peerStatusChanged(const QString&,int)));
|
||||||
|
|
||||||
|
compareRole = new RSTreeWidgetItemCompareRole;
|
||||||
|
compareRole->setRole(COLUMN_NAME, ROLE_SORT);
|
||||||
|
|
||||||
|
ui->clearButton->hide();
|
||||||
|
|
||||||
|
// sort list by name ascending
|
||||||
|
ui->friendList->sortItems(COLUMN_NAME, Qt::AscendingOrder);
|
||||||
|
}
|
||||||
|
|
||||||
|
FriendSelectionWidget::~FriendSelectionWidget()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FriendSelectionWidget::setHeaderText(const QString &text)
|
||||||
|
{
|
||||||
|
ui->friendList->headerItem()->setText(COLUMN_NAME, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FriendSelectionWidget::setModus(Modus modus)
|
||||||
|
{
|
||||||
|
listModus = modus;
|
||||||
|
|
||||||
|
switch (listModus) {
|
||||||
|
case MODUS_SINGLE:
|
||||||
|
case MODUS_CHECK:
|
||||||
|
ui->friendList->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
|
break;
|
||||||
|
case MODUS_MULTI:
|
||||||
|
ui->friendList->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
fillList();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FriendSelectionWidget::setShowGroups(bool show)
|
||||||
|
{
|
||||||
|
showGroups = show;
|
||||||
|
|
||||||
|
fillList();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FriendSelectionWidget::start()
|
||||||
|
{
|
||||||
|
started = true;
|
||||||
|
fillList();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FriendSelectionWidget::fillList()
|
||||||
|
{
|
||||||
|
if (!started) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get selected items
|
||||||
|
std::list<std::string> sslIdsSelected;
|
||||||
|
selectedSslIds(sslIdsSelected, true);
|
||||||
|
|
||||||
|
std::list<std::string> groupIdsSelected;
|
||||||
|
selectedGroupIds(groupIdsSelected);
|
||||||
|
|
||||||
|
// remove old items
|
||||||
|
ui->friendList->clear();
|
||||||
|
|
||||||
|
// get existing groups
|
||||||
|
std::list<RsGroupInfo> groupInfoList;
|
||||||
|
std::list<RsGroupInfo>::iterator groupIt;
|
||||||
|
rsPeers->getGroupInfoList(groupInfoList);
|
||||||
|
|
||||||
|
std::list<std::string> sslIds;
|
||||||
|
std::list<std::string>::iterator sslIt;
|
||||||
|
rsPeers->getFriendList(sslIds);
|
||||||
|
|
||||||
|
std::list<StatusInfo> statusInfo;
|
||||||
|
rsStatus->getStatusList(statusInfo);
|
||||||
|
|
||||||
|
std::list<std::string> filledSslIds;
|
||||||
|
|
||||||
|
// start with groups
|
||||||
|
groupIt = groupInfoList.begin();
|
||||||
|
while (true) {
|
||||||
|
QTreeWidgetItem *groupItem = NULL;
|
||||||
|
RsGroupInfo *groupInfo = NULL;
|
||||||
|
|
||||||
|
if (showGroups && groupIt != groupInfoList.end()) {
|
||||||
|
groupInfo = &(*groupIt);
|
||||||
|
|
||||||
|
if (groupInfo->peerIds.size() == 0) {
|
||||||
|
// don't show empty groups
|
||||||
|
groupIt++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// add group item
|
||||||
|
groupItem = new RSTreeWidgetItem(compareRole, IDTYPE_GROUP);
|
||||||
|
|
||||||
|
// Add item to the list
|
||||||
|
ui->friendList->addTopLevelItem(groupItem);
|
||||||
|
|
||||||
|
groupItem->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless);
|
||||||
|
groupItem->setTextAlignment(COLUMN_NAME, Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
|
groupItem->setIcon(COLUMN_NAME, QIcon(IMAGE_GROUP16));
|
||||||
|
|
||||||
|
groupItem->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(groupInfo->id));
|
||||||
|
|
||||||
|
groupItem->setExpanded(true);
|
||||||
|
|
||||||
|
QString groupName = GroupDefs::name(*groupInfo);
|
||||||
|
groupItem->setText(COLUMN_NAME, groupName);
|
||||||
|
groupItem->setData(COLUMN_DATA, ROLE_SORT, ((groupInfo->flag & RS_GROUP_FLAG_STANDARD) ? "0 " : "1 ") + groupName);
|
||||||
|
|
||||||
|
if (listModus == MODUS_CHECK) {
|
||||||
|
groupItem->setFlags(Qt::ItemIsUserCheckable | groupItem->flags());
|
||||||
|
groupItem->setCheckState(0, Qt::Unchecked);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (std::find(groupIdsSelected.begin(), groupIdsSelected.end(), groupInfo->id) != groupIdsSelected.end()) {
|
||||||
|
setSelected(listModus, groupItem, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// iterate through ssl ids
|
||||||
|
for (sslIt = sslIds.begin(); sslIt != sslIds.end(); sslIt++) {
|
||||||
|
RsPeerDetails detail;
|
||||||
|
if (!rsPeers->getPeerDetails(*sslIt, detail)) {
|
||||||
|
continue; /* BAD */
|
||||||
|
}
|
||||||
|
|
||||||
|
if (groupInfo) {
|
||||||
|
// we fill a group, check if gpg id is assigned
|
||||||
|
if (std::find(groupInfo->peerIds.begin(), groupInfo->peerIds.end(), detail.gpg_id) == groupInfo->peerIds.end()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// we fill the not assigned ssl ids
|
||||||
|
if (std::find(filledSslIds.begin(), filledSslIds.end(), *sslIt) != filledSslIds.end()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// add equal too, its no problem
|
||||||
|
filledSslIds.push_back(detail.id);
|
||||||
|
|
||||||
|
// make a widget per friend
|
||||||
|
QTreeWidgetItem *item = new RSTreeWidgetItem(compareRole, IDTYPE_SSL);
|
||||||
|
|
||||||
|
QString name = PeerDefs::nameWithLocation(detail);
|
||||||
|
item->setText(COLUMN_NAME, name);
|
||||||
|
|
||||||
|
int state = RS_STATUS_OFFLINE;
|
||||||
|
if (detail.state & RS_PEER_STATE_CONNECTED) {
|
||||||
|
std::list<StatusInfo>::iterator it;
|
||||||
|
for (it = statusInfo.begin(); it != statusInfo.end() ; it++) {
|
||||||
|
if (it->id == detail.id) {
|
||||||
|
state = it->status;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state != (int) RS_STATUS_OFFLINE) {
|
||||||
|
item->setTextColor(COLUMN_NAME, COLOR_CONNECT);
|
||||||
|
}
|
||||||
|
|
||||||
|
item->setIcon(COLUMN_NAME, QIcon(StatusDefs::imageUser(state)));
|
||||||
|
item->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(detail.id));
|
||||||
|
item->setData(COLUMN_DATA, ROLE_SORT, "2 " + name);
|
||||||
|
|
||||||
|
if (listModus == MODUS_CHECK) {
|
||||||
|
item->setFlags(Qt::ItemIsUserCheckable | item->flags());
|
||||||
|
item->setCheckState(0, Qt::Unchecked);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add to the list
|
||||||
|
if (groupItem) {
|
||||||
|
groupItem->addChild(item);
|
||||||
|
} else {
|
||||||
|
ui->friendList->addTopLevelItem(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (std::find(sslIdsSelected.begin(), sslIdsSelected.end(), detail.id) != sslIdsSelected.end()) {
|
||||||
|
setSelected(listModus, item, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (groupIt != groupInfoList.end()) {
|
||||||
|
groupIt++;
|
||||||
|
} else {
|
||||||
|
// all done
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ui->filterEdit->text().isEmpty() == false) {
|
||||||
|
filterItems();
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->friendList->update(); /* update display */
|
||||||
|
|
||||||
|
emit contentChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FriendSelectionWidget::peerStatusChanged(const QString& peerId, int status)
|
||||||
|
{
|
||||||
|
QTreeWidgetItemIterator itemIterator(ui->friendList);
|
||||||
|
QTreeWidgetItem *item;
|
||||||
|
while ((item = *itemIterator) != NULL) {
|
||||||
|
itemIterator++;
|
||||||
|
|
||||||
|
if (item->data(COLUMN_DATA, ROLE_ID).toString() == peerId) {
|
||||||
|
QColor color;
|
||||||
|
if (status != (int) RS_STATUS_OFFLINE) {
|
||||||
|
color = COLOR_CONNECT;
|
||||||
|
}
|
||||||
|
|
||||||
|
item->setTextColor(COLUMN_NAME, color);
|
||||||
|
item->setIcon(COLUMN_NAME, QIcon(StatusDefs::imageUser(status)));
|
||||||
|
//break; no break, friend can assigned to groups more than one
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FriendSelectionWidget::contextMenuRequested(const QPoint &pos)
|
||||||
|
{
|
||||||
|
emit customContextMenuRequested(pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FriendSelectionWidget::itemDoubleClicked(QTreeWidgetItem *item, int /*column*/)
|
||||||
|
{
|
||||||
|
if (!item) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
emit doubleClicked((IdType) item->type(), item->data(COLUMN_DATA, ROLE_ID).toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
void FriendSelectionWidget::itemChanged(QTreeWidgetItem *item, int column)
|
||||||
|
{
|
||||||
|
if (inItemChanged) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (listModus != MODUS_CHECK) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (column != COLUMN_CHECK) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!showGroups) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
inItemChanged = true;
|
||||||
|
|
||||||
|
switch ((IdType) item->type()) {
|
||||||
|
case IDTYPE_NONE:
|
||||||
|
break;
|
||||||
|
case IDTYPE_GROUP:
|
||||||
|
{
|
||||||
|
bool selected = isSelected(listModus, item);
|
||||||
|
|
||||||
|
int childCount = item->childCount();
|
||||||
|
for (int i = 0; i < childCount; ++i) {
|
||||||
|
setSelected(listModus, item->child(i), selected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case IDTYPE_SSL:
|
||||||
|
{
|
||||||
|
QTreeWidgetItem *itemParent = item->parent();
|
||||||
|
if (itemParent == NULL) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
int childCount = itemParent->childCount();
|
||||||
|
bool foundUnselected = false;
|
||||||
|
for (int index = 0; index < childCount; ++index) {
|
||||||
|
if (!isSelected(listModus, itemParent->child(index))) {
|
||||||
|
foundUnselected = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setSelected(listModus, itemParent, !foundUnselected);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
inItemChanged = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FriendSelectionWidget::clearFilter()
|
||||||
|
{
|
||||||
|
ui->filterEdit->clear();
|
||||||
|
ui->filterEdit->setFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FriendSelectionWidget::filterChanged()
|
||||||
|
{
|
||||||
|
QString text = ui->filterEdit->text();
|
||||||
|
|
||||||
|
ui->clearButton->setVisible(!text.isEmpty());
|
||||||
|
|
||||||
|
filterItems();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FriendSelectionWidget::filterItems()
|
||||||
|
{
|
||||||
|
int count = ui->friendList->topLevelItemCount();
|
||||||
|
for (int index = 0; index < count; index++) {
|
||||||
|
filterItem(ui->friendList->topLevelItem(index),ui->filterEdit->text());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FriendSelectionWidget::filterItem(QTreeWidgetItem *item, const QString &text)
|
||||||
|
{
|
||||||
|
bool visible = true;
|
||||||
|
|
||||||
|
if (text.isEmpty() == false) {
|
||||||
|
if (item->text(0).contains(text, Qt::CaseInsensitive) == false) {
|
||||||
|
visible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int visibleChildCount = 0;
|
||||||
|
int count = item->childCount();
|
||||||
|
for (int index = 0; index < count; index++) {
|
||||||
|
if (filterItem(item->child(index), text)) {
|
||||||
|
visibleChildCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (visible || visibleChildCount) {
|
||||||
|
item->setHidden(false);
|
||||||
|
} else {
|
||||||
|
item->setHidden(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (visible || visibleChildCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
int FriendSelectionWidget::selectedItemCount()
|
||||||
|
{
|
||||||
|
return ui->friendList->selectedItems().count();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString FriendSelectionWidget::selectedId(IdType &idType)
|
||||||
|
{
|
||||||
|
QTreeWidgetItem *item = ui->friendList->currentItem();
|
||||||
|
if (!item) {
|
||||||
|
idType = IDTYPE_NONE;
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
idType = (IdType) item->type();
|
||||||
|
return item->data(COLUMN_DATA, ROLE_ID).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FriendSelectionWidget::selectedIds(IdType idType, std::list<std::string> &ids, bool onlyDirectSelected)
|
||||||
|
{
|
||||||
|
QTreeWidgetItemIterator itemIterator(ui->friendList);
|
||||||
|
QTreeWidgetItem *item;
|
||||||
|
while ((item = *itemIterator) != NULL) {
|
||||||
|
itemIterator++;
|
||||||
|
|
||||||
|
std::string id;
|
||||||
|
|
||||||
|
switch ((IdType) item->type()) {
|
||||||
|
case IDTYPE_NONE:
|
||||||
|
break;
|
||||||
|
case IDTYPE_GROUP:
|
||||||
|
if (idType == IDTYPE_GROUP) {
|
||||||
|
if (isSelected(listModus, item)) {
|
||||||
|
id = item->data(COLUMN_DATA, ROLE_ID).toString().toStdString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case IDTYPE_SSL:
|
||||||
|
if (idType == IDTYPE_SSL) {
|
||||||
|
if (isSelected(listModus, item)) {
|
||||||
|
id = item->data(COLUMN_DATA, ROLE_ID).toString().toStdString();
|
||||||
|
} else {
|
||||||
|
if (!onlyDirectSelected) {
|
||||||
|
QTreeWidgetItem *itemParent = item->parent();
|
||||||
|
if (itemParent && isSelected(listModus, itemParent)) {
|
||||||
|
id = item->data(COLUMN_DATA, ROLE_ID).toString().toStdString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!id.empty() && std::find(ids.begin(), ids.end(), id) == ids.end()) {
|
||||||
|
ids.push_back(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FriendSelectionWidget::setSelectedIds(IdType idType, const std::list<std::string> &ids, bool add)
|
||||||
|
{
|
||||||
|
QTreeWidgetItemIterator itemIterator(ui->friendList);
|
||||||
|
QTreeWidgetItem *item;
|
||||||
|
while ((item = *itemIterator) != NULL) {
|
||||||
|
itemIterator++;
|
||||||
|
|
||||||
|
std::string id = item->data(COLUMN_DATA, ROLE_ID).toString().toStdString();
|
||||||
|
IdType itemType = (IdType) item->type();
|
||||||
|
|
||||||
|
switch (itemType) {
|
||||||
|
case IDTYPE_NONE:
|
||||||
|
break;
|
||||||
|
case IDTYPE_GROUP:
|
||||||
|
case IDTYPE_SSL:
|
||||||
|
if (idType == itemType) {
|
||||||
|
if (std::find(ids.begin(), ids.end(), id) != ids.end()) {
|
||||||
|
setSelected(listModus, item, true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!add) {
|
||||||
|
setSelected(listModus, item, false);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
101
retroshare-gui/src/gui/common/FriendSelectionWidget.h
Normal file
101
retroshare-gui/src/gui/common/FriendSelectionWidget.h
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
/****************************************************************
|
||||||
|
*
|
||||||
|
* RetroShare is distributed under the following license:
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012, 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 FRIENDSELECTIONWIDGET_H
|
||||||
|
#define FRIENDSELECTIONWIDGET_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class FriendSelectionWidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
class QTreeWidgetItem;
|
||||||
|
class RSTreeWidgetItemCompareRole;
|
||||||
|
|
||||||
|
class FriendSelectionWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
enum IdType
|
||||||
|
{
|
||||||
|
IDTYPE_NONE,
|
||||||
|
IDTYPE_GROUP,
|
||||||
|
IDTYPE_SSL
|
||||||
|
};
|
||||||
|
|
||||||
|
enum Modus
|
||||||
|
{
|
||||||
|
MODUS_SINGLE,
|
||||||
|
MODUS_MULTI,
|
||||||
|
MODUS_CHECK
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit FriendSelectionWidget(QWidget *parent = 0);
|
||||||
|
~FriendSelectionWidget();
|
||||||
|
|
||||||
|
void setHeaderText(const QString &text);
|
||||||
|
void setModus(Modus modus);
|
||||||
|
void setShowGroups(bool show);
|
||||||
|
void start();
|
||||||
|
|
||||||
|
int selectedItemCount();
|
||||||
|
QString selectedId(IdType &idType);
|
||||||
|
void selectedSslIds(std::list<std::string> &sslIds, bool onlyDirectSelected) { selectedIds(IDTYPE_SSL, sslIds, onlyDirectSelected); }
|
||||||
|
void selectedGroupIds(std::list<std::string> &groupIds) { selectedIds(IDTYPE_GROUP, groupIds, true); }
|
||||||
|
|
||||||
|
void setSelectedSslIds(const std::list<std::string> &sslIds, bool add) { setSelectedIds(IDTYPE_SSL, sslIds, add); }
|
||||||
|
void setSelectedGroupIds(const std::list<std::string> &groupIds, bool add) { setSelectedIds(IDTYPE_GROUP, groupIds, add); }
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void contentChanged();
|
||||||
|
void customContextMenuRequested(const QPoint &pos);
|
||||||
|
void doubleClicked(IdType idType, const QString &id);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void fillList();
|
||||||
|
void peerStatusChanged(const QString& peerId, int status);
|
||||||
|
void filterChanged();
|
||||||
|
void clearFilter();
|
||||||
|
void contextMenuRequested(const QPoint &pos);
|
||||||
|
void itemDoubleClicked(QTreeWidgetItem *item, int column);
|
||||||
|
void itemChanged(QTreeWidgetItem *item, int column);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void filterItems();
|
||||||
|
bool filterItem(QTreeWidgetItem *item, const QString &text);
|
||||||
|
|
||||||
|
void selectedIds(IdType idType, std::list<std::string> &ids, bool onlyDirectSelected);
|
||||||
|
void setSelectedIds(IdType idType, const std::list<std::string> &ids, bool add);
|
||||||
|
|
||||||
|
bool started;
|
||||||
|
RSTreeWidgetItemCompareRole *compareRole;
|
||||||
|
Modus listModus;
|
||||||
|
bool showGroups;
|
||||||
|
bool inItemChanged;
|
||||||
|
|
||||||
|
Ui::FriendSelectionWidget *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FRIENDSELECTIONWIDGET_H
|
123
retroshare-gui/src/gui/common/FriendSelectionWidget.ui
Normal file
123
retroshare-gui/src/gui/common/FriendSelectionWidget.ui
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>FriendSelectionWidget</class>
|
||||||
|
<widget class="QWidget" name="FriendSelectionWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>211</width>
|
||||||
|
<height>358</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="horizontalSpacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="verticalSpacing">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0" colspan="2">
|
||||||
|
<widget class="QLabel" name="filterLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Search for Name:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLineEdit" name="filterEdit">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Search Friends</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QPushButton" name="clearButton">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>16</width>
|
||||||
|
<height>16</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16</width>
|
||||||
|
<height>16</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>MS Shell Dlg 2</family>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Reset</string>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">QPushButton
|
||||||
|
{
|
||||||
|
border-image: url(:/images/closenormal.png)
|
||||||
|
}
|
||||||
|
|
||||||
|
QPushButton:hover
|
||||||
|
{
|
||||||
|
border-image: url(:/images/closehover.png)
|
||||||
|
}
|
||||||
|
|
||||||
|
QPushButton:pressed {
|
||||||
|
border-image: url(:/images/closepressed.png)
|
||||||
|
}</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTreeWidget" name="friendList">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="contextMenuPolicy">
|
||||||
|
<enum>Qt::CustomContextMenu</enum>
|
||||||
|
</property>
|
||||||
|
<property name="editTriggers">
|
||||||
|
<set>QAbstractItemView::NoEditTriggers</set>
|
||||||
|
</property>
|
||||||
|
<property name="sortingEnabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="allColumnsShowFocus">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="expandsOnDoubleClick">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
@ -41,16 +41,17 @@ CreateForum::CreateForum(QWidget *parent)
|
|||||||
connect( ui.cancelButton, SIGNAL( clicked ( bool ) ), this, SLOT( cancelForum( ) ) );
|
connect( ui.cancelButton, SIGNAL( clicked ( bool ) ), this, SLOT( cancelForum( ) ) );
|
||||||
connect( ui.createButton, SIGNAL( clicked ( bool ) ), this, SLOT( createForum( ) ) );
|
connect( ui.createButton, SIGNAL( clicked ( bool ) ), this, SLOT( createForum( ) ) );
|
||||||
connect( ui.pubKeyShare_cb, SIGNAL( clicked() ), this, SLOT( setShareList( ) ));
|
connect( ui.pubKeyShare_cb, SIGNAL( clicked() ), this, SLOT( setShareList( ) ));
|
||||||
connect( ui.keyShareList, SIGNAL(itemChanged( QTreeWidgetItem *, int ) ),
|
|
||||||
this, SLOT(togglePersonItem( QTreeWidgetItem *, int ) ));
|
|
||||||
|
|
||||||
if(!ui.pubKeyShare_cb->isChecked()){
|
|
||||||
|
|
||||||
|
if (!ui.pubKeyShare_cb->isChecked()) {
|
||||||
ui.contactsdockWidget->hide();
|
ui.contactsdockWidget->hide();
|
||||||
this->resize(this->size().width() - ui.contactsdockWidget->size().width(),
|
this->resize(this->size().width() - ui.contactsdockWidget->size().width(), this->size().height());
|
||||||
this->size().height());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* initialize key share list */
|
||||||
|
ui.keyShareList->setHeaderText(tr("Contacts:"));
|
||||||
|
ui.keyShareList->setModus(FriendSelectionWidget::MODUS_CHECK);
|
||||||
|
ui.keyShareList->start();
|
||||||
|
|
||||||
newForum();
|
newForum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,153 +75,56 @@ void CreateForum::newForum()
|
|||||||
ui.forumDesc->clear();
|
ui.forumDesc->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateForum::togglePersonItem( QTreeWidgetItem *item, int /*col*/ )
|
|
||||||
{
|
|
||||||
|
|
||||||
/* extract id */
|
|
||||||
std::string id = (item -> text(1)).toStdString();
|
|
||||||
|
|
||||||
/* get state */
|
|
||||||
bool checked = (Qt::Checked == item -> checkState(0)); /* alway column 0 */
|
|
||||||
|
|
||||||
/* call control fns */
|
|
||||||
std::list<std::string>::iterator lit = std::find(mShareList.begin(), mShareList.end(), id);
|
|
||||||
|
|
||||||
if(checked && (lit == mShareList.end())){
|
|
||||||
|
|
||||||
// make sure ids not added already
|
|
||||||
mShareList.push_back(id);
|
|
||||||
|
|
||||||
}else
|
|
||||||
if(lit != mShareList.end()){
|
|
||||||
|
|
||||||
mShareList.erase(lit);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CreateForum::createForum()
|
void CreateForum::createForum()
|
||||||
{
|
{
|
||||||
QString name = misc::removeNewLine(ui.forumName->text());
|
QString name = misc::removeNewLine(ui.forumName->text());
|
||||||
QString desc = ui.forumDesc->toPlainText(); //toHtml();
|
QString desc = ui.forumDesc->toPlainText(); //toHtml();
|
||||||
uint32_t flags = 0;
|
uint32_t flags = 0;
|
||||||
|
|
||||||
if(name.isEmpty())
|
if(name.isEmpty()) {
|
||||||
{ /* error message */
|
/* error message */
|
||||||
QMessageBox::warning(this, "RetroShare",
|
QMessageBox::warning(this, "RetroShare", tr("Please add a Name"), QMessageBox::Ok, QMessageBox::Ok);
|
||||||
tr("Please add a Name"),
|
|
||||||
QMessageBox::Ok, QMessageBox::Ok);
|
|
||||||
return; //Don't add a empty name!!
|
return; //Don't add a empty name!!
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
|
||||||
if (ui.typePublic->isChecked())
|
if (ui.typePublic->isChecked()) {
|
||||||
{
|
|
||||||
flags |= RS_DISTRIB_PUBLIC;
|
flags |= RS_DISTRIB_PUBLIC;
|
||||||
}
|
} else if (ui.typePrivate->isChecked()) {
|
||||||
else if (ui.typePrivate->isChecked())
|
|
||||||
{
|
|
||||||
flags |= RS_DISTRIB_PRIVATE;
|
flags |= RS_DISTRIB_PRIVATE;
|
||||||
}
|
} else if (ui.typeEncrypted->isChecked()) {
|
||||||
else if (ui.typeEncrypted->isChecked())
|
|
||||||
{
|
|
||||||
flags |= RS_DISTRIB_ENCRYPTED;
|
flags |= RS_DISTRIB_ENCRYPTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ui.msgAuth->isChecked())
|
if (ui.msgAuth->isChecked()) {
|
||||||
{
|
|
||||||
flags |= RS_DISTRIB_AUTHEN_REQ;
|
flags |= RS_DISTRIB_AUTHEN_REQ;
|
||||||
}
|
} else if (ui.msgAnon->isChecked()) {
|
||||||
else if (ui.msgAnon->isChecked())
|
|
||||||
{
|
|
||||||
flags |= RS_DISTRIB_AUTHEN_ANON;
|
flags |= RS_DISTRIB_AUTHEN_ANON;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rsForums)
|
if (rsForums) {
|
||||||
{
|
std::string forumId = rsForums->createForum(name.toStdWString(), desc.toStdWString(), flags);
|
||||||
std::string forumId = rsForums->createForum(name.toStdWString(),
|
|
||||||
desc.toStdWString(), flags);
|
|
||||||
|
|
||||||
if(ui.pubKeyShare_cb->isChecked())
|
if (ui.pubKeyShare_cb->isChecked()) {
|
||||||
rsForums->forumShareKeys(forumId, mShareList);
|
std::list<std::string> shareList;
|
||||||
|
ui.keyShareList->selectedSslIds(shareList, false);
|
||||||
|
rsForums->forumShareKeys(forumId, shareList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateForum::setShareList(){
|
void CreateForum::setShareList()
|
||||||
|
{
|
||||||
if(ui.pubKeyShare_cb->isChecked()){
|
if (ui.pubKeyShare_cb->isChecked()){
|
||||||
this->resize(this->size().width() + ui.contactsdockWidget->size().width(),
|
this->resize(this->size().width() + ui.contactsdockWidget->size().width(), this->size().height());
|
||||||
this->size().height());
|
|
||||||
ui.contactsdockWidget->show();
|
ui.contactsdockWidget->show();
|
||||||
|
} else { // hide share widget
|
||||||
|
|
||||||
if (!rsPeers)
|
|
||||||
{
|
|
||||||
/* not ready yet! */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::list<std::string> peers;
|
|
||||||
std::list<std::string>::iterator it;
|
|
||||||
|
|
||||||
rsPeers->getFriendList(peers);
|
|
||||||
|
|
||||||
/* get a link to the table */
|
|
||||||
QTreeWidget *shareWidget = ui.keyShareList;
|
|
||||||
|
|
||||||
QList<QTreeWidgetItem *> items;
|
|
||||||
|
|
||||||
for(it = peers.begin(); it != peers.end(); it++)
|
|
||||||
{
|
|
||||||
|
|
||||||
RsPeerDetails detail;
|
|
||||||
if (!rsPeers->getPeerDetails(*it, detail))
|
|
||||||
{
|
|
||||||
continue; /* BAD */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* make a widget per friend */
|
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
|
|
||||||
|
|
||||||
item -> setText(0, PeerDefs::nameWithLocation(detail));
|
|
||||||
if (detail.state & RS_PEER_STATE_CONNECTED) {
|
|
||||||
item -> setTextColor(0,(Qt::darkBlue));
|
|
||||||
}
|
|
||||||
item -> setSizeHint(0, QSize( 17,17 ) );
|
|
||||||
|
|
||||||
item -> setText(1, QString::fromStdString(detail.id));
|
|
||||||
|
|
||||||
item -> setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
|
|
||||||
item -> setCheckState(0, Qt::Unchecked);
|
|
||||||
|
|
||||||
|
|
||||||
/* add to the list */
|
|
||||||
items.append(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* remove old items */
|
|
||||||
shareWidget->clear();
|
|
||||||
shareWidget->setColumnCount(1);
|
|
||||||
|
|
||||||
/* add the items in! */
|
|
||||||
shareWidget->insertTopLevelItems(0, items);
|
|
||||||
|
|
||||||
shareWidget->update(); /* update display */
|
|
||||||
|
|
||||||
}else{ // hide share widget
|
|
||||||
ui.contactsdockWidget->hide();
|
ui.contactsdockWidget->hide();
|
||||||
this->resize(this->size().width() - ui.contactsdockWidget->size().width(),
|
this->resize(this->size().width() - ui.contactsdockWidget->size().width(), this->size().height());
|
||||||
this->size().height());
|
|
||||||
mShareList.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CreateForum::cancelForum()
|
void CreateForum::cancelForum()
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
|
@ -32,29 +32,23 @@ class CreateForum : public QDialog
|
|||||||
public:
|
public:
|
||||||
CreateForum(QWidget *parent = 0);
|
CreateForum(QWidget *parent = 0);
|
||||||
|
|
||||||
void newForum(); /* cleanup */
|
void newForum(); /* cleanup */
|
||||||
|
|
||||||
/** Qt Designer generated object */
|
private slots:
|
||||||
Ui::CreateForum ui;
|
/* actions to take.... */
|
||||||
|
void createForum();
|
||||||
|
void cancelForum();
|
||||||
|
|
||||||
|
// set private forum key share list
|
||||||
|
void setShareList();
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::list<std::string> mShareList;
|
||||||
|
|
||||||
QPixmap picture;
|
QPixmap picture;
|
||||||
|
|
||||||
private slots:
|
/** Qt Designer generated object */
|
||||||
|
Ui::CreateForum ui;
|
||||||
/* actions to take.... */
|
|
||||||
void createForum();
|
|
||||||
void cancelForum();
|
|
||||||
|
|
||||||
// set private forum key share list
|
|
||||||
void setShareList();
|
|
||||||
|
|
||||||
// when user checks a person in share list checkboxes
|
|
||||||
void togglePersonItem(QTreeWidgetItem* item, int col);
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
std::list<std::string> mShareList;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -160,7 +160,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QTreeWidget" name="keyShareList">
|
<widget class="FriendSelectionWidget" name="keyShareList" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
@ -191,14 +191,6 @@ p, li { white-space: pre-wrap; }
|
|||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="sortingEnabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<column>
|
|
||||||
<property name="text">
|
|
||||||
<string>Contacts:</string>
|
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -367,6 +359,14 @@ p, li { white-space: pre-wrap; }
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>FriendSelectionWidget</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>gui/common/FriendSelectionWidget.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../images.qrc"/>
|
<include location="../images.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -144,8 +144,6 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WFlags flags)
|
|||||||
connect(ui.actionContactsView, SIGNAL(triggered()), this, SLOT(toggleContacts()));
|
connect(ui.actionContactsView, SIGNAL(triggered()), this, SLOT(toggleContacts()));
|
||||||
connect(ui.actionSaveas, SIGNAL(triggered()), this, SLOT(saveasDraft()));
|
connect(ui.actionSaveas, SIGNAL(triggered()), this, SLOT(saveasDraft()));
|
||||||
connect(ui.actionAttach, SIGNAL(triggered()), this, SLOT(attachFile()));
|
connect(ui.actionAttach, SIGNAL(triggered()), this, SLOT(attachFile()));
|
||||||
connect(ui.filterPatternLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(filterRegExpChanged()));
|
|
||||||
connect(ui.clearButton, SIGNAL(clicked()), this, SLOT(clearFilter()));
|
|
||||||
connect(ui.titleEdit, SIGNAL(textChanged(const QString &)), this, SLOT(titleChanged()));
|
connect(ui.titleEdit, SIGNAL(textChanged(const QString &)), this, SLOT(titleChanged()));
|
||||||
|
|
||||||
connect(ui.sizeincreaseButton, SIGNAL (clicked()), this, SLOT (fontSizeIncrease()));
|
connect(ui.sizeincreaseButton, SIGNAL (clicked()), this, SLOT (fontSizeIncrease()));
|
||||||
@ -165,7 +163,6 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WFlags flags)
|
|||||||
connect(ui.msgText->document(), SIGNAL(redoAvailable(bool)), actionRedo, SLOT(setEnabled(bool)));
|
connect(ui.msgText->document(), SIGNAL(redoAvailable(bool)), actionRedo, SLOT(setEnabled(bool)));
|
||||||
|
|
||||||
connect(ui.msgFileList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuFileList(QPoint)));
|
connect(ui.msgFileList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuFileList(QPoint)));
|
||||||
connect(ui.msgSendList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuMsgSendList(QPoint)));
|
|
||||||
|
|
||||||
connect(ui.hashBox, SIGNAL(fileHashingStarted()), this, SLOT(fileHashingStarted()));
|
connect(ui.hashBox, SIGNAL(fileHashingStarted()), this, SLOT(fileHashingStarted()));
|
||||||
connect(ui.hashBox, SIGNAL(fileHashingFinished(QList<HashedFile>)), this, SLOT(fileHashingFinished(QList<HashedFile>)));
|
connect(ui.hashBox, SIGNAL(fileHashingFinished(QList<HashedFile>)), this, SLOT(fileHashingFinished(QList<HashedFile>)));
|
||||||
@ -194,19 +191,19 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WFlags flags)
|
|||||||
connect(ui.addCcButton, SIGNAL(clicked(void)), this, SLOT(addCc()));
|
connect(ui.addCcButton, SIGNAL(clicked(void)), this, SLOT(addCc()));
|
||||||
connect(ui.addBccButton, SIGNAL(clicked(void)), this, SLOT(addBcc()));
|
connect(ui.addBccButton, SIGNAL(clicked(void)), this, SLOT(addBcc()));
|
||||||
connect(ui.addRecommendButton, SIGNAL(clicked(void)), this, SLOT(addRecommend()));
|
connect(ui.addRecommendButton, SIGNAL(clicked(void)), this, SLOT(addRecommend()));
|
||||||
connect(ui.msgSendList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(addTo()));
|
|
||||||
|
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(groupsChanged(int)), this, SLOT(groupsChanged(int)));
|
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(const QString&,int)), this, SLOT(peerStatusChanged(const QString&,int)));
|
connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(const QString&,int)), this, SLOT(peerStatusChanged(const QString&,int)));
|
||||||
|
connect(ui.friendSelectionWidget, SIGNAL(contentChanged()), this, SLOT(buildCompleter()));
|
||||||
|
connect(ui.friendSelectionWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuMsgSendList(QPoint)));
|
||||||
|
connect(ui.friendSelectionWidget, SIGNAL(doubleClicked(IdType,QString)), this, SLOT(addTo()));
|
||||||
|
|
||||||
/* hide the Tree +/- */
|
/* hide the Tree +/- */
|
||||||
ui.msgFileList -> setRootIsDecorated( false );
|
ui.msgFileList -> setRootIsDecorated( false );
|
||||||
|
|
||||||
/* to hide the header */
|
/* initialize friends list */
|
||||||
//ui.msgSendList->header()->hide();
|
ui.friendSelectionWidget->setHeaderText(tr("Send To:"));
|
||||||
|
ui.friendSelectionWidget->setModus(FriendSelectionWidget::MODUS_MULTI);
|
||||||
/* sort send list by name ascending */
|
ui.friendSelectionWidget->start();
|
||||||
ui.msgSendList->sortItems(0, Qt::AscendingOrder);
|
|
||||||
|
|
||||||
QActionGroup *grp = new QActionGroup(this);
|
QActionGroup *grp = new QActionGroup(this);
|
||||||
connect(grp, SIGNAL(triggered(QAction *)), this, SLOT(textAlign(QAction *)));
|
connect(grp, SIGNAL(triggered(QAction *)), this, SLOT(textAlign(QAction *)));
|
||||||
@ -270,8 +267,6 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WFlags flags)
|
|||||||
QPalette palette = QApplication::palette();
|
QPalette palette = QApplication::palette();
|
||||||
codeBackground = palette.color( QPalette::Active, QPalette::Midlight );
|
codeBackground = palette.color( QPalette::Active, QPalette::Midlight );
|
||||||
|
|
||||||
ui.clearButton->hide();
|
|
||||||
|
|
||||||
ui.recipientWidget->setColumnCount(COLUMN_RECIPIENT_COUNT);
|
ui.recipientWidget->setColumnCount(COLUMN_RECIPIENT_COUNT);
|
||||||
|
|
||||||
QHeaderView *header = ui.recipientWidget->horizontalHeader();
|
QHeaderView *header = ui.recipientWidget->horizontalHeader();
|
||||||
@ -291,8 +286,7 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WFlags flags)
|
|||||||
// load settings
|
// load settings
|
||||||
processSettings(true);
|
processSettings(true);
|
||||||
|
|
||||||
/* worker fns */
|
buildCompleter();
|
||||||
insertSendList();
|
|
||||||
|
|
||||||
/* set focus to subject */
|
/* set focus to subject */
|
||||||
ui.titleEdit->setFocus();
|
ui.titleEdit->setFocus();
|
||||||
@ -499,7 +493,10 @@ void MessageComposer::contextMenuMsgSendList(QPoint)
|
|||||||
{
|
{
|
||||||
QMenu contextMnu(this);
|
QMenu contextMnu(this);
|
||||||
|
|
||||||
int selectedCount = ui.msgSendList->selectedItems().count();
|
int selectedCount = ui.friendSelectionWidget->selectedItemCount();
|
||||||
|
|
||||||
|
FriendSelectionWidget::IdType idType;
|
||||||
|
ui.friendSelectionWidget->selectedId(idType);
|
||||||
|
|
||||||
QAction *action = contextMnu.addAction(QIcon(), tr("Add to \"To\""), this, SLOT(addTo()));
|
QAction *action = contextMnu.addAction(QIcon(), tr("Add to \"To\""), this, SLOT(addTo()));
|
||||||
action->setEnabled(selectedCount);
|
action->setEnabled(selectedCount);
|
||||||
@ -513,7 +510,7 @@ void MessageComposer::contextMenuMsgSendList(QPoint)
|
|||||||
contextMnu.addSeparator();
|
contextMnu.addSeparator();
|
||||||
|
|
||||||
action = contextMnu.addAction(QIcon(IMAGE_FRIENDINFO), tr("Friend Details"), this, SLOT(friendDetails()));
|
action = contextMnu.addAction(QIcon(IMAGE_FRIENDINFO), tr("Friend Details"), this, SLOT(friendDetails()));
|
||||||
action->setEnabled(selectedCount == 1);
|
action->setEnabled(selectedCount == 1 && idType == FriendSelectionWidget::IDTYPE_SSL);
|
||||||
|
|
||||||
contextMnu.exec(QCursor::pos());
|
contextMnu.exec(QCursor::pos());
|
||||||
}
|
}
|
||||||
@ -548,27 +545,8 @@ static void setNewCompleter(QTableWidget *tableWidget, QCompleter *completer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageComposer::insertSendList()
|
void MessageComposer::buildCompleter()
|
||||||
{
|
{
|
||||||
/* get a link to the table */
|
|
||||||
QTreeWidget *sendWidget = ui.msgSendList;
|
|
||||||
|
|
||||||
/* remove old items */
|
|
||||||
sendWidget->clear();
|
|
||||||
sendWidget->setColumnCount(1);
|
|
||||||
|
|
||||||
setNewCompleter(ui.recipientWidget, NULL);
|
|
||||||
if (m_completer) {
|
|
||||||
delete(m_completer);
|
|
||||||
m_completer = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!rsPeers)
|
|
||||||
{
|
|
||||||
/* not ready yet! */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// get existing groups
|
// get existing groups
|
||||||
std::list<RsGroupInfo> groupInfoList;
|
std::list<RsGroupInfo> groupInfoList;
|
||||||
std::list<RsGroupInfo>::iterator groupIt;
|
std::list<RsGroupInfo>::iterator groupIt;
|
||||||
@ -578,118 +556,6 @@ void MessageComposer::insertSendList()
|
|||||||
std::list<std::string>::iterator peerIt;
|
std::list<std::string>::iterator peerIt;
|
||||||
rsPeers->getFriendList(peers);
|
rsPeers->getFriendList(peers);
|
||||||
|
|
||||||
std::list<StatusInfo> statusInfo;
|
|
||||||
rsStatus->getStatusList(statusInfo);
|
|
||||||
|
|
||||||
std::list<std::string> fillPeerIds;
|
|
||||||
|
|
||||||
// start with groups
|
|
||||||
groupIt = groupInfoList.begin();
|
|
||||||
while (true) {
|
|
||||||
QTreeWidgetItem *groupItem = NULL;
|
|
||||||
RsGroupInfo *groupInfo = NULL;
|
|
||||||
|
|
||||||
if (groupIt != groupInfoList.end()) {
|
|
||||||
groupInfo = &(*groupIt);
|
|
||||||
|
|
||||||
if (groupInfo->peerIds.size() == 0) {
|
|
||||||
// don't show empty groups
|
|
||||||
groupIt++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// add group item
|
|
||||||
groupItem = new RSTreeWidgetItem(m_compareRole, TYPE_GROUP);
|
|
||||||
|
|
||||||
// Add item to the list
|
|
||||||
sendWidget->addTopLevelItem(groupItem);
|
|
||||||
|
|
||||||
groupItem->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless);
|
|
||||||
// groupItem->setSizeHint(COLUMN_NAME, QSize(26, 26));
|
|
||||||
groupItem->setTextAlignment(COLUMN_CONTACT_NAME, Qt::AlignLeft | Qt::AlignVCenter);
|
|
||||||
groupItem->setIcon(COLUMN_CONTACT_NAME, QIcon(IMAGE_GROUP16));
|
|
||||||
|
|
||||||
/* used to find back the item */
|
|
||||||
groupItem->setData(COLUMN_CONTACT_DATA, ROLE_CONTACT_ID, QString::fromStdString(groupInfo->id));
|
|
||||||
|
|
||||||
groupItem->setExpanded(true);
|
|
||||||
|
|
||||||
QString groupName = GroupDefs::name(*groupInfo);
|
|
||||||
groupItem->setText(COLUMN_CONTACT_NAME, groupName);
|
|
||||||
groupItem->setData(COLUMN_CONTACT_DATA, ROLE_CONTACT_SORT, ((groupInfo->flag & RS_GROUP_FLAG_STANDARD) ? "0 " : "1 ") + groupName);
|
|
||||||
}
|
|
||||||
|
|
||||||
// iterate through peers
|
|
||||||
for (peerIt = peers.begin(); peerIt != peers.end(); peerIt++) {
|
|
||||||
RsPeerDetails detail;
|
|
||||||
if (!rsPeers->getPeerDetails(*peerIt, detail)) {
|
|
||||||
continue; /* BAD */
|
|
||||||
}
|
|
||||||
|
|
||||||
if (groupInfo) {
|
|
||||||
// we fill a group, check if gpg id is assigned
|
|
||||||
if (std::find(groupInfo->peerIds.begin(), groupInfo->peerIds.end(), detail.gpg_id) == groupInfo->peerIds.end()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// we fill the not assigned gpg ids
|
|
||||||
if (std::find(fillPeerIds.begin(), fillPeerIds.end(), *peerIt) != fillPeerIds.end()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// add equal too, its no problem
|
|
||||||
fillPeerIds.push_back(detail.id);
|
|
||||||
|
|
||||||
/* make a widget per friend */
|
|
||||||
QTreeWidgetItem *item = new RSTreeWidgetItem(m_compareRole, TYPE_SSL);
|
|
||||||
|
|
||||||
/* add all the labels */
|
|
||||||
/* (0) Person */
|
|
||||||
QString name = PeerDefs::nameWithLocation(detail);
|
|
||||||
item->setText(COLUMN_CONTACT_NAME, name);
|
|
||||||
|
|
||||||
int state = RS_STATUS_OFFLINE;
|
|
||||||
if (detail.state & RS_PEER_STATE_CONNECTED) {
|
|
||||||
std::list<StatusInfo>::iterator it;
|
|
||||||
for (it = statusInfo.begin(); it != statusInfo.end() ; it++) {
|
|
||||||
if (it->id == detail.id) {
|
|
||||||
state = it->status;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state != (int) RS_STATUS_OFFLINE) {
|
|
||||||
item->setTextColor(COLUMN_CONTACT_NAME, COLOR_CONNECT);
|
|
||||||
}
|
|
||||||
|
|
||||||
item->setIcon(COLUMN_CONTACT_NAME, QIcon(StatusDefs::imageUser(state)));
|
|
||||||
item->setData(COLUMN_CONTACT_DATA, ROLE_CONTACT_ID, QString::fromStdString(detail.id));
|
|
||||||
item->setData(COLUMN_CONTACT_DATA, ROLE_CONTACT_SORT, "2 " + name);
|
|
||||||
|
|
||||||
// add to the list
|
|
||||||
if (groupItem) {
|
|
||||||
groupItem->addChild(item);
|
|
||||||
} else {
|
|
||||||
sendWidget->addTopLevelItem(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (groupIt != groupInfoList.end()) {
|
|
||||||
groupIt++;
|
|
||||||
} else {
|
|
||||||
// all done
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ui.filterPatternLineEdit->text().isEmpty() == false) {
|
|
||||||
FilterItems();
|
|
||||||
}
|
|
||||||
|
|
||||||
sendWidget->update(); /* update display */
|
|
||||||
|
|
||||||
// create completer list for friends
|
// create completer list for friends
|
||||||
QStringList completerList;
|
QStringList completerList;
|
||||||
QStringList completerGroupList;
|
QStringList completerGroupList;
|
||||||
@ -721,34 +587,8 @@ void MessageComposer::insertSendList()
|
|||||||
setNewCompleter(ui.recipientWidget, m_completer);
|
setNewCompleter(ui.recipientWidget, m_completer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageComposer::groupsChanged(int type)
|
|
||||||
{
|
|
||||||
Q_UNUSED(type);
|
|
||||||
|
|
||||||
insertSendList();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MessageComposer::peerStatusChanged(const QString& peer_id, int status)
|
void MessageComposer::peerStatusChanged(const QString& peer_id, int status)
|
||||||
{
|
{
|
||||||
QTreeWidgetItemIterator itemIterator(ui.msgSendList);
|
|
||||||
QTreeWidgetItem *item;
|
|
||||||
while ((item = *itemIterator) != NULL) {
|
|
||||||
itemIterator++;
|
|
||||||
|
|
||||||
if (item->data(COLUMN_CONTACT_DATA, ROLE_CONTACT_ID).toString() == peer_id) {
|
|
||||||
QColor color;
|
|
||||||
if (status != (int) RS_STATUS_OFFLINE) {
|
|
||||||
color = COLOR_CONNECT;
|
|
||||||
} else {
|
|
||||||
color = Qt::black;
|
|
||||||
}
|
|
||||||
|
|
||||||
item->setTextColor(COLUMN_CONTACT_NAME, color);
|
|
||||||
item->setIcon(COLUMN_CONTACT_NAME, QIcon(StatusDefs::imageUser(status)));
|
|
||||||
//break; no break, peers can assigned to groups more than one
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int rowCount = ui.recipientWidget->rowCount();
|
int rowCount = ui.recipientWidget->rowCount();
|
||||||
int row;
|
int row;
|
||||||
|
|
||||||
@ -2266,75 +2106,20 @@ void MessageComposer::fileHashingFinished(QList<HashedFile> hashedFiles)
|
|||||||
ui.msgFileList->show();
|
ui.msgFileList->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clear Filter */
|
|
||||||
void MessageComposer::clearFilter()
|
|
||||||
{
|
|
||||||
ui.filterPatternLineEdit->clear();
|
|
||||||
ui.filterPatternLineEdit->setFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MessageComposer::filterRegExpChanged()
|
|
||||||
{
|
|
||||||
QString text = ui.filterPatternLineEdit->text();
|
|
||||||
|
|
||||||
if (text.isEmpty()) {
|
|
||||||
ui.clearButton->hide();
|
|
||||||
} else {
|
|
||||||
ui.clearButton->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
FilterItems();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MessageComposer::FilterItems()
|
|
||||||
{
|
|
||||||
QString sPattern = ui.filterPatternLineEdit->text();
|
|
||||||
|
|
||||||
int nCount = ui.msgSendList->topLevelItemCount ();
|
|
||||||
for (int nIndex = 0; nIndex < nCount; nIndex++) {
|
|
||||||
FilterItem(ui.msgSendList->topLevelItem(nIndex), sPattern);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool MessageComposer::FilterItem(QTreeWidgetItem *pItem, QString &sPattern)
|
|
||||||
{
|
|
||||||
bool bVisible = true;
|
|
||||||
|
|
||||||
if (sPattern.isEmpty() == false) {
|
|
||||||
if (pItem->text(0).contains(sPattern, Qt::CaseInsensitive) == false) {
|
|
||||||
bVisible = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int nVisibleChildCount = 0;
|
|
||||||
int nCount = pItem->childCount();
|
|
||||||
for (int nIndex = 0; nIndex < nCount; nIndex++) {
|
|
||||||
if (FilterItem(pItem->child(nIndex), sPattern)) {
|
|
||||||
nVisibleChildCount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bVisible || nVisibleChildCount) {
|
|
||||||
pItem->setHidden(false);
|
|
||||||
} else {
|
|
||||||
pItem->setHidden(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (bVisible || nVisibleChildCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MessageComposer::addContact(enumType type)
|
void MessageComposer::addContact(enumType type)
|
||||||
{
|
{
|
||||||
QTreeWidgetItemIterator itemIterator(ui.msgSendList);
|
std::list<std::string> ids;
|
||||||
QTreeWidgetItem *item;
|
ui.friendSelectionWidget->selectedGroupIds(ids);
|
||||||
while ((item = *itemIterator) != NULL) {
|
|
||||||
itemIterator++;
|
|
||||||
|
|
||||||
if (item->isSelected()) {
|
std::list<std::string>::iterator idIt;
|
||||||
std::string id = item->data(COLUMN_CONTACT_DATA, ROLE_CONTACT_ID).toString().toStdString();
|
for (idIt = ids.begin(); idIt != ids.end(); idIt++) {
|
||||||
bool group = (item->type() == TYPE_GROUP);
|
addRecipient(type, *idIt, true);
|
||||||
addRecipient(type, id, group);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ids.empty();
|
||||||
|
ui.friendSelectionWidget->selectedSslIds(ids, true);
|
||||||
|
for (idIt = ids.begin(); idIt != ids.end(); idIt++) {
|
||||||
|
addRecipient(type, *idIt, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2356,41 +2141,7 @@ void MessageComposer::addBcc()
|
|||||||
void MessageComposer::addRecommend()
|
void MessageComposer::addRecommend()
|
||||||
{
|
{
|
||||||
std::list<std::string> sslIds;
|
std::list<std::string> sslIds;
|
||||||
|
ui.friendSelectionWidget->selectedSslIds(sslIds, false);
|
||||||
QTreeWidgetItemIterator itemIterator(ui.msgSendList);
|
|
||||||
QTreeWidgetItem *item;
|
|
||||||
while ((item = *itemIterator) != NULL) {
|
|
||||||
itemIterator++;
|
|
||||||
|
|
||||||
if (item->isSelected()) {
|
|
||||||
std::string id = item->data(COLUMN_CONTACT_DATA, ROLE_CONTACT_ID).toString().toStdString();
|
|
||||||
bool group = (item->type() == TYPE_GROUP);
|
|
||||||
|
|
||||||
if (group) {
|
|
||||||
RsGroupInfo groupInfo;
|
|
||||||
if (rsPeers->getGroupInfo(id, groupInfo) == false) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::list<std::string>::iterator gpgIt;
|
|
||||||
for (gpgIt = groupInfo.peerIds.begin(); gpgIt != groupInfo.peerIds.end(); gpgIt++) {
|
|
||||||
std::list<std::string> groupSslIds;
|
|
||||||
rsPeers->getAssociatedSSLIds(*gpgIt, groupSslIds);
|
|
||||||
|
|
||||||
std::list<std::string>::iterator sslIt;
|
|
||||||
for (sslIt = groupSslIds.begin(); sslIt != groupSslIds.end(); sslIt++) {
|
|
||||||
if (std::find(sslIds.begin(), sslIds.end(), *sslIt) == sslIds.end()) {
|
|
||||||
sslIds.push_back(*sslIt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (std::find(sslIds.begin(), sslIds.end(), id) == sslIds.end()) {
|
|
||||||
sslIds.push_back(id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sslIds.empty()) {
|
if (sslIds.empty()) {
|
||||||
return;
|
return;
|
||||||
@ -2408,18 +2159,14 @@ void MessageComposer::addRecommend()
|
|||||||
|
|
||||||
void MessageComposer::friendDetails()
|
void MessageComposer::friendDetails()
|
||||||
{
|
{
|
||||||
QList<QTreeWidgetItem*> selectedItems = ui.msgSendList->selectedItems();
|
FriendSelectionWidget::IdType idType;
|
||||||
if (selectedItems.count() != 1) {
|
QString id = ui.friendSelectionWidget->selectedId(idType);
|
||||||
|
|
||||||
|
if (id.isEmpty() || idType != FriendSelectionWidget::IDTYPE_SSL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTreeWidgetItem *item = selectedItems[0];
|
ConfCertDialog::showIt(id.toStdString(), ConfCertDialog::PageDetails);
|
||||||
if (item->type() == TYPE_GROUP) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string id = item->data(COLUMN_CONTACT_DATA, ROLE_CONTACT_ID).toString().toStdString();
|
|
||||||
ConfCertDialog::showIt(id, ConfCertDialog::PageDetails);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageComposer::tagAboutToShow()
|
void MessageComposer::tagAboutToShow()
|
||||||
|
@ -55,7 +55,6 @@ public:
|
|||||||
static MessageComposer *forwardMsg(const std::string &msgId);
|
static MessageComposer *forwardMsg(const std::string &msgId);
|
||||||
|
|
||||||
/* worker fns */
|
/* worker fns */
|
||||||
void insertSendList();
|
|
||||||
void insertFileList(const std::list<DirDetails>&);
|
void insertFileList(const std::list<DirDetails>&);
|
||||||
void insertFileList(const std::list<FileInfo>&);
|
void insertFileList(const std::list<FileInfo>&);
|
||||||
void addFile(const FileInfo &fileInfo);
|
void addFile(const FileInfo &fileInfo);
|
||||||
@ -88,6 +87,7 @@ private slots:
|
|||||||
void pasteRecommended();
|
void pasteRecommended();
|
||||||
void on_contactsdockWidget_visibilityChanged(bool visible);
|
void on_contactsdockWidget_visibilityChanged(bool visible);
|
||||||
void toggleContacts();
|
void toggleContacts();
|
||||||
|
void buildCompleter();
|
||||||
|
|
||||||
void fileNew();
|
void fileNew();
|
||||||
void fileOpen();
|
void fileOpen();
|
||||||
@ -126,8 +126,6 @@ private slots:
|
|||||||
void toggleCode();
|
void toggleCode();
|
||||||
void addPostSplitter();
|
void addPostSplitter();
|
||||||
|
|
||||||
void filterRegExpChanged();
|
|
||||||
void clearFilter();
|
|
||||||
void titleChanged();
|
void titleChanged();
|
||||||
|
|
||||||
// Add to To/Cc/Bcc address fields
|
// Add to To/Cc/Bcc address fields
|
||||||
@ -138,7 +136,6 @@ private slots:
|
|||||||
void editingRecipientFinished();
|
void editingRecipientFinished();
|
||||||
void friendDetails();
|
void friendDetails();
|
||||||
|
|
||||||
void groupsChanged(int type);
|
|
||||||
void peerStatusChanged(const QString& peer_id, int status);
|
void peerStatusChanged(const QString& peer_id, int status);
|
||||||
|
|
||||||
void tagAboutToShow();
|
void tagAboutToShow();
|
||||||
@ -168,9 +165,6 @@ private:
|
|||||||
|
|
||||||
bool sendMessage_internal(bool bDraftbox);
|
bool sendMessage_internal(bool bDraftbox);
|
||||||
|
|
||||||
void FilterItems();
|
|
||||||
bool FilterItem(QTreeWidgetItem *pItem, QString &sPattern);
|
|
||||||
|
|
||||||
void calculateTitle();
|
void calculateTitle();
|
||||||
void addEmptyRecipient();
|
void addEmptyRecipient();
|
||||||
|
|
||||||
|
@ -71,73 +71,7 @@
|
|||||||
<number>1</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<widget class="FriendSelectionWidget" name="friendSelectionWidget" native="true">
|
||||||
<property name="verticalSpacing">
|
|
||||||
<number>2</number>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0" colspan="2">
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>Search for Name:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLineEdit" name="filterPatternLineEdit">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Search Friends</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QPushButton" name="clearButton">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>16</width>
|
|
||||||
<height>16</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16</width>
|
|
||||||
<height>16</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>MS Shell Dlg 2</family>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Reset</string>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">QPushButton
|
|
||||||
{
|
|
||||||
border-image: url(:/images/closenormal.png)
|
|
||||||
}
|
|
||||||
|
|
||||||
QPushButton:hover
|
|
||||||
{
|
|
||||||
border-image: url(:/images/closehover.png)
|
|
||||||
}
|
|
||||||
|
|
||||||
QPushButton:pressed {
|
|
||||||
border-image: url(:/images/closepressed.png)
|
|
||||||
}</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QTreeWidget" name="msgSendList">
|
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
@ -171,23 +105,9 @@ border-image: url(:/images/closepressed.png)
|
|||||||
<property name="contextMenuPolicy">
|
<property name="contextMenuPolicy">
|
||||||
<enum>Qt::CustomContextMenu</enum>
|
<enum>Qt::CustomContextMenu</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="selectionMode">
|
|
||||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sortingEnabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="expandsOnDoubleClick">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<column>
|
|
||||||
<property name="text">
|
|
||||||
<string>Send To:</string>
|
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="2" column="0">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
@ -1044,14 +964,18 @@ border: 1px solid #CCCCCC;}</string>
|
|||||||
<header location="global">gui/common/HashBox.h</header>
|
<header location="global">gui/common/HashBox.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>FriendSelectionWidget</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>gui/common/FriendSelectionWidget.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>recipientWidget</tabstop>
|
<tabstop>recipientWidget</tabstop>
|
||||||
<tabstop>titleEdit</tabstop>
|
<tabstop>titleEdit</tabstop>
|
||||||
<tabstop>msgText</tabstop>
|
<tabstop>msgText</tabstop>
|
||||||
<tabstop>msgFileList</tabstop>
|
<tabstop>msgFileList</tabstop>
|
||||||
<tabstop>filterPatternLineEdit</tabstop>
|
|
||||||
<tabstop>msgSendList</tabstop>
|
|
||||||
<tabstop>addToButton</tabstop>
|
<tabstop>addToButton</tabstop>
|
||||||
<tabstop>addCcButton</tabstop>
|
<tabstop>addCcButton</tabstop>
|
||||||
<tabstop>addBccButton</tabstop>
|
<tabstop>addBccButton</tabstop>
|
||||||
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user