summaryrefslogtreecommitdiff
path: root/noncore/net/mail/mainwindow.cpp
authoralwin <alwin>2004-01-08 14:04:54 (UTC)
committer alwin <alwin>2004-01-08 14:04:54 (UTC)
commitab6a32266c8fb625e782c601c9729af7f98904f6 (patch) (side-by-side diff)
tree1457c421109359bdaa50082f2640d33ac4d74cc2 /noncore/net/mail/mainwindow.cpp
parentb85bc4484bcc0a53557b4759c3e9e58dc9059138 (diff)
downloadopie-ab6a32266c8fb625e782c601c9729af7f98904f6.zip
opie-ab6a32266c8fb625e782c601c9729af7f98904f6.tar.gz
opie-ab6a32266c8fb625e782c601c9729af7f98904f6.tar.bz2
- store single message to another folder implemented
- cleaned code in mainwindow and opiemail.cpp
Diffstat (limited to 'noncore/net/mail/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/mainwindow.cpp151
1 files changed, 26 insertions, 125 deletions
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index e16f853..c38392c 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -4,17 +4,12 @@
#include <qtimer.h>
#include <qlayout.h>
#include <qmessagebox.h>
-#include <qtextstream.h>
#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
-
#include "defines.h"
#include "mainwindow.h"
-#include "viewmail.h"
-#include <libmailwrapper/mailtypes.h>
-#include "mailistviewitem.h"
MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
@@ -127,6 +122,16 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
connect( mailView, SIGNAL( mouseButtonPressed(int, QListViewItem *,const QPoint&,int ) ),this,
SLOT( mailHold( int, QListViewItem *,const QPoint&,int ) ) );
connect(folderView, SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*)));
+ connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
+ connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
+// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
+ connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
+ // Added by Stefan Eilers to allow starting by addressbook..
+ // copied from old mail2
+#if !defined(QT_NO_COP)
+ connect( qApp, SIGNAL( appMessage( const QCString&, const QByteArray& ) ),
+ this, SLOT( appMessage( const QCString&, const QByteArray& ) ) );
+#endif
QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) );
}
@@ -135,6 +140,11 @@ MainWindow::~MainWindow()
{
}
+void MainWindow::appMessage(const QCString &, const QByteArray &)
+{
+ qDebug("appMessage not reached");
+}
+
void MainWindow::slotAdjustLayout() {
QWidget *d = QApplication::desktop();
@@ -164,141 +174,32 @@ void MainWindow::slotEditSettings()
{
}
-void MainWindow::slotShowFolders( bool show )
+void MainWindow::slotShowFolders( bool )
{
- qDebug( "Show Folders" );
- if ( show && folderView->isHidden() ) {
- qDebug( "-> showing" );
- folderView->show();
- } else if ( !show && !folderView->isHidden() ) {
- qDebug( "-> hiding" );
- folderView->hide();
- }
+ qDebug( "slotShowFolders not reached" );
}
-void MainWindow::refreshMailView(QList<RecMail>*list)
+void MainWindow::refreshMailView(QList<RecMail>*)
{
- MailListViewItem*item = 0;
- mailView->clear();
- for (unsigned int i = 0; i < list->count();++i) {
- item = new MailListViewItem(mailView,item);
- item->storeData(*(list->at(i)));
- item->showEntry();
- }
+ qDebug( "refreshMailView not reached" );
}
-void MainWindow::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int )
+
+void MainWindow::mailLeftClicked(int, QListViewItem *,const QPoint&,int )
{
- /* just LEFT button - or tap with stylus on pda */
- if (button!=1) return;
- if (!item) return;
- displayMail();
+ qDebug( "mailLeftClicked not reached" );
}
void MainWindow::displayMail()
{
- QListViewItem*item = mailView->currentItem();
- if (!item) return;
- RecMail mail = ((MailListViewItem*)item)->data();
- RecBody body = folderView->fetchBody(mail);
- ViewMail readMail( this );
- readMail.setBody( body );
- readMail.setMail( mail );
- readMail.showMaximized();
- readMail.exec();
-
- if ( readMail.deleted ) {
- folderView->refreshCurrent();
- } else {
- ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "") );
- }
+ qDebug("displayMail not reached");
}
void MainWindow::slotDeleteMail()
{
- if (!mailView->currentItem()) return;
- RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data();
- if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail.getFrom() + " - " + mail.getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) {
- mail.Wrapper()->deleteMail( mail );
- folderView->refreshCurrent();
- }
-}
-
-void MainWindow::mailHold(int button, QListViewItem *item,const QPoint&,int )
-{
- /* just the RIGHT button - or hold on pda */
- if (button!=2) {return;}
- qDebug("Event right/hold");
- if (!item) return;
- QPopupMenu *m = new QPopupMenu(0);
- if (m) {
- m->insertItem(tr("Read this mail"),this,SLOT(displayMail()));
- m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail()));
- m->setFocus();
- m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
- delete m;
- }
-}
-
-MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item )
- :QListViewItem(parent,item),mail_data()
-{
-}
-
-void MailListViewItem::showEntry()
-{
- if ( mail_data.getFlags().testBit( FLAG_ANSWERED ) == true) {
- setPixmap( 0, Resource::loadPixmap( "mail/kmmsgreplied") );
- } else if ( mail_data.getFlags().testBit( FLAG_SEEN ) == true ) {
- /* I think it looks nicer if there are not such a log of icons but only on mails
- replied or new - Alwin*/
- //setPixmap( 0, Resource::loadPixmap( "mail/kmmsgunseen") );
- } else {
- setPixmap( 0, Resource::loadPixmap( "mail/kmmsgnew") );
- }
- double s = mail_data.Msgsize();
- int w;
- w=0;
-
- while (s>1024) {
- s/=1024;
- ++w;
- if (w>=2) break;
- }
-
- QString q="";
- QString fsize="";
- switch(w) {
- case 1:
- q="k";
- break;
- case 2:
- q="M";
- break;
- default:
- break;
- }
-
- {
- QTextOStream o(&fsize);
- if (w>0) o.precision(2); else o.precision(0);
- o.setf(QTextStream::fixed);
- o << s << " " << q << "Byte";
- }
-
- setText(1,mail_data.getSubject());
- setText(2,mail_data.getFrom());
- setText(3,fsize);
- setText(4,mail_data.getDate());
+ qDebug("deleteMail not reached");
}
-void MailListViewItem::storeData(const RecMail&data)
+void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int )
{
- mail_data = data;
+ qDebug("mailHold not reached");
}
-
-const RecMail& MailListViewItem::data()const
-{
- return mail_data;
-}
-
-