summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-12-14 00:55:16 (UTC)
committer harlekin <harlekin>2003-12-14 00:55:16 (UTC)
commit9a0f1ee9b3ba465942d207eaddec722371f86353 (patch) (unidiff)
tree0dabc3598a8516a58a6b5e01019e22062af2b6de
parentff2b84787e454f8a11aaef7a4ce18941ac0d28fd (diff)
downloadopie-9a0f1ee9b3ba465942d207eaddec722371f86353.zip
opie-9a0f1ee9b3ba465942d207eaddec722371f86353.tar.gz
opie-9a0f1ee9b3ba465942d207eaddec722371f86353.tar.bz2
little fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/mainwindow.cpp6
-rw-r--r--noncore/net/mail/mainwindow.h1
2 files changed, 2 insertions, 5 deletions
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index c410829..2b5870a 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -114,105 +114,103 @@ void MainWindow::slotAdjustLayout() {
114 QWidget *d = QApplication::desktop(); 114 QWidget *d = QApplication::desktop();
115 115
116 if ( d->width() < d->height() ) { 116 if ( d->width() < d->height() ) {
117 layout->setDirection( QBoxLayout::TopToBottom ); 117 layout->setDirection( QBoxLayout::TopToBottom );
118 } else { 118 } else {
119 layout->setDirection( QBoxLayout::LeftToRight ); 119 layout->setDirection( QBoxLayout::LeftToRight );
120 } 120 }
121 delete d; 121 delete d;
122} 122}
123 123
124void MainWindow::slotAdjustColumns() 124void MainWindow::slotAdjustColumns()
125{ 125{
126 bool hidden = folderView->isHidden(); 126 bool hidden = folderView->isHidden();
127 if ( hidden ) folderView->show(); 127 if ( hidden ) folderView->show();
128 folderView->setColumnWidth( 0, folderView->visibleWidth() ); 128 folderView->setColumnWidth( 0, folderView->visibleWidth() );
129 if ( hidden ) folderView->hide(); 129 if ( hidden ) folderView->hide();
130 130
131 mailView->setColumnWidth( 0, 10 ); 131 mailView->setColumnWidth( 0, 10 );
132 mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 ); 132 mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 );
133 mailView->setColumnWidth( 2, 80 ); 133 mailView->setColumnWidth( 2, 80 );
134 mailView->setColumnWidth( 3, 50 ); 134 mailView->setColumnWidth( 3, 50 );
135} 135}
136 136
137void MainWindow::slotShowFolders( bool show ) 137void MainWindow::slotShowFolders( bool show )
138{ 138{
139 qDebug( "Show Folders" ); 139 qDebug( "Show Folders" );
140 if ( show && folderView->isHidden() ) { 140 if ( show && folderView->isHidden() ) {
141 qDebug( "-> showing" ); 141 qDebug( "-> showing" );
142 folderView->show(); 142 folderView->show();
143 } else if ( !show && !folderView->isHidden() ) { 143 } else if ( !show && !folderView->isHidden() ) {
144 qDebug( "-> hiding" ); 144 qDebug( "-> hiding" );
145 folderView->hide(); 145 folderView->hide();
146 } 146 }
147} 147}
148 148
149void MainWindow::refreshMailView(QList<RecMail>*list) 149void MainWindow::refreshMailView(QList<RecMail>*list)
150{ 150{
151 MailListViewItem*item = 0; 151 MailListViewItem*item = 0;
152 mailView->clear(); 152 mailView->clear();
153 for (unsigned int i = 0; i < list->count();++i) { 153 for (unsigned int i = 0; i < list->count();++i) {
154 item = new MailListViewItem(mailView,item); 154 item = new MailListViewItem(mailView,item);
155 item->storeData(*(list->at(i))); 155 item->storeData(*(list->at(i)));
156 item->showEntry(); 156 item->showEntry();
157 } 157 }
158} 158}
159void MainWindow::displayMail(QListViewItem*item) 159void MainWindow::displayMail(QListViewItem*item)
160{ 160{
161 161
162 m_currentItem = item;
163
164 if (!item) return; 162 if (!item) return;
165 RecMail mail = ((MailListViewItem*)item)->data(); 163 RecMail mail = ((MailListViewItem*)item)->data();
166 RecBody body = folderView->fetchBody(mail); 164 RecBody body = folderView->fetchBody(mail);
167 165
168 ViewMail readMail( this ); 166 ViewMail readMail( this );
169 readMail.setBody( body ); 167 readMail.setBody( body );
170 readMail.setMail( mail ); 168 readMail.setMail( mail );
171 readMail.showMaximized(); 169 readMail.showMaximized();
172 readMail.exec(); 170 readMail.exec();
173 171
174 if ( readMail.deleted ) { 172 if ( readMail.deleted ) {
175 folderView->refreshCurrent(); 173 folderView->refreshCurrent();
176 } else { 174 } else {
177 ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgunseen") ); 175 ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgunseen") );
178 } 176 }
179} 177}
180 178
181void MainWindow::slotDeleteMail() 179void MainWindow::slotDeleteMail()
182{ 180{
183 if (!m_currentItem) return; 181 if (!mailView->currentItem()) return;
184 RecMail mail = ((MailListViewItem*)m_currentItem)->data(); 182 RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data();
185 mail.Wrapper()->deleteMail( mail ); 183 mail.Wrapper()->deleteMail( mail );
186 folderView->refreshCurrent(); 184 folderView->refreshCurrent();
187} 185}
188 186
189 187
190 188
191MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) 189MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item )
192 :QListViewItem(parent,item),mail_data() 190 :QListViewItem(parent,item),mail_data()
193{ 191{
194} 192}
195 193
196void MailListViewItem::showEntry() 194void MailListViewItem::showEntry()
197{ 195{
198 if ( mail_data.getFlags().testBit( FLAG_SEEN ) == true ) { 196 if ( mail_data.getFlags().testBit( FLAG_SEEN ) == true ) {
199 setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgunseen") ); 197 setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgunseen") );
200 } else { 198 } else {
201 setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgnew") ); 199 setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgnew") );
202 } 200 }
203 setText(1,mail_data.getSubject()); 201 setText(1,mail_data.getSubject());
204 setText(2,mail_data.getFrom()); 202 setText(2,mail_data.getFrom());
205 setText(3,mail_data.getDate()); 203 setText(3,mail_data.getDate());
206} 204}
207 205
208void MailListViewItem::storeData(const RecMail&data) 206void MailListViewItem::storeData(const RecMail&data)
209{ 207{
210 mail_data = data; 208 mail_data = data;
211} 209}
212 210
213const RecMail& MailListViewItem::data()const 211const RecMail& MailListViewItem::data()const
214{ 212{
215 return mail_data; 213 return mail_data;
216} 214}
217 215
218 216
diff --git a/noncore/net/mail/mainwindow.h b/noncore/net/mail/mainwindow.h
index 8641510..21af190 100644
--- a/noncore/net/mail/mainwindow.h
+++ b/noncore/net/mail/mainwindow.h
@@ -1,44 +1,43 @@
1#ifndef MAINWINDOW_H 1#ifndef MAINWINDOW_H
2#define MAINWINDOW_H 2#define MAINWINDOW_H
3 3
4#include <qmainwindow.h> 4#include <qmainwindow.h>
5#include <qlistview.h> 5#include <qlistview.h>
6#include <qaction.h> 6#include <qaction.h>
7 7
8#include <qtoolbar.h> 8#include <qtoolbar.h>
9#include <qmenubar.h> 9#include <qmenubar.h>
10 10
11#include "accountview.h" 11#include "accountview.h"
12 12
13class RecMail; 13class RecMail;
14 14
15class MainWindow : public QMainWindow 15class MainWindow : public QMainWindow
16{ 16{
17 Q_OBJECT 17 Q_OBJECT
18 18
19public: 19public:
20 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); 20 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 );
21 21
22public slots: 22public slots:
23 void slotAdjustColumns(); 23 void slotAdjustColumns();
24 24
25protected slots: 25protected slots:
26 virtual void slotShowFolders( bool show ); 26 virtual void slotShowFolders( bool show );
27 virtual void refreshMailView(QList<RecMail>*); 27 virtual void refreshMailView(QList<RecMail>*);
28 virtual void displayMail(QListViewItem*); 28 virtual void displayMail(QListViewItem*);
29 virtual void slotDeleteMail(); 29 virtual void slotDeleteMail();
30 void slotAdjustLayout(); 30 void slotAdjustLayout();
31 31
32protected: 32protected:
33 QToolBar *toolBar; 33 QToolBar *toolBar;
34 QMenuBar *menuBar; 34 QMenuBar *menuBar;
35 QPopupMenu *mailMenu, *settingsMenu; 35 QPopupMenu *mailMenu, *settingsMenu;
36 QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails, 36 QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails,
37 *editSettings, *editAccounts, *syncFolders; 37 *editSettings, *editAccounts, *syncFolders;
38 AccountView *folderView; 38 AccountView *folderView;
39 QListView *mailView; 39 QListView *mailView;
40 QListViewItem* m_currentItem;
41 QBoxLayout *layout; 40 QBoxLayout *layout;
42}; 41};
43 42
44#endif 43#endif