mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-24 00:31:32 -04:00
- Added a drop-down item to allow removing unused keys, in the Network dialog.
- added key removal method in OpenPGP-SDK - improved FriendSelectionDialog/Widget to enable select all/none keys, and show non friend keys - added safe key removal method in PGPHandler. Removed keys from other locations will not cause errors. - added backup system to public keyring, impossibility to remove public parts of owned secret keys, etc. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6382 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
02890c737a
commit
0266329dc8
17 changed files with 314 additions and 81 deletions
|
@ -4,29 +4,40 @@
|
|||
#include <QDialogButtonBox>
|
||||
#include "FriendSelectionDialog.h"
|
||||
|
||||
std::list<std::string> FriendSelectionDialog::selectFriends()
|
||||
std::list<std::string> FriendSelectionDialog::selectFriends(QWidget *parent,const QString& caption,const QString& header_text,
|
||||
FriendSelectionWidget::Modus modus,
|
||||
FriendSelectionWidget::ShowTypes show_type,
|
||||
FriendSelectionWidget::IdType pre_selected_id_type,
|
||||
const std::list<std::string>& pre_selected_ids)
|
||||
{
|
||||
FriendSelectionDialog dialog ;
|
||||
FriendSelectionDialog dialog(parent,header_text,modus,show_type,pre_selected_id_type,pre_selected_ids) ;
|
||||
|
||||
dialog.friends_widget->start() ;
|
||||
dialog.setWindowTitle(tr("Choose some friends")) ;
|
||||
dialog.friends_widget->setSelectedIds(pre_selected_id_type,pre_selected_ids,true) ;
|
||||
|
||||
dialog.setWindowTitle(caption) ;
|
||||
|
||||
if(QDialog::Rejected == dialog.exec())
|
||||
return std::list<std::string>() ;
|
||||
|
||||
std::list<std::string> ids ;
|
||||
dialog.friends_widget->selectedSslIds(ids,false) ;
|
||||
dialog.friends_widget->selectedIds(pre_selected_id_type,ids,false) ;
|
||||
|
||||
return ids ;
|
||||
}
|
||||
|
||||
FriendSelectionDialog::FriendSelectionDialog(QWidget *parent)
|
||||
FriendSelectionDialog::FriendSelectionDialog(QWidget *parent,const QString& header_text,
|
||||
FriendSelectionWidget::Modus modus,
|
||||
FriendSelectionWidget::ShowTypes show_type,
|
||||
FriendSelectionWidget::IdType pre_selected_id_type,
|
||||
const std::list<std::string>& pre_selected_ids)
|
||||
: QDialog(parent)
|
||||
{
|
||||
friends_widget = new FriendSelectionWidget(this) ;
|
||||
|
||||
friends_widget->setHeaderText(tr("Contacts:"));
|
||||
friends_widget->setModus(FriendSelectionWidget::MODUS_CHECK);
|
||||
friends_widget->setShowType(FriendSelectionWidget::SHOW_GROUP | FriendSelectionWidget::SHOW_SSL);
|
||||
friends_widget->setHeaderText(header_text);
|
||||
friends_widget->setModus(modus) ;
|
||||
friends_widget->setShowType(show_type) ;
|
||||
|
||||
QLayout *l = new QVBoxLayout ;
|
||||
setLayout(l) ;
|
||||
|
|
|
@ -6,11 +6,16 @@
|
|||
class FriendSelectionDialog : public QDialog
|
||||
{
|
||||
public:
|
||||
static std::list<std::string> selectFriends() ;
|
||||
|
||||
static std::list<std::string> selectFriends(QWidget *parent,const QString& caption,const QString& header_string,
|
||||
FriendSelectionWidget::Modus modus = FriendSelectionWidget::MODUS_MULTI,
|
||||
FriendSelectionWidget::ShowTypes = FriendSelectionWidget::SHOW_GROUP | FriendSelectionWidget::SHOW_SSL,
|
||||
FriendSelectionWidget::IdType pre_selected_id_type = FriendSelectionWidget::IDTYPE_SSL,
|
||||
const std::list<std::string>& pre_selected_ids = std::list<std::string>()) ;
|
||||
private:
|
||||
virtual ~FriendSelectionDialog() ;
|
||||
FriendSelectionDialog(QWidget *parent = NULL) ;
|
||||
FriendSelectionDialog(QWidget *parent,const QString& header_string,FriendSelectionWidget::Modus modus,FriendSelectionWidget::ShowTypes show_type,
|
||||
FriendSelectionWidget::IdType pre_selected_id_type,
|
||||
const std::list<std::string>& pre_selected_ids) ;
|
||||
|
||||
FriendSelectionWidget *friends_widget ;
|
||||
};
|
||||
|
|
|
@ -89,6 +89,8 @@ FriendSelectionWidget::FriendSelectionWidget(QWidget *parent) :
|
|||
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->selectAll_PB, SIGNAL(clicked()), this, SLOT(selectAll()));
|
||||
connect(ui->deselectAll_PB, SIGNAL(clicked()), this, SLOT(deselectAll()));
|
||||
connect(ui->filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterItems(QString)));
|
||||
|
||||
connect(NotifyQt::getInstance(), SIGNAL(groupsChanged(int)), this, SLOT(fillList()));
|
||||
|
@ -148,6 +150,17 @@ void FriendSelectionWidget::setModus(Modus modus)
|
|||
break;
|
||||
}
|
||||
|
||||
if(modus == MODUS_CHECK)
|
||||
{
|
||||
ui->selectAll_PB->setHidden(false) ;
|
||||
ui->deselectAll_PB->setHidden(false) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->selectAll_PB->setHidden(true) ;
|
||||
ui->deselectAll_PB->setHidden(true) ;
|
||||
}
|
||||
|
||||
fillList();
|
||||
}
|
||||
|
||||
|
@ -221,7 +234,7 @@ void FriendSelectionWidget::fillList()
|
|||
}
|
||||
|
||||
std::list<std::string> gpgIdsSelected;
|
||||
if (mShowTypes & SHOW_GPG) {
|
||||
if (mShowTypes & (SHOW_GPG | SHOW_NON_FRIEND_GPG)) {
|
||||
selectedGpgIds(gpgIdsSelected, true);
|
||||
}
|
||||
|
||||
|
@ -235,10 +248,15 @@ void FriendSelectionWidget::fillList()
|
|||
|
||||
std::list<std::string> gpgIds;
|
||||
std::list<std::string>::iterator gpgIt;
|
||||
rsPeers->getGPGAcceptedList(gpgIds);
|
||||
|
||||
if(mShowTypes & SHOW_NON_FRIEND_GPG)
|
||||
rsPeers->getGPGAllList(gpgIds);
|
||||
else
|
||||
rsPeers->getGPGAcceptedList(gpgIds);
|
||||
|
||||
std::list<std::string> sslIds;
|
||||
std::list<std::string>::iterator sslIt;
|
||||
|
||||
if ((mShowTypes & (SHOW_SSL | SHOW_GPG)) == SHOW_SSL) {
|
||||
rsPeers->getFriendList(sslIds);
|
||||
}
|
||||
|
@ -295,7 +313,7 @@ void FriendSelectionWidget::fillList()
|
|||
}
|
||||
}
|
||||
|
||||
if (mShowTypes & SHOW_GPG) {
|
||||
if (mShowTypes & (SHOW_GPG | SHOW_NON_FRIEND_GPG)) {
|
||||
// iterate through gpg ids
|
||||
for (gpgIt = gpgIds.begin(); gpgIt != gpgIds.end(); gpgIt++) {
|
||||
if (groupInfo) {
|
||||
|
@ -466,7 +484,7 @@ void FriendSelectionWidget::peerStatusChanged(const QString& peerId, int status)
|
|||
QString gpgId;
|
||||
int gpgStatus = RS_STATUS_OFFLINE;
|
||||
|
||||
if (mShowTypes & SHOW_GPG) {
|
||||
if (mShowTypes & (SHOW_GPG | SHOW_NON_FRIEND_GPG)) {
|
||||
/* need gpg id and online state */
|
||||
RsPeerDetails detail;
|
||||
if (rsPeers->getPeerDetails(peerId.toStdString(), detail)) {
|
||||
|
@ -763,6 +781,17 @@ void FriendSelectionWidget::selectedIds(IdType idType, std::list<std::string> &i
|
|||
}
|
||||
}
|
||||
|
||||
void FriendSelectionWidget::deselectAll()
|
||||
{
|
||||
for(QTreeWidgetItemIterator itemIterator(ui->friendList);*itemIterator!=NULL;++itemIterator)
|
||||
setSelected(mListModus, *itemIterator, false);
|
||||
}
|
||||
void FriendSelectionWidget::selectAll()
|
||||
{
|
||||
for(QTreeWidgetItemIterator itemIterator(ui->friendList);*itemIterator!=NULL;++itemIterator)
|
||||
setSelected(mListModus, *itemIterator, true);
|
||||
}
|
||||
|
||||
void FriendSelectionWidget::setSelectedIds(IdType idType, const std::list<std::string> &ids, bool add)
|
||||
{
|
||||
QTreeWidgetItemIterator itemIterator(ui->friendList);
|
||||
|
|
|
@ -56,9 +56,10 @@ public:
|
|||
};
|
||||
|
||||
enum ShowType {
|
||||
SHOW_GROUP = 1,
|
||||
SHOW_GPG = 2,
|
||||
SHOW_SSL = 4
|
||||
SHOW_GROUP = 1,
|
||||
SHOW_GPG = 2,
|
||||
SHOW_SSL = 4,
|
||||
SHOW_NON_FRIEND_GPG = 8,
|
||||
};
|
||||
|
||||
Q_DECLARE_FLAGS(ShowTypes, ShowType)
|
||||
|
@ -110,6 +111,8 @@ private slots:
|
|||
void contextMenuRequested(const QPoint &pos);
|
||||
void itemDoubleClicked(QTreeWidgetItem *item, int column);
|
||||
void itemChanged(QTreeWidgetItem *item, int column);
|
||||
void selectAll() ;
|
||||
void deselectAll() ;
|
||||
|
||||
private:
|
||||
bool filterItem(QTreeWidgetItem *item, const QString &text);
|
||||
|
@ -130,6 +133,8 @@ private:
|
|||
QColor mTextColorOnline;
|
||||
|
||||
Ui::FriendSelectionWidget *ui;
|
||||
|
||||
friend class FriendSelectionDialog ;
|
||||
};
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(FriendSelectionWidget::ShowTypes)
|
||||
|
|
|
@ -6,37 +6,11 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>211</width>
|
||||
<height>358</height>
|
||||
<width>446</width>
|
||||
<height>320</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="LineEditClear" name="filterLineEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="friendList">
|
||||
<property name="minimumSize">
|
||||
|
@ -67,6 +41,34 @@
|
|||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="filterLabel">
|
||||
<property name="text">
|
||||
<string>Search :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="LineEditClear" name="filterLineEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="selectAll_PB">
|
||||
<property name="text">
|
||||
<string>All</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="deselectAll_PB">
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue