mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-18 13:54:07 -05:00
49 lines
1.3 KiB
C++
49 lines
1.3 KiB
C++
![]() |
#include <list>
|
||
|
|
||
|
#include <QLayout>
|
||
|
#include <QDialogButtonBox>
|
||
|
#include "FriendSelectionDialog.h"
|
||
|
|
||
|
std::list<std::string> FriendSelectionDialog::selectFriends()
|
||
|
{
|
||
|
FriendSelectionDialog dialog ;
|
||
|
dialog.friends_widget->start() ;
|
||
|
dialog.setWindowTitle(tr("Choose some friends")) ;
|
||
|
|
||
|
if(QDialog::Rejected == dialog.exec())
|
||
|
return std::list<std::string>() ;
|
||
|
|
||
|
std::list<std::string> ids ;
|
||
|
dialog.friends_widget->selectedSslIds(ids,false) ;
|
||
|
|
||
|
return ids ;
|
||
|
}
|
||
|
|
||
|
FriendSelectionDialog::FriendSelectionDialog(QWidget *parent)
|
||
|
: 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);
|
||
|
|
||
|
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 ;
|
||
|
}
|
||
|
|