mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-29 01:16:20 -05:00
Removed new lines of the QLineEdit input fields after input in forum, channel, message and group.
Removed size hint of he trees to show erroneous texts. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3768 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
49a9268b9e
commit
b79341503e
@ -511,8 +511,6 @@ void ChannelFeed::fillChannelList(int channelItem, std::list<ChannelInfo> &chann
|
||||
chNameItem = new QChannelItem();
|
||||
chPopItem = new QStandardItem();
|
||||
|
||||
chNameItem->setSizeHint(QSize(22, 22));
|
||||
|
||||
channel.append(chNameItem);
|
||||
channel.append(chPopItem);
|
||||
groupItem->appendRow(channel);
|
||||
|
@ -1019,7 +1019,6 @@ void ForumsDialog::insertThreads()
|
||||
}
|
||||
|
||||
item->setText(COLUMN_THREAD_TITLE, QString::fromStdWString(tit->title));
|
||||
item->setSizeHint(COLUMN_THREAD_TITLE, QSize( 18,18 ) );
|
||||
|
||||
if (rsPeers->getPeerName(msginfo.srcId) !="")
|
||||
{
|
||||
@ -1126,7 +1125,7 @@ void ForumsDialog::insertThreads()
|
||||
}
|
||||
|
||||
child->setText(COLUMN_THREAD_TITLE, QString::fromStdWString(mit->title));
|
||||
child->setSizeHint(COLUMN_THREAD_TITLE, QSize( 17,17 ) );
|
||||
|
||||
|
||||
if (rsPeers->getPeerName(msginfo.srcId) !="")
|
||||
{
|
||||
|
@ -1050,9 +1050,10 @@ void PeersDialog::insertPeers()
|
||||
// there are some dead id's assigned
|
||||
groupItem->setHidden(true);
|
||||
} else {
|
||||
groupItem->setText(COLUMN_NAME, QString("%1 (%2/%3)").arg(GroupDefs::name(*groupInfo)).arg(onlineCount).arg(availableCount));
|
||||
QString groupName = GroupDefs::name(*groupInfo);
|
||||
groupItem->setText(COLUMN_NAME, QString("%1 (%2/%3)").arg(groupName).arg(onlineCount).arg(availableCount));
|
||||
// show first the standard groups, than the user groups
|
||||
groupItem->setData(COLUMN_NAME, ROLE_SORT, ((groupInfo->flag & RS_GROUP_FLAG_STANDARD) ? "0 " : "1 ") + QString::fromUtf8(groupInfo->name.c_str()));
|
||||
groupItem->setData(COLUMN_NAME, ROLE_SORT, ((groupInfo->flag & RS_GROUP_FLAG_STANDARD) ? "0 " : "1 ") + groupName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include "CreateChannel.h"
|
||||
#include "gui/common/PeerDefs.h"
|
||||
#include "util/misc.h"
|
||||
|
||||
#include <retroshare/rschannels.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
@ -154,7 +155,7 @@ void CreateChannel::newChannel()
|
||||
|
||||
void CreateChannel::createChannel()
|
||||
{
|
||||
QString name = ui.channelName->text();
|
||||
QString name = misc::removeNewLine(ui.channelName->text());
|
||||
QString desc = ui.channelDesc->toPlainText();
|
||||
uint32_t flags = 0;
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#include "CreateChannelMsg.h"
|
||||
#include "gui/feeds/SubFileItem.h"
|
||||
#include "util/misc.h"
|
||||
|
||||
#include <retroshare/rschannels.h>
|
||||
#include <retroshare/rsfiles.h>
|
||||
@ -407,9 +408,6 @@ void CreateChannelMsg::newChannelMsg()
|
||||
}
|
||||
|
||||
channelName->setText(QString::fromStdWString(ci.channelName));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -419,7 +417,7 @@ void CreateChannelMsg::sendMsg()
|
||||
std::cerr << std::endl;
|
||||
|
||||
/* construct message bits */
|
||||
std::wstring subject = subjectEdit->text().toStdWString();
|
||||
std::wstring subject = misc::removeNewLine(subjectEdit->text()).toStdWString();
|
||||
std::wstring msg = msgEdit->toPlainText().toStdWString();
|
||||
|
||||
std::list<FileInfo> files;
|
||||
@ -456,7 +454,7 @@ void CreateChannelMsg::sendMsg()
|
||||
|
||||
void CreateChannelMsg::sendMessage(std::wstring subject, std::wstring msg, std::list<FileInfo> &files)
|
||||
{
|
||||
QString name = subjectEdit->text();
|
||||
QString name = misc::removeNewLine(subjectEdit->text());
|
||||
|
||||
if(name.isEmpty())
|
||||
{ /* error message */
|
||||
@ -467,12 +465,6 @@ void CreateChannelMsg::sendMessage(std::wstring subject, std::wstring msg, std::
|
||||
return; //Don't add an empty Subject!!
|
||||
}
|
||||
else
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* rsChannels */
|
||||
if (rsChannels)
|
||||
{
|
||||
|
@ -24,6 +24,8 @@
|
||||
|
||||
#include <retroshare/rschannels.h>
|
||||
|
||||
#include "util/misc.h"
|
||||
|
||||
#include <list>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
@ -89,7 +91,6 @@ void EditChanDetails::loadChannel()
|
||||
// Set Channel Name
|
||||
ui.nameline->setText(QString::fromStdWString(ci.channelName));
|
||||
|
||||
|
||||
// Set Channel Description
|
||||
ui.DescriptiontextEdit->setText(QString::fromStdWString(ci.channelDesc));
|
||||
|
||||
@ -120,7 +121,7 @@ void EditChanDetails::applyDialog()
|
||||
|
||||
ChannelInfo ci;
|
||||
|
||||
ci.channelName = ui.nameline->text().toStdWString();
|
||||
ci.channelName = misc::removeNewLine(ui.nameline->text()).toStdWString();
|
||||
ci.channelDesc = ui.DescriptiontextEdit->document()->toPlainText().toStdWString();
|
||||
|
||||
|
||||
|
@ -26,12 +26,13 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include "GroupDefs.h"
|
||||
#include "util/misc.h"
|
||||
|
||||
const QString GroupDefs::name(const RsGroupInfo &groupInfo)
|
||||
{
|
||||
if ((groupInfo.flag & RS_GROUP_FLAG_STANDARD) == 0) {
|
||||
/* no need to be translated */
|
||||
return QString::fromUtf8(groupInfo.name.c_str());
|
||||
return misc::removeNewLine(groupInfo.name);
|
||||
}
|
||||
|
||||
if (groupInfo.id == RS_GROUP_ID_FRIENDS) {
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "util/misc.h"
|
||||
|
||||
#include "CreateForum.h"
|
||||
|
||||
#include <retroshare/rsforums.h>
|
||||
@ -67,7 +69,7 @@ void CreateForum::newForum()
|
||||
|
||||
void CreateForum::createForum()
|
||||
{
|
||||
QString name = ui.forumName->text();
|
||||
QString name = misc::removeNewLine(ui.forumName->text());
|
||||
QString desc = ui.forumDesc->toPlainText(); //toHtml();
|
||||
uint32_t flags = 0;
|
||||
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include <QDesktopWidget>
|
||||
#include <QDropEvent>
|
||||
|
||||
|
||||
#include <retroshare/rsforums.h>
|
||||
#include <retroshare/rsfiles.h>
|
||||
|
||||
@ -37,6 +36,8 @@
|
||||
#include "gui/feeds/AttachFileItem.h"
|
||||
#include "gui/common/Emoticons.h"
|
||||
|
||||
#include "util/misc.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
||||
@ -97,24 +98,25 @@ void CreateForumMsg::newMsg()
|
||||
QString subj;
|
||||
if ((mParentId != "") && (rsForums->getForumMessage(mForumId, mParentId, msg)))
|
||||
{
|
||||
QString title = QString::fromStdWString(msg.title);
|
||||
name += " " + tr("In Reply to") + ": ";
|
||||
name += QString::fromStdWString(msg.title);
|
||||
name += title;
|
||||
|
||||
QString text = QString::fromStdWString(msg.title);
|
||||
QString text = title;
|
||||
|
||||
if (text.startsWith("Re:", Qt::CaseInsensitive))
|
||||
{
|
||||
subj = QString::fromStdWString(msg.title);
|
||||
subj = title;
|
||||
}
|
||||
else
|
||||
{
|
||||
subj = "Re: " + QString::fromStdWString(msg.title);
|
||||
subj = "Re: " + title;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ui.forumName->setText(name);
|
||||
ui.forumSubject->setText(subj);
|
||||
ui.forumName->setText(misc::removeNewLine(name));
|
||||
ui.forumSubject->setText(misc::removeNewLine(subj));
|
||||
|
||||
if (!ui.forumSubject->text().isEmpty())
|
||||
{
|
||||
@ -141,7 +143,7 @@ void CreateForumMsg::newMsg()
|
||||
|
||||
void CreateForumMsg::createMsg()
|
||||
{
|
||||
QString name = ui.forumSubject->text();
|
||||
QString name = misc::removeNewLine(ui.forumSubject->text());
|
||||
QString desc = ui.forumMessage->toHtml();
|
||||
|
||||
if(name.isEmpty())
|
||||
|
@ -23,6 +23,8 @@
|
||||
|
||||
#include <retroshare/rsforums.h>
|
||||
|
||||
#include "util/misc.h"
|
||||
|
||||
#include <list>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
@ -69,7 +71,7 @@ void EditForumDetails::applyDialog()
|
||||
|
||||
ForumInfo info;
|
||||
|
||||
info.forumName = ui.nameline->text().toStdWString();
|
||||
info.forumName = misc::removeNewLine(ui.nameline->text()).toStdWString();
|
||||
info.forumDesc = ui.DescriptiontextEdit->document()->toPlainText().toStdWString();
|
||||
|
||||
rsForums->setForumInfo(m_forumId, info);
|
||||
|
@ -23,6 +23,8 @@
|
||||
|
||||
#include <retroshare/rspeers.h>
|
||||
|
||||
#include "util/misc.h"
|
||||
|
||||
#include "CreateGroup.h"
|
||||
#include "gui/common/GroupDefs.h"
|
||||
|
||||
@ -39,7 +41,7 @@ CreateGroup::CreateGroup(const std::string groupId, QWidget *parent, Qt::WFlags
|
||||
/* edit exisiting group */
|
||||
RsGroupInfo groupInfo;
|
||||
if (rsPeers->getGroupInfo(m_groupId, groupInfo)) {
|
||||
ui.groupname->setText(QString::fromUtf8(groupInfo.name.c_str()));
|
||||
ui.groupname->setText(misc::removeNewLine(groupInfo.name));
|
||||
|
||||
setWindowTitle(tr("Edit Group"));
|
||||
ui.headerLabel->setText(tr("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">"
|
||||
@ -73,7 +75,7 @@ CreateGroup::~CreateGroup()
|
||||
|
||||
void CreateGroup::on_groupname_textChanged(QString text)
|
||||
{
|
||||
if (text.isEmpty() || usedGroupNames.contains(text)) {
|
||||
if (text.isEmpty() || usedGroupNames.contains(misc::removeNewLine(text))) {
|
||||
ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||
} else {
|
||||
ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
|
||||
@ -86,13 +88,13 @@ void CreateGroup::on_buttonBox_accepted()
|
||||
|
||||
if (m_groupId.empty()) {
|
||||
// add new group
|
||||
groupInfo.name = ui.groupname->text().toUtf8().constData();
|
||||
groupInfo.name = misc::removeNewLine(ui.groupname->text()).toUtf8().constData();
|
||||
if (rsPeers->addGroup(groupInfo)) {
|
||||
close();
|
||||
}
|
||||
} else {
|
||||
if (rsPeers->getGroupInfo(m_groupId, groupInfo) == true) {
|
||||
groupInfo.name = ui.groupname->text().toUtf8().constData();
|
||||
groupInfo.name = misc::removeNewLine(ui.groupname->text()).toUtf8().constData();
|
||||
if (rsPeers->editGroup(m_groupId, groupInfo)) {
|
||||
close();
|
||||
}
|
||||
|
@ -727,7 +727,7 @@ void MessageComposer::titleChanged()
|
||||
|
||||
void MessageComposer::calculateTitle()
|
||||
{
|
||||
setWindowTitle(tr("Compose") + ": " + ui.titleEdit->text());
|
||||
setWindowTitle(tr("Compose") + ": " + misc::removeNewLine(ui.titleEdit->text()));
|
||||
}
|
||||
|
||||
static void calculateGroupsOfSslIds(std::list<RsGroupInfo> &existingGroupInfos, std::list<std::string> &checkSslIds, std::list<std::string> &checkGroupIds)
|
||||
@ -998,7 +998,7 @@ void MessageComposer::insertTitleText(const QString &title, enumMessageType typ
|
||||
break;
|
||||
}
|
||||
|
||||
ui.titleEdit->setText(titleText);
|
||||
ui.titleEdit->setText(misc::removeNewLine(titleText));
|
||||
}
|
||||
|
||||
void MessageComposer::insertPastedText(QString msg)
|
||||
@ -1063,7 +1063,7 @@ bool MessageComposer::sendMessage_internal(bool bDraftbox)
|
||||
/* construct a message */
|
||||
MessageInfo mi;
|
||||
|
||||
mi.title = ui.titleEdit->text().toStdWString();
|
||||
mi.title = misc::removeNewLine(ui.titleEdit->text()).toStdWString();
|
||||
mi.msg = ui.msgText->toHtml().toStdWString();
|
||||
|
||||
/* check for existing title */
|
||||
|
@ -364,6 +364,21 @@ class misc : public QObject{
|
||||
|
||||
return QString("%1 %2").arg(count, 0, 'f', decimal).arg(unit);
|
||||
}
|
||||
|
||||
static QString removeNewLine(const QString &text)
|
||||
{
|
||||
return QString(text).replace("\n", " ");
|
||||
}
|
||||
|
||||
static QString removeNewLine(const std::string &text)
|
||||
{
|
||||
return QString::fromUtf8(text.c_str()).replace("\n", " ");
|
||||
}
|
||||
|
||||
static QString removeNewLine(const std::wstring &text)
|
||||
{
|
||||
return QString::fromStdWString(text).replace("\n", " ");
|
||||
}
|
||||
};
|
||||
|
||||
// Trick to get a portable sleep() function
|
||||
|
Loading…
Reference in New Issue
Block a user