mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-25 06:40:58 -04:00
incorporated changed from defnax
This commit is contained in:
parent
87ede7eff5
commit
39f4878244
9 changed files with 3813 additions and 3641 deletions
|
@ -284,6 +284,10 @@ void FriendSelectionWidget::secured_fillList()
|
||||||
std::set<RsGxsId> gxsIdsSelected;
|
std::set<RsGxsId> gxsIdsSelected;
|
||||||
if (mShowTypes & SHOW_GXS)
|
if (mShowTypes & SHOW_GXS)
|
||||||
selectedIds<RsGxsId,IDTYPE_GXS>(gxsIdsSelected,true);
|
selectedIds<RsGxsId,IDTYPE_GXS>(gxsIdsSelected,true);
|
||||||
|
|
||||||
|
std::set<RsGxsId> gxsIdsSelected2;
|
||||||
|
if (mShowTypes & SHOW_CONTACTS)
|
||||||
|
selectedIds<RsGxsId,IDTYPE_GXS>(gxsIdsSelected2,true);
|
||||||
|
|
||||||
// remove old items
|
// remove old items
|
||||||
ui->friendList->clear();
|
ui->friendList->clear();
|
||||||
|
@ -525,6 +529,7 @@ void FriendSelectionWidget::secured_fillList()
|
||||||
// iterate through gpg ids
|
// iterate through gpg ids
|
||||||
for (std::vector<RsGxsGroupId>::const_iterator gxsIt = gxsIds.begin(); gxsIt != gxsIds.end(); ++gxsIt)
|
for (std::vector<RsGxsGroupId>::const_iterator gxsIt = gxsIds.begin(); gxsIt != gxsIds.end(); ++gxsIt)
|
||||||
{
|
{
|
||||||
|
|
||||||
// we fill the not assigned gpg ids
|
// we fill the not assigned gpg ids
|
||||||
if (std::find(filledIds.begin(), filledIds.end(), (*gxsIt).toStdString()) != filledIds.end())
|
if (std::find(filledIds.begin(), filledIds.end(), (*gxsIt).toStdString()) != filledIds.end())
|
||||||
continue;
|
continue;
|
||||||
|
@ -570,6 +575,61 @@ void FriendSelectionWidget::secured_fillList()
|
||||||
setSelected(mListModus, gxsItem, true);
|
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()) {
|
if (groupIt != groupInfoList.end()) {
|
||||||
++groupIt;
|
++groupIt;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -65,7 +65,8 @@ public:
|
||||||
SHOW_GPG = 2,
|
SHOW_GPG = 2,
|
||||||
SHOW_SSL = 4,
|
SHOW_SSL = 4,
|
||||||
SHOW_NON_FRIEND_GPG = 8,
|
SHOW_NON_FRIEND_GPG = 8,
|
||||||
SHOW_GXS =16
|
SHOW_GXS =16,
|
||||||
|
SHOW_CONTACTS =32
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_FLAGS(ShowTypes, ShowType)
|
Q_DECLARE_FLAGS(ShowTypes, ShowType)
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,79 +1,81 @@
|
||||||
/****************************************************************
|
/****************************************************************
|
||||||
* RetroShare is distributed under the following license:
|
* RetroShare is distributed under the following license:
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006 - 2010 RetroShare Team
|
* Copyright (C) 2006 - 2010 RetroShare Team
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation; either version 2
|
* as published by the Free Software Foundation; either version 2
|
||||||
* of the License, or (at your option) any later version.
|
* of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
* Boston, MA 02110-1301, USA.
|
* Boston, MA 02110-1301, USA.
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
#ifndef _CHATPAGE_H
|
#ifndef _CHATPAGE_H
|
||||||
#define _CHATPAGE_H
|
#define _CHATPAGE_H
|
||||||
|
|
||||||
#include <retroshare-gui/configpage.h>
|
#include <retroshare-gui/configpage.h>
|
||||||
#include "ui_ChatPage.h"
|
#include "ui_ChatPage.h"
|
||||||
|
|
||||||
class ChatPage : public ConfigPage
|
class ChatPage : public ConfigPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** Default Constructor */
|
/** Default Constructor */
|
||||||
ChatPage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
|
ChatPage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
|
||||||
/** Default Destructor */
|
/** Default Destructor */
|
||||||
~ChatPage() {}
|
~ChatPage() {}
|
||||||
|
|
||||||
/** Saves the changes on this page */
|
/** Saves the changes on this page */
|
||||||
virtual bool save(QString &errmsg);
|
virtual bool save(QString &errmsg);
|
||||||
/** Loads the settings for this page */
|
/** Loads the settings for this page */
|
||||||
virtual void load();
|
virtual void load();
|
||||||
|
|
||||||
virtual QPixmap iconPixmap() const { return QPixmap(":/images/chat_24.png") ; }
|
virtual QPixmap iconPixmap() const { return QPixmap(":/images/chat_24.png") ; }
|
||||||
virtual QString pageName() const { return tr("Chat") ; }
|
virtual QString pageName() const { return tr("Chat") ; }
|
||||||
virtual QString helpText() const { return ""; }
|
virtual QString helpText() const { return ""; }
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_historyComboBoxVariant_currentIndexChanged(int index);
|
void on_historyComboBoxVariant_currentIndexChanged(int index);
|
||||||
void on_privateComboBoxVariant_currentIndexChanged(int index);
|
void on_privateComboBoxVariant_currentIndexChanged(int index);
|
||||||
void on_publicComboBoxVariant_currentIndexChanged(int index);
|
void on_publicComboBoxVariant_currentIndexChanged(int index);
|
||||||
void on_pushButtonChangeChatFont_clicked();
|
void on_pushButtonChangeChatFont_clicked();
|
||||||
void on_publicList_currentRowChanged(int currentRow);
|
void on_publicList_currentRowChanged(int currentRow);
|
||||||
void on_privateList_currentRowChanged(int currentRow);
|
void on_privateList_currentRowChanged(int currentRow);
|
||||||
void on_historyList_currentRowChanged(int currentRow);
|
void on_historyList_currentRowChanged(int currentRow);
|
||||||
|
|
||||||
void on_cbSearch_WithoutLimit_toggled(bool);
|
void on_cbSearch_WithoutLimit_toggled(bool);
|
||||||
void on_btSearch_FoundColor_clicked();
|
void on_btSearch_FoundColor_clicked();
|
||||||
|
|
||||||
|
void distantChatComboBoxChanged(int);
|
||||||
private:
|
|
||||||
void setPreviewMessages(QString &stylePath, QString styleVariant, QTextBrowser *textBrowser);
|
|
||||||
void fillPreview(QListWidget *listWidget, QComboBox *comboBox, QTextBrowser *textBrowser);
|
private:
|
||||||
|
void setPreviewMessages(QString &stylePath, QString styleVariant, QTextBrowser *textBrowser);
|
||||||
QFont fontTempChat;
|
void fillPreview(QListWidget *listWidget, QComboBox *comboBox, QTextBrowser *textBrowser);
|
||||||
|
|
||||||
QString publicStylePath;
|
QFont fontTempChat;
|
||||||
QString publicStyleVariant;
|
|
||||||
QString privateStylePath;
|
QString publicStylePath;
|
||||||
QString privateStyleVariant;
|
QString publicStyleVariant;
|
||||||
QString historyStylePath;
|
QString privateStylePath;
|
||||||
QString historyStyleVariant;
|
QString privateStyleVariant;
|
||||||
|
QString historyStylePath;
|
||||||
QRgb rgbChatSearchFoundColor;
|
QString historyStyleVariant;
|
||||||
|
|
||||||
/** Qt Designer generated object */
|
QRgb rgbChatSearchFoundColor;
|
||||||
Ui::ChatPage ui;
|
|
||||||
};
|
/** Qt Designer generated object */
|
||||||
|
Ui::ChatPage ui;
|
||||||
#endif
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -20,8 +20,43 @@
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>General</string>
|
<string>General</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<layout class="QGridLayout" name="gridLayout_5">
|
||||||
<item>
|
<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">
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
@ -203,7 +238,7 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="1" column="1">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox_2">
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
|
|
|
@ -1,239 +1,269 @@
|
||||||
/****************************************************************
|
/****************************************************************
|
||||||
* RetroShare is distributed under the following license:
|
* RetroShare is distributed under the following license:
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006, crypton
|
* Copyright (C) 2006, crypton
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation; either version 2
|
* as published by the Free Software Foundation; either version 2
|
||||||
* of the License, or (at your option) any later version.
|
* of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
* Boston, MA 02110-1301, USA.
|
* Boston, MA 02110-1301, USA.
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
#include "rshare.h"
|
#include "rshare.h"
|
||||||
#include "rsharesettings.h"
|
#include "rsharesettings.h"
|
||||||
#include "retroshare/rsmsgs.h"
|
#include "retroshare/rsmsgs.h"
|
||||||
|
|
||||||
#include "MessagePage.h"
|
#include "MessagePage.h"
|
||||||
#include "gui/common/TagDefs.h"
|
#include "gui/common/TagDefs.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "NewTag.h"
|
#include "NewTag.h"
|
||||||
|
|
||||||
MessagePage::MessagePage(QWidget * parent, Qt::WindowFlags flags)
|
MessagePage::MessagePage(QWidget * parent, Qt::WindowFlags flags)
|
||||||
: ConfigPage(parent, flags)
|
: ConfigPage(parent, flags)
|
||||||
{
|
{
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
||||||
m_pTags = new MsgTagType;
|
m_pTags = new MsgTagType;
|
||||||
|
|
||||||
connect (ui.addpushButton, SIGNAL(clicked(bool)), this, SLOT (addTag()));
|
connect (ui.addpushButton, SIGNAL(clicked(bool)), this, SLOT (addTag()));
|
||||||
connect (ui.editpushButton, SIGNAL(clicked(bool)), this, SLOT (editTag()));
|
connect (ui.editpushButton, SIGNAL(clicked(bool)), this, SLOT (editTag()));
|
||||||
connect (ui.deletepushButton, SIGNAL(clicked(bool)), this, SLOT (deleteTag()));
|
connect (ui.deletepushButton, SIGNAL(clicked(bool)), this, SLOT (deleteTag()));
|
||||||
connect (ui.defaultTagButton, SIGNAL(clicked(bool)), this, SLOT (defaultTag()));
|
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)));
|
connect (ui.tags_listWidget, SIGNAL(currentRowChanged(int)), this, SLOT(currentRowChangedTag(int)));
|
||||||
|
|
||||||
ui.editpushButton->setEnabled(false);
|
ui.editpushButton->setEnabled(false);
|
||||||
ui.deletepushButton->setEnabled(false);
|
ui.deletepushButton->setEnabled(false);
|
||||||
|
|
||||||
ui.openComboBox->addItem(tr("A new tab"), RshareSettings::MSG_OPEN_TAB);
|
ui.openComboBox->addItem(tr("A new tab"), RshareSettings::MSG_OPEN_TAB);
|
||||||
ui.openComboBox->addItem(tr("A new window"), RshareSettings::MSG_OPEN_WINDOW);
|
ui.openComboBox->addItem(tr("A new window"), RshareSettings::MSG_OPEN_WINDOW);
|
||||||
|
|
||||||
//ui.encryptedMsgs_CB->setEnabled(false) ;
|
connect(ui.comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(distantMsgsComboBoxChanged(int)));
|
||||||
}
|
|
||||||
|
|
||||||
MessagePage::~MessagePage()
|
//ui.encryptedMsgs_CB->setEnabled(false) ;
|
||||||
{
|
}
|
||||||
delete(m_pTags);
|
|
||||||
}
|
MessagePage::~MessagePage()
|
||||||
|
{
|
||||||
void MessagePage::toggleEnableEncryptedDistantMsgs(bool b)
|
delete(m_pTags);
|
||||||
{
|
}
|
||||||
rsMail->enableDistantMessaging(b) ;
|
|
||||||
}
|
void MessagePage::toggleEnableEncryptedDistantMsgs(bool b)
|
||||||
|
{
|
||||||
/** Saves the changes on this page */
|
rsMail->enableDistantMessaging(b) ;
|
||||||
bool
|
}
|
||||||
MessagePage::save(QString &/*errmsg*/)
|
|
||||||
{
|
void MessagePage::distantMsgsComboBoxChanged(int i)
|
||||||
Settings->setMsgSetToReadOnActivate(ui.setMsgToReadOnActivate->isChecked());
|
{
|
||||||
Settings->setMsgLoadEmbeddedImages(ui.loadEmbeddedImages->isChecked());
|
switch(i)
|
||||||
Settings->setMsgOpen((RshareSettings::enumMsgOpen) ui.openComboBox->itemData(ui.openComboBox->currentIndex()).toInt());
|
{
|
||||||
|
case 0: rsMail->enableDistantMessaging(true) ;
|
||||||
std::map<uint32_t, std::pair<std::string, uint32_t> >::iterator Tag;
|
break ;
|
||||||
for (Tag = m_pTags->types.begin(); Tag != m_pTags->types.end(); ++Tag) {
|
|
||||||
// check for changed tags
|
case 1: ;
|
||||||
std::list<uint32_t>::iterator changedTagId;
|
break ;
|
||||||
for (changedTagId = m_changedTagIds.begin(); changedTagId != m_changedTagIds.end(); ++changedTagId) {
|
|
||||||
if (*changedTagId == Tag->first) {
|
case 2: rsMail->enableDistantMessaging(false) ;
|
||||||
if (Tag->second.first.empty()) {
|
break ;
|
||||||
// delete tag
|
|
||||||
rsMail->removeMessageTagType(Tag->first);
|
|
||||||
continue;
|
default: ;
|
||||||
}
|
}
|
||||||
|
|
||||||
rsMail->setMessageTagType(Tag->first, Tag->second.first, Tag->second.second);
|
}
|
||||||
break;
|
|
||||||
}
|
/** Saves the changes on this page */
|
||||||
}
|
bool
|
||||||
}
|
MessagePage::save(QString &/*errmsg*/)
|
||||||
|
{
|
||||||
return true;
|
Settings->setMsgSetToReadOnActivate(ui.setMsgToReadOnActivate->isChecked());
|
||||||
}
|
Settings->setMsgLoadEmbeddedImages(ui.loadEmbeddedImages->isChecked());
|
||||||
|
Settings->setMsgOpen((RshareSettings::enumMsgOpen) ui.openComboBox->itemData(ui.openComboBox->currentIndex()).toInt());
|
||||||
/** Loads the settings for this page */
|
|
||||||
void
|
// state of distant Message combobox
|
||||||
MessagePage::load()
|
Settings->setValue("DistantMessages", ui.comboBox->currentIndex());
|
||||||
{
|
|
||||||
ui.setMsgToReadOnActivate->setChecked(Settings->getMsgSetToReadOnActivate());
|
std::map<uint32_t, std::pair<std::string, uint32_t> >::iterator Tag;
|
||||||
ui.loadEmbeddedImages->setChecked(Settings->getMsgLoadEmbeddedImages());
|
for (Tag = m_pTags->types.begin(); Tag != m_pTags->types.end(); ++Tag) {
|
||||||
ui.openComboBox->setCurrentIndex(ui.openComboBox->findData(Settings->getMsgOpen()));
|
// check for changed tags
|
||||||
|
std::list<uint32_t>::iterator changedTagId;
|
||||||
ui.encryptedMsgs_CB->setChecked(rsMail->distantMessagingEnabled()) ;
|
for (changedTagId = m_changedTagIds.begin(); changedTagId != m_changedTagIds.end(); ++changedTagId) {
|
||||||
// fill items
|
if (*changedTagId == Tag->first) {
|
||||||
rsMail->getMessageTagTypes(*m_pTags);
|
if (Tag->second.first.empty()) {
|
||||||
fillTags();
|
// delete tag
|
||||||
}
|
rsMail->removeMessageTagType(Tag->first);
|
||||||
|
continue;
|
||||||
// fill tags
|
}
|
||||||
void MessagePage::fillTags()
|
|
||||||
{
|
rsMail->setMessageTagType(Tag->first, Tag->second.first, Tag->second.second);
|
||||||
ui.tags_listWidget->clear();
|
break;
|
||||||
|
}
|
||||||
std::map<uint32_t, std::pair<std::string, uint32_t> >::iterator Tag;
|
}
|
||||||
for (Tag = m_pTags->types.begin(); Tag != m_pTags->types.end(); ++Tag) {
|
}
|
||||||
QString text = TagDefs::name(Tag->first, Tag->second.first);
|
|
||||||
|
return true;
|
||||||
QListWidgetItem *pItemWidget = new QListWidgetItem(text, ui.tags_listWidget);
|
}
|
||||||
pItemWidget->setTextColor(QColor(Tag->second.second));
|
|
||||||
pItemWidget->setData(Qt::UserRole, Tag->first);
|
/** Loads the settings for this page */
|
||||||
}
|
void
|
||||||
}
|
MessagePage::load()
|
||||||
|
{
|
||||||
void MessagePage::addTag()
|
ui.setMsgToReadOnActivate->setChecked(Settings->getMsgSetToReadOnActivate());
|
||||||
{
|
ui.loadEmbeddedImages->setChecked(Settings->getMsgLoadEmbeddedImages());
|
||||||
NewTag TagDlg(*m_pTags);
|
ui.openComboBox->setCurrentIndex(ui.openComboBox->findData(Settings->getMsgOpen()));
|
||||||
if (TagDlg.exec() == QDialog::Accepted && TagDlg.m_nId) {
|
|
||||||
std::map<uint32_t, std::pair<std::string, uint32_t> >::iterator Tag;
|
//ui.encryptedMsgs_CB->setChecked(rsMail->distantMessagingEnabled()) ;
|
||||||
Tag = m_pTags->types.find(TagDlg.m_nId);
|
|
||||||
if (Tag != m_pTags->types.end()) {
|
// state of filter combobox
|
||||||
QString text = TagDefs::name(Tag->first, Tag->second.first);
|
int index = Settings->value("DistantMessages", 0).toInt();
|
||||||
|
ui.comboBox->setCurrentIndex(index);
|
||||||
QListWidgetItem *pItemWidget = new QListWidgetItem(text, ui.tags_listWidget);
|
|
||||||
pItemWidget->setTextColor(QColor(Tag->second.second));
|
// fill items
|
||||||
pItemWidget->setData(Qt::UserRole, TagDlg.m_nId);
|
rsMail->getMessageTagTypes(*m_pTags);
|
||||||
|
fillTags();
|
||||||
m_changedTagIds.push_back(TagDlg.m_nId);
|
}
|
||||||
}
|
|
||||||
}
|
// fill tags
|
||||||
}
|
void MessagePage::fillTags()
|
||||||
|
{
|
||||||
void MessagePage::editTag()
|
ui.tags_listWidget->clear();
|
||||||
{
|
|
||||||
QListWidgetItem *pItemWidget = ui.tags_listWidget->currentItem();
|
std::map<uint32_t, std::pair<std::string, uint32_t> >::iterator Tag;
|
||||||
if (pItemWidget == NULL) {
|
for (Tag = m_pTags->types.begin(); Tag != m_pTags->types.end(); ++Tag) {
|
||||||
return;
|
QString text = TagDefs::name(Tag->first, Tag->second.first);
|
||||||
}
|
|
||||||
|
QListWidgetItem *pItemWidget = new QListWidgetItem(text, ui.tags_listWidget);
|
||||||
uint32_t nId = pItemWidget->data(Qt::UserRole).toInt();
|
pItemWidget->setTextColor(QColor(Tag->second.second));
|
||||||
if (nId == 0) {
|
pItemWidget->setData(Qt::UserRole, Tag->first);
|
||||||
return;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NewTag TagDlg(*m_pTags, nId);
|
void MessagePage::addTag()
|
||||||
TagDlg.setWindowTitle(tr("Edit Tag"));
|
{
|
||||||
if (TagDlg.exec() == QDialog::Accepted && TagDlg.m_nId) {
|
NewTag TagDlg(*m_pTags);
|
||||||
std::map<uint32_t, std::pair<std::string, uint32_t> >::iterator Tag;
|
if (TagDlg.exec() == QDialog::Accepted && TagDlg.m_nId) {
|
||||||
Tag = m_pTags->types.find(TagDlg.m_nId);
|
std::map<uint32_t, std::pair<std::string, uint32_t> >::iterator Tag;
|
||||||
if (Tag != m_pTags->types.end()) {
|
Tag = m_pTags->types.find(TagDlg.m_nId);
|
||||||
if (Tag->first >= RS_MSGTAGTYPE_USER) {
|
if (Tag != m_pTags->types.end()) {
|
||||||
pItemWidget->setText(QString::fromStdString(Tag->second.first));
|
QString text = TagDefs::name(Tag->first, Tag->second.first);
|
||||||
}
|
|
||||||
pItemWidget->setTextColor(QColor(Tag->second.second));
|
QListWidgetItem *pItemWidget = new QListWidgetItem(text, ui.tags_listWidget);
|
||||||
|
pItemWidget->setTextColor(QColor(Tag->second.second));
|
||||||
if (std::find(m_changedTagIds.begin(), m_changedTagIds.end(), TagDlg.m_nId) == m_changedTagIds.end()) {
|
pItemWidget->setData(Qt::UserRole, TagDlg.m_nId);
|
||||||
m_changedTagIds.push_back(TagDlg.m_nId);
|
|
||||||
}
|
m_changedTagIds.push_back(TagDlg.m_nId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagePage::deleteTag()
|
void MessagePage::editTag()
|
||||||
{
|
{
|
||||||
QListWidgetItem *pItemWidget = ui.tags_listWidget->currentItem();
|
QListWidgetItem *pItemWidget = ui.tags_listWidget->currentItem();
|
||||||
if (pItemWidget == NULL) {
|
if (pItemWidget == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nId = pItemWidget->data(Qt::UserRole).toInt();
|
uint32_t nId = pItemWidget->data(Qt::UserRole).toInt();
|
||||||
if (nId == 0) {
|
if (nId == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nId < RS_MSGTAGTYPE_USER) {
|
NewTag TagDlg(*m_pTags, nId);
|
||||||
// can't delete standard tag item
|
TagDlg.setWindowTitle(tr("Edit Tag"));
|
||||||
return;
|
if (TagDlg.exec() == QDialog::Accepted && TagDlg.m_nId) {
|
||||||
}
|
std::map<uint32_t, std::pair<std::string, uint32_t> >::iterator Tag;
|
||||||
|
Tag = m_pTags->types.find(TagDlg.m_nId);
|
||||||
std::map<uint32_t, std::pair<std::string, uint32_t> >::iterator Tag;
|
if (Tag != m_pTags->types.end()) {
|
||||||
Tag = m_pTags->types.find(nId);
|
if (Tag->first >= RS_MSGTAGTYPE_USER) {
|
||||||
if (Tag != m_pTags->types.end()) {
|
pItemWidget->setText(QString::fromStdString(Tag->second.first));
|
||||||
// erase the text for later delete
|
}
|
||||||
Tag->second.first.erase();
|
pItemWidget->setTextColor(QColor(Tag->second.second));
|
||||||
}
|
|
||||||
|
if (std::find(m_changedTagIds.begin(), m_changedTagIds.end(), TagDlg.m_nId) == m_changedTagIds.end()) {
|
||||||
ui.tags_listWidget->removeItemWidget(pItemWidget);
|
m_changedTagIds.push_back(TagDlg.m_nId);
|
||||||
delete (pItemWidget);
|
}
|
||||||
|
}
|
||||||
if (std::find(m_changedTagIds.begin(), m_changedTagIds.end(), nId) == m_changedTagIds.end()) {
|
}
|
||||||
m_changedTagIds.push_back(nId);
|
}
|
||||||
}
|
|
||||||
}
|
void MessagePage::deleteTag()
|
||||||
|
{
|
||||||
void MessagePage::defaultTag()
|
QListWidgetItem *pItemWidget = ui.tags_listWidget->currentItem();
|
||||||
{
|
if (pItemWidget == NULL) {
|
||||||
rsMail->resetMessageStandardTagTypes(*m_pTags);
|
return;
|
||||||
|
}
|
||||||
// add all standard items to changed list
|
|
||||||
std::map<uint32_t, std::pair<std::string, uint32_t> >::iterator Tag;
|
uint32_t nId = pItemWidget->data(Qt::UserRole).toInt();
|
||||||
for (Tag = m_pTags->types.begin(); Tag != m_pTags->types.end(); ++Tag) {
|
if (nId == 0) {
|
||||||
if (Tag->first < RS_MSGTAGTYPE_USER) {
|
return;
|
||||||
if (std::find(m_changedTagIds.begin(), m_changedTagIds.end(), Tag->first) == m_changedTagIds.end()) {
|
}
|
||||||
m_changedTagIds.push_back(Tag->first);
|
|
||||||
}
|
if (nId < RS_MSGTAGTYPE_USER) {
|
||||||
}
|
// can't delete standard tag item
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
fillTags();
|
|
||||||
}
|
std::map<uint32_t, std::pair<std::string, uint32_t> >::iterator Tag;
|
||||||
|
Tag = m_pTags->types.find(nId);
|
||||||
void MessagePage::currentRowChangedTag(int row)
|
if (Tag != m_pTags->types.end()) {
|
||||||
{
|
// erase the text for later delete
|
||||||
QListWidgetItem *pItemWidget = ui.tags_listWidget->item(row);
|
Tag->second.first.erase();
|
||||||
|
}
|
||||||
bool bEditEnable = false;
|
|
||||||
bool bDeleteEnable = false;
|
ui.tags_listWidget->removeItemWidget(pItemWidget);
|
||||||
|
delete (pItemWidget);
|
||||||
if (pItemWidget) {
|
|
||||||
bEditEnable = true;
|
if (std::find(m_changedTagIds.begin(), m_changedTagIds.end(), nId) == m_changedTagIds.end()) {
|
||||||
|
m_changedTagIds.push_back(nId);
|
||||||
uint32_t nId = pItemWidget->data(Qt::UserRole).toInt();
|
}
|
||||||
|
}
|
||||||
if (nId >= RS_MSGTAGTYPE_USER) {
|
|
||||||
bDeleteEnable = true;
|
void MessagePage::defaultTag()
|
||||||
}
|
{
|
||||||
}
|
rsMail->resetMessageStandardTagTypes(*m_pTags);
|
||||||
|
|
||||||
ui.editpushButton->setEnabled(bEditEnable);
|
// add all standard items to changed list
|
||||||
ui.deletepushButton->setEnabled(bDeleteEnable);
|
std::map<uint32_t, std::pair<std::string, uint32_t> >::iterator Tag;
|
||||||
}
|
for (Tag = m_pTags->types.begin(); Tag != m_pTags->types.end(); ++Tag) {
|
||||||
|
if (Tag->first < RS_MSGTAGTYPE_USER) {
|
||||||
|
if (std::find(m_changedTagIds.begin(), m_changedTagIds.end(), Tag->first) == m_changedTagIds.end()) {
|
||||||
|
m_changedTagIds.push_back(Tag->first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fillTags();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MessagePage::currentRowChangedTag(int row)
|
||||||
|
{
|
||||||
|
QListWidgetItem *pItemWidget = ui.tags_listWidget->item(row);
|
||||||
|
|
||||||
|
bool bEditEnable = false;
|
||||||
|
bool bDeleteEnable = false;
|
||||||
|
|
||||||
|
if (pItemWidget) {
|
||||||
|
bEditEnable = true;
|
||||||
|
|
||||||
|
uint32_t nId = pItemWidget->data(Qt::UserRole).toInt();
|
||||||
|
|
||||||
|
if (nId >= RS_MSGTAGTYPE_USER) {
|
||||||
|
bDeleteEnable = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ui.editpushButton->setEnabled(bEditEnable);
|
||||||
|
ui.deletepushButton->setEnabled(bDeleteEnable);
|
||||||
|
}
|
||||||
|
|
|
@ -1,70 +1,72 @@
|
||||||
/****************************************************************
|
/****************************************************************
|
||||||
* RetroShare is distributed under the following license:
|
* RetroShare is distributed under the following license:
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006, crypton
|
* Copyright (C) 2006, crypton
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation; either version 2
|
* as published by the Free Software Foundation; either version 2
|
||||||
* of the License, or (at your option) any later version.
|
* of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
* Boston, MA 02110-1301, USA.
|
* Boston, MA 02110-1301, USA.
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
#ifndef MESSAGEPAGE_H
|
#ifndef MESSAGEPAGE_H
|
||||||
#define MESSAGEPAGE_H
|
#define MESSAGEPAGE_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <retroshare-gui/configpage.h>
|
#include <retroshare-gui/configpage.h>
|
||||||
#include "ui_MessagePage.h"
|
#include "ui_MessagePage.h"
|
||||||
|
|
||||||
#include "gui/msgs/MessageInterface.h"
|
#include "gui/msgs/MessageInterface.h"
|
||||||
|
|
||||||
class MessagePage : public ConfigPage
|
class MessagePage : public ConfigPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MessagePage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
|
MessagePage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
|
||||||
~MessagePage();
|
~MessagePage();
|
||||||
|
|
||||||
/** Saves the changes on this page */
|
/** Saves the changes on this page */
|
||||||
virtual bool save(QString &errmsg);
|
virtual bool save(QString &errmsg);
|
||||||
/** Loads the settings for this page */
|
/** Loads the settings for this page */
|
||||||
virtual void load();
|
virtual void load();
|
||||||
|
|
||||||
virtual QPixmap iconPixmap() const { return QPixmap(":/images/evolution.png") ; }
|
virtual QPixmap iconPixmap() const { return QPixmap(":/images/evolution.png") ; }
|
||||||
virtual QString pageName() const { return tr("Message") ; }
|
virtual QString pageName() const { return tr("Message") ; }
|
||||||
virtual QString helpText() const { return ""; }
|
virtual QString helpText() const { return ""; }
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void addTag();
|
void addTag();
|
||||||
void editTag();
|
void editTag();
|
||||||
void deleteTag();
|
void deleteTag();
|
||||||
void defaultTag();
|
void defaultTag();
|
||||||
|
|
||||||
void currentRowChangedTag(int row);
|
void currentRowChangedTag(int row);
|
||||||
void toggleEnableEncryptedDistantMsgs(bool) ;
|
void toggleEnableEncryptedDistantMsgs(bool) ;
|
||||||
|
void distantMsgsComboBoxChanged(int);
|
||||||
private:
|
|
||||||
void fillTags();
|
|
||||||
|
private:
|
||||||
/* Pointer for not include of rsmsgs.h */
|
void fillTags();
|
||||||
MsgTagType *m_pTags;
|
|
||||||
std::list<uint32_t> m_changedTagIds;
|
/* Pointer for not include of rsmsgs.h */
|
||||||
|
MsgTagType *m_pTags;
|
||||||
Ui::MessagePage ui;
|
std::list<uint32_t> m_changedTagIds;
|
||||||
};
|
|
||||||
|
Ui::MessagePage ui;
|
||||||
#endif // !MESSAGEPAGE_H
|
};
|
||||||
|
|
||||||
|
#endif // !MESSAGEPAGE_H
|
||||||
|
|
||||||
|
|
|
@ -59,21 +59,30 @@
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Distant messages:</string>
|
<string>Distant messages:</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<item>
|
<item row="0" column="2">
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QComboBox" name="comboBox">
|
||||||
<property name="text">
|
<item>
|
||||||
<string><html><head/><body><p align="justify">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. </p></body></html></string>
|
<property name="text">
|
||||||
</property>
|
<string>Everyone</string>
|
||||||
<property name="wordWrap">
|
</property>
|
||||||
<bool>true</bool>
|
</item>
|
||||||
</property>
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Contacts</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Nobody</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="0" column="1">
|
||||||
<widget class="QCheckBox" name="encryptedMsgs_CB">
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Accept encrypted distant messages from everyone</string>
|
<string>Accept encrypted distant messages from</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue