diff --git a/retroshare-gui/src/gui/PeersDialog.cpp b/retroshare-gui/src/gui/PeersDialog.cpp index c38e5071d..ebabfa769 100644 --- a/retroshare-gui/src/gui/PeersDialog.cpp +++ b/retroshare-gui/src/gui/PeersDialog.cpp @@ -75,6 +75,7 @@ #define IMAGE_DENYFRIEND ":/images/denied16.png" #define IMAGE_REMOVEFRIEND ":/images/removefriend16.png" #define IMAGE_EXPORTFRIEND ":/images/exportpeers_16x16.png" +#define IMAGE_ADDFRIEND ":/images/user/add_user16.png" #define IMAGE_FRIENDINFO ":/images/peerdetails_16x16.png" #define IMAGE_CHAT ":/images/chat.png" #define IMAGE_MSG ":/images/mail_new.png" @@ -134,6 +135,7 @@ PeersDialog::PeersDialog(QWidget *parent) connect( ui.addfileButton, SIGNAL(clicked() ), this , SLOT(addExtraFile())); connect( ui.msgText, SIGNAL(anchorClicked(const QUrl &)), SLOT(anchorClicked(const QUrl &))); + connect(ui.actionAdd_Friend, SIGNAL(triggered()), this, SLOT(addFriend())); connect(ui.action_Hide_Offline_Friends, SIGNAL(triggered()), this, SLOT(insertPeers())); connect(ui.action_Hide_Status_Column, SIGNAL(triggered()), this, SLOT(statusColumn())); @@ -410,14 +412,15 @@ void PeersDialog::peertreeWidgetCostumPopupMenu( QPoint point ) { bool standard = c->data(COLUMN_DATA, ROLE_STANDARD).toBool(); - contextMnu.addAction(QIcon(IMAGE_MSG), tr("Message group"), this, SLOT(msgfriend())); + contextMnu.addAction(QIcon(IMAGE_MSG), tr("Message Group"), this, SLOT(msgfriend())); + contextMnu.addAction(QIcon(IMAGE_ADDFRIEND), tr("Add Friend"), this, SLOT(addFriend())); contextMnu.addSeparator(); - action = contextMnu.addAction(QIcon(IMAGE_EDIT), tr("Edit group"), this, SLOT(editGroup())); + action = contextMnu.addAction(QIcon(IMAGE_EDIT), tr("Edit Group"), this, SLOT(editGroup())); action->setDisabled(standard); - action = contextMnu.addAction(QIcon(IMAGE_REMOVE), tr("Remove group"), this, SLOT(removeGroup())); + action = contextMnu.addAction(QIcon(IMAGE_REMOVE), tr("Remove Group"), this, SLOT(removeGroup())); action->setDisabled(standard); } break; @@ -1265,6 +1268,24 @@ void PeersDialog::configurefriend() ConfCertDialog::show(getPeerRsCertId(getCurrentPeer())); } +void PeersDialog::addFriend() +{ + std::string groupId; + + QTreeWidgetItem *c = getCurrentPeer(); + if (c && c->type() == TYPE_GROUP) { + groupId = c->data(COLUMN_DATA, ROLE_ID).toString().toStdString(); + } + + ConnectFriendWizard connwiz (this); + + if (groupId.empty() == false) { + connwiz.setGroup(groupId); + } + + connwiz.exec (); +} + void PeersDialog::resetStatusBar() { #ifdef PEERS_DEBUG @@ -1732,13 +1753,6 @@ void PeersDialog::changeAvatarClicked() updateAvatar(); } -void PeersDialog::on_actionAdd_Friend_activated() -{ - ConnectFriendWizard connectwiz (this); - - connectwiz.exec (); -} - void PeersDialog::on_actionCreate_New_Forum_activated() { MainWindow::activatePage (MainWindow::Forums); diff --git a/retroshare-gui/src/gui/PeersDialog.h b/retroshare-gui/src/gui/PeersDialog.h index 6c051b395..0a1d718ee 100644 --- a/retroshare-gui/src/gui/PeersDialog.h +++ b/retroshare-gui/src/gui/PeersDialog.h @@ -118,6 +118,7 @@ private slots: /** Remove friend */ void removefriend(); /** start a chat with a friend **/ + void addFriend(); void chatfriend(QTreeWidgetItem* ); void chatfriendproxy(); void msgfriend(); @@ -148,7 +149,6 @@ private slots: void changeAvatarClicked(); void getAvatar(); - void on_actionAdd_Friend_activated(); void on_actionAdd_Group_activated(); void on_actionCreate_New_Forum_activated(); void on_actionCreate_New_Channel_activated(); diff --git a/retroshare-gui/src/gui/connect/ConnectFriendWizard.cpp b/retroshare-gui/src/gui/connect/ConnectFriendWizard.cpp index f1c155aab..c5fc8fadc 100755 --- a/retroshare-gui/src/gui/connect/ConnectFriendWizard.cpp +++ b/retroshare-gui/src/gui/connect/ConnectFriendWizard.cpp @@ -21,6 +21,7 @@ #include "ConnectFriendWizard.h" #include "gui/common/PeerDefs.h" +#include "gui/common/GroupDefs.h" #include //for rsPeers variable #include @@ -56,6 +57,7 @@ #define CERT_STRING_FIELD_CONNECT_FRIEND_WIZARD "peerCertString" #define SIGN_RADIO_BUTTON_FIELD_CONNECT_FRIEND_WIZARD "signCheckBox" #define ACCEPT_RADIO_BUTTON_FIELD_CONNECT_FRIEND_WIZARD "acceptCheckBox" +#define GROUP_ID_FIELD_CONNECT_FRIEND_WIZARD "groupIdField" @@ -99,6 +101,14 @@ ConnectFriendWizard::ConnectFriendWizard(QWidget *parent) setWindowTitle(tr("Connect Friend Wizard")); } + +//============================================================================ + +void ConnectFriendWizard::setGroup(const std::string &groupId) +{ + setField(GROUP_ID_FIELD_CONNECT_FRIEND_WIZARD, QString::fromStdString(groupId)); +} + //============================================================================ void @@ -120,6 +130,11 @@ ConnectFriendWizard::accept() std::cerr << "ConclusionPage::validatePage() accepting GPG key for connection." << std::endl; rsPeers->setAcceptToConnectGPGCertificate(gpg_Id, true); } + + QString groupId = field(GROUP_ID_FIELD_CONNECT_FRIEND_WIZARD).toString(); + if (groupId.isEmpty() == false) { + rsPeers->assignPeerToGroup(groupId.toStdString(), gpg_Id, true); + } } if (ssl_Id != "") { @@ -915,6 +930,11 @@ ConclusionPage::ConclusionPage(QWidget *parent) : QWizardPage(parent) { dyndns = new QLineEdit(this); dyndns->setVisible(false); registerField("dyndns",dyndns); + + groupComboBox = new QComboBox(this); + groupLabel = new QLabel(this); + groupLabel->setVisible(false); + registerField(GROUP_ID_FIELD_CONNECT_FRIEND_WIZARD, groupLabel); } //============================================================================ @@ -926,6 +946,15 @@ int ConclusionPage::nextId() const { // //============================================================================ // +void ConclusionPage::groupCurrentIndexChanged(int index) +{ + setField(GROUP_ID_FIELD_CONNECT_FRIEND_WIZARD, groupComboBox->itemData(index, Qt::UserRole)); +} + +// +//============================================================================ +// + void ConclusionPage::initializePage() { std::string id = field(SSL_ID_FIELD_CONNECT_FRIEND_WIZARD).toString().toStdString(); std::string gpg_id = field(GPG_ID_FIELD_CONNECT_FRIEND_WIZARD).toString().toStdString(); @@ -1008,6 +1037,19 @@ void ConclusionPage::initializePage() { locEdit->setText( QString::fromStdString( detail.location ) ); signersEdit->setPlainText( ts ); + std::list groupInfoList; + rsPeers->getGroupInfoList(groupInfoList); + GroupDefs::sortByName(groupInfoList); + groupComboBox->addItem("", ""); // empty value + for (std::list::iterator groupIt = groupInfoList.begin(); groupIt != groupInfoList.end(); groupIt++) { + groupComboBox->addItem(GroupDefs::name(*groupIt), QString::fromStdString(groupIt->id)); + } + + QString groupId = field(GROUP_ID_FIELD_CONNECT_FRIEND_WIZARD).toString(); + if (groupId.isEmpty() == false) { + groupComboBox->setCurrentIndex(groupComboBox->findData(groupId)); + } + connect(groupComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(groupCurrentIndexChanged(int))); } //============================================================================ diff --git a/retroshare-gui/src/gui/connect/ConnectFriendWizard.h b/retroshare-gui/src/gui/connect/ConnectFriendWizard.h index 06bace851..36f8dc554 100755 --- a/retroshare-gui/src/gui/connect/ConnectFriendWizard.h +++ b/retroshare-gui/src/gui/connect/ConnectFriendWizard.h @@ -38,6 +38,8 @@ public: ConnectFriendWizard(QWidget *parent = 0); + void setGroup(const std::string &groupId); + void accept(); private slots: @@ -210,6 +212,7 @@ public: private slots: // void printButtonClicked(); + void groupCurrentIndexChanged(int index); private: QGroupBox* peerDetailsFrame; @@ -224,6 +227,8 @@ private: QLabel* locEdit; QLabel* signersLabel; QTextEdit* signersEdit; + QComboBox* groupComboBox; + QLabel* groupLabel; QLabel* radioButtonsLabel; QCheckBox *signGPGCheckBox; diff --git a/retroshare-gui/src/lang/retroshare_de.qm b/retroshare-gui/src/lang/retroshare_de.qm index f93e7b80b..1622072e3 100644 Binary files a/retroshare-gui/src/lang/retroshare_de.qm and b/retroshare-gui/src/lang/retroshare_de.qm differ diff --git a/retroshare-gui/src/lang/retroshare_de.ts b/retroshare-gui/src/lang/retroshare_de.ts index 06965840b..3666ee867 100644 --- a/retroshare-gui/src/lang/retroshare_de.ts +++ b/retroshare-gui/src/lang/retroshare_de.ts @@ -763,7 +763,7 @@ p, li { white-space: pre-wrap; } CertificatePage - + Certificate files Zertifikat-Dateien @@ -1325,12 +1325,12 @@ Keine Beschreibung Füge als Freund hinzu, zu dem verbunden wird - + It seems your friend is already registered. Adding it might just set it's ip address. Ihr Freund ist bereits registriert. Das nochmalige Hinzufügen ändert nur seine IP. - + Peer details Nachbar Details @@ -1591,7 +1591,7 @@ und meinen GPG Schlüssel nicht unterzeichnet ConnectFriendWizard - + Connect Friend Wizard Assistent um sich zu einem Freund zu verbinden @@ -2834,7 +2834,7 @@ p, li { white-space: pre-wrap; } EmailPage - + Invite Friend by Email Einladung per E-Mail versenden @@ -2875,7 +2875,7 @@ Bis bald in RetroShare! ErrorMessagePage - + Sorry, some error appeared Entschuldigung, es trat ein Fehler auf @@ -7045,7 +7045,7 @@ p, li { white-space: pre-wrap; } PeersDialog - + Chat Chat @@ -7070,7 +7070,7 @@ p, li { white-space: pre-wrap; } Verbinde zum Freund - + Profile Profil @@ -7105,12 +7105,7 @@ p, li { white-space: pre-wrap; } Standort - - Message group - Gruppe anschreiben - - - + Friend Details Freund-Details @@ -7130,12 +7125,7 @@ p, li { white-space: pre-wrap; } Freund anschreiben - - Edit group - Gruppe ändern - - - + Recommend this Friend to... Freund weiterempfehlen... @@ -7175,17 +7165,12 @@ p, li { white-space: pre-wrap; } Aus allen Gruppen entfernen - - Remove group - Gruppe entfernen - - - + Available Verfügbar - + Add Extra File Zusätzliche Datei hinzufügen @@ -7303,6 +7288,7 @@ p, li { white-space: pre-wrap; } + Add Friend Freund hinzufügen @@ -7351,18 +7337,33 @@ p, li { white-space: pre-wrap; } Chat Verlauf speichern - - + + RetroShare - + + Message Group + Gruppe anschreiben + + + + Edit Group + Gruppe ändern + + + + Remove Group + Gruppe entfernen + + + Do you want to remove this Friend? Willst du diesen Freund entfernen? - + Save as... Speichern unter... @@ -7395,12 +7396,12 @@ p, li { white-space: pre-wrap; } Status Spalte ausblenden - + Friends Storm Aktivitäten - + is typing... tippt... @@ -7420,7 +7421,7 @@ p, li { white-space: pre-wrap; } Freunde - + Paste Friend Link RetroShare Link einfügen @@ -8886,7 +8887,7 @@ p, li { white-space: pre-wrap; } RsidPage - + RetroShare ID RetroShare ID @@ -10408,7 +10409,7 @@ p, li { white-space: pre-wrap; } TextPage - + Use text representation of the PGP certificates. Verwende diesen Text als PGP Zertifikat.