mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-26 09:41:29 -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();
|
chNameItem = new QChannelItem();
|
||||||
chPopItem = new QStandardItem();
|
chPopItem = new QStandardItem();
|
||||||
|
|
||||||
chNameItem->setSizeHint(QSize(22, 22));
|
|
||||||
|
|
||||||
channel.append(chNameItem);
|
channel.append(chNameItem);
|
||||||
channel.append(chPopItem);
|
channel.append(chPopItem);
|
||||||
groupItem->appendRow(channel);
|
groupItem->appendRow(channel);
|
||||||
|
@ -1019,7 +1019,6 @@ void ForumsDialog::insertThreads()
|
|||||||
}
|
}
|
||||||
|
|
||||||
item->setText(COLUMN_THREAD_TITLE, QString::fromStdWString(tit->title));
|
item->setText(COLUMN_THREAD_TITLE, QString::fromStdWString(tit->title));
|
||||||
item->setSizeHint(COLUMN_THREAD_TITLE, QSize( 18,18 ) );
|
|
||||||
|
|
||||||
if (rsPeers->getPeerName(msginfo.srcId) !="")
|
if (rsPeers->getPeerName(msginfo.srcId) !="")
|
||||||
{
|
{
|
||||||
@ -1126,7 +1125,7 @@ void ForumsDialog::insertThreads()
|
|||||||
}
|
}
|
||||||
|
|
||||||
child->setText(COLUMN_THREAD_TITLE, QString::fromStdWString(mit->title));
|
child->setText(COLUMN_THREAD_TITLE, QString::fromStdWString(mit->title));
|
||||||
child->setSizeHint(COLUMN_THREAD_TITLE, QSize( 17,17 ) );
|
|
||||||
|
|
||||||
if (rsPeers->getPeerName(msginfo.srcId) !="")
|
if (rsPeers->getPeerName(msginfo.srcId) !="")
|
||||||
{
|
{
|
||||||
|
@ -1050,9 +1050,10 @@ void PeersDialog::insertPeers()
|
|||||||
// there are some dead id's assigned
|
// there are some dead id's assigned
|
||||||
groupItem->setHidden(true);
|
groupItem->setHidden(true);
|
||||||
} else {
|
} 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
|
// 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 "CreateChannel.h"
|
||||||
#include "gui/common/PeerDefs.h"
|
#include "gui/common/PeerDefs.h"
|
||||||
|
#include "util/misc.h"
|
||||||
|
|
||||||
#include <retroshare/rschannels.h>
|
#include <retroshare/rschannels.h>
|
||||||
#include <retroshare/rspeers.h>
|
#include <retroshare/rspeers.h>
|
||||||
@ -154,7 +155,7 @@ void CreateChannel::newChannel()
|
|||||||
|
|
||||||
void CreateChannel::createChannel()
|
void CreateChannel::createChannel()
|
||||||
{
|
{
|
||||||
QString name = ui.channelName->text();
|
QString name = misc::removeNewLine(ui.channelName->text());
|
||||||
QString desc = ui.channelDesc->toPlainText();
|
QString desc = ui.channelDesc->toPlainText();
|
||||||
uint32_t flags = 0;
|
uint32_t flags = 0;
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include "CreateChannelMsg.h"
|
#include "CreateChannelMsg.h"
|
||||||
#include "gui/feeds/SubFileItem.h"
|
#include "gui/feeds/SubFileItem.h"
|
||||||
|
#include "util/misc.h"
|
||||||
|
|
||||||
#include <retroshare/rschannels.h>
|
#include <retroshare/rschannels.h>
|
||||||
#include <retroshare/rsfiles.h>
|
#include <retroshare/rsfiles.h>
|
||||||
@ -407,9 +408,6 @@ void CreateChannelMsg::newChannelMsg()
|
|||||||
}
|
}
|
||||||
|
|
||||||
channelName->setText(QString::fromStdWString(ci.channelName));
|
channelName->setText(QString::fromStdWString(ci.channelName));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -419,7 +417,7 @@ void CreateChannelMsg::sendMsg()
|
|||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
/* construct message bits */
|
/* construct message bits */
|
||||||
std::wstring subject = subjectEdit->text().toStdWString();
|
std::wstring subject = misc::removeNewLine(subjectEdit->text()).toStdWString();
|
||||||
std::wstring msg = msgEdit->toPlainText().toStdWString();
|
std::wstring msg = msgEdit->toPlainText().toStdWString();
|
||||||
|
|
||||||
std::list<FileInfo> files;
|
std::list<FileInfo> files;
|
||||||
@ -456,7 +454,7 @@ void CreateChannelMsg::sendMsg()
|
|||||||
|
|
||||||
void CreateChannelMsg::sendMessage(std::wstring subject, std::wstring msg, std::list<FileInfo> &files)
|
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())
|
if(name.isEmpty())
|
||||||
{ /* error message */
|
{ /* error message */
|
||||||
@ -467,12 +465,6 @@ void CreateChannelMsg::sendMessage(std::wstring subject, std::wstring msg, std::
|
|||||||
return; //Don't add an empty Subject!!
|
return; //Don't add an empty Subject!!
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* rsChannels */
|
/* rsChannels */
|
||||||
if (rsChannels)
|
if (rsChannels)
|
||||||
{
|
{
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
|
|
||||||
#include <retroshare/rschannels.h>
|
#include <retroshare/rschannels.h>
|
||||||
|
|
||||||
|
#include "util/misc.h"
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -89,7 +91,6 @@ void EditChanDetails::loadChannel()
|
|||||||
// Set Channel Name
|
// Set Channel Name
|
||||||
ui.nameline->setText(QString::fromStdWString(ci.channelName));
|
ui.nameline->setText(QString::fromStdWString(ci.channelName));
|
||||||
|
|
||||||
|
|
||||||
// Set Channel Description
|
// Set Channel Description
|
||||||
ui.DescriptiontextEdit->setText(QString::fromStdWString(ci.channelDesc));
|
ui.DescriptiontextEdit->setText(QString::fromStdWString(ci.channelDesc));
|
||||||
|
|
||||||
@ -120,7 +121,7 @@ void EditChanDetails::applyDialog()
|
|||||||
|
|
||||||
ChannelInfo ci;
|
ChannelInfo ci;
|
||||||
|
|
||||||
ci.channelName = ui.nameline->text().toStdWString();
|
ci.channelName = misc::removeNewLine(ui.nameline->text()).toStdWString();
|
||||||
ci.channelDesc = ui.DescriptiontextEdit->document()->toPlainText().toStdWString();
|
ci.channelDesc = ui.DescriptiontextEdit->document()->toPlainText().toStdWString();
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,12 +26,13 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include "GroupDefs.h"
|
#include "GroupDefs.h"
|
||||||
|
#include "util/misc.h"
|
||||||
|
|
||||||
const QString GroupDefs::name(const RsGroupInfo &groupInfo)
|
const QString GroupDefs::name(const RsGroupInfo &groupInfo)
|
||||||
{
|
{
|
||||||
if ((groupInfo.flag & RS_GROUP_FLAG_STANDARD) == 0) {
|
if ((groupInfo.flag & RS_GROUP_FLAG_STANDARD) == 0) {
|
||||||
/* no need to be translated */
|
/* no need to be translated */
|
||||||
return QString::fromUtf8(groupInfo.name.c_str());
|
return misc::removeNewLine(groupInfo.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (groupInfo.id == RS_GROUP_ID_FRIENDS) {
|
if (groupInfo.id == RS_GROUP_ID_FRIENDS) {
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
#include "util/misc.h"
|
||||||
|
|
||||||
#include "CreateForum.h"
|
#include "CreateForum.h"
|
||||||
|
|
||||||
#include <retroshare/rsforums.h>
|
#include <retroshare/rsforums.h>
|
||||||
@ -67,7 +69,7 @@ void CreateForum::newForum()
|
|||||||
|
|
||||||
void CreateForum::createForum()
|
void CreateForum::createForum()
|
||||||
{
|
{
|
||||||
QString name = ui.forumName->text();
|
QString name = misc::removeNewLine(ui.forumName->text());
|
||||||
QString desc = ui.forumDesc->toPlainText(); //toHtml();
|
QString desc = ui.forumDesc->toPlainText(); //toHtml();
|
||||||
uint32_t flags = 0;
|
uint32_t flags = 0;
|
||||||
|
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
#include <QDropEvent>
|
#include <QDropEvent>
|
||||||
|
|
||||||
|
|
||||||
#include <retroshare/rsforums.h>
|
#include <retroshare/rsforums.h>
|
||||||
#include <retroshare/rsfiles.h>
|
#include <retroshare/rsfiles.h>
|
||||||
|
|
||||||
@ -37,6 +36,8 @@
|
|||||||
#include "gui/feeds/AttachFileItem.h"
|
#include "gui/feeds/AttachFileItem.h"
|
||||||
#include "gui/common/Emoticons.h"
|
#include "gui/common/Emoticons.h"
|
||||||
|
|
||||||
|
#include "util/misc.h"
|
||||||
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
|
||||||
@ -97,24 +98,25 @@ void CreateForumMsg::newMsg()
|
|||||||
QString subj;
|
QString subj;
|
||||||
if ((mParentId != "") && (rsForums->getForumMessage(mForumId, mParentId, msg)))
|
if ((mParentId != "") && (rsForums->getForumMessage(mForumId, mParentId, msg)))
|
||||||
{
|
{
|
||||||
|
QString title = QString::fromStdWString(msg.title);
|
||||||
name += " " + tr("In Reply to") + ": ";
|
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))
|
if (text.startsWith("Re:", Qt::CaseInsensitive))
|
||||||
{
|
{
|
||||||
subj = QString::fromStdWString(msg.title);
|
subj = title;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
subj = "Re: " + QString::fromStdWString(msg.title);
|
subj = "Re: " + title;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.forumName->setText(name);
|
ui.forumName->setText(misc::removeNewLine(name));
|
||||||
ui.forumSubject->setText(subj);
|
ui.forumSubject->setText(misc::removeNewLine(subj));
|
||||||
|
|
||||||
if (!ui.forumSubject->text().isEmpty())
|
if (!ui.forumSubject->text().isEmpty())
|
||||||
{
|
{
|
||||||
@ -141,7 +143,7 @@ void CreateForumMsg::newMsg()
|
|||||||
|
|
||||||
void CreateForumMsg::createMsg()
|
void CreateForumMsg::createMsg()
|
||||||
{
|
{
|
||||||
QString name = ui.forumSubject->text();
|
QString name = misc::removeNewLine(ui.forumSubject->text());
|
||||||
QString desc = ui.forumMessage->toHtml();
|
QString desc = ui.forumMessage->toHtml();
|
||||||
|
|
||||||
if(name.isEmpty())
|
if(name.isEmpty())
|
||||||
|
@ -23,6 +23,8 @@
|
|||||||
|
|
||||||
#include <retroshare/rsforums.h>
|
#include <retroshare/rsforums.h>
|
||||||
|
|
||||||
|
#include "util/misc.h"
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -69,7 +71,7 @@ void EditForumDetails::applyDialog()
|
|||||||
|
|
||||||
ForumInfo info;
|
ForumInfo info;
|
||||||
|
|
||||||
info.forumName = ui.nameline->text().toStdWString();
|
info.forumName = misc::removeNewLine(ui.nameline->text()).toStdWString();
|
||||||
info.forumDesc = ui.DescriptiontextEdit->document()->toPlainText().toStdWString();
|
info.forumDesc = ui.DescriptiontextEdit->document()->toPlainText().toStdWString();
|
||||||
|
|
||||||
rsForums->setForumInfo(m_forumId, info);
|
rsForums->setForumInfo(m_forumId, info);
|
||||||
|
@ -23,6 +23,8 @@
|
|||||||
|
|
||||||
#include <retroshare/rspeers.h>
|
#include <retroshare/rspeers.h>
|
||||||
|
|
||||||
|
#include "util/misc.h"
|
||||||
|
|
||||||
#include "CreateGroup.h"
|
#include "CreateGroup.h"
|
||||||
#include "gui/common/GroupDefs.h"
|
#include "gui/common/GroupDefs.h"
|
||||||
|
|
||||||
@ -39,7 +41,7 @@ CreateGroup::CreateGroup(const std::string groupId, QWidget *parent, Qt::WFlags
|
|||||||
/* edit exisiting group */
|
/* edit exisiting group */
|
||||||
RsGroupInfo groupInfo;
|
RsGroupInfo groupInfo;
|
||||||
if (rsPeers->getGroupInfo(m_groupId, 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"));
|
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\">"
|
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)
|
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);
|
ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
|
ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
|
||||||
@ -86,13 +88,13 @@ void CreateGroup::on_buttonBox_accepted()
|
|||||||
|
|
||||||
if (m_groupId.empty()) {
|
if (m_groupId.empty()) {
|
||||||
// add new group
|
// add new group
|
||||||
groupInfo.name = ui.groupname->text().toUtf8().constData();
|
groupInfo.name = misc::removeNewLine(ui.groupname->text()).toUtf8().constData();
|
||||||
if (rsPeers->addGroup(groupInfo)) {
|
if (rsPeers->addGroup(groupInfo)) {
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (rsPeers->getGroupInfo(m_groupId, groupInfo) == true) {
|
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)) {
|
if (rsPeers->editGroup(m_groupId, groupInfo)) {
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
@ -727,7 +727,7 @@ void MessageComposer::titleChanged()
|
|||||||
|
|
||||||
void MessageComposer::calculateTitle()
|
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)
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.titleEdit->setText(titleText);
|
ui.titleEdit->setText(misc::removeNewLine(titleText));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageComposer::insertPastedText(QString msg)
|
void MessageComposer::insertPastedText(QString msg)
|
||||||
@ -1063,7 +1063,7 @@ bool MessageComposer::sendMessage_internal(bool bDraftbox)
|
|||||||
/* construct a message */
|
/* construct a message */
|
||||||
MessageInfo mi;
|
MessageInfo mi;
|
||||||
|
|
||||||
mi.title = ui.titleEdit->text().toStdWString();
|
mi.title = misc::removeNewLine(ui.titleEdit->text()).toStdWString();
|
||||||
mi.msg = ui.msgText->toHtml().toStdWString();
|
mi.msg = ui.msgText->toHtml().toStdWString();
|
||||||
|
|
||||||
/* check for existing title */
|
/* check for existing title */
|
||||||
|
@ -364,6 +364,21 @@ class misc : public QObject{
|
|||||||
|
|
||||||
return QString("%1 %2").arg(count, 0, 'f', decimal).arg(unit);
|
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
|
// Trick to get a portable sleep() function
|
||||||
|
Loading…
x
Reference in New Issue
Block a user