summaryrefslogtreecommitdiff
path: root/noncore/net/mail/mainwindow.cpp
authoralwin <alwin>2004-03-02 12:21:11 (UTC)
committer alwin <alwin>2004-03-02 12:21:11 (UTC)
commitb6b1c97559c0ed9f2e33632272426bf98f289232 (patch) (unidiff)
treed3a9987704770cdf5eb14e1136f6e3ecb2f36a04 /noncore/net/mail/mainwindow.cpp
parent0d59c780513da78033f4d9040475dee9db0256d4 (diff)
downloadopie-b6b1c97559c0ed9f2e33632272426bf98f289232.zip
opie-b6b1c97559c0ed9f2e33632272426bf98f289232.tar.gz
opie-b6b1c97559c0ed9f2e33632272426bf98f289232.tar.bz2
applied the patch generated by the optimize_connect script from
TT.
Diffstat (limited to 'noncore/net/mail/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/mainwindow.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index 2a1f90d..3f34fe7 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -1,217 +1,217 @@
1#include <qlabel.h> 1#include <qlabel.h>
2#include <qvbox.h> 2#include <qvbox.h>
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#include <qmessagebox.h> 6#include <qmessagebox.h>
7 7
8#include <qpe/qpeapplication.h> 8#include <qpe/qpeapplication.h>
9#include <qpe/resource.h> 9#include <qpe/resource.h>
10 10
11#include "defines.h" 11#include "defines.h"
12#include "mainwindow.h" 12#include "mainwindow.h"
13 13
14 14
15MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 15MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
16 : QMainWindow( parent, name, flags ) 16 : QMainWindow( parent, name, flags )
17{ 17{
18 18
19 setCaption( tr( "Mail" ) ); 19 setCaption( tr( "Mail" ) );
20 setToolBarsMovable( false ); 20 setToolBarsMovable( false );
21 21
22 toolBar = new QToolBar( this ); 22 toolBar = new QToolBar( this );
23 menuBar = new QMenuBar( toolBar ); 23 menuBar = new QMenuBar( toolBar );
24 mailMenu = new QPopupMenu( menuBar ); 24 mailMenu = new QPopupMenu( menuBar );
25 menuBar->insertItem( tr( "Mail" ), mailMenu ); 25 menuBar->insertItem( tr( "Mail" ), mailMenu );
26 settingsMenu = new QPopupMenu( menuBar ); 26 settingsMenu = new QPopupMenu( menuBar );
27 menuBar->insertItem( tr( "Settings" ), settingsMenu ); 27 menuBar->insertItem( tr( "Settings" ), settingsMenu );
28 28
29 addToolBar( toolBar ); 29 addToolBar( toolBar );
30 toolBar->setHorizontalStretchable( true ); 30 toolBar->setHorizontalStretchable( true );
31 31
32 QLabel *spacer = new QLabel( toolBar ); 32 QLabel *spacer = new QLabel( toolBar );
33 spacer->setBackgroundMode( QWidget::PaletteButton ); 33 spacer->setBackgroundMode( QWidget::PaletteButton );
34 toolBar->setStretchableWidget( spacer ); 34 toolBar->setStretchableWidget( spacer );
35 35
36 composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL, 36 composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL,
37 0, 0, this ); 37 0, 0, this );
38 composeMail->addTo( toolBar ); 38 composeMail->addTo( toolBar );
39 composeMail->addTo( mailMenu ); 39 composeMail->addTo( mailMenu );
40 40
41 sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED, 41 sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED,
42 0, 0, this ); 42 0, 0, this );
43 sendQueued->addTo( toolBar ); 43 sendQueued->addTo( toolBar );
44 sendQueued->addTo( mailMenu ); 44 sendQueued->addTo( mailMenu );
45 45
46 /* 46 /*
47 syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, 47 syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC,
48 0, 0, this ); 48 0, 0, this );
49 syncFolders->addTo( toolBar ); 49 syncFolders->addTo( toolBar );
50 syncFolders->addTo( mailMenu ); 50 syncFolders->addTo( mailMenu );
51 */ 51 */
52 52
53 showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS, 53 showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS,
54 0, 0, this, 0, true ); 54 0, 0, this, 0, true );
55 showFolders->addTo( toolBar ); 55 showFolders->addTo( toolBar );
56 showFolders->addTo( mailMenu ); 56 showFolders->addTo( mailMenu );
57 showFolders->setOn( true ); 57 showFolders->setOn( true );
58 connect(showFolders, SIGNAL( toggled( bool ) ), 58 connect(showFolders, SIGNAL( toggled(bool) ),
59 SLOT( slotShowFolders( bool ) ) ); 59 SLOT( slotShowFolders(bool) ) );
60 60
61 /* 61 /*
62 searchMails = new QAction( tr( "Search mails" ), QIconSet( Resource::loadPixmap("find") ), 62 searchMails = new QAction( tr( "Search mails" ), QIconSet( Resource::loadPixmap("find") ),
63 0, 0, this ); 63 0, 0, this );
64 searchMails->addTo( toolBar ); 64 searchMails->addTo( toolBar );
65 searchMails->addTo( mailMenu ); 65 searchMails->addTo( mailMenu );
66 */ 66 */
67 67
68 deleteMails = new QAction(tr("Delete Mail"), QIconSet( Resource::loadPixmap("trash")), 0, 0, this); 68 deleteMails = new QAction(tr("Delete Mail"), QIconSet( Resource::loadPixmap("trash")), 0, 0, this);
69 deleteMails->addTo( toolBar ); 69 deleteMails->addTo( toolBar );
70 deleteMails->addTo( mailMenu ); 70 deleteMails->addTo( mailMenu );
71 connect( deleteMails, SIGNAL( activated() ), 71 connect( deleteMails, SIGNAL( activated() ),
72 SLOT( slotDeleteMail() ) ); 72 SLOT( slotDeleteMail() ) );
73 73
74 editSettings = new QAction( tr( "Edit settings" ), QIconSet( Resource::loadPixmap("SettingsIcon") ) , 74 editSettings = new QAction( tr( "Edit settings" ), QIconSet( Resource::loadPixmap("SettingsIcon") ) ,
75 0, 0, this ); 75 0, 0, this );
76 editSettings->addTo( settingsMenu ); 76 editSettings->addTo( settingsMenu );
77 connect( editSettings, SIGNAL( activated() ), 77 connect( editSettings, SIGNAL( activated() ),
78 SLOT( slotEditSettings() ) ); 78 SLOT( slotEditSettings() ) );
79 editAccounts = new QAction( tr( "Configure accounts" ), QIconSet( Resource::loadPixmap("mail/editaccounts") ) , 79 editAccounts = new QAction( tr( "Configure accounts" ), QIconSet( Resource::loadPixmap("mail/editaccounts") ) ,
80 0, 0, this ); 80 0, 0, this );
81 editAccounts->addTo( settingsMenu ); 81 editAccounts->addTo( settingsMenu );
82 82
83 //setCentralWidget( view ); 83 //setCentralWidget( view );
84 84
85 QVBox* wrapperBox = new QVBox( this ); 85 QVBox* wrapperBox = new QVBox( this );
86 setCentralWidget( wrapperBox ); 86 setCentralWidget( wrapperBox );
87 87
88 QWidget *view = new QWidget( wrapperBox ); 88 QWidget *view = new QWidget( wrapperBox );
89 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" ) );
96 96
97 layout->addWidget( folderView ); 97 layout->addWidget( folderView );
98 98
99 mailView = new QListView( view ); 99 mailView = new QListView( view );
100 mailView->addColumn( tr( "" ) ); 100 mailView->addColumn( tr( "" ) );
101 mailView->addColumn( tr( "Subject" ),QListView::Manual ); 101 mailView->addColumn( tr( "Subject" ),QListView::Manual );
102 mailView->addColumn( tr( "Sender" ),QListView::Manual ); 102 mailView->addColumn( tr( "Sender" ),QListView::Manual );
103 mailView->addColumn( tr( "Size" ),QListView::Manual); 103 mailView->addColumn( tr( "Size" ),QListView::Manual);
104 mailView->addColumn( tr( "Date" )); 104 mailView->addColumn( tr( "Date" ));
105 mailView->setAllColumnsShowFocus(true); 105 mailView->setAllColumnsShowFocus(true);
106 mailView->setSorting(-1); 106 mailView->setSorting(-1);
107 107
108 statusWidget = new StatusWidget( wrapperBox ); 108 statusWidget = new StatusWidget( wrapperBox );
109 statusWidget->hide(); 109 statusWidget->hide();
110 110
111 layout->addWidget( mailView ); 111 layout->addWidget( mailView );
112 layout->setStretchFactor( folderView, 1 ); 112 layout->setStretchFactor( folderView, 1 );
113 layout->setStretchFactor( mailView, 2 ); 113 layout->setStretchFactor( mailView, 2 );
114 114
115 slotAdjustLayout(); 115 slotAdjustLayout();
116 116
117 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); 117 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold);
118 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); 118 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold);
119 119
120 connect( mailView, SIGNAL( mouseButtonClicked(int, QListViewItem *,const QPoint&,int ) ),this, 120 connect( mailView, SIGNAL( mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ),this,
121 SLOT( mailLeftClicked( int, QListViewItem *,const QPoint&,int ) ) ); 121 SLOT( mailLeftClicked(int,QListViewItem*,const QPoint&,int) ) );
122 connect( mailView, SIGNAL( mouseButtonPressed(int, QListViewItem *,const QPoint&,int ) ),this, 122 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
123 SLOT( mailHold( int, QListViewItem *,const QPoint&,int ) ) ); 123 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) );
124 connect(folderView, SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*))); 124 connect(folderView, SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*)));
125 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); 125 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
126 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); 126 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
127// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); 127// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
128 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); 128 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
129 // Added by Stefan Eilers to allow starting by addressbook.. 129 // Added by Stefan Eilers to allow starting by addressbook..
130 // copied from old mail2 130 // copied from old mail2
131#if !defined(QT_NO_COP) 131#if !defined(QT_NO_COP)
132 connect( qApp, SIGNAL( appMessage( const QCString&, const QByteArray& ) ), 132 connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ),
133 this, SLOT( appMessage( const QCString&, const QByteArray& ) ) ); 133 this, SLOT( appMessage(const QCString&,const QByteArray&) ) );
134#endif 134#endif
135 135
136 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); 136 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) );
137} 137}
138 138
139MainWindow::~MainWindow() 139MainWindow::~MainWindow()
140{ 140{
141} 141}
142 142
143void MainWindow::appMessage(const QCString &, const QByteArray &) 143void MainWindow::appMessage(const QCString &, const QByteArray &)
144{ 144{
145 qDebug("appMessage not reached"); 145 qDebug("appMessage not reached");
146} 146}
147 147
148void MainWindow::slotAdjustLayout() { 148void MainWindow::slotAdjustLayout() {
149 149
150 QWidget *d = QApplication::desktop(); 150 QWidget *d = QApplication::desktop();
151 151
152 if ( d->width() < d->height() ) { 152 if ( d->width() < d->height() ) {
153 layout->setDirection( QBoxLayout::TopToBottom ); 153 layout->setDirection( QBoxLayout::TopToBottom );
154 } else { 154 } else {
155 layout->setDirection( QBoxLayout::LeftToRight ); 155 layout->setDirection( QBoxLayout::LeftToRight );
156 } 156 }
157} 157}
158 158
159void MainWindow::slotAdjustColumns() 159void MainWindow::slotAdjustColumns()
160{ 160{
161 bool hidden = folderView->isHidden(); 161 bool hidden = folderView->isHidden();
162 if ( hidden ) folderView->show(); 162 if ( hidden ) folderView->show();
163 folderView->setColumnWidth( 0, folderView->visibleWidth() ); 163 folderView->setColumnWidth( 0, folderView->visibleWidth() );
164 if ( hidden ) folderView->hide(); 164 if ( hidden ) folderView->hide();
165 165
166 mailView->setColumnWidth( 0, 10 ); 166 mailView->setColumnWidth( 0, 10 );
167 mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 ); 167 mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 );
168 mailView->setColumnWidth( 2, 80 ); 168 mailView->setColumnWidth( 2, 80 );
169 mailView->setColumnWidth( 3, 50 ); 169 mailView->setColumnWidth( 3, 50 );
170 mailView->setColumnWidth( 4, 50 ); 170 mailView->setColumnWidth( 4, 50 );
171} 171}
172 172
173void MainWindow::slotEditSettings() 173void MainWindow::slotEditSettings()
174{ 174{
175} 175}
176 176
177void MainWindow::slotShowFolders( bool ) 177void MainWindow::slotShowFolders( bool )
178{ 178{
179 qDebug( "slotShowFolders not reached" ); 179 qDebug( "slotShowFolders not reached" );
180} 180}
181 181
182void MainWindow::refreshMailView(QList<RecMail>*) 182void MainWindow::refreshMailView(QList<RecMail>*)
183{ 183{
184 qDebug( "refreshMailView not reached" ); 184 qDebug( "refreshMailView not reached" );
185} 185}
186 186
187void MainWindow::mailLeftClicked(int, QListViewItem *,const QPoint&,int ) 187void MainWindow::mailLeftClicked(int, QListViewItem *,const QPoint&,int )
188{ 188{
189 qDebug( "mailLeftClicked not reached" ); 189 qDebug( "mailLeftClicked not reached" );
190} 190}
191 191
192void MainWindow::displayMail() 192void MainWindow::displayMail()
193{ 193{
194 qDebug("displayMail not reached"); 194 qDebug("displayMail not reached");
195} 195}
196 196
197void MainWindow::slotDeleteMail() 197void MainWindow::slotDeleteMail()
198{ 198{
199 qDebug("deleteMail not reached"); 199 qDebug("deleteMail not reached");
200} 200}
201 201
202void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) 202void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int )
203{ 203{
204 qDebug("mailHold not reached"); 204 qDebug("mailHold not reached");
205} 205}
206 206
207void MainWindow::slotSendQueued() 207void MainWindow::slotSendQueued()
208{ 208{
209} 209}
210 210
211void MainWindow::slotEditAccounts() 211void MainWindow::slotEditAccounts()
212{ 212{
213} 213}
214 214
215void MainWindow::slotComposeMail() 215void MainWindow::slotComposeMail()
216{ 216{
217} 217}