Added to display the Box name for the Main Tab when switching box

* Added to display the Box name for the Main Tab when switching box
* Fixed to clear the Message Widgets Labels when switched the Box
This commit is contained in:
defnax 2020-02-26 16:50:05 +01:00
parent 1cca7a4969
commit 6f4971ea48
3 changed files with 250 additions and 143 deletions

View File

@ -59,6 +59,11 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string>Bcc:</string>
</property>
@ -75,6 +80,11 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string>To:</string>
</property>
@ -91,6 +101,11 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string>Cc:</string>
</property>
@ -110,6 +125,11 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string>Tags:</string>
</property>
@ -126,6 +146,11 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
@ -217,6 +242,13 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
@ -245,6 +277,11 @@
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
@ -321,6 +358,11 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string>Subject:</string>
</property>
@ -337,6 +379,11 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string>From:</string>
</property>

View File

@ -61,6 +61,13 @@
#define IMAGE_DECRYPTMESSAGE ":/images/decrypt-mail.png"
#define IMAGE_AUTHOR_INFO ":/images/info16.png"
#define IMAGE_INBOX ":/images/folder-inbox.png"
#define IMAGE_OUTBOX ":/images/folder-outbox.png"
#define IMAGE_SENT ":/images/folder-sent.png"
#define IMAGE_DRAFTS ":/images/folder-draft.png"
#define IMAGE_TRASH ":/images/folder-trash.png"
#define IMAGE_FOLDER ":/images/foldermail.png"
#define ROLE_QUICKVIEW_TYPE Qt::UserRole
#define ROLE_QUICKVIEW_ID Qt::UserRole + 1
#define ROLE_QUICKVIEW_TEXT Qt::UserRole + 2
@ -158,6 +165,10 @@ MessagesDialog::MessagesDialog(QWidget *parent)
// Set initial size of the splitter
ui.listSplitter->setStretchFactor(0, 0);
ui.listSplitter->setStretchFactor(1, 1);
// Set initial size of the splitter
ui.boxSplitter->setStretchFactor(0, 0);
ui.boxSplitter->setStretchFactor(1, 1);
/* add filter actions */
ui.filterLineEdit->addFilter(QIcon(), tr("Subject"), RsMessageModel::COLUMN_THREAD_SUBJECT, tr("Search Subject"));
@ -332,6 +343,8 @@ void MessagesDialog::processSettings(bool load)
// state of splitter
ui.msgSplitter->restoreState(Settings->value("SplitterMsg").toByteArray());
ui.listSplitter->restoreState(Settings->value("SplitterList").toByteArray());
ui.boxSplitter->restoreState(Settings->value("SplitterBox").toByteArray());
} else {
// save settings
@ -342,6 +355,7 @@ void MessagesDialog::processSettings(bool load)
// state of splitter
Settings->setValue("SplitterMsg", ui.msgSplitter->saveState());
Settings->setValue("SplitterList", ui.listSplitter->saveState());
Settings->setValue("SplitterBox", ui.boxSplitter->saveState());
}
Settings->endGroup();
@ -736,15 +750,31 @@ void MessagesDialog::changeBox(int box_row)
switch(box_row)
{
case 0: mMessageModel->setCurrentBox(RsMessageModel::BOX_INBOX ); break;
case 1: mMessageModel->setCurrentBox(RsMessageModel::BOX_OUTBOX); break;
case 2: mMessageModel->setCurrentBox(RsMessageModel::BOX_DRAFTS); break;
case 3: mMessageModel->setCurrentBox(RsMessageModel::BOX_SENT ); break;
case 4: mMessageModel->setCurrentBox(RsMessageModel::BOX_TRASH ); break;
case 0: mMessageModel->setCurrentBox(RsMessageModel::BOX_INBOX );
ui.tabWidget->setTabText(0, tr("Inbox"));
ui.tabWidget->setTabIcon(0, QIcon(IMAGE_INBOX));
break;
case 1: mMessageModel->setCurrentBox(RsMessageModel::BOX_OUTBOX);
ui.tabWidget->setTabText(0, tr("Outbox"));
ui.tabWidget->setTabIcon(0, QIcon(IMAGE_OUTBOX));
break;
case 2: mMessageModel->setCurrentBox(RsMessageModel::BOX_DRAFTS);
ui.tabWidget->setTabText(0, tr("Drafts"));
ui.tabWidget->setTabIcon(0, QIcon(IMAGE_DRAFTS));
break;
case 3: mMessageModel->setCurrentBox(RsMessageModel::BOX_SENT );
ui.tabWidget->setTabText(0, tr("Sent"));
ui.tabWidget->setTabIcon(0, QIcon(IMAGE_SENT));
break;
case 4: mMessageModel->setCurrentBox(RsMessageModel::BOX_TRASH );
ui.tabWidget->setTabText(0, tr("Trash"));
ui.tabWidget->setTabIcon(0, QIcon(IMAGE_TRASH));
break;
default:
mMessageModel->setCurrentBox(RsMessageModel::BOX_NONE); break;
}
inChange = false;
insertMsgTxtAndFiles(ui.messageTreeWidget->currentIndex());
}
void MessagesDialog::changeQuickView(int newrow)
@ -759,13 +789,34 @@ void MessagesDialog::changeQuickView(int newrow)
if(newrow >= 0) // -1 means that nothing is selected
switch(newrow)
{
case 0x00: f = RsMessageModel::QUICK_VIEW_STARRED ; break;
case 0x01: f = RsMessageModel::QUICK_VIEW_SYSTEM ; break;
case 0x02: f = RsMessageModel::QUICK_VIEW_IMPORTANT; break;
case 0x03: f = RsMessageModel::QUICK_VIEW_WORK ; break;
case 0x04: f = RsMessageModel::QUICK_VIEW_PERSONAL ; break;
case 0x05: f = RsMessageModel::QUICK_VIEW_TODO ; break;
case 0x06: f = RsMessageModel::QUICK_VIEW_LATER ; break;
case 0x00: f = RsMessageModel::QUICK_VIEW_STARRED ;
ui.tabWidget->setTabText(0, tr("Starred"));
ui.tabWidget->setTabIcon(0, QIcon(IMAGE_STAR_ON));
break;
case 0x01: f = RsMessageModel::QUICK_VIEW_SYSTEM ;
ui.tabWidget->setTabText(0, tr("System"));
ui.tabWidget->setTabIcon(0, QIcon(IMAGE_SYSTEM));
break;
case 0x02: f = RsMessageModel::QUICK_VIEW_IMPORTANT;
ui.tabWidget->setTabText(0, tr("Important"));
ui.tabWidget->setTabIcon(0, QIcon(IMAGE_FOLDER));
break;
case 0x03: f = RsMessageModel::QUICK_VIEW_WORK ;
ui.tabWidget->setTabText(0, tr("Work"));
ui.tabWidget->setTabIcon(0, QIcon(IMAGE_FOLDER));
break;
case 0x04: f = RsMessageModel::QUICK_VIEW_PERSONAL ;
ui.tabWidget->setTabText(0, tr("Personal"));
ui.tabWidget->setTabIcon(0, QIcon(IMAGE_FOLDER));
break;
case 0x05: f = RsMessageModel::QUICK_VIEW_TODO ;
ui.tabWidget->setTabText(0, tr("Todo"));
ui.tabWidget->setTabIcon(0, QIcon(IMAGE_FOLDER));
break;
case 0x06: f = RsMessageModel::QUICK_VIEW_LATER ;
ui.tabWidget->setTabText(0, tr("Later"));
ui.tabWidget->setTabIcon(0, QIcon(IMAGE_FOLDER));
break;
default:
f = RsMessageModel::QuickViewFilter( (int)RsMessageModel::QUICK_VIEW_USER + newrow - 0x07);
}

View File

@ -42,7 +42,7 @@
<attribute name="title">
<string notr="true">Messages</string>
</attribute>
<layout class="QGridLayout" name="gridLayout">
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
@ -74,99 +74,9 @@
<property name="bottomMargin">
<number>0</number>
</property>
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<property name="spacing">
<number>0</number>
</property>
<item row="1" column="0">
<widget class="QListWidget" name="listWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<item>
<property name="text">
<string>Inbox</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/folder-inbox.png</normaloff>:/images/folder-inbox.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Outbox</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/folder-outbox.png</normaloff>:/images/folder-outbox.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Draft</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/folder-draft.png</normaloff>:/images/folder-draft.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Sent</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/folder-sent.png</normaloff>:/images/folder-sent.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Trash</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/folder-trash.png</normaloff>:/images/folder-trash.png</iconset>
</property>
</item>
</widget>
</item>
<item row="3" column="0">
<widget class="QListWidget" name="quickViewWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="totalLabel">
<property name="minimumSize">
<size>
<width>0</width>
<height>18</height>
</size>
</property>
<property name="text">
<string>Total Inbox:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QFrame" name="folderFrame">
<property name="autoFillBackground">
@ -217,48 +127,147 @@
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QSplitter" name="boxSplitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<widget class="QListWidget" name="listWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<item>
<property name="text">
<string>Inbox</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/folder-inbox.png</normaloff>:/images/folder-inbox.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Outbox</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/folder-outbox.png</normaloff>:/images/folder-outbox.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Draft</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/folder-draft.png</normaloff>:/images/folder-draft.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Sent</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/folder-sent.png</normaloff>:/images/folder-sent.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Trash</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/folder-trash.png</normaloff>:/images/folder-trash.png</iconset>
</property>
</item>
</widget>
<widget class="QWidget" name="layoutWidget">
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QFrame" name="quickViewFrame">
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="quickViewFrameHLayout">
<property name="topMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<widget class="QLabel" name="quickViewPixmap">
<property name="maximumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/tag24.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="quickViewLabel">
<property name="text">
<string>Quick View</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QListWidget" name="quickViewWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="2" column="0">
<widget class="QFrame" name="quickViewFrame">
<property name="autoFillBackground">
<bool>true</bool>
<widget class="QLabel" name="totalLabel">
<property name="minimumSize">
<size>
<width>0</width>
<height>18</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
<property name="text">
<string>Total Inbox:</string>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="quickViewFrameHLayout">
<property name="topMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<widget class="QLabel" name="quickViewPixmap">
<property name="maximumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/tag24.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="quickViewLabel">
<property name="text">
<string>Quick View</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>