#include #include #include #include "FriendSelectionDialog.h" std::list FriendSelectionDialog::selectFriends_PGP(QWidget *parent,const QString& caption,const QString& header_text, FriendSelectionWidget::Modus modus, FriendSelectionWidget::ShowTypes show_type, const std::list& pre_selected_ids) { std::list psids ; for(std::list::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_GPG,psids) ; dialog.setWindowTitle(caption) ; if(QDialog::Rejected == dialog.exec()) return std::list() ; std::list sids ; dialog.friends_widget->selectedIds(sids,false) ; return sids ; } std::list FriendSelectionDialog::selectFriends_SSL(QWidget *parent,const QString& caption,const QString& header_text, FriendSelectionWidget::Modus modus, FriendSelectionWidget::ShowTypes show_type, const std::list& pre_selected_ids) { std::list psids ; for(std::list::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() ; std::list sids ; dialog.friends_widget->selectedIds(sids,false) ; return sids ; } std::list FriendSelectionDialog::selectFriends_GXS(QWidget *parent,const QString& caption,const QString& header_text, FriendSelectionWidget::Modus modus, FriendSelectionWidget::ShowTypes show_type, const std::list& pre_selected_ids) { std::list psids ; for(std::list::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() ; std::list sids ; dialog.friends_widget->selectedIds(sids,false) ; return sids ; } FriendSelectionDialog::FriendSelectionDialog(QWidget *parent,const QString& header_text, FriendSelectionWidget::Modus modus, FriendSelectionWidget::ShowTypes show_type, FriendSelectionWidget::IdType pre_selected_id_type, const std::list& pre_selected_ids) : QDialog(parent) { friends_widget = new FriendSelectionWidget(this) ; friends_widget->setHeaderText(header_text); friends_widget->setModus(modus) ; friends_widget->setShowType(show_type) ; friends_widget->start() ; friends_widget->setSelectedIds(pre_selected_id_type, pre_selected_ids, false); 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 ; }