Fixed utf8 issues (Patch from Asamk #3393353)

SearchDialog: enable search for strings containing utf8 characters, I assume that filenames are always stored as utf8 on all platforms
ConnectFriendWizard: adding friends with gpg key or from file, now sets location name correctly
notifyqt: setting status message in chatwindow works correctly now, when a friend changes his message while the chat window is open

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4635 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2011-10-11 23:29:38 +00:00
parent e3798dafe9
commit 7e3a342a9a
3 changed files with 20 additions and 20 deletions

View File

@ -338,7 +338,7 @@ void SearchDialog::download()
std::string hash = item->text(SR_HASH_COL).toStdString(); std::string hash = item->text(SR_HASH_COL).toStdString();
getSourceFriendsForHash(hash,srcIds) ; getSourceFriendsForHash(hash,srcIds) ;
if(!rsFiles -> FileRequest((item->text(SR_NAME_COL)).toStdString(), hash, (item->text(SR_SIZE_COL)).toULongLong(), "", RS_FILE_HINTS_NETWORK_WIDE, srcIds)) if(!rsFiles -> FileRequest((item->text(SR_NAME_COL)).toUtf8().constData(), hash, (item->text(SR_SIZE_COL)).toULongLong(), "", RS_FILE_HINTS_NETWORK_WIDE, srcIds))
attemptDownloadLocal = true ; attemptDownloadLocal = true ;
else else
{ {
@ -366,10 +366,10 @@ void SearchDialog::downloadDirectory(const QTreeWidgetItem *item, const QString
getSourceFriendsForHash(hash,srcIds) ; getSourceFriendsForHash(hash,srcIds) ;
rsFiles->FileRequest(item->text(SR_NAME_COL).toStdString(), rsFiles->FileRequest(item->text(SR_NAME_COL).toUtf8().constData(),
hash, hash,
item->text(SR_SIZE_COL).toULongLong(), item->text(SR_SIZE_COL).toULongLong(),
cleanPath.toStdString(),RS_FILE_HINTS_NETWORK_WIDE, srcIds); cleanPath.toUtf8().constData(),RS_FILE_HINTS_NETWORK_WIDE, srcIds);
std::cout << "SearchDialog::downloadDirectory(): "\ std::cout << "SearchDialog::downloadDirectory(): "\
"issuing file request from search dialog: -" "issuing file request from search dialog: -"

View File

@ -271,7 +271,7 @@ void MessageWidget::getcurrentrecommended()
switch (it->column()) { switch (it->column()) {
case COLUMN_FILE_NAME: case COLUMN_FILE_NAME:
fi.fname = it->data().toString().toStdString() ; fi.fname = it->data().toString().toUtf8().constData();
break ; break ;
case COLUMN_FILE_SIZE: case COLUMN_FILE_SIZE:
fi.size = it->data().toULongLong() ; fi.size = it->data().toULongLong() ;
@ -287,7 +287,7 @@ void MessageWidget::getcurrentrecommended()
std::cout << "Requesting file " << fi.fname << ", size=" << fi.size << ", hash=" << fi.hash << std::endl ; std::cout << "Requesting file " << fi.fname << ", size=" << fi.size << ", hash=" << fi.hash << std::endl ;
if (rsFiles->FileRequest(fi.fname, fi.hash, fi.size, "", RS_FILE_HINTS_NETWORK_WIDE, srcIds) == false) { if (rsFiles->FileRequest(fi.fname, fi.hash, fi.size, "", RS_FILE_HINTS_NETWORK_WIDE, srcIds) == false) {
QMessageBox mb(QObject::tr("File Request canceled"), QObject::tr("The following has not been added to your download list, because you already have it:\n ") + QString::fromStdString(fi.fname), QMessageBox::Critical, QMessageBox::Ok, 0, 0); QMessageBox mb(QObject::tr("File Request canceled"), QObject::tr("The following has not been added to your download list, because you already have it:\n ") + QString::fromUtf8(fi.fname.c_str()), QMessageBox::Critical, QMessageBox::Ok, 0, 0);
mb.setWindowIcon(QIcon(QString::fromUtf8(":/images/rstray3.png"))); mb.setWindowIcon(QIcon(QString::fromUtf8(":/images/rstray3.png")));
mb.exec(); mb.exec();
} }
@ -436,7 +436,7 @@ void MessageWidget::fill(const std::string &msgId)
QList<QTreeWidgetItem*> items; QList<QTreeWidgetItem*> items;
for (it = recList.begin(); it != recList.end(); it++) { for (it = recList.begin(); it != recList.end(); it++) {
QTreeWidgetItem *item = new QTreeWidgetItem; QTreeWidgetItem *item = new QTreeWidgetItem;
item->setText(COLUMN_FILE_NAME, QString::fromStdString(it->fname)); item->setText(COLUMN_FILE_NAME, QString::fromUtf8(it->fname.c_str()));
item->setText(COLUMN_FILE_SIZE, QString::number(it->size)); item->setText(COLUMN_FILE_SIZE, QString::number(it->size));
item->setText(COLUMN_FILE_HASH, QString::fromStdString(it->hash)); item->setText(COLUMN_FILE_HASH, QString::fromStdString(it->hash));

View File

@ -192,9 +192,9 @@ void NotifyQt::notifyPeerStatusChanged(const std::string& peer_id, uint32_t stat
/* one or more peers has changed the states */ /* one or more peers has changed the states */
void NotifyQt::notifyPeerStatusChangedSummary() void NotifyQt::notifyPeerStatusChangedSummary()
{ {
#ifdef NOTIFY_DEBUG #ifdef NOTIFY_DEBUG
std::cerr << "Notifyqt:: notified that one peer has changed the state" << std::endl; std::cerr << "Notifyqt:: notified that one peer has changed the state" << std::endl;
#endif #endif
emit peerStatusChangedSummary(); emit peerStatusChangedSummary();
} }
@ -206,41 +206,41 @@ void NotifyQt::notifyChannelMsgReadSatusChanged(const std::string& channelId, co
void NotifyQt::notifyOwnStatusMessageChanged() void NotifyQt::notifyOwnStatusMessageChanged()
{ {
#ifdef NOTIFY_DEBUG #ifdef NOTIFY_DEBUG
std::cerr << "Notifyqt:: notified that own avatar changed" << std::endl ; std::cerr << "Notifyqt:: notified that own avatar changed" << std::endl ;
#endif #endif
emit ownStatusMessageChanged() ; emit ownStatusMessageChanged() ;
} }
void NotifyQt::notifyPeerHasNewAvatar(std::string peer_id) void NotifyQt::notifyPeerHasNewAvatar(std::string peer_id)
{ {
#ifdef NOTIFY_DEBUG #ifdef NOTIFY_DEBUG
std::cerr << "notifyQt: notification of new avatar." << std::endl ; std::cerr << "notifyQt: notification of new avatar." << std::endl ;
#endif #endif
emit peerHasNewAvatar(QString::fromStdString(peer_id)) ; emit peerHasNewAvatar(QString::fromStdString(peer_id)) ;
} }
void NotifyQt::notifyCustomState(const std::string& peer_id, const std::string& status_string) void NotifyQt::notifyCustomState(const std::string& peer_id, const std::string& status_string)
{ {
#ifdef NOTIFY_DEBUG #ifdef NOTIFY_DEBUG
std::cerr << "notifyQt: Received custom status string notification" << std::endl ; std::cerr << "notifyQt: Received custom status string notification" << std::endl ;
#endif #endif
emit peerHasNewCustomStateString(QString::fromStdString(peer_id), QString::fromStdString(status_string)) ; emit peerHasNewCustomStateString(QString::fromStdString(peer_id), QString::fromUtf8(status_string.c_str())) ;
} }
void NotifyQt::notifyChatStatus(const std::string& peer_id,const std::string& status_string,bool is_private) void NotifyQt::notifyChatStatus(const std::string& peer_id,const std::string& status_string,bool is_private)
{ {
#ifdef NOTIFY_DEBUG #ifdef NOTIFY_DEBUG
std::cerr << "notifyQt: Received chat status string: " << status_string << std::endl ; std::cerr << "notifyQt: Received chat status string: " << status_string << std::endl ;
#endif #endif
emit chatStatusChanged(QString::fromStdString(peer_id),QString::fromStdString(status_string),is_private) ; emit chatStatusChanged(QString::fromStdString(peer_id),QString::fromUtf8(status_string.c_str()),is_private) ;
} }
void NotifyQt::notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleFileInfo>& files) void NotifyQt::notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleFileInfo>& files)
{ {
#ifdef NOTIFY_DEBUG #ifdef NOTIFY_DEBUG
std::cerr << "in notify search result..." << std::endl ; std::cerr << "in notify search result..." << std::endl ;
#endif #endif
for(std::list<TurtleFileInfo>::const_iterator it(files.begin());it!=files.end();++it) for(std::list<TurtleFileInfo>::const_iterator it(files.begin());it!=files.end();++it)
{ {