New class for working with peer names (rsid, name + location, ...) - PeerDefs.

Show the location in brackets - "name (location)" (defined now in PeerDefs).
Renamed head of context menu in PeersDialog for ssl items.
Fixed german translation.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3553 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-09-28 20:33:34 +00:00
parent 277a321f1b
commit de16f6c72d
20 changed files with 304 additions and 181 deletions

View File

@ -284,6 +284,7 @@ HEADERS += rshare.h \
gui/common/GroupDefs.h \
gui/common/Emoticons.h \
gui/common/RSTreeWidgetItem.h \
gui/common/PeerDefs.h \
gui/MessagesDialog.h \
gui/help/browser/helpbrowser.h \
gui/help/browser/helptextbrowser.h \
@ -482,6 +483,7 @@ SOURCES += main.cpp \
gui/common/GroupDefs.cpp \
gui/common/Emoticons.cpp \
gui/common/RSTreeWidgetItem.cpp \
gui/common/PeerDefs.cpp \
gui/settings/rsharesettings.cpp \
gui/settings/RsharePeerSettings.cpp \
gui/settings/rsettings.cpp \

View File

@ -38,6 +38,7 @@
#include "settings/rsharesettings.h"
#include "util/misc.h"
#include "common/TagDefs.h"
#include "common/PeerDefs.h"
#include <retroshare/rsinit.h>
#include <retroshare/rspeers.h>
@ -1365,11 +1366,11 @@ void MessagesDialog::insertMessages()
text += ", ";
}
QString sPeer = QString::fromStdString(rsPeers->getPeerName(*pit));
if (sPeer.isEmpty()) {
text += tr("Anonymous") + "@" + QString::fromStdString(*pit);
std::string peerName = rsPeers->getPeerName(*pit);
if (peerName.empty()) {
text += PeerDefs::rsid("", *pit);
} else {
text += sPeer;
text += QString::fromStdString(peerName);
}
}
} else {
@ -1687,15 +1688,12 @@ void MessagesDialog::insertMsgTxtAndFiles(QModelIndex Index, bool bSetToRead)
std::list<std::string>::const_iterator pit;
QString msgTxt;
QString name;
QString rsid;
for(pit = msgInfo.msgto.begin(); pit != msgInfo.msgto.end(); pit++)
{
QString sPeer = QString::fromStdString(rsPeers->getPeerName(*pit));
if (sPeer.isEmpty())
{
msgTxt += "<a style='color: black;'href='" + tr("Anonymous") + "@" + QString::fromStdString(*pit) + "'> " + tr("Anonymous") + "</a>" + " ";
}
else
msgTxt += "<a style='color: black;'href='" + sPeer + "@" + QString::fromStdString(*pit) + "'> " + sPeer + "</a>" + " ";
rsid = PeerDefs::rsidFromId(*pit, &name);
msgTxt += "<a style='color: black;'href='" + rsid + "'> " + name + "</a>" + " ";
}
ui.toText->setText(msgTxt);
@ -1706,13 +1704,8 @@ void MessagesDialog::insertMsgTxtAndFiles(QModelIndex Index, bool bSetToRead)
msgTxt.clear();
for(pit = msgInfo.msgcc.begin(); pit != msgInfo.msgcc.end(); pit++)
{
QString sPeer = QString::fromStdString(rsPeers->getPeerName(*pit));
if (sPeer.isEmpty())
{
msgTxt += "<a style='color: black;'href='" + tr("Anonymous") + "@" + QString::fromStdString(*pit) + "'> " + tr("Anonymous") + "</a>" + " ";
}
else
msgTxt += "<a style='color: black;'href='" + sPeer + "@" + QString::fromStdString(*pit) + "'> " + sPeer + "</a>" + " ";
rsid = PeerDefs::rsidFromId(*pit, &name);
msgTxt += "<a style='color: black;'href='" + rsid + "'> " + name + "</a>" + " ";
}
ui.ccText->setText(msgTxt);
} else {
@ -1728,13 +1721,8 @@ void MessagesDialog::insertMsgTxtAndFiles(QModelIndex Index, bool bSetToRead)
msgTxt.clear();
for(pit = msgInfo.msgbcc.begin(); pit != msgInfo.msgbcc.end(); pit++)
{
QString sPeer = QString::fromStdString(rsPeers->getPeerName(*pit));
if (sPeer.isEmpty())
{
msgTxt += "<a style='color: black;'href='" + tr("Anonymous") + "@" + QString::fromStdString(*pit) + "'> " + tr("Anonymous") + "</a>" + " ";
}
else
msgTxt += "<a style='color: black;'href='" + sPeer + "@" + QString::fromStdString(*pit) + "'> " + sPeer + "</a>" + " ";
rsid = PeerDefs::rsidFromId(*pit, &name);
msgTxt += "<a style='color: black;'href='" + rsid + "'> " + name + "</a>" + " ";
}
ui.bccText->setText(msgTxt);
} else {
@ -1757,8 +1745,11 @@ void MessagesDialog::insertMsgTxtAndFiles(QModelIndex Index, bool bSetToRead)
} else {
sSrcId = msgInfo.srcId;
}
ui.fromText->setText("<a style='color: blue;' href='" + QString::fromStdString(rsPeers->getPeerName(sSrcId)) + "@" + QString::fromStdString(sSrcId) + "'> " + QString::fromStdString(rsPeers->getPeerName(sSrcId)) +"</a>");
ui.fromText->setToolTip(QString::fromStdString(rsPeers->getPeerName(sSrcId)) + "@" + QString::fromStdString(sSrcId));
rsid = PeerDefs::rsidFromId(sSrcId, &name);
msgTxt += "<a style='color: black;'href='" + rsid + "'> " + name + "</a>" + " ";
ui.fromText->setText("<a style='color: blue;' href='" + rsid + "'> " + name +"</a>");
ui.fromText->setToolTip(rsid);
ui.subjectText->setText(QString::fromStdWString(msgInfo.title));
ui.msgText->setHtml(QString::fromStdWString(msgInfo.msg));
@ -2296,23 +2287,10 @@ void MessagesDialog::tagTriggered(QAction *pAction)
void MessagesDialog::linkActivated(QString link)
{
if (link.isEmpty() == false) {
// search for cert id in string
std::string certidstr;
int nIndex = link.indexOf("@");
if (nIndex >= 0)
{
// found "@", extract cert id from string
certidstr = link.mid(nIndex + 1).toStdString();
}
else
{
// maybe its only the cert id
certidstr = link.toStdString();
}
std::string id = PeerDefs::idFromRsid(link, false);
RsPeerDetails detail;
if (rsPeers->getPeerDetails(certidstr, detail) && detail.accept_connection) {
if (rsPeers->getPeerDetails(id, detail) && detail.accept_connection) {
MessageComposer::msgFriend(detail.id, false);
}
}

View File

@ -52,6 +52,7 @@
#include "util/Widget.h"
#include "settings/rsharesettings.h"
#include "common/RSTreeWidgetItem.h"
#include "common/PeerDefs.h"
#include "RetroShareLink.h"
@ -193,7 +194,7 @@ MessengerWindow::MessengerWindow(QWidget* parent, Qt::WFlags flags)
std::string ownId = rsPeers->getOwnId();
if (rsPeers->getPeerDetails(ownId, pd)) {
/* calculate only once */
m_nickName = QString::fromStdString(pd.name) + " - " + QString::fromStdString(pd.location);
m_nickName = PeerDefs::nameWithLocation(pd);
#ifdef MINIMAL_RSGUI
ui.statusButton->setText(m_nickName);
#endif

View File

@ -468,7 +468,7 @@ void NetworkDialog::insertConnect()
backgrndcolor=QColor("#42B2B2"); //kind of darkCyan
item -> setIcon(0,(QIcon(IMAGE_DENIED)));
for(int k=0;k<8;++k)
item -> setToolTip(k,QString::fromStdString(detail.name) + QString(tr(" has authenticated you. \nRight-click and select 'make friend' to be able to connect."))) ;
item -> setToolTip(k, QString::fromStdString(detail.name) + tr(" has authenticated you. \nRight-click and select 'make friend' to be able to connect."));
}
else
{
@ -509,7 +509,7 @@ void NetworkDialog::insertConnect()
}
self_item -> setText(0, "0");
self_item->setIcon(0,(QIcon(IMAGE_AUTHED)));
self_item->setText(COLUMN_PEERNAME,QString::fromStdString(ownGPGDetails.name) + " (yourself)") ;
self_item->setText(COLUMN_PEERNAME, QString::fromStdString(ownGPGDetails.name) + " (" + tr("yourself") + ")");
self_item->setText(2,"N/A");
self_item->setText(COLUMN_PEERID, QString::fromStdString(ownGPGDetails.id));

View File

@ -371,7 +371,7 @@ void PeersDialog::peertreeWidgetCostumPopupMenu( QPoint point )
iconLabel->setMaximumSize( iconLabel->frameSize().height() + 24, 24 );
hbox->addWidget(iconLabel);
textLabel = new QLabel( tr("<strong>RetroShare instance</strong>"), widget );
textLabel = new QLabel("<strong>" + tr("RetroShare") + "</strong>", widget );
hbox->addWidget(textLabel);
@ -392,12 +392,16 @@ void PeersDialog::peertreeWidgetCostumPopupMenu( QPoint point )
// define header
switch (type) {
case TYPE_GROUP:
//this is a GPG key
textLabel->setText(tr("<strong>Group</strong>"));
break;
//this is a GPG key
textLabel->setText("<strong>" + tr("Group") + "</strong>");
break;
case TYPE_GPG:
//this is a GPG key
textLabel->setText(tr("<strong>Friend</strong>"));
textLabel->setText("<strong>" + tr("Friend") + "</strong>");
break;
case TYPE_SSL:
//this is a SSL key
textLabel->setText("<strong>" + tr("Location") + "</strong>");
break;
}

View File

@ -30,6 +30,7 @@
#include "RetroShareLink.h"
#include "util/misc.h"
#include "common/PeerDefs.h"
#include <retroshare/rsfiles.h>
#include <retroshare/rspeers.h>
@ -172,7 +173,7 @@ QString RetroShareLink::toString() const
QString RetroShareLink::niceName() const
{
if (type() == TYPE_PERSON) {
return name() + "@" + hash();
return PeerDefs::rsid(name().toStdString(), hash().toStdString());
}
return name();

View File

@ -34,7 +34,8 @@
#include "settings/rsharesettings.h"
#include "AddLinksDialog.h"
#include "RetroShareLink.h"
#include "gui/RemoteDirModel.h"
#include "RemoteDirModel.h"
#include "common/PeerDefs.h"
#include <retroshare/rspeers.h>
#include <retroshare/rsfiles.h>
@ -746,18 +747,16 @@ void SharedFilesDialog::sharedDirTreeWidgetContextMenu( QPoint point )
if(!rsPeers->getPeerDetails(*it,details))
continue ;
std::string name = details.name ;
std::string location = details.location ;
QString nn = PeerDefs::nameWithLocation(details);
std::string nn = name + " (" + location +")" ;
/* parents are
* recMenu
* msgMenu
*/
RsAction *qaf1 = new RsAction( QIcon(IMAGE_FRIEND), QString::fromStdString( nn ), &recMenu, *it );
RsAction *qaf1 = new RsAction( QIcon(IMAGE_FRIEND), nn, &recMenu, *it );
connect( qaf1 , SIGNAL( triggeredId( std::string ) ), this, SLOT( recommendFilesTo( std::string ) ) );
RsAction *qaf2 = new RsAction( QIcon(IMAGE_FRIEND), QString::fromStdString( nn ), &msgMenu, *it );
RsAction *qaf2 = new RsAction( QIcon(IMAGE_FRIEND), nn, &msgMenu, *it );
connect( qaf2 , SIGNAL( triggeredId( std::string ) ), this, SLOT( recommendFilesToMsg( std::string ) ) );
recMenu.addAction(qaf1);

View File

@ -164,7 +164,7 @@ void TrustView::update()
int j = getRowColId(*it2) ;
QString trr( (i==j)?"Self":"Trust") ;
QString trr( (i==j)?tr("Self"):tr("Trust")) ;
if(trustTableTW->item(i,j) == NULL)
trustTableTW->setItem(i,j,new QTableWidgetItem(trr)) ;

View File

@ -26,6 +26,7 @@
#include <algorithm>
#include "CreateChannel.h"
#include "gui/common/PeerDefs.h"
#include <retroshare/rschannels.h>
#include <retroshare/rspeers.h>
@ -105,7 +106,7 @@ void CreateChannel::setShareList(){
/* make a widget per friend */
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
item -> setText(0, QString::fromStdString(detail.name) + " - " + QString::fromStdString(detail.location));
item -> setText(0, PeerDefs::nameWithLocation(detail));
if (detail.state & RS_PEER_STATE_CONNECTED) {
item -> setTextColor(0,(Qt::darkBlue));
}

View File

@ -27,6 +27,8 @@
#include <retroshare/rschannels.h>
#include <retroshare/rspeers.h>
#include "gui/common/PeerDefs.h"
ShareKey::ShareKey(QWidget *parent, Qt::WFlags flags, std::string chanId) :
QDialog(parent, flags), mChannelId(chanId)
{
@ -128,7 +130,7 @@ void ShareKey::setShareList(){
/* make a widget per friend */
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
item -> setText(0, QString::fromStdString(detail.name) + " - " + QString::fromStdString(detail.location));
item -> setText(0, PeerDefs::nameWithLocation(detail));
if (detail.state & RS_PEER_STATE_CONNECTED) {
item -> setTextColor(0,(Qt::darkBlue));
}

View File

@ -53,6 +53,8 @@
#include "gui/feeds/AttachFileItem.h"
#include "gui/msgs/MessageComposer.h"
#include "gui/common/PeerDefs.h"
#include <time.h>
#define appDir QApplication::applicationDirPath()
@ -90,8 +92,7 @@ void playsound()
}
/** Default constructor */
PopupChatDialog::PopupChatDialog(std::string id, std::string name,
QWidget *parent, Qt::WFlags flags)
PopupChatDialog::PopupChatDialog(std::string id, const QString name, QWidget *parent, Qt::WFlags flags)
: QMainWindow(parent, flags), dialogId(id), dialogName(name),
lastChatTime(0), lastChatName("")
@ -145,7 +146,7 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name,
//ui.textBrowser->setOpenExternalLinks ( false );
//ui.textBrowser->setOpenLinks ( false );
QString title = tr("RetroShare") + " - " + QString::fromStdString(name);
QString title = tr("RetroShare") + " - " + name;
setWindowTitle(title);
setWindowIcon(QIcon(IMAGE_WINDOW));
@ -259,7 +260,7 @@ void PopupChatDialog::processSettings(bool bLoad)
{
RsPeerDetails sslDetails;
if (rsPeers->getPeerDetails(id, sslDetails)) {
popupchatdialog = new PopupChatDialog(id, sslDetails.name + " - " + sslDetails.location);
popupchatdialog = new PopupChatDialog(id, PeerDefs::nameWithLocation(sslDetails));
chatDialogs[id] = popupchatdialog;
#ifdef PEERS_DEBUG
std::cerr << "new chat so: enable SHOW popupchatdialog()" << std::endl;
@ -1132,14 +1133,14 @@ void PopupChatDialog::updateStatus(const QString &peer_id, int status)
ui.avatarlabel->setStyleSheet("QLabel#avatarlabel{ border-image:url(:/images/avatarstatus_bg_offline.png); }");
ui.avatarlabel->setEnabled(false);
ui.infoframe->setVisible(true);
ui.infolabel->setText( QString::fromStdString(dialogName) + " " + tr("apears to be Offline.") +"\n" + tr("Messages you send will be delivered after Friend is again Online"));
ui.infolabel->setText(dialogName + " " + tr("apears to be Offline.") +"\n" + tr("Messages you send will be delivered after Friend is again Online"));
break;
case RS_STATUS_INACTIVE:
ui.avatarlabel->setStyleSheet("QLabel#avatarlabel{ border-image:url(:/images/avatarstatus_bg_away.png); }");
ui.avatarlabel->setEnabled(true);
ui.infoframe->setVisible(true);
ui.infolabel->setText( QString::fromStdString(dialogName) + " " + tr("is Idle and may not reply"));
ui.infolabel->setText(dialogName + " " + tr("is Idle and may not reply"));
break;
case RS_STATUS_ONLINE:
@ -1151,20 +1152,20 @@ void PopupChatDialog::updateStatus(const QString &peer_id, int status)
case RS_STATUS_AWAY:
ui.avatarlabel->setStyleSheet("QLabel#avatarlabel{ border-image:url(:/images/avatarstatus_bg_away.png); }");
ui.avatarlabel->setEnabled(true);
ui.infolabel->setText( QString::fromStdString(dialogName) + " " + tr("is Away and may not reply"));
ui.infolabel->setText(dialogName + " " + tr("is Away and may not reply"));
ui.infoframe->setVisible(true);
break;
case RS_STATUS_BUSY:
ui.avatarlabel->setStyleSheet("QLabel#avatarlabel{ border-image:url(:/images/avatarstatus_bg_busy.png); }");
ui.avatarlabel->setEnabled(true);
ui.infolabel->setText( QString::fromStdString(dialogName) + " " + tr("is Busy and may not reply"));
ui.infolabel->setText(dialogName + " " + tr("is Busy and may not reply"));
ui.infoframe->setVisible(true);
break;
}
QString statusString("<span style=\"font-size:11pt; font-weight:500;""\">%1</span>");
ui.friendnamelabel->setText( QString::fromStdString(dialogName) + " (" + statusString.arg(StatusDefs::name(status)) + ")") ;
ui.friendnamelabel->setText(dialogName + " (" + statusString.arg(StatusDefs::name(status)) + ")") ;
return;
}

View File

@ -70,8 +70,7 @@ public slots:
protected:
/** Default constructor */
PopupChatDialog(std::string id, std::string name,
QWidget *parent = 0, Qt::WFlags flags = 0);
PopupChatDialog(std::string id, const QString name, QWidget *parent = 0, Qt::WFlags flags = 0);
/** Default destructor */
~PopupChatDialog();
@ -127,7 +126,8 @@ private:
QAction *actionTextItalic;
QAction *pasteLinkAct ;
std::string dialogId, dialogName;
std::string dialogId;
QString dialogName;
unsigned int lastChatTime;
std::string lastChatName;

View File

@ -0,0 +1,95 @@
/****************************************************************
* This file is distributed under the following license:
*
* Copyright (c) 2010, 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 <QCoreApplication>
#include <retroshare/rspeers.h>
#include "PeerDefs.h"
const QString PeerDefs::nameWithLocation(const RsPeerDetails &details)
{
QString name = QString::fromStdString(details.name);
if (details.location.empty() == false) {
name += " (" + QString::fromStdString(details.location) + ")";
}
return name;
}
const QString PeerDefs::rsid(const std::string &name, const std::string &id)
{
if (name.empty()) {
return qApp->translate("PeerDefs", "Anonymous") + "@" + QString::fromStdString(id);
}
return QString::fromStdString(name) + "@" + QString::fromStdString(id);
}
const QString PeerDefs::rsid(const RsPeerDetails &details)
{
return rsid(details.name, details.id);
}
const QString PeerDefs::rsidFromId(const std::string &id, QString *name /*= NULL*/)
{
QString rsid;
std::string peerName = rsPeers->getPeerName(id);
if (peerName.empty()) {
rsid = PeerDefs::rsid("", id);
if (name) {
*name = qApp->translate("PeerDefs", "Anonymous");
}
} else {
rsid = PeerDefs::rsid(peerName, id);
if (name) {
*name = QString::fromStdString(peerName);
}
}
return rsid;
}
const std::string PeerDefs::idFromRsid(const QString &rsid, bool check)
{
// search for cert id in string
std::string id;
int index = rsid.indexOf("@");
if (index >= 0) {
// found "@", extract cert id from string
id = rsid.mid(index + 1).toStdString();
} else {
// maybe its only the cert id
id = rsid.toStdString();
}
if (check) {
RsPeerDetails detail;
if (rsPeers->getPeerDetails(id, detail) == false) {
id.clear();
}
}
return id;
}

View File

@ -0,0 +1,42 @@
/****************************************************************
* This file is distributed under the following license:
*
* Copyright (c) 2010, 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 _PEERDEFS_H
#define _PEERDEFS_H
#include <QString>
class RsPeerDetails;
class PeerDefs
{
public:
static const QString nameWithLocation(const RsPeerDetails &details);
static const QString rsid(const RsPeerDetails &details);
static const QString rsid(const std::string &name, const std::string &id);
static const QString rsidFromId(const std::string &id, QString *name = NULL);
static const std::string idFromRsid(const QString &rsid, bool check);
};
#endif

View File

@ -31,6 +31,7 @@
#include <retroshare/rsdisc.h>
#include "gui/help/browser/helpbrowser.h"
#include "gui/common/PeerDefs.h"
ConfCertDialog *ConfCertDialog::instance()
{
@ -133,7 +134,7 @@ void ConfCertDialog::loadDialog()
ui.name->setText(QString::fromStdString(detail.name));
ui.peerid->setText(QString::fromStdString(detail.id));
ui.rsid->setText(QString::fromStdString(detail.name) + "@" + QString::fromStdString(detail.id));
ui.rsid->setText(PeerDefs::rsid(detail));
if (!detail.isOnlyGPGdetail) {
@ -396,7 +397,7 @@ void ConfCertDialog::denyFriend() {
void ConfCertDialog::signGPGKey() {
std::string gpg_id = rsPeers->getGPGId(mId);
if (!rsPeers->signGPGCertificate(gpg_id)) {
QMessageBox::StandardButton sb = QMessageBox::warning ( NULL,
QMessageBox::warning ( NULL,
tr("Signature Failure"),
tr("Maybe password is wrong"),
QMessageBox::Ok);

View File

@ -20,6 +20,7 @@
****************************************************************/
#include "ConnectFriendWizard.h"
#include "gui/common/PeerDefs.h"
#include <retroshare/rspeers.h> //for rsPeers variable
#include <retroshare/rsiface.h>
@ -1065,18 +1066,10 @@ int RsidPage::nextId() const {
if (rsidstring.isEmpty() == false) {
// search for peer id in string
std::string rsidstr;
std::string rsidstr = PeerDefs::idFromRsid(rsidstring, false);
int nIndex = rsidstring.indexOf("@");
if (nIndex >= 0) {
// found "@", extract peer id from string
rsidstr = rsidstring.mid(nIndex + 1).toStdString();
} else {
// maybe its only the peer id
rsidstr = rsidstring.toStdString();
}
RsPeerDetails pd;
if ( rsPeers->getPeerDetails(rsidstr, pd) ) {
if (rsidstr.empty() == false && rsPeers->getPeerDetails(rsidstr, pd) ) {
wizard()->setField(SSL_ID_FIELD_CONNECT_FRIEND_WIZARD, QString::fromStdString(pd.id));
wizard()->setField(GPG_ID_FIELD_CONNECT_FRIEND_WIZARD, QString::fromStdString(pd.gpg_id));
wizard()->setField(LOCATION_FIELD_CONNECT_FRIEND_WIZARD, QString::fromStdString(pd.location));

View File

@ -46,6 +46,7 @@
#include "gui/common/RSTreeWidgetItem.h"
#include "gui/common/GroupDefs.h"
#include "gui/common/StatusDefs.h"
#include "gui/common/PeerDefs.h"
#include "gui/RetroShareLink.h"
#include "gui/settings/rsharesettings.h"
#include "gui/feeds/AttachFileItem.h"
@ -94,16 +95,6 @@ public:
}
};
static QString BuildPeerName(RsPeerDetails &detail)
{
QString name = QString::fromUtf8(detail.name.c_str());
if (detail.location.empty() == false) {
name += " - " + QString::fromUtf8(detail.location.c_str());
}
return name;
}
/** Constructor */
MessageComposer::MessageComposer(QWidget *parent, Qt::WFlags flags)
: QMainWindow(parent, flags), mCheckAttachment(true)
@ -560,7 +551,7 @@ void MessageComposer::insertSendList()
/* add all the labels */
/* (0) Person */
QString name = BuildPeerName(detail);
QString name = PeerDefs::nameWithLocation(detail);
item->setText(COLUMN_CONTACT_NAME, name);
int state = RS_STATUS_OFFLINE;
@ -605,7 +596,7 @@ void MessageComposer::insertSendList()
continue; /* BAD */
}
QString name = BuildPeerName(detail);
QString name = PeerDefs::nameWithLocation(detail);
if (completerList.indexOf(name) == -1) {
completerList.append(name);
}
@ -1160,9 +1151,9 @@ void MessageComposer::setRecipientToRow(int row, enumType type, std::string id,
name = tr("Unknown");
}
} else {
RsPeerDetails detail;
if (rsPeers->getPeerDetails(id, detail)) {
name = BuildPeerName(detail);
RsPeerDetails details;
if (rsPeers->getPeerDetails(id, details)) {
name = PeerDefs::nameWithLocation(details);
StatusInfo peerStatusInfo;
// No check of return value. Non existing status info is handled as offline.
@ -1267,15 +1258,15 @@ void MessageComposer::editingRecipientFinished()
std::list<std::string>::iterator peerIt;
for (peerIt = peers.begin(); peerIt != peers.end(); peerIt++) {
RsPeerDetails detail;
if (!rsPeers->getPeerDetails(*peerIt, detail)) {
RsPeerDetails details;
if (!rsPeers->getPeerDetails(*peerIt, details)) {
continue; /* BAD */
}
QString name = BuildPeerName(detail);
QString name = PeerDefs::nameWithLocation(details);
if (text.compare(name, Qt::CaseSensitive) == 0) {
// found it
setRecipientToRow(row, type, detail.id, false);
setRecipientToRow(row, type, details.id, false);
return;
}
}

View File

@ -29,14 +29,8 @@
//#include <QContextMenuEvent>
#include <QMenu>
//#include <QFile>
#include <QFileDialog>
//#include <QCursor>
//#include <QPoint>
//#include <QMouseEvent>
#include <QMessageBox>
//#include <QPixmap>
//#include <QPrintDialog>
/** Constructor */

View File

@ -763,7 +763,7 @@ p, li { white-space: pre-wrap; }
<context>
<name>CertificatePage</name>
<message>
<location filename="../gui/connect/ConnectFriendWizard.cpp" line="+606"/>
<location filename="../gui/connect/ConnectFriendWizard.cpp" line="+607"/>
<source>Certificate files</source>
<translation>Zertifikat-Dateien</translation>
</message>
@ -1489,7 +1489,7 @@ Keine Beschreibung</translation>
<translation>Voll </translation>
</message>
<message>
<location filename="../gui/connect/ConfCertDialog.cpp" line="+61"/>
<location filename="../gui/connect/ConfCertDialog.cpp" line="+62"/>
<source>Apply and Close</source>
<translation>Übernehmen und Schliessen</translation>
</message>
@ -2104,7 +2104,7 @@ Möchten Sie die Änderungen speichern?</translation>
<translation>Erstellen</translation>
</message>
<message>
<location filename="../gui/channels/CreateChannel.cpp" line="+162"/>
<location filename="../gui/channels/CreateChannel.cpp" line="+163"/>
<source>RetroShare</source>
<translation></translation>
</message>
@ -2839,7 +2839,7 @@ p, li { white-space: pre-wrap; }
<context>
<name>EmailPage</name>
<message>
<location filename="../gui/connect/ConnectFriendWizard.cpp" line="+1010"/>
<location filename="../gui/connect/ConnectFriendWizard.cpp" line="+1002"/>
<source>Invite Friend by Email</source>
<translation>Einladung per E-Mail versenden</translation>
</message>
@ -2880,7 +2880,7 @@ Bis bald in RetroShare!</translation>
<context>
<name>ErrorMessagePage</name>
<message>
<location line="-323"/>
<location line="-315"/>
<source>Sorry, some error appeared</source>
<translation>Entschuldigung, es trat ein Fehler auf</translation>
</message>
@ -4835,11 +4835,12 @@ p, li { white-space: pre-wrap; }
<translation>Kanäle</translation>
</message>
<message>
<location line="+4"/>
<source>Blogs</source>
<translation type="obsolete">Blogs</translation>
<translation type="unfinished">Blogs</translation>
</message>
<message>
<location line="+540"/>
<location line="+539"/>
<source>Internal Error</source>
<translation>Interener Fehler</translation>
</message>
@ -4895,7 +4896,7 @@ p, li { white-space: pre-wrap; }
<translation>Schnellstart Assistent</translation>
</message>
<message>
<location filename="../gui/MainWindow.cpp" line="-261"/>
<location filename="../gui/MainWindow.cpp" line="-264"/>
<source>Search</source>
<translation>Suchen</translation>
</message>
@ -4910,7 +4911,7 @@ p, li { white-space: pre-wrap; }
<translation>Messenger</translation>
</message>
<message>
<location filename="../gui/MainWindow.cpp" line="+148"/>
<location filename="../gui/MainWindow.cpp" line="+151"/>
<source>Show/Hide</source>
<translation>Anzeigen/Verbergen</translation>
</message>
@ -4987,12 +4988,12 @@ p, li { white-space: pre-wrap; }
<translation>Foren</translation>
</message>
<message>
<location line="-66"/>
<location line="-69"/>
<source>RetroShare %1 a secure decentralised communication platform</source>
<translation>RetroShare %1 eine sichere und dezentralisierte Kommunikationsplattform</translation>
</message>
<message>
<location line="+567"/>
<location line="+570"/>
<source>Open Messages</source>
<translation>Öffne Nachrichten</translation>
</message>
@ -5054,7 +5055,7 @@ Bitte gib etwas Speicher frei und drücke OK.</translation>
<name>MessageComposer</name>
<message>
<location filename="../gui/msgs/MessageComposer.ui" line="+17"/>
<location filename="../gui/msgs/MessageComposer.cpp" line="+398"/>
<location filename="../gui/msgs/MessageComposer.cpp" line="+389"/>
<location line="+344"/>
<source>Compose</source>
<translation>Verfassen</translation>
@ -5583,7 +5584,7 @@ Willst Du die Nachricht speichern ?</translation>
<name>MessagesDialog</name>
<message>
<location filename="../gui/MessagesDialog.ui" line="+573"/>
<location filename="../gui/MessagesDialog.cpp" line="+690"/>
<location filename="../gui/MessagesDialog.cpp" line="+691"/>
<source>New Message</source>
<translation>Neue Nachricht</translation>
</message>
@ -5691,15 +5692,15 @@ p, li { white-space: pre-wrap; }
<message>
<location line="+171"/>
<location filename="../gui/MessagesDialog.cpp" line="-44"/>
<location line="+932"/>
<location line="+922"/>
<location line="+10"/>
<source>Inbox</source>
<translation>Posteingang</translation>
</message>
<message>
<location line="+9"/>
<location filename="../gui/MessagesDialog.cpp" line="-937"/>
<location line="+950"/>
<location filename="../gui/MessagesDialog.cpp" line="-927"/>
<location line="+940"/>
<location line="+8"/>
<source>Outbox</source>
<translation>Postausgang</translation>
@ -5711,7 +5712,7 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<location line="+9"/>
<location filename="../gui/MessagesDialog.cpp" line="-948"/>
<location filename="../gui/MessagesDialog.cpp" line="-938"/>
<source>Sent</source>
<translation>Gesendet</translation>
</message>
@ -5768,13 +5769,13 @@ p, li { white-space: pre-wrap; }
<translation>Speichern unter...</translation>
</message>
<message>
<location filename="../gui/MessagesDialog.cpp" line="+697"/>
<location filename="../gui/MessagesDialog.cpp" line="+687"/>
<source>Print Document</source>
<translation>Dokument drucken</translation>
</message>
<message>
<location filename="../gui/MessagesDialog.ui" line="-859"/>
<location filename="../gui/MessagesDialog.cpp" line="-1584"/>
<location filename="../gui/MessagesDialog.cpp" line="-1574"/>
<source>Subject</source>
<translation>Betreff</translation>
</message>
@ -5856,15 +5857,7 @@ p, li { white-space: pre-wrap; }
<translation>Empfohlene Dateien einblenden</translation>
</message>
<message>
<location line="+437"/>
<location line="+325"/>
<location line="+17"/>
<location line="+22"/>
<source>Anonymous</source>
<translation>Anonym</translation>
</message>
<message>
<location line="+179"/>
<location line="+970"/>
<source>Save as...</source>
<translation>Speichern unter...</translation>
</message>
@ -5874,7 +5867,7 @@ p, li { white-space: pre-wrap; }
<translation>HTML-Dateien (*.htm *.html);;Alle Dateien (*)</translation>
</message>
<message>
<location line="-1568"/>
<location line="-1558"/>
<location line="+272"/>
<source>Reply to All</source>
<translation>Allen antworten</translation>
@ -5914,7 +5907,7 @@ p, li { white-space: pre-wrap; }
<message>
<location line="+171"/>
<location filename="../gui/MessagesDialog.cpp" line="+710"/>
<location line="+974"/>
<location line="+964"/>
<location line="+5"/>
<source>Trash</source>
<translation>Papierkorb</translation>
@ -5930,7 +5923,7 @@ p, li { white-space: pre-wrap; }
<translation>Ordner</translation>
</message>
<message>
<location filename="../gui/MessagesDialog.cpp" line="-1678"/>
<location filename="../gui/MessagesDialog.cpp" line="-1668"/>
<source>Remove All Tags</source>
<translation>Alle Schlagwörter entfernen</translation>
</message>
@ -5966,13 +5959,13 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<location line="+275"/>
<location line="+965"/>
<location line="+955"/>
<location line="+8"/>
<source>Drafts</source>
<translation>Entwürfe</translation>
</message>
<message>
<location line="-937"/>
<location line="-927"/>
<source>To</source>
<translation>An</translation>
</message>
@ -5982,7 +5975,7 @@ p, li { white-space: pre-wrap; }
<translation>Editieren...</translation>
</message>
<message>
<location line="+1434"/>
<location line="+1424"/>
<location line="+4"/>
<location line="+4"/>
<location line="+4"/>
@ -5994,7 +5987,7 @@ p, li { white-space: pre-wrap; }
<context>
<name>MessengerWindow</name>
<message>
<location filename="../gui/MessengerWindow.cpp" line="+293"/>
<location filename="../gui/MessengerWindow.cpp" line="+294"/>
<source>Expand all</source>
<translation>Alle erweitern</translation>
</message>
@ -6449,7 +6442,12 @@ p, li { white-space: pre-wrap; }
<translation>GPG Schlüssel nicht unterzeichnet</translation>
</message>
<message>
<location line="+222"/>
<location line="+80"/>
<source>yourself</source>
<translation>selbst</translation>
</message>
<message>
<location line="+142"/>
<location line="+16"/>
<location line="+4"/>
<location line="+6"/>
@ -6797,6 +6795,15 @@ p, li { white-space: pre-wrap; }
<translation>Nachbar Online</translation>
</message>
</context>
<context>
<name>PeerDefs</name>
<message>
<location filename="../gui/common/PeerDefs.cpp" line="+40"/>
<location line="+20"/>
<source>Anonymous</source>
<translation>Anonym</translation>
</message>
</context>
<context>
<name>PeerItem</name>
<message>
@ -6945,7 +6952,7 @@ p, li { white-space: pre-wrap; }
<context>
<name>PeersDialog</name>
<message>
<location filename="../gui/PeersDialog.cpp" line="+423"/>
<location filename="../gui/PeersDialog.cpp" line="+427"/>
<source>Chat</source>
<translation>Chat</translation>
</message>
@ -6970,7 +6977,7 @@ p, li { white-space: pre-wrap; }
<translation>Verbinde zum Freund</translation>
</message>
<message>
<location line="-295"/>
<location line="-299"/>
<source>Profile</source>
<translation>Profil</translation>
</message>
@ -6990,7 +6997,22 @@ p, li { white-space: pre-wrap; }
<translation>ich</translation>
</message>
<message>
<location line="+164"/>
<location line="+151"/>
<source>Group</source>
<translation>Gruppe</translation>
</message>
<message>
<location line="+4"/>
<source>Friend</source>
<translation>Freund</translation>
</message>
<message>
<location line="+4"/>
<source>Location</source>
<translation>Standort</translation>
</message>
<message>
<location line="+9"/>
<source>Message group</source>
<translation>Gruppe anschreiben</translation>
</message>
@ -7015,17 +7037,7 @@ p, li { white-space: pre-wrap; }
<translation>Freund anschreiben</translation>
</message>
<message>
<location line="-28"/>
<source>&lt;strong&gt;Group&lt;/strong&gt;</source>
<translation>&lt;strong&gt;Gruppe&lt;/strong&gt;</translation>
</message>
<message>
<location line="+4"/>
<source>&lt;strong&gt;Friend&lt;/strong&gt;</source>
<translation>&lt;strong&gt;Freund&lt;/strong&gt;</translation>
</message>
<message>
<location line="+13"/>
<location line="-11"/>
<source>Edit group</source>
<translation>Gruppe ändern</translation>
</message>
@ -7075,12 +7087,7 @@ p, li { white-space: pre-wrap; }
<translation>Gruppe entfernen</translation>
</message>
<message>
<location line="-42"/>
<source>&lt;strong&gt;RetroShare instance&lt;/strong&gt;</source>
<translation></translation>
</message>
<message>
<location line="+640"/>
<location line="+598"/>
<source>Available</source>
<translation>Verfügbar</translation>
</message>
@ -7251,7 +7258,8 @@ p, li { white-space: pre-wrap; }
<translation>Chat Verlauf speichern</translation>
</message>
<message>
<location filename="../gui/PeersDialog.cpp" line="-661"/>
<location filename="../gui/PeersDialog.cpp" line="-1506"/>
<location line="+845"/>
<source>RetroShare</source>
<translation></translation>
</message>
@ -7294,12 +7302,12 @@ p, li { white-space: pre-wrap; }
<translation>Status Spalte ausblenden</translation>
</message>
<message>
<location filename="../gui/PeersDialog.cpp" line="-1793"/>
<location filename="../gui/PeersDialog.cpp" line="-1797"/>
<source>Friends Storm</source>
<translation>Aktivitäten</translation>
</message>
<message>
<location line="+1140"/>
<location line="+1144"/>
<source>is typing...</source>
<translation>tippt...</translation>
</message>
@ -7622,7 +7630,7 @@ p, li { white-space: pre-wrap; }
<context>
<name>PopupChatDialog</name>
<message>
<location filename="../gui/chat/PopupChatDialog.cpp" line="+701"/>
<location filename="../gui/chat/PopupChatDialog.cpp" line="+702"/>
<source>Hide Avatar</source>
<translation>Avatar verstecken</translation>
</message>
@ -7944,7 +7952,7 @@ Do you want to send them a Message instead</source>
<context>
<name>ProfileView</name>
<message>
<location filename="../gui/profile/ProfileView.cpp" line="+77"/>
<location filename="../gui/profile/ProfileView.cpp" line="+70"/>
<source>Clear Photo</source>
<translation>Photo entfernen</translation>
</message>
@ -8365,7 +8373,7 @@ p, li { white-space: pre-wrap; }
<translation>Vielleicht ist das Passwort falsch</translation>
</message>
<message>
<location filename="../gui/RetroShareLink.cpp" line="+270"/>
<location filename="../gui/RetroShareLink.cpp" line="+271"/>
<source>File Request Confirmation</source>
<translation>Bestätigung der Dateianforderung</translation>
</message>
@ -8905,7 +8913,7 @@ p, li { white-space: pre-wrap; }
<translation>Füge die RetroShare ID eines Freundes ein, Beispiel Peer@BDE8D16A46D938CF </translation>
</message>
<message>
<location line="+52"/>
<location line="+44"/>
<source>This Peer %1 is not available in your Network</source>
<translation>Der Nutzer %1 ist nicht in deinem Netzwerk verfügbar</translation>
</message>
@ -9520,7 +9528,7 @@ p, li { white-space: pre-wrap; }
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/channels/ShareKey.cpp" line="+78"/>
<location filename="../gui/channels/ShareKey.cpp" line="+80"/>
<source>RetroShare</source>
<translation></translation>
</message>
@ -9658,7 +9666,7 @@ p, li { white-space: pre-wrap; }
<name>SharedFilesDialog</name>
<message>
<location filename="../gui/SharedFilesDialog.ui" line="+846"/>
<location filename="../gui/SharedFilesDialog.cpp" line="+286"/>
<location filename="../gui/SharedFilesDialog.cpp" line="+287"/>
<source>Download</source>
<translation>Herunterladen</translation>
</message>
@ -9717,22 +9725,22 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<location filename="../gui/SharedFilesDialog.cpp" line="-72"/>
<location line="+599"/>
<location line="+597"/>
<source>Open File</source>
<translation>Datei öffnen</translation>
</message>
<message>
<location line="-597"/>
<location line="-595"/>
<source>Open Folder</source>
<translation>Ordner öffnen</translation>
</message>
<message>
<location line="+606"/>
<location line="+604"/>
<source>Set command for opening this file</source>
<translation>Setze eine Regel zum Öffnen dieser Datei</translation>
</message>
<message>
<location line="-533"/>
<location line="-531"/>
<source>Copy retroshare Link</source>
<translation>Kopiere RetroShare Link</translation>
</message>
@ -9792,7 +9800,7 @@ p, li { white-space: pre-wrap; }
<translation>Füge die Links zur Verknüpfungs-Wolke hinzu</translation>
</message>
<message>
<location line="+670"/>
<location line="+668"/>
<source>&lt;strong&gt;My Shared Files&lt;/strong&gt;</source>
<translation>&lt;strong&gt;Meine Dateien&lt;/strong&gt;</translation>
</message>
@ -10394,7 +10402,7 @@ p, li { white-space: pre-wrap; }
<context>
<name>TextPage</name>
<message>
<location filename="../gui/connect/ConnectFriendWizard.cpp" line="-885"/>
<location filename="../gui/connect/ConnectFriendWizard.cpp" line="-877"/>
<source>Use text representation of the PGP certificates.</source>
<translation>Verwende diesen Text als PGP Zertifikat.</translation>
</message>
@ -10909,7 +10917,17 @@ p, li { white-space: pre-wrap; }
<translation>Diese Tabelle wird normalerweise alle 10 Sekunden neu geladen.</translation>
</message>
<message>
<location line="+169"/>
<location line="+138"/>
<source>Self</source>
<translation>Selbst</translation>
</message>
<message>
<location line="+0"/>
<source>Trust</source>
<translation>Vertrauen</translation>
</message>
<message>
<location line="+31"/>
<source> is athenticated (one way) by </source>
<translation> ist authentifiziert (ein Weg) von</translation>
</message>