Moved friend recommendations into the ConnectFriendWizard

Updated english translation

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6679 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2013-09-02 22:51:26 +00:00
parent 495cc17da3
commit e5d8860e21
13 changed files with 135 additions and 336 deletions

View File

@ -1,94 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2012, RetroShare Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <QMessageBox>
#include "FriendRecommendDialog.h"
#include "ui_FriendRecommendDialog.h"
#include "msgs/MessageComposer.h"
#include "settings/rsharesettings.h"
void FriendRecommendDialog::showYourself()
{
FriendRecommendDialog *dlg = new FriendRecommendDialog();
dlg->show();
}
FriendRecommendDialog::FriendRecommendDialog() :
QDialog(NULL, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint),
ui(new Ui::FriendRecommendDialog)
{
ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose, true);
ui->headerFrame->setHeaderImage(QPixmap(":/images/user/friends64.png"));
ui->headerFrame->setHeaderText(tr("Friend Recommendations"));
Settings->loadWidgetInformation(this);
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(sendMsg()));
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
ui->recommendList->setHeaderText(tr("Recommend friends"));
ui->recommendList->setModus(FriendSelectionWidget::MODUS_CHECK);
ui->recommendList->setShowType(FriendSelectionWidget::SHOW_GROUP | FriendSelectionWidget::SHOW_SSL);
ui->recommendList->start();
ui->toList->setHeaderText(tr("To"));
ui->toList->setModus(FriendSelectionWidget::MODUS_CHECK);
ui->toList->start();
ui->messageEdit->setText(MessageComposer::recommendMessage());
}
FriendRecommendDialog::~FriendRecommendDialog()
{
Settings->saveWidgetInformation(this);
delete ui;
}
void FriendRecommendDialog::sendMsg()
{
std::list<std::string> recommendIds;
ui->recommendList->selectedSslIds(recommendIds, false);
if (recommendIds.empty()) {
QMessageBox::warning(this, "RetroShare", tr("Please select at least one friend for recommendation."), QMessageBox::Ok, QMessageBox::Ok);
return;
}
std::list<std::string> toIds;
ui->toList->selectedSslIds(toIds, false);
if (toIds.empty()) {
QMessageBox::warning(this, "RetroShare", tr("Please select at least one friend as recipient."), QMessageBox::Ok, QMessageBox::Ok);
return;
}
std::list<std::string>::iterator toId;
for (toId = toIds.begin(); toId != toIds.end(); toId++) {
MessageComposer::recommendFriend(recommendIds, *toId, ui->messageEdit->toHtml(), true);
}
done(Accepted);
}

View File

@ -1,49 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2012, RetroShare Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef FRIENDRECOMMENDDIALOG_H
#define FRIENDRECOMMENDDIALOG_H
#include <QDialog>
namespace Ui {
class FriendRecommendDialog;
}
class FriendRecommendDialog : public QDialog
{
Q_OBJECT
public:
~FriendRecommendDialog();
static void showYourself();
private slots:
void sendMsg();
private:
FriendRecommendDialog();
Ui::FriendRecommendDialog *ui;
};
#endif // FRIENDRECOMMENDDIALOG_H

View File

@ -1,127 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FriendRecommendDialog</class>
<widget class="QDialog" name="FriendRecommendDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>493</width>
<height>362</height>
</rect>
</property>
<property name="windowTitle">
<string>Friend Recommendations</string>
</property>
<property name="windowIcon">
<iconset resource="images.qrc">
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
</property>
<property name="sizeGripEnabled">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="HeaderFrame" name="headerFrame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QFrame" name="frame_2">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="FriendSelectionWidget" name="recommendList" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="FriendSelectionWidget" name="toList" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QTextEdit" name="messageEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Message:</string>
</property>
</widget>
</item>
</layout>
<zorder></zorder>
<zorder>messageEdit</zorder>
<zorder>buttonBox</zorder>
<zorder>label</zorder>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>FriendSelectionWidget</class>
<extends>QWidget</extends>
<header>gui/common/FriendSelectionWidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>HeaderFrame</class>
<extends>QFrame</extends>
<header>gui/common/HeaderFrame.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -51,7 +51,6 @@
#include "util/misc.h"
#include "util/HandleRichText.h"
#include "util/DateTime.h"
//#include "FriendRecommendDialog.h"
#include "FriendsDialog.h"
#include "NetworkView.h"
#include "NetworkDialog.h"
@ -87,7 +86,6 @@ FriendsDialog::FriendsDialog(QWidget *parent)
connect( ui.actionSet_your_Personal_Message, SIGNAL(triggered()), this, SLOT(statusmessage()));
connect( ui.addfileButton, SIGNAL(clicked() ), this , SLOT(addExtraFile()));
connect( ui.actionAdd_Friend, SIGNAL(triggered()), this, SLOT(addFriend()));
connect( ui.actionFriendRecommendations, SIGNAL(triggered()), this, SLOT(recommendFriends()));
ui.avatar->setFrameType(AvatarWidget::STATUS_FRAME);
ui.avatar->setOwnId();
@ -168,7 +166,6 @@ FriendsDialog::FriendsDialog(QWidget *parent)
// menu->addAction(ui.actionAdd_Friend);
// menu->addAction(ui.actionAdd_Group);
// menu->addAction(ui.actionCreate_new_Chat_lobby);
// menu->addAction(ui.actionFriendRecommendations);
//
// menu->addSeparator();
// menu->addAction(ui.actionSet_your_Avatar);

View File

@ -127,8 +127,6 @@ private slots:
//void newsFeedChanged(int count);
// void recommendFriends();
signals:
void notifyGroupChat(const QString&,const QString&) ;

View File

@ -824,15 +824,6 @@
<string>Create new Chat lobby</string>
</property>
</action>
<action name="actionFriendRecommendations">
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/user/invite24.png</normaloff>:/images/user/invite24.png</iconset>
</property>
<property name="text">
<string>Friend Recommendations</string>
</property>
</action>
<action name="actionChooseFont">
<property name="text">
<string>Choose Font</string>

View File

@ -33,7 +33,6 @@
#include "gui/chat/ChatDialog.h"
//#include "gui/chat/CreateLobbyDialog.h"
#include "gui/common/AvatarDefs.h"
#include "gui/FriendRecommendDialog.h"
#include "gui/connect/ConfCertDialog.h"
#include "gui/connect/ConnectFriendWizard.h"
@ -527,10 +526,6 @@ void FriendList::peerTreeWidgetCostumPopupMenu()
}
contextMnu.addSeparator();
contextMnu.addAction(QIcon(IMAGE_EXPAND), tr("Recommend many friends to each others"), this, SLOT(recommendFriends()));
contextMnu.addSeparator();
contextMnu.addAction(QIcon(IMAGE_EXPAND), tr("Expand all"), ui->peerTreeWidget, SLOT(expandAll()));
@ -538,17 +533,13 @@ void FriendList::peerTreeWidgetCostumPopupMenu()
contextMnu.exec(QCursor::pos());
}
void FriendList::createNewGroup()
{
CreateGroup createGrpDialog ("", this);
createGrpDialog.exec();
}
void FriendList::recommendFriends()
{
FriendRecommendDialog::showYourself();
}
void FriendList::updateDisplay()
{
insertPeers();

View File

@ -150,7 +150,6 @@ private slots:
#ifdef UNFINISHED_FD
void viewprofile();
#endif
void recommendFriends() ;
void createNewGroup() ;
void addToGroup();

View File

@ -32,6 +32,7 @@
#include "gui/common/PeerDefs.h"
#include "gui/common/GroupDefs.h"
#include "gui/GetStartedDialog.h"
#include "gui/msgs/MessageComposer.h"
#include <retroshare/rsiface.h>
@ -397,6 +398,18 @@ void ConnectFriendWizard::initializePage(int id)
fillGroups(this, ui->fr_groupComboBox, groupId);
}
break;
case Page_FriendRecommendations:
ui->frec_recommendList->setHeaderText(tr("Recommend friends"));
ui->frec_recommendList->setModus(FriendSelectionWidget::MODUS_CHECK);
ui->frec_recommendList->setShowType(FriendSelectionWidget::SHOW_GROUP | FriendSelectionWidget::SHOW_SSL);
ui->frec_recommendList->start();
ui->frec_toList->setHeaderText(tr("To"));
ui->frec_toList->setModus(FriendSelectionWidget::MODUS_CHECK);
ui->frec_toList->start();
ui->frec_messageEdit->setText(MessageComposer::recommendMessage());
break;
}
}
@ -509,7 +522,6 @@ bool ConnectFriendWizard::validateCurrentPage()
body += "\n\n" + QString::fromUtf8(rsPeers->GetRetroshareInvite(false).c_str());
sendMail (mailaddresses, ui->subjectEdit->text(), body);
return true;
}
break;
case Page_ErrorMessage:
@ -518,6 +530,29 @@ bool ConnectFriendWizard::validateCurrentPage()
break;
case Page_FriendRequest:
break;
case Page_FriendRecommendations:
{
std::list<std::string> recommendIds;
ui->frec_recommendList->selectedSslIds(recommendIds, false);
if (recommendIds.empty()) {
QMessageBox::warning(this, "RetroShare", tr("Please select at least one friend for recommendation."), QMessageBox::Ok, QMessageBox::Ok);
return false;
}
std::list<std::string> toIds;
ui->frec_toList->selectedSslIds(toIds, false);
if (toIds.empty()) {
QMessageBox::warning(this, "RetroShare", tr("Please select at least one friend as recipient."), QMessageBox::Ok, QMessageBox::Ok);
return false;
}
std::list<std::string>::iterator toId;
for (toId = toIds.begin(); toId != toIds.end(); toId++) {
MessageComposer::recommendFriend(recommendIds, *toId, ui->frec_messageEdit->toHtml(), true);
}
}
}
return true;
@ -532,6 +567,7 @@ int ConnectFriendWizard::nextId() const
if (ui->foffRadioButton->isChecked()) return Page_Foff;
if (ui->rsidRadioButton->isChecked()) return Page_Rsid;
if (ui->emailRadioButton->isChecked()) return Page_Email;
if (ui->friendRecommendationsRadioButton->isChecked()) return Page_FriendRecommendations;
return ConnectFriendWizard::Page_Foff;
case Page_Text:
case Page_Cert:
@ -542,6 +578,7 @@ int ConnectFriendWizard::nextId() const
case Page_ErrorMessage:
case Page_Conclusion:
case Page_FriendRequest:
case Page_FriendRecommendations:
return -1;
}

View File

@ -25,7 +25,7 @@ class ConnectFriendWizard : public QWizard
Q_OBJECT
public:
enum Page { Page_Intro, Page_Text, Page_Cert, Page_ErrorMessage, Page_Conclusion, Page_Foff, Page_Rsid, Page_Email, Page_FriendRequest };
enum Page { Page_Intro, Page_Text, Page_Cert, Page_ErrorMessage, Page_Conclusion, Page_Foff, Page_Rsid, Page_Email, Page_FriendRequest, Page_FriendRecommendations };
ConnectFriendWizard(QWidget *parent = 0);
~ConnectFriendWizard();

View File

@ -64,6 +64,13 @@
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="friendRecommendationsRadioButton">
<property name="text">
<string>Recommend many friends to each others</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="ConnectFriendPage" name="TextPage">
@ -951,6 +958,60 @@
</item>
</layout>
</widget>
<widget class="QWizardPage" name="FriendRecommendationsPage">
<property name="title">
<string>Friend Recommendations</string>
</property>
<property name="subTitle">
<string>Recommend many friends to each others</string>
</property>
<attribute name="pageId">
<string notr="true">ConnectFriendWizard::Page_FriendRecommendations</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_16">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="FriendSelectionWidget" name="frec_recommendList" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="FriendSelectionWidget" name="frec_toList" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="frec_label">
<property name="text">
<string>Message:</string>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="frec_messageEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<customwidgets>
<customwidget>
@ -970,10 +1031,15 @@
<header>gui/connect/ConnectFriendWizard.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>FriendSelectionWidget</class>
<extends>QWidget</extends>
<header>gui/common/FriendSelectionWidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -2625,6 +2625,34 @@ Some services (Discovery, anonymous routing) can be switched off globally, which
<source>Direct source</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Recommend many friends to each others</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Friend Recommendations</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Message:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Recommend friends</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>To</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please select at least one friend for recommendation.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please select at least one friend as recipient.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ConnectProgressDialog</name>
@ -5542,42 +5570,11 @@ p, li { white-space: pre-wrap; }
<source>Create new group</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Recommend many friends to each others</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Display</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FriendRecommendDialog</name>
<message>
<source>Friend Recommendations</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Message:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Recommend friends</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>To</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please select at least one friend for recommendation.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please select at least one friend as recipient.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FriendRequestToaster</name>
<message>
@ -5714,10 +5711,6 @@ p, li { white-space: pre-wrap; }
<source>Create new Chat lobby</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Friend Recommendations</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Choose Font</source>
<translation type="unfinished"></translation>

View File

@ -311,7 +311,6 @@ HEADERS += rshare.h \
gui/TrustView.h \
gui/MessengerWindow.h \
gui/FriendsDialog.h \
gui/FriendRecommendDialog.h \
gui/ServicePermissionDialog.h \
gui/RemoteDirModel.h \
gui/RetroShareLink.h \
@ -526,7 +525,6 @@ FORMS += gui/StartDialog.ui \
gui/MessagesDialog.ui \
gui/help/browser/helpbrowser.ui \
gui/HelpDialog.ui \
gui/FriendRecommendDialog.ui \
gui/ServicePermissionDialog.ui \
gui/bwgraph/bwgraph.ui \
gui/profile/ProfileWidget.ui \
@ -624,7 +622,6 @@ SOURCES += main.cpp \
gui/TrustView.cpp \
gui/MessengerWindow.cpp \
gui/FriendsDialog.cpp \
gui/FriendRecommendDialog.cpp \
gui/ServicePermissionDialog.cpp \
gui/RemoteDirModel.cpp \
gui/RsAutoUpdatePage.cpp \