summaryrefslogtreecommitdiff
path: root/noncore/net/mail/mainwindow.cpp
Unidiff
Diffstat (limited to 'noncore/net/mail/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/mainwindow.cpp29
1 files changed, 26 insertions, 3 deletions
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index 8ef7ddd..c410829 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -57,12 +57,17 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
57 57
58 searchMails = new QAction( tr( "Search mails" ), ICON_SEARCHMAILS, 58 searchMails = new QAction( tr( "Search mails" ), ICON_SEARCHMAILS,
59 0, 0, this ); 59 0, 0, this );
60 searchMails->addTo( toolBar ); 60 searchMails->addTo( toolBar );
61 searchMails->addTo( mailMenu ); 61 searchMails->addTo( mailMenu );
62 62
63 deleteMails = new QAction(tr("Delete Mail"), QIconSet(Resource::loadPixmap("mail/delete")), 0, 0, this);
64 deleteMails->addTo( toolBar );
65 deleteMails->addTo( mailMenu );
66 connect( deleteMails, SIGNAL( activated() ),
67 SLOT( slotDeleteMail() ) );
63 68
64 editSettings = new QAction( tr( "Edit settings" ), ICON_EDITSETTINGS, 69 editSettings = new QAction( tr( "Edit settings" ), ICON_EDITSETTINGS,
65 0, 0, this ); 70 0, 0, this );
66 editSettings->addTo( settingsMenu ); 71 editSettings->addTo( settingsMenu );
67 72
68 editAccounts = new QAction( tr( "Configure accounts" ), ICON_EDITACCOUNTS, 73 editAccounts = new QAction( tr( "Configure accounts" ), ICON_EDITACCOUNTS,
@@ -95,13 +100,13 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
95 100
96 slotAdjustLayout(); 101 slotAdjustLayout();
97 102
98 connect( mailView, SIGNAL( clicked( QListViewItem * ) ),this, 103 connect( mailView, SIGNAL( clicked( QListViewItem * ) ),this,
99 SLOT( displayMail( QListViewItem * ) ) ); 104 SLOT( displayMail( QListViewItem * ) ) );
100 105
101 connect(folderView,SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*))); 106 connect(folderView, SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*)));
102 107
103 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); 108 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) );
104} 109}
105 110
106 111
107void MainWindow::slotAdjustLayout() { 112void MainWindow::slotAdjustLayout() {
@@ -128,13 +133,13 @@ void MainWindow::slotAdjustColumns()
128 mailView->setColumnWidth( 2, 80 ); 133 mailView->setColumnWidth( 2, 80 );
129 mailView->setColumnWidth( 3, 50 ); 134 mailView->setColumnWidth( 3, 50 );
130} 135}
131 136
132void MainWindow::slotShowFolders( bool show ) 137void MainWindow::slotShowFolders( bool show )
133{ 138{
134 qDebug( "Show Folders" ); 139 qDebug( "Show Folders" );
135 if ( show && folderView->isHidden() ) { 140 if ( show && folderView->isHidden() ) {
136 qDebug( "-> showing" ); 141 qDebug( "-> showing" );
137 folderView->show(); 142 folderView->show();
138 } else if ( !show && !folderView->isHidden() ) { 143 } else if ( !show && !folderView->isHidden() ) {
139 qDebug( "-> hiding" ); 144 qDebug( "-> hiding" );
140 folderView->hide(); 145 folderView->hide();
@@ -150,24 +155,42 @@ void MainWindow::refreshMailView(QList<RecMail>*list)
150 item->storeData(*(list->at(i))); 155 item->storeData(*(list->at(i)));
151 item->showEntry(); 156 item->showEntry();
152 } 157 }
153} 158}
154void MainWindow::displayMail(QListViewItem*item) 159void MainWindow::displayMail(QListViewItem*item)
155{ 160{
161
162 m_currentItem = item;
163
156 if (!item) return; 164 if (!item) return;
157 RecMail mail = ((MailListViewItem*)item)->data(); 165 RecMail mail = ((MailListViewItem*)item)->data();
158 RecBody body = folderView->fetchBody(mail); 166 RecBody body = folderView->fetchBody(mail);
159 167
160 ViewMail readMail( this ); 168 ViewMail readMail( this );
161 readMail.setBody( body ); 169 readMail.setBody( body );
162 readMail.setMail( mail ); 170 readMail.setMail( mail );
163 readMail.showMaximized(); 171 readMail.showMaximized();
164 readMail.exec(); 172 readMail.exec();
165 ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgunseen") ); 173
174 if ( readMail.deleted ) {
175 folderView->refreshCurrent();
176 } else {
177 ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgunseen") );
178 }
166} 179}
167 180
181void MainWindow::slotDeleteMail()
182{
183 if (!m_currentItem) return;
184 RecMail mail = ((MailListViewItem*)m_currentItem)->data();
185 mail.Wrapper()->deleteMail( mail );
186 folderView->refreshCurrent();
187}
188
189
190
168MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) 191MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item )
169 :QListViewItem(parent,item),mail_data() 192 :QListViewItem(parent,item),mail_data()
170{ 193{
171} 194}
172 195
173void MailListViewItem::showEntry() 196void MailListViewItem::showEntry()