incorporated changed from defnax

This commit is contained in:
csoler 2015-12-04 22:42:56 -05:00
parent 87ede7eff5
commit 39f4878244
9 changed files with 3813 additions and 3641 deletions

View file

@ -285,6 +285,10 @@ void FriendSelectionWidget::secured_fillList()
if (mShowTypes & SHOW_GXS)
selectedIds<RsGxsId,IDTYPE_GXS>(gxsIdsSelected,true);
std::set<RsGxsId> gxsIdsSelected2;
if (mShowTypes & SHOW_CONTACTS)
selectedIds<RsGxsId,IDTYPE_GXS>(gxsIdsSelected2,true);
// remove old items
ui->friendList->clear();
@ -525,6 +529,7 @@ void FriendSelectionWidget::secured_fillList()
// iterate through gpg ids
for (std::vector<RsGxsGroupId>::const_iterator gxsIt = gxsIds.begin(); gxsIt != gxsIds.end(); ++gxsIt)
{
// we fill the not assigned gpg ids
if (std::find(filledIds.begin(), filledIds.end(), (*gxsIt).toStdString()) != filledIds.end())
continue;
@ -570,6 +575,61 @@ void FriendSelectionWidget::secured_fillList()
setSelected(mListModus, gxsItem, true);
}
}
if(mShowTypes & SHOW_CONTACTS)
{
// iterate through gpg ids
for (std::vector<RsGxsGroupId>::const_iterator gxsIt = gxsIds.begin(); gxsIt != gxsIds.end(); ++gxsIt)
{
// we fill the not assigned gpg ids
if (std::find(filledIds.begin(), filledIds.end(), (*gxsIt).toStdString()) != filledIds.end())
continue;
// add equal too, its no problem
filledIds.push_back((*gxsIt).toStdString());
RsIdentityDetails detail;
if (!rsIdentity->getIdDetails(RsGxsId(*gxsIt), detail))
continue; /* BAD */
QList<QIcon> icons ;
GxsIdDetails::getIcons(detail,icons,GxsIdDetails::ICON_TYPE_AVATAR) ;
QIcon identicon = icons.front() ;
if(detail.mFlags & RS_IDENTITY_FLAGS_IS_A_CONTACT)
{
// make a widget per friend
gxsItem = new RSTreeWidgetItem(mCompareRole, IDTYPE_GXS);
QString name = QString::fromUtf8(detail.mNickname.c_str());
gxsItem->setText(COLUMN_NAME, name + " ("+QString::fromStdString( (*gxsIt).toStdString() )+")");
//gxsItem->setTextColor(COLUMN_NAME, textColorOnline());
gxsItem->setFlags(Qt::ItemIsUserCheckable | gxsItem->flags());
gxsItem->setIcon(COLUMN_NAME, identicon);
gxsItem->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(detail.mId.toStdString()));
gxsItem->setData(COLUMN_NAME, ROLE_SORT_GROUP, 1);
gxsItem->setData(COLUMN_NAME, ROLE_SORT_STANDARD_GROUP, 0);
//TODO: online state for gxs items
gxsItem->setData(COLUMN_NAME, ROLE_SORT_STATE, 1);
gxsItem->setData(COLUMN_NAME, ROLE_SORT_NAME, name);
if (mListModus == MODUS_CHECK)
gxsItem->setCheckState(0, Qt::Unchecked);
ui->friendList->addTopLevelItem(gxsItem);
gxsItem->setExpanded(true);
emit itemAdded(IDTYPE_GXS, QString::fromStdString(detail.mId.toStdString()), gxsItem);
if (std::find(gxsIdsSelected.begin(), gxsIdsSelected.end(), detail.mId) != gxsIdsSelected.end())
setSelected(mListModus, gxsItem, true);
}
}
}
if (groupIt != groupInfoList.end()) {
++groupIt;
} else {

View file

@ -65,7 +65,8 @@ public:
SHOW_GPG = 2,
SHOW_SSL = 4,
SHOW_NON_FRIEND_GPG = 8,
SHOW_GXS =16
SHOW_GXS =16,
SHOW_CONTACTS =32
};
Q_DECLARE_FLAGS(ShowTypes, ShowType)

View file

@ -268,7 +268,8 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WindowFlags flags)
/* Add filter types */
ui.filterComboBox->addItem(tr("All"));
ui.filterComboBox->addItem(tr("Friend Nodes"));
ui.filterComboBox->addItem(tr("Distant peer identities"));
ui.filterComboBox->addItem(tr("Persons"));
ui.filterComboBox->addItem(tr("Contacts"));
ui.filterComboBox->setCurrentIndex(0);
connect(ui.comboStyle, SIGNAL(activated(int)),this, SLOT(changeFormatType(int)));
@ -2569,6 +2570,10 @@ void MessageComposer::filterComboBoxChanged(int i)
case 2: ui.friendSelectionWidget->setShowType(FriendSelectionWidget::SHOW_GXS) ;
break ;
case 3: ui.friendSelectionWidget->setShowType(FriendSelectionWidget::SHOW_CONTACTS) ;
break ;
default: ;
}

View file

@ -100,6 +100,9 @@ ChatPage::ChatPage(QWidget * parent, Qt::WindowFlags flags)
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
connect(ui.distantChatcomboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(distantChatComboBoxChanged(int)));
#if QT_VERSION < 0x040600
ui.minimumContrastLabel->hide();
ui.minimumContrast->hide();
@ -120,6 +123,9 @@ ChatPage::save(QString &/*errmsg*/)
Settings->setValue("MinimumContrast", ui.minimumContrast->value());
Settings->endGroup();
// state of distant Chat combobox
Settings->setValue("DistantChat", ui.distantChatcomboBox->currentIndex());
Settings->setChatScreenFont(fontTempChat.toString());
NotifyQt::getInstance()->notifyChatFontChanged();
@ -224,6 +230,10 @@ ChatPage::load()
ui.minimumContrast->setValue(Settings->value("MinimumContrast", 4.5).toDouble());
Settings->endGroup();
// state of distant Chat combobox
int index = Settings->value("DistantChat", 0).toInt();
ui.distantChatcomboBox->setCurrentIndex(index);
fontTempChat.fromString(Settings->getChatScreenFont());
ui.sendMessageWithCtrlReturn->setChecked(Settings->getChatSendMessageWithCtrlReturn());
@ -490,3 +500,21 @@ void ChatPage::on_btSearch_FoundColor_clicked()
ui.btSearch_FoundColor->setIcon(pix);
}
}
void ChatPage::distantChatComboBoxChanged(int i)
{
switch(i)
{
case 0: ;
break ;
case 1: ;
break ;
case 2: ;
break ;
default: ;
}
}

View file

@ -56,6 +56,8 @@ class ChatPage : public ConfigPage
void on_cbSearch_WithoutLimit_toggled(bool);
void on_btSearch_FoundColor_clicked();
void distantChatComboBoxChanged(int);
private:
void setPreviewMessages(QString &stylePath, QString styleVariant, QTextBrowser *textBrowser);

View file

@ -20,8 +20,43 @@
<attribute name="title">
<string>General</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Distant Chat</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="2">
<widget class="QComboBox" name="distantChatcomboBox">
<item>
<property name="text">
<string>Everyone</string>
</property>
</item>
<item>
<property name="text">
<string>Contacts</string>
</property>
</item>
<item>
<property name="text">
<string>Nobody</string>
</property>
</item>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="distantchatlabel">
<property name="text">
<string>Accept encrypted distant chat from</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QGroupBox" name="groupBox">
@ -203,7 +238,7 @@
</item>
</layout>
</item>
<item>
<item row="1" column="1">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="groupBox_2">

View file

@ -39,7 +39,7 @@ MessagePage::MessagePage(QWidget * parent, Qt::WindowFlags flags)
connect (ui.editpushButton, SIGNAL(clicked(bool)), this, SLOT (editTag()));
connect (ui.deletepushButton, SIGNAL(clicked(bool)), this, SLOT (deleteTag()));
connect (ui.defaultTagButton, SIGNAL(clicked(bool)), this, SLOT (defaultTag()));
connect (ui.encryptedMsgs_CB, SIGNAL(toggled(bool)), this, SLOT (toggleEnableEncryptedDistantMsgs(bool)));
//connect (ui.encryptedMsgs_CB, SIGNAL(toggled(bool)), this, SLOT (toggleEnableEncryptedDistantMsgs(bool)));
connect (ui.tags_listWidget, SIGNAL(currentRowChanged(int)), this, SLOT(currentRowChangedTag(int)));
@ -49,6 +49,9 @@ MessagePage::MessagePage(QWidget * parent, Qt::WindowFlags flags)
ui.openComboBox->addItem(tr("A new tab"), RshareSettings::MSG_OPEN_TAB);
ui.openComboBox->addItem(tr("A new window"), RshareSettings::MSG_OPEN_WINDOW);
connect(ui.comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(distantMsgsComboBoxChanged(int)));
//ui.encryptedMsgs_CB->setEnabled(false) ;
}
@ -62,6 +65,25 @@ void MessagePage::toggleEnableEncryptedDistantMsgs(bool b)
rsMail->enableDistantMessaging(b) ;
}
void MessagePage::distantMsgsComboBoxChanged(int i)
{
switch(i)
{
case 0: rsMail->enableDistantMessaging(true) ;
break ;
case 1: ;
break ;
case 2: rsMail->enableDistantMessaging(false) ;
break ;
default: ;
}
}
/** Saves the changes on this page */
bool
MessagePage::save(QString &/*errmsg*/)
@ -70,6 +92,9 @@ MessagePage::save(QString &/*errmsg*/)
Settings->setMsgLoadEmbeddedImages(ui.loadEmbeddedImages->isChecked());
Settings->setMsgOpen((RshareSettings::enumMsgOpen) ui.openComboBox->itemData(ui.openComboBox->currentIndex()).toInt());
// state of distant Message combobox
Settings->setValue("DistantMessages", ui.comboBox->currentIndex());
std::map<uint32_t, std::pair<std::string, uint32_t> >::iterator Tag;
for (Tag = m_pTags->types.begin(); Tag != m_pTags->types.end(); ++Tag) {
// check for changed tags
@ -99,7 +124,12 @@ MessagePage::load()
ui.loadEmbeddedImages->setChecked(Settings->getMsgLoadEmbeddedImages());
ui.openComboBox->setCurrentIndex(ui.openComboBox->findData(Settings->getMsgOpen()));
ui.encryptedMsgs_CB->setChecked(rsMail->distantMessagingEnabled()) ;
//ui.encryptedMsgs_CB->setChecked(rsMail->distantMessagingEnabled()) ;
// state of filter combobox
int index = Settings->value("DistantMessages", 0).toInt();
ui.comboBox->setCurrentIndex(index);
// fill items
rsMail->getMessageTagTypes(*m_pTags);
fillTags();

View file

@ -54,7 +54,9 @@ private slots:
void defaultTag();
void currentRowChangedTag(int row);
void toggleEnableEncryptedDistantMsgs(bool) ;
void toggleEnableEncryptedDistantMsgs(bool) ;
void distantMsgsComboBoxChanged(int);
private:
void fillTags();

View file

@ -59,21 +59,30 @@
<property name="title">
<string>Distant messages:</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;justify&quot;&gt;The link below allows people in the network to send encrypted messages to you, using tunnels. To do that, they need your public PGP key, which they will get using the Retroshare discovery system. &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="2">
<widget class="QComboBox" name="comboBox">
<item>
<property name="text">
<string>Everyone</string>
</property>
</item>
<item>
<property name="text">
<string>Contacts</string>
</property>
</item>
<item>
<property name="text">
<string>Nobody</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QCheckBox" name="encryptedMsgs_CB">
<item row="0" column="1">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Accept encrypted distant messages from everyone</string>
<string>Accept encrypted distant messages from</string>
</property>
</widget>
</item>