mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-25 15:35:49 -04:00
* Fixing the Post buttons to get disabled when the limit has been exceeded
This commit is contained in:
parent
30956f8de5
commit
11d3583233
7 changed files with 20 additions and 11 deletions
|
@ -56,6 +56,7 @@ PostedCreatePostDialog::PostedCreatePostDialog(RsPosted *posted, const RsGxsGrou
|
||||||
connect(ui->submitButton, SIGNAL(clicked()), this, SLOT(createPost()));
|
connect(ui->submitButton, SIGNAL(clicked()), this, SLOT(createPost()));
|
||||||
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(close()));
|
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(close()));
|
||||||
connect(ui->addPicButton, SIGNAL(clicked() ), this , SLOT(addPicture()));
|
connect(ui->addPicButton, SIGNAL(clicked() ), this , SLOT(addPicture()));
|
||||||
|
connect(ui->RichTextEditWidget, SIGNAL(textSizeOk(bool)),ui->submitButton, SLOT(setEnabled(bool)));
|
||||||
|
|
||||||
ui->headerFrame->setHeaderImage(FilesDefs::getPixmapFromQtResourcePath(":/icons/png/postedlinks.png"));
|
ui->headerFrame->setHeaderImage(FilesDefs::getPixmapFromQtResourcePath(":/icons/png/postedlinks.png"));
|
||||||
ui->headerFrame->setHeaderText(tr("Create a new Post"));
|
ui->headerFrame->setHeaderText(tr("Create a new Post"));
|
||||||
|
|
|
@ -58,10 +58,12 @@ CreateGxsChannelMsg::CreateGxsChannelMsg(const RsGxsGroupId &cId, RsGxsMessageId
|
||||||
|
|
||||||
headerFrame->setHeaderImage(FilesDefs::getPixmapFromQtResourcePath(":/icons/png/channel.png"));
|
headerFrame->setHeaderImage(FilesDefs::getPixmapFromQtResourcePath(":/icons/png/channel.png"));
|
||||||
|
|
||||||
if(!existing_post.isNull())
|
if(!existing_post.isNull()){
|
||||||
headerFrame->setHeaderText(tr("Edit Channel Post"));
|
headerFrame->setHeaderText(tr("Edit Channel Post"));
|
||||||
else
|
postButton->setText(tr("Update"));
|
||||||
|
}else{
|
||||||
headerFrame->setHeaderText(tr("New Channel Post"));
|
headerFrame->setHeaderText(tr("New Channel Post"));
|
||||||
|
}
|
||||||
|
|
||||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||||
|
|
||||||
|
@ -77,6 +79,7 @@ CreateGxsChannelMsg::CreateGxsChannelMsg(const RsGxsGroupId &cId, RsGxsMessageId
|
||||||
connect(stackedWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint)));
|
connect(stackedWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint)));
|
||||||
connect(generateCheckBox, SIGNAL(toggled(bool)), generateSpinBox, SLOT(setEnabled(bool)));
|
connect(generateCheckBox, SIGNAL(toggled(bool)), generateSpinBox, SLOT(setEnabled(bool)));
|
||||||
connect(aspectRatio_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(changeAspectRatio(int)));
|
connect(aspectRatio_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(changeAspectRatio(int)));
|
||||||
|
connect(RichTextEditWidget, SIGNAL(textSizeOk(bool)),postButton, SLOT(setEnabled(bool)));
|
||||||
|
|
||||||
channelpostButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/comment.png"));
|
channelpostButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/comment.png"));
|
||||||
attachmentsButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/attachements.png"));
|
attachmentsButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/attachements.png"));
|
||||||
|
|
|
@ -187,7 +187,8 @@ ShareManager QPushButton#addButton:hover {
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateGxsForumMsg QPushButton#postButton:disabled, PostedCreatePostDialog QPushButton#postButton:disabled {
|
CreateGxsForumMsg QPushButton#postButton:disabled, PostedCreatePostDialog QPushButton#submitButton:disabled,
|
||||||
|
CreateGxsChannelMsg QPushButton#postButton:disabled {
|
||||||
font: bold;
|
font: bold;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
color: white;
|
color: white;
|
||||||
|
|
|
@ -2109,7 +2109,8 @@ GxsCreateCommentDialog QPushButton#postButton:hover, , GxsGroupDialog QPushButto
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateGxsForumMsg QPushButton#postButton:disabled {
|
CreateGxsForumMsg QPushButton#postButton:disabled, PostedCreatePostDialog QPushButton#submitButton:disabled,
|
||||||
|
CreateGxsChannelMsg QPushButton#postButton:disabled {
|
||||||
font: bold;
|
font: bold;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
color: white;
|
color: white;
|
||||||
|
|
|
@ -1262,7 +1262,8 @@ ShareManager QPushButton#closeButton {
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateGxsForumMsg QPushButton#postButton:disabled {
|
CreateGxsForumMsg QPushButton#postButton:disabled, PostedCreatePostDialog QPushButton#submitButton:disabled,
|
||||||
|
CreateGxsChannelMsg QPushButton#postButton:disabled {
|
||||||
font: bold;
|
font: bold;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
color: white;
|
color: white;
|
||||||
|
|
|
@ -602,15 +602,15 @@ void RichTextEdit::checkLength(){
|
||||||
if(charRemains >= 0) {
|
if(charRemains >= 0) {
|
||||||
text = tr("It remains %1 characters after HTML conversion.").arg(charRemains);
|
text = tr("It remains %1 characters after HTML conversion.").arg(charRemains);
|
||||||
f_info->setStyleSheet("QLabel#f_info { }");
|
f_info->setStyleSheet("QLabel#f_info { }");
|
||||||
|
emit textSizeOk(true);
|
||||||
}else{
|
}else{
|
||||||
text = tr("Warning: This message is too big of %1 characters after HTML conversion.").arg((0-charRemains));
|
text = tr("Warning: This message is too big of %1 characters after HTML conversion.").arg((0-charRemains));
|
||||||
f_info->setStyleSheet("QLabel#f_info {color: red; font: bold; }");
|
f_info->setStyleSheet("QLabel#f_info {color: red; font: bold; }");
|
||||||
|
emit textSizeOk(false);
|
||||||
}
|
}
|
||||||
//buttonBox->button(QDialogButtonBox::Ok)->setEnabled(charRemains>=0);
|
|
||||||
f_info->setText(text);
|
f_info->setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void RichTextEdit::setPlaceHolderTextPosted() {
|
void RichTextEdit::setPlaceHolderTextPosted() {
|
||||||
f_textedit->setPlaceholderText(tr("Text (optional)"));
|
f_textedit->setPlaceholderText(tr("Text (optional)"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,11 +38,13 @@ class RichTextEdit : public QWidget, protected Ui::RichTextEdit {
|
||||||
QTextCursor textCursor() const { return f_textedit->textCursor(); }
|
QTextCursor textCursor() const { return f_textedit->textCursor(); }
|
||||||
void setTextCursor(const QTextCursor& cursor) { f_textedit->setTextCursor(cursor); }
|
void setTextCursor(const QTextCursor& cursor) { f_textedit->setTextCursor(cursor); }
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void textSizeOk(bool);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setText(const QString &text);
|
void setText(const QString &text);
|
||||||
void setPlaceHolderTextPosted();
|
void setPlaceHolderTextPosted();
|
||||||
|
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void setPlainText(const QString &text) { f_textedit->setPlainText(text); }
|
void setPlainText(const QString &text) { f_textedit->setPlainText(text); }
|
||||||
void setHtml(const QString &text) { f_textedit->setHtml(text); }
|
void setHtml(const QString &text) { f_textedit->setHtml(text); }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue