summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <tsdgeos@terra.es>2012-05-11 13:45:47 (GMT)
committerAlbert Astals Cid <tsdgeos@terra.es>2012-05-12 06:45:02 (GMT)
commitdd562605699304f26f1bfe914dda6982894e6077 (patch)
tree00184e587f0ec730652ba5be04beb1e8f09d6b0c
parent8f8196d1e02787d12096c5914ae6771700a0b89f (diff)
Save size of message/mime splitter on change
This way when you change the mime size splitter and select a new message in the list the expect thing happens (i.e. the sizes of the message/mime widgets remain the same) (cherry picked from commit 1c448b1dbdceeb5a456ba7a4431551792a43ce1c) REVIEW: 104916
-rw-r--r--messageviewer/viewer_p.cpp20
-rw-r--r--messageviewer/viewer_p.h5
2 files changed, 13 insertions, 12 deletions
diff --git a/messageviewer/viewer_p.cpp b/messageviewer/viewer_p.cpp
index 4d33e28..6d28a5e 100644
--- a/messageviewer/viewer_p.cpp
+++ b/messageviewer/viewer_p.cpp
@@ -221,7 +221,6 @@ ViewerPrivate::ViewerPrivate( Viewer *aParent, QWidget *mainWindow,
mResizeTimer.setObjectName( "mResizeTimer" );
mExternalWindow = ( aParent == mainWindow );
- mSplitterSizes << 180 << 100;
mPrinting = false;
createWidgets();
@@ -1145,14 +1144,6 @@ void ViewerPrivate::readConfig()
if ( raction )
raction->setChecked( true );
- const int mimeH = GlobalSettings::self()->mimePaneHeight();
- const int messageH = GlobalSettings::self()->messagePaneHeight();
- mSplitterSizes.clear();
- if ( GlobalSettings::self()->mimeTreeLocation() == GlobalSettings::EnumMimeTreeLocation::bottom )
- mSplitterSizes << messageH << mimeH;
- else
- mSplitterSizes << mimeH << messageH;
-
adjustLayout();
readGlobalOverrideCodec();
@@ -1402,11 +1393,19 @@ void ViewerPrivate::atmViewMsg( KMime::Message::Ptr message )
void ViewerPrivate::adjustLayout()
{
#ifndef QT_NO_TREEVIEW
+ const int mimeH = GlobalSettings::self()->mimePaneHeight();
+ const int messageH = GlobalSettings::self()->messagePaneHeight();
+ QList<int> splitterSizes;
+ if ( GlobalSettings::self()->mimeTreeLocation() == GlobalSettings::EnumMimeTreeLocation::bottom )
+ splitterSizes << messageH << mimeH;
+ else
+ splitterSizes << mimeH << messageH;
+
if ( GlobalSettings::self()->mimeTreeLocation() == GlobalSettings::EnumMimeTreeLocation::bottom )
mSplitter->addWidget( mMimePartTree );
else
mSplitter->insertWidget( 0, mMimePartTree );
- mSplitter->setSizes( mSplitterSizes );
+ mSplitter->setSizes( splitterSizes );
if ( GlobalSettings::self()->mimeTreeMode() == GlobalSettings::EnumMimeTreeMode::Always &&
mMsgDisplay )
@@ -1442,6 +1441,7 @@ void ViewerPrivate::createWidgets() {
QVBoxLayout * vlay = new QVBoxLayout( q );
vlay->setMargin( 0 );
mSplitter = new QSplitter( Qt::Vertical, q );
+ connect(mSplitter, SIGNAL(splitterMoved(int,int)), this, SLOT(saveSplitterSizes()));
mSplitter->setObjectName( "mSplitter" );
mSplitter->setChildrenCollapsible( false );
vlay->addWidget( mSplitter );
diff --git a/messageviewer/viewer_p.h b/messageviewer/viewer_p.h
index e881b82..26681f5 100644
--- a/messageviewer/viewer_p.h
+++ b/messageviewer/viewer_p.h
@@ -360,7 +360,6 @@ public:
void atmViewMsg( KMime::Message::Ptr message );
void adjustLayout();
- void saveSplitterSizes() const;
void createWidgets();
void createActions();
@@ -474,6 +473,9 @@ private slots:
void slotOpenWithAction(QAction *act);
void slotOpenWithDialog();
+
+ void saveSplitterSizes() const;
+
public slots:
/** An URL has been activate with a click. */
void slotUrlOpen( const QUrl &url = QUrl());
@@ -628,7 +630,6 @@ public:
bool mUseFixedFont;
bool mPrinting;
//bool mShowCompleteMessage;
- QList<int> mSplitterSizes;
QString mIdOfLastViewedMessage;
QWidget *mMainWindow;
KActionCollection *mActionCollection;