summaryrefslogtreecommitdiff
authoralwin <alwin>2005-03-05 17:46:46 (UTC)
committer alwin <alwin>2005-03-05 17:46:46 (UTC)
commita287cf7aad0660d4c7a573ff4da8ef35c78bb712 (patch) (unidiff)
treedf6b26dca01f4b41710197b1653225c52b4b287b
parentc017febf6f4092bb968d12df5a30a0af30066048 (diff)
downloadopie-a287cf7aad0660d4c7a573ff4da8ef35c78bb712.zip
opie-a287cf7aad0660d4c7a573ff4da8ef35c78bb712.tar.gz
opie-a287cf7aad0660d4c7a573ff4da8ef35c78bb712.tar.bz2
change the layoutdirection of main window when display is rotating
(LeftToRight when 0 rotation, TopToButtom when 90)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/mainwindow.cpp32
-rw-r--r--noncore/net/mail/mainwindow.h4
2 files changed, 29 insertions, 7 deletions
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index c115b32..93d80d9 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -8,2 +8,3 @@
8#include <qpe/qpeapplication.h> 8#include <qpe/qpeapplication.h>
9#include <qpe/qcopenvelope_qws.h>
9 10
@@ -88,3 +89,2 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
88 QWidget *view = new QWidget( wrapperBox ); 89 QWidget *view = new QWidget( wrapperBox );
89
90 layout = new QBoxLayout ( view, QBoxLayout::LeftToRight ); 90 layout = new QBoxLayout ( view, QBoxLayout::LeftToRight );
@@ -115,2 +115,4 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
115 115
116 m_Rotate = (QApplication::desktop()->width() > QApplication::desktop()->height()?0:90);
117
116 slotAdjustLayout(); 118 slotAdjustLayout();
@@ -135,2 +137,5 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
135 this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); 137 this, SLOT( appMessage(const QCString&,const QByteArray&) ) );
138 m_sysChannel = new QCopChannel( "QPE/System", this );
139 connect( m_sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ),
140 this, SLOT( systemMessage(const QCString&,const QByteArray&) ) );
136#endif 141#endif
@@ -144,2 +149,16 @@ MainWindow::~MainWindow()
144 149
150void MainWindow::systemMessage( const QCString& msg, const QByteArray& data )
151{
152 int _newrotation;
153 QDataStream stream( data, IO_ReadOnly );
154 if ( msg == "setCurrentRotation(int)" )
155 {
156 stream >> _newrotation;
157 if (m_Rotate != _newrotation) {
158 slotAdjustLayout();
159 m_Rotate = _newrotation;
160 }
161 }
162}
163
145void MainWindow::appMessage(const QCString &, const QByteArray &) 164void MainWindow::appMessage(const QCString &, const QByteArray &)
@@ -151,9 +170,8 @@ void MainWindow::slotAdjustLayout() {
151 170
152 QWidget *d = QApplication::desktop(); 171 QWidget *d = QApplication::desktop();
153 172 if ( d->width() < d->height() ) {
154 if ( d->width() < d->height() ) { 173 layout->setDirection( QBoxLayout::TopToBottom );
155 layout->setDirection( QBoxLayout::TopToBottom );
156 } else { 174 } else {
157 layout->setDirection( QBoxLayout::LeftToRight ); 175 layout->setDirection( QBoxLayout::LeftToRight );
158 } 176 }
159} 177}
diff --git a/noncore/net/mail/mainwindow.h b/noncore/net/mail/mainwindow.h
index 8d004c6..8cec888 100644
--- a/noncore/net/mail/mainwindow.h
+++ b/noncore/net/mail/mainwindow.h
@@ -17,2 +17,3 @@
17class RecMail; 17class RecMail;
18class QCopChannel;
18 19
@@ -30,2 +31,3 @@ public slots:
30 virtual void slotComposeMail(); 31 virtual void slotComposeMail();
32 virtual void systemMessage( const QCString&, const QByteArray& );
31 33
@@ -53,2 +55,4 @@ protected:
53 QBoxLayout *layout; 55 QBoxLayout *layout;
56 int m_Rotate;
57 QCopChannel* m_sysChannel;
54}; 58};