Added feature to expand To field

* Added feature to expand To field
* Fixed TreeVersion
This commit is contained in:
defnax 2022-12-20 21:51:21 +01:00
parent 12ef7240e9
commit d3d672dc0d
4 changed files with 201 additions and 151 deletions

View File

@ -135,6 +135,7 @@ MessageWidget::MessageWidget(bool controlled, QWidget *parent, Qt::WindowFlags f
isWindow = false;
currMsgFlags = 0;
expandFiles = false;
ui.expandButton->hide();
ui.actionTextBesideIcon->setData(Qt::ToolButtonTextBesideIcon);
ui.actionIconOnly->setData(Qt::ToolButtonIconOnly);
@ -144,7 +145,8 @@ MessageWidget::MessageWidget(bool controlled, QWidget *parent, Qt::WindowFlags f
connect(ui.downloadButton, SIGNAL(clicked()), this, SLOT(getallrecommended()));
connect(ui.msgText, SIGNAL(anchorClicked(QUrl)), this, SLOT(anchorClicked(QUrl)));
connect(ui.sendInviteButton, SIGNAL(clicked()), this, SLOT(sendInvite()));
connect(ui.expandButton, SIGNAL(clicked()), this, SLOT(expandTo()));
connect(ui.replyButton, SIGNAL(clicked()), this, SLOT(reply()));
connect(ui.replyallButton, SIGNAL(clicked()), this, SLOT(replyAll()));
connect(ui.forwardButton, SIGNAL(clicked()), this, SLOT(forward()));
@ -551,6 +553,9 @@ void MessageWidget::fill(const std::string &msgId)
ui.deleteButton->setEnabled(false);
ui.moreButton->setEnabled(false);
ui.expandButton->hide();
ui.trans_ToText->setMaximumHeight(ui.trans_ToText->fontMetrics().lineSpacing()*1.5);
currMsgFlags = 0;
return;
@ -635,6 +640,17 @@ void MessageWidget::fill(const std::string &msgId)
ui.trans_ToText->setText(to_text);
int recipientsCount = ui.trans_ToText->toPlainText().split(QRegExp("(\\s|\\n|\\r)+"), QString::SkipEmptyParts).count();
ui.expandButton->setText( QString::number(recipientsCount)+ " " + tr("more"));
if (recipientsCount >=20) {
ui.expandButton->show();
} else {
ui.expandButton->hide();
ui.expandButton->setChecked(false);
ui.trans_ToText->setMaximumHeight(ui.trans_ToText->fontMetrics().lineSpacing()*1.5);
}
if (!cc_text.isNull())
{
ui.ccLabel->setVisible(true);
@ -937,3 +953,14 @@ void MessageWidget::checkLength()
ui.sizeLabel->setText(text);
}
void MessageWidget::expandTo()
{
if (ui.expandButton->isChecked()) {
ui.trans_ToText->setMaximumHeight(ui.trans_ToText->fontMetrics().lineSpacing()*3.5);
ui.expandButton->setToolTip(tr("Show less"));
} else {
ui.trans_ToText->setMaximumHeight(ui.trans_ToText->fontMetrics().lineSpacing()*1.5);
ui.expandButton->setToolTip(tr("Show more"));
}
}

View File

@ -72,7 +72,7 @@ private slots:
void saveAs();
void refill();
void sendInvite();
void expandTo();
void msgfilelistWidgetCostumPopupMenu(QPoint);
void messagesTagsChanged();

View File

@ -51,93 +51,6 @@
<property name="verticalSpacing">
<number>3</number>
</property>
<item row="4" column="0">
<widget class="QLabel" name="bccLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string>Bcc:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="toLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string>To:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="ccLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string>Cc:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="tagsLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string>Tags:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QLabel" name="dateText">
<property name="sizePolicy">
@ -290,6 +203,114 @@
</item>
</layout>
</item>
<item row="7" column="0">
<widget class="QLabel" name="tagsLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string>Tags:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="subjectLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string>Subject:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="ccLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string>Cc:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="bccLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string>Bcc:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="toLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string>To:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
<widget class="QLabel" name="subjectText">
<property name="sizePolicy">
@ -313,6 +334,25 @@
</property>
</widget>
</item>
<item row="5" column="1" colspan="4">
<widget class="RSTextBrowser" name="trans_CCText">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16</height>
</size>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="fromText">
<property name="sizePolicy">
@ -346,45 +386,7 @@
</property>
</widget>
</item>
<item row="2" column="1" colspan="4">
<widget class="RSTextBrowser" name="trans_ToText">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16</height>
</size>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="1" colspan="4">
<widget class="RSTextBrowser" name="trans_CCText">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16</height>
</size>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="1" colspan="4">
<item row="6" column="1" colspan="4">
<widget class="RSTextBrowser" name="trans_BCCText">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Maximum">
@ -403,30 +405,9 @@
</property>
</widget>
</item>
<item row="5" column="1" colspan="4">
<item row="7" column="1" colspan="4">
<layout class="QHBoxLayout" name="tagLayout"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="subjectLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string>Subject:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="fromLabel">
<property name="sizePolicy">
@ -448,6 +429,48 @@
</property>
</widget>
</item>
<item row="4" column="1" colspan="4">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>6</number>
</property>
<item>
<widget class="RSTextBrowser" name="trans_ToText">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16</height>
</size>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="expandButton">
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="popupMode">
<enum>QToolButton::InstantPopup</enum>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>

View File

@ -420,7 +420,7 @@ UserNotify *MessagesDialog::createUserNotify(QObject *parent)
void MessagesDialog::processSettings(bool load)
{
int messageTreeVersion = 3; // version number for the settings to solve problems when modifying the column count
int messageTreeVersion = 4; // version number for the settings to solve problems when modifying the column count
inProcessSettings = true;