2013-02-22 16:42:27 -05:00
|
|
|
#include <list>
|
|
|
|
|
|
|
|
#include <QLayout>
|
|
|
|
#include <QDialogButtonBox>
|
|
|
|
#include "FriendSelectionDialog.h"
|
|
|
|
|
2014-03-17 16:56:06 -04:00
|
|
|
std::list<RsPgpId> FriendSelectionDialog::selectFriends_PGP(QWidget *parent,const QString& caption,const QString& header_text,
|
|
|
|
FriendSelectionWidget::Modus modus,
|
|
|
|
FriendSelectionWidget::ShowTypes show_type,
|
|
|
|
const std::list<RsPgpId>& pre_selected_ids)
|
2013-02-22 16:42:27 -05:00
|
|
|
{
|
2014-03-17 16:56:06 -04:00
|
|
|
std::list<std::string> psids ;
|
|
|
|
for(std::list<RsPgpId>::const_iterator it(pre_selected_ids.begin());it!=pre_selected_ids.end();++it)
|
|
|
|
psids.push_back( (*it).toStdString() ) ;
|
2013-05-29 17:32:02 -04:00
|
|
|
|
2014-03-17 16:56:06 -04:00
|
|
|
FriendSelectionDialog dialog(parent,header_text,modus,show_type,FriendSelectionWidget::IDTYPE_GPG,psids) ;
|
2013-02-22 16:42:27 -05:00
|
|
|
|
2014-03-17 16:56:06 -04:00
|
|
|
dialog.setWindowTitle(caption) ;
|
2013-02-22 16:42:27 -05:00
|
|
|
|
2014-03-17 16:56:06 -04:00
|
|
|
if(QDialog::Rejected == dialog.exec())
|
|
|
|
return std::list<RsPgpId>() ;
|
2013-02-22 16:42:27 -05:00
|
|
|
|
2014-03-17 16:56:06 -04:00
|
|
|
std::list<RsPgpId> sids ;
|
|
|
|
dialog.friends_widget->selectedIds<RsPgpId,FriendSelectionWidget::IDTYPE_GPG>(sids,false) ;
|
|
|
|
|
|
|
|
return sids ;
|
2013-02-22 16:42:27 -05:00
|
|
|
}
|
2014-03-17 16:56:06 -04:00
|
|
|
std::list<RsPeerId> FriendSelectionDialog::selectFriends_SSL(QWidget *parent,const QString& caption,const QString& header_text,
|
|
|
|
FriendSelectionWidget::Modus modus,
|
|
|
|
FriendSelectionWidget::ShowTypes show_type,
|
|
|
|
const std::list<RsPeerId>& pre_selected_ids)
|
|
|
|
{
|
|
|
|
std::list<std::string> psids ;
|
|
|
|
for(std::list<RsPeerId>::const_iterator it(pre_selected_ids.begin());it!=pre_selected_ids.end();++it)
|
|
|
|
psids.push_back( (*it).toStdString() ) ;
|
|
|
|
|
|
|
|
FriendSelectionDialog dialog(parent,header_text,modus,show_type,FriendSelectionWidget::IDTYPE_SSL,psids) ;
|
|
|
|
|
|
|
|
dialog.setWindowTitle(caption) ;
|
2013-02-22 16:42:27 -05:00
|
|
|
|
2014-03-17 16:56:06 -04:00
|
|
|
if(QDialog::Rejected == dialog.exec())
|
|
|
|
return std::list<RsPeerId>() ;
|
|
|
|
|
|
|
|
std::list<RsPeerId> sids ;
|
|
|
|
dialog.friends_widget->selectedIds<RsPeerId,FriendSelectionWidget::IDTYPE_SSL>(sids,false) ;
|
|
|
|
|
|
|
|
return sids ;
|
|
|
|
}
|
2014-03-29 10:18:05 -04:00
|
|
|
std::list<RsGxsId> FriendSelectionDialog::selectFriends_GXS(QWidget *parent,const QString& caption,const QString& header_text,
|
|
|
|
FriendSelectionWidget::Modus modus,
|
|
|
|
FriendSelectionWidget::ShowTypes show_type,
|
|
|
|
const std::list<RsGxsId>& pre_selected_ids)
|
|
|
|
{
|
|
|
|
std::list<std::string> psids ;
|
|
|
|
for(std::list<RsGxsId>::const_iterator it(pre_selected_ids.begin());it!=pre_selected_ids.end();++it)
|
|
|
|
psids.push_back( (*it).toStdString() ) ;
|
|
|
|
|
|
|
|
FriendSelectionDialog dialog(parent,header_text,modus,show_type,FriendSelectionWidget::IDTYPE_SSL,psids) ;
|
|
|
|
|
|
|
|
dialog.setWindowTitle(caption) ;
|
|
|
|
|
|
|
|
if(QDialog::Rejected == dialog.exec())
|
|
|
|
return std::list<RsGxsId>() ;
|
|
|
|
|
|
|
|
std::list<RsGxsId> sids ;
|
|
|
|
dialog.friends_widget->selectedIds<RsGxsId,FriendSelectionWidget::IDTYPE_GXS>(sids,false) ;
|
|
|
|
|
|
|
|
return sids ;
|
|
|
|
}
|
2013-05-29 17:32:02 -04:00
|
|
|
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)
|
2013-02-22 16:42:27 -05:00
|
|
|
: QDialog(parent)
|
|
|
|
{
|
|
|
|
friends_widget = new FriendSelectionWidget(this) ;
|
|
|
|
|
2013-05-29 17:32:02 -04:00
|
|
|
friends_widget->setHeaderText(header_text);
|
|
|
|
friends_widget->setModus(modus) ;
|
|
|
|
friends_widget->setShowType(show_type) ;
|
2013-06-10 09:27:24 -04:00
|
|
|
friends_widget->start() ;
|
|
|
|
friends_widget->setSelectedIds(pre_selected_id_type, pre_selected_ids, false);
|
2013-02-22 16:42:27 -05:00
|
|
|
|
|
|
|
QLayout *l = new QVBoxLayout ;
|
|
|
|
setLayout(l) ;
|
|
|
|
|
|
|
|
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
|
|
|
|
|
|
|
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
|
|
|
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
|
|
|
|
|
|
|
l->addWidget(friends_widget) ;
|
|
|
|
l->addWidget(buttonBox) ;
|
|
|
|
l->update() ;
|
|
|
|
}
|
|
|
|
|
|
|
|
FriendSelectionDialog::~FriendSelectionDialog()
|
|
|
|
{
|
|
|
|
delete friends_widget ;
|
|
|
|
}
|
|
|
|
|