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