3 patches from AsamK:

* fixed utf8 in dropping links to channels
	* fixed pasting cert links in the friend list
	* added code to allow pasting GPG certificates missing a newline at the end.


git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5064 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2012-03-30 19:43:39 +00:00
parent 08a52dc369
commit 0778e8f691
8 changed files with 34 additions and 26 deletions

View File

@ -1127,7 +1127,8 @@ static bool splitCert(const std::string &certstr, std::string &cert, std::string
if (pos != std::string::npos) {
pos += pgpend.length();
cert = certstr.substr(0, pos);
peerInfo = certstr.substr(pos + 1);
if (pos + 1 < certstr.length())
peerInfo = certstr.substr(pos + 1);
}
return !cert.empty();

View File

@ -1234,7 +1234,7 @@ QMimeData * RetroshareDirModel::mimeData ( const QModelIndexList & indexes ) con
drags[details.hash] = details.count;
QString line = QString("%1/%2/%3/").arg(QString::fromUtf8(details.name.c_str())).arg(QString::fromStdString(details.hash)).arg(details.count);
QString line = QString("%1/%2/%3/").arg(QString::fromUtf8(details.name.c_str()), QString::fromStdString(details.hash), QString::number(details.count));
if (RemoteMode)
{
@ -1258,7 +1258,7 @@ QMimeData * RetroshareDirModel::mimeData ( const QModelIndexList & indexes ) con
#endif
QMimeData *data = new QMimeData();
data->setData("application/x-rsfilelist", QByteArray(text.toAscii()));
data->setData("application/x-rsfilelist", text.toUtf8());
return data;
}

View File

@ -47,20 +47,6 @@
/* Key for UI Preferences */
#define UI_PREF_ADVANCED_SEARCH "UIOptions/AdvancedSearch"
/* indicies for search results item columns SR_ = Search Result */
/* indicies for search results item columns SR_ = Search Result */
#define SR_NAME_COL 0
#define SR_SIZE_COL 1
#define SR_ID_COL 2
#define SR_TYPE_COL 3
#define SR_AGE_COL 4
#define SR_HASH_COL 5
#define SR_SEARCH_ID_COL 6
#define SR_UID_COL 7
#define SR_DATA_COL SR_NAME_COL
#define SR_ROLE_LOCAL Qt::UserRole
/* indicies for search summary item columns SS_ = Search Summary */
#define SS_TEXT_COL 0
#define SS_COUNT_COL 1

View File

@ -38,20 +38,26 @@ QMimeData * SearchTreeWidget::mimeData ( const QList<QTreeWidgetItem *> items )
QString text;
for(it = items.begin(); it != items.end(); it++)
{
QString line;
for(int i = 0; i < (*it)->columnCount(); i++)
QString line = QString("%1/%2/%3/").arg((*it)->text(SR_NAME_COL), (*it)->text(SR_HASH_COL), (*it)->text(SR_SIZE_COL));
bool isLocal = (*it)->data(SR_DATA_COL, SR_ROLE_LOCAL).toBool();
if (isLocal)
{
line += (*it)->text(i);
line += "/";
line += "Local";
}
line += "\n";
else
{
line += "Remote";
}
line += "/\n";
text += line;
}
std::cerr << "Created MimeData:";
std::cerr << std::endl;
std::string str = text.toStdString();
std::string str = text.toUtf8().constData();
std::cerr << str;
std::cerr << std::endl;

View File

@ -24,6 +24,19 @@
#include <QTreeWidget>
/* indicies for search results item columns SR_ = Search Result */
#define SR_NAME_COL 0
#define SR_SIZE_COL 1
#define SR_ID_COL 2
#define SR_TYPE_COL 3
#define SR_AGE_COL 4
#define SR_HASH_COL 5
#define SR_SEARCH_ID_COL 6
#define SR_UID_COL 7
#define SR_DATA_COL SR_NAME_COL
#define SR_ROLE_LOCAL Qt::UserRole
class SearchTreeWidget : public QTreeWidget
{
Q_OBJECT

View File

@ -110,7 +110,7 @@ void CreateChannelMsg::pasteLink()
FileInfo info ;
if(rsFiles->alreadyHaveFile( (*it).hash().toStdString(),info ) )
addAttachment((*it).hash().toStdString(), (*it).name().toStdString(), (*it).size(), true, "") ;
addAttachment((*it).hash().toStdString(), (*it).name().toUtf8().constData(), (*it).size(), true, "") ;
else
not_have.push_back( *it ) ;
}

View File

@ -363,7 +363,7 @@ void FriendList::peerTreeWidgetCostumPopupMenu()
}
QAction *action = contextMnu.addAction(QIcon(IMAGE_PASTELINK), tr("Paste Friend Link"), this, SLOT(pastePerson()));
if (RSLinkClipboard::empty(RetroShareLink::TYPE_PERSON)) {
if (RSLinkClipboard::empty(RetroShareLink::TYPE_PERSON) && RSLinkClipboard::empty(RetroShareLink::TYPE_CERTIFICATE)) {
action->setDisabled(true);
}
@ -473,7 +473,7 @@ void FriendList::peerTreeWidgetCostumPopupMenu()
}
} else {
QAction *action = contextMnu.addAction(QIcon(IMAGE_PASTELINK), tr("Paste Friend Link"), this, SLOT(pastePerson()));
if (RSLinkClipboard::empty(RetroShareLink::TYPE_PERSON)) {
if (RSLinkClipboard::empty(RetroShareLink::TYPE_PERSON) && RSLinkClipboard::empty(RetroShareLink::TYPE_CERTIFICATE)) {
action->setDisabled(true);
}
}
@ -1271,6 +1271,7 @@ void FriendList::recommendfriend()
void FriendList::pastePerson()
{
RSLinkClipboard::process(RetroShareLink::TYPE_PERSON);
RSLinkClipboard::process(RetroShareLink::TYPE_CERTIFICATE);
}
void FriendList::copyFullCertificate()

View File

@ -338,6 +338,7 @@ TextPage::TextPage(QWidget *parent)
"certificate into the box below" )) ;
friendCertEdit = new QTextEdit;
friendCertEdit->setAcceptRichText(false);
//font.setWeight(75);
QFont font("Courier New",10,50,false);