summaryrefslogtreecommitdiff
Unidiff
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
@@ -3,12 +3,13 @@
3#include <qheader.h> 3#include <qheader.h>
4#include <qtimer.h> 4#include <qtimer.h>
5#include <qlayout.h> 5#include <qlayout.h>
6 6
7#include <opie2/odebug.h> 7#include <opie2/odebug.h>
8#include <qpe/qpeapplication.h> 8#include <qpe/qpeapplication.h>
9#include <qpe/qcopenvelope_qws.h>
9 10
10#include "defines.h" 11#include "defines.h"
11#include "mainwindow.h" 12#include "mainwindow.h"
12 13
13using namespace Opie::Core; 14using namespace Opie::Core;
14 15
@@ -83,13 +84,12 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
83 //setCentralWidget( view ); 84 //setCentralWidget( view );
84 85
85 QVBox* wrapperBox = new QVBox( this ); 86 QVBox* wrapperBox = new QVBox( this );
86 setCentralWidget( wrapperBox ); 87 setCentralWidget( wrapperBox );
87 88
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 );
91 91
92 folderView = new AccountView( view ); 92 folderView = new AccountView( view );
93 folderView->header()->hide(); 93 folderView->header()->hide();
94 folderView->setRootIsDecorated( true ); 94 folderView->setRootIsDecorated( true );
95 folderView->addColumn( tr( "Mailbox" ) ); 95 folderView->addColumn( tr( "Mailbox" ) );
@@ -110,12 +110,14 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
110 statusWidget->hide(); 110 statusWidget->hide();
111 111
112 layout->addWidget( mailView ); 112 layout->addWidget( mailView );
113 layout->setStretchFactor( folderView, 1 ); 113 layout->setStretchFactor( folderView, 1 );
114 layout->setStretchFactor( mailView, 2 ); 114 layout->setStretchFactor( mailView, 2 );
115 115
116 m_Rotate = (QApplication::desktop()->width() > QApplication::desktop()->height()?0:90);
117
116 slotAdjustLayout(); 118 slotAdjustLayout();
117 119
118 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); 120 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold);
119 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); 121 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold);
120 122
121 connect( mailView, SIGNAL( mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ),this, 123 connect( mailView, SIGNAL( mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ),this,
@@ -130,35 +132,51 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
130 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); 132 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
131 // Added by Stefan Eilers to allow starting by addressbook.. 133 // Added by Stefan Eilers to allow starting by addressbook..
132 // copied from old mail2 134 // copied from old mail2
133#if !defined(QT_NO_COP) 135#if !defined(QT_NO_COP)
134 connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), 136 connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ),
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
137 142
138 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); 143 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) );
139} 144}
140 145
141MainWindow::~MainWindow() 146MainWindow::~MainWindow()
142{ 147{
143} 148}
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 &)
146{ 165{
147 odebug << "appMessage not reached" << oendl; 166 odebug << "appMessage not reached" << oendl;
148} 167}
149 168
150void MainWindow::slotAdjustLayout() { 169void 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}
160 178
161void MainWindow::slotAdjustColumns() 179void MainWindow::slotAdjustColumns()
162{ 180{
163 bool hidden = folderView->isHidden(); 181 bool hidden = folderView->isHidden();
164 if ( hidden ) folderView->show(); 182 if ( hidden ) folderView->show();
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
@@ -12,12 +12,13 @@
12#include "statuswidget.h" 12#include "statuswidget.h"
13 13
14#include <libmailwrapper/mailtypes.h> 14#include <libmailwrapper/mailtypes.h>
15#include <opie2/osmartpointer.h> 15#include <opie2/osmartpointer.h>
16 16
17class RecMail; 17class RecMail;
18class QCopChannel;
18 19
19class MainWindow : public QMainWindow 20class MainWindow : public QMainWindow
20{ 21{
21 Q_OBJECT 22 Q_OBJECT
22 23
23public: 24public:
@@ -25,12 +26,13 @@ public:
25 virtual ~MainWindow(); 26 virtual ~MainWindow();
26 27
27public slots: 28public slots:
28 virtual void slotAdjustColumns(); 29 virtual void slotAdjustColumns();
29 virtual void appMessage(const QCString &msg, const QByteArray &data); 30 virtual void appMessage(const QCString &msg, const QByteArray &data);
30 virtual void slotComposeMail(); 31 virtual void slotComposeMail();
32 virtual void systemMessage( const QCString&, const QByteArray& );
31 33
32protected slots: 34protected slots:
33 virtual void slotSendQueued(); 35 virtual void slotSendQueued();
34 virtual void slotEditAccounts(); 36 virtual void slotEditAccounts();
35 virtual void slotShowFolders( bool show ); 37 virtual void slotShowFolders( bool show );
36 virtual void refreshMailView(const QValueList<RecMailP>&); 38 virtual void refreshMailView(const QValueList<RecMailP>&);
@@ -48,9 +50,11 @@ protected:
48 QPopupMenu *mailMenu, *settingsMenu; 50 QPopupMenu *mailMenu, *settingsMenu;
49 QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails, 51 QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails,
50 *editSettings, *editAccounts, *syncFolders; 52 *editSettings, *editAccounts, *syncFolders;
51 AccountView *folderView; 53 AccountView *folderView;
52 QListView *mailView; 54 QListView *mailView;
53 QBoxLayout *layout; 55 QBoxLayout *layout;
56 int m_Rotate;
57 QCopChannel* m_sysChannel;
54}; 58};
55 59
56#endif 60#endif