-rw-r--r-- | noncore/net/mail/mainwindow.cpp | 32 | ||||
-rw-r--r-- | noncore/net/mail/mainwindow.h | 4 |
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 @@ #include <qpe/qpeapplication.h> +#include <qpe/qcopenvelope_qws.h> @@ -88,3 +89,2 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) QWidget *view = new QWidget( wrapperBox ); - layout = new QBoxLayout ( view, QBoxLayout::LeftToRight ); @@ -115,2 +115,4 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) + m_Rotate = (QApplication::desktop()->width() > QApplication::desktop()->height()?0:90); + slotAdjustLayout(); @@ -135,2 +137,5 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); + m_sysChannel = new QCopChannel( "QPE/System", this ); + connect( m_sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ), + this, SLOT( systemMessage(const QCString&,const QByteArray&) ) ); #endif @@ -144,2 +149,16 @@ MainWindow::~MainWindow() +void MainWindow::systemMessage( const QCString& msg, const QByteArray& data ) +{ + int _newrotation; + QDataStream stream( data, IO_ReadOnly ); + if ( msg == "setCurrentRotation(int)" ) + { + stream >> _newrotation; + if (m_Rotate != _newrotation) { + slotAdjustLayout(); + m_Rotate = _newrotation; + } + } +} + void MainWindow::appMessage(const QCString &, const QByteArray &) @@ -151,9 +170,8 @@ void MainWindow::slotAdjustLayout() { - QWidget *d = QApplication::desktop(); - - if ( d->width() < d->height() ) { - layout->setDirection( QBoxLayout::TopToBottom ); + QWidget *d = QApplication::desktop(); + if ( d->width() < d->height() ) { + layout->setDirection( QBoxLayout::TopToBottom ); } else { - layout->setDirection( QBoxLayout::LeftToRight ); - } + layout->setDirection( QBoxLayout::LeftToRight ); + } } 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 @@ class RecMail; +class QCopChannel; @@ -30,2 +31,3 @@ public slots: virtual void slotComposeMail(); + virtual void systemMessage( const QCString&, const QByteArray& ); @@ -53,2 +55,4 @@ protected: QBoxLayout *layout; + int m_Rotate; + QCopChannel* m_sysChannel; }; |