Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

mainwindow.cpp

Go to the documentation of this file.
00001 #include <qmessagebox.h>
00002 #include <qaction.h>
00003 #include <qapplication.h>
00004 
00005 #include <qpe/qcopenvelope_qws.h>
00006 
00007 #include "mailstatusbar.h"
00008 #include "folderwidget.h"
00009 #include "mainwindow.h"
00010 #include "configdiag.h"
00011 #include "configfile.h"
00012 #include "searchdiag.h"
00013 #include "mailtable.h"
00014 #include "composer.h"
00015 #include "viewmail.h"
00016 #include "mailfactory.h"
00017 
00018 MainWindow::MainWindow(QWidget *parent, const char *name, WFlags fl)
00019         : MainWindowBase(parent, name, fl)
00020 {
00021         status->setStopEnabled(false);
00022 
00023         connect(folderView, SIGNAL(status(const QString&)), status, SLOT(setStatusText(const QString&)));
00024         connect(folderView, SIGNAL(folderSelected(Folder)), mailView, SLOT(setFolder(Folder)));
00025 
00026         connect(mailView, SIGNAL(mailClicked(IMAPResponseFETCH,IMAPHandler*)), SLOT(mailClicked(IMAPResponseFETCH,IMAPHandler*)));
00027         connect(mailView, SIGNAL(status(const QString&)), status, SLOT(setStatusText(const QString&)));
00028         connect(mailView, SIGNAL(totalSteps(int)), status, SLOT(setProgressTotalSteps(int)));
00029         connect(mailView, SIGNAL(progress(int)), status, SLOT(setProgress(int)));
00030         connect(mailView, SIGNAL(resetProgress()), status, SLOT(resetProgress()));
00031         connect(mailView, SIGNAL(stopEnabled(bool)), status, SLOT(setStopEnabled(bool)));
00032 
00033         connect(status, SIGNAL(stop()), mailView, SLOT(stop()));
00034 
00035         connect(compose, SIGNAL(activated()), SLOT(slotComposeNoParams()));
00036         connect(sendQueue, SIGNAL(activated()), SLOT(slotSendQueued()));
00037         connect(findmails, SIGNAL(activated()), SLOT(slotSearch()));
00038         connect(configure, SIGNAL(activated()), SLOT(slotConfigure()));
00039 
00040         // Added by Stefan Eilers to allow starting by addressbook..
00041 #if !defined(QT_NO_COP) 
00042 //      QCopChannel *addressChannel = new QCopChannel("QPE/Application/mail" , this );
00043 //      connect (addressChannel, SIGNAL( received(const QCString&,const QByteArray&)),
00044 //               this, SLOT ( appMessage(const QCString&,const QByteArray&) ) );
00045         connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ),
00046                  this, SLOT( appMessage(const QCString&,const QByteArray&) ) );
00047 #endif
00048 }
00049 
00050 // Added by Stefan Eilers to allow starting by addressbook..
00051 void MainWindow::appMessage(const QCString &msg, const QByteArray &data)
00052 {
00053         if (msg == "writeMail(QString,QString)") {
00054                 QDataStream stream(data,IO_ReadOnly);
00055                 QString name, email;
00056                 stream >> name >> email;
00057 
00058                 qWarning("opie-mail:: Should send mail to %s with address %s", name.latin1(), email.latin1() );
00059 
00060                 slotCompose( name, email );
00061                 
00062         }else{
00063                 QString str_message = msg;
00064                 qWarning("opie-mail:: Received unknown QCop-Message: %s", str_message.latin1() );
00065         }
00066 }
00067 
00068 void MainWindow::slotCompose( const QString& name, const QString& email )
00069 {
00070         Composer composer(this, 0, true);
00071 
00072         // If there is a mailaddress given, create message..
00073         if ( ! name.isEmpty() ){
00074                 qWarning("opie-mail:: Compose mail for %s with address %s", name.latin1(), email.latin1() );
00075                 SendMail compMail;
00076                 compMail.setTo( "\"" + name + "\"" + " " + "<"+ email + ">");
00077                 composer.setSendMail( compMail );
00078         }
00079         composer.showMaximized();
00080         composer.exec();
00081 }
00082 
00083 void MainWindow::slotComposeNoParams()
00084 {
00085         slotCompose( 0l, 0l);
00086 }
00087 
00088 void MainWindow::slotSendQueued()
00089 {
00090         Composer composer(this, 0, true, true);
00091 //      composer.sendQueue();
00092         composer.showMaximized();
00093         composer.exec();
00094 //      composer.close();
00095 }
00096 
00097 void MainWindow::slotSearch()
00098 {
00099         SearchDiag searchDiag(this, 0, true);
00100         searchDiag.showMaximized();
00101         searchDiag.exec();
00102 }
00103 
00104 void MainWindow::slotConfigure()
00105 {
00106         ConfigDiag configDiag(this, 0, true);
00107         configDiag.showMaximized();
00108         configDiag.exec();
00109 
00110         connect(&configDiag, SIGNAL(changed()), folderView, SLOT(update()));
00111 }
00112 
00113 void MainWindow::mailClicked(IMAPResponseFETCH mail, IMAPHandler *handler)
00114 {
00115         ViewMail viewMail(mail, handler, this, 0, true);
00116         viewMail.showMaximized();
00117         viewMail.exec();
00118 }

Generated on Sat Nov 5 16:15:53 2005 for OPIE by  doxygen 1.4.2