summaryrefslogtreecommitdiff
path: root/noncore/unsupported/mailit
Side-by-side diff
Diffstat (limited to 'noncore/unsupported/mailit') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/mailit/addatt.cpp4
-rw-r--r--noncore/unsupported/mailit/emailclient.cpp32
-rw-r--r--noncore/unsupported/mailit/emailhandler.cpp22
-rw-r--r--noncore/unsupported/mailit/mailitwindow.cpp36
4 files changed, 47 insertions, 47 deletions
diff --git a/noncore/unsupported/mailit/addatt.cpp b/noncore/unsupported/mailit/addatt.cpp
index 19ac58f..420f84c 100644
--- a/noncore/unsupported/mailit/addatt.cpp
+++ b/noncore/unsupported/mailit/addatt.cpp
@@ -1,196 +1,196 @@
/**********************************************************************
** Copyright (C) 2001 Trolltech AS. All rights reserved.
**
** This file is part of Qt Palmtop Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include <qlayout.h>
#include <qhbox.h>
#include <qdir.h>
#include <qstringlist.h>
#include <qpe/resource.h>
#include "addatt.h"
FileItem::FileItem(QListView *parent, DocLnk* dl)
: QListViewItem(parent)
{
/*file = fileInfo;
type = fileType;*/
doclnk=dl;
setText(0, doclnk->name());
/* if (fileType == "Picture") {
setPixmap(0, Resource::loadPixmap("pixmap"));
} else if (fileType == "Document") {
setPixmap(0, Resource::loadPixmap("txt"));
} else if (fileType == "Sound") {
setPixmap(0, Resource::loadPixmap("play"));
} else if (fileType == "Movie") {
setPixmap(0, Resource::loadPixmap("MPEGPlayer"));
} else if (fileType == "File") {
setPixmap(0, Resource::loadPixmap("exec"));
}*/
}
FileItem::~FileItem()
{
if (doclnk!=NULL) delete doclnk;
doclnk=NULL;
}
AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f)
: QDialog(parent, name, f)
{
setCaption(tr("Adding attachments") );
QGridLayout *top = new QGridLayout(this, 1,1 );
QHBox *buttons=new QHBox(this);
/*fileCategoryButton = new QPushButton(this);*/
attachButton = new QPushButton(tr("attach..."), buttons);
removeButton = new QPushButton(tr("Remove"), buttons);
/*fileCategories = new QPopupMenu(fileCategoryButton);
fileCategoryButton->setPopup(fileCategories);
fileCategories->insertItem("Document");
fileCategories->insertItem("Picture");
fileCategories->insertItem("Sound");
fileCategories->insertItem("Movie");
fileCategories->insertItem("File");
fileCategoryButton->setText("Document");
top->addWidget(fileCategoryButton, 0, 0);*/
top->addWidget(buttons,1,0);
//buttons->addWidget(attachButton,0,0);
//buttons->addWidget(removeButton,0,1);
//connect(fileCategories, SIGNAL(activated(int)), this,
// SLOT(fileCategorySelected(int)) );*/
connect(attachButton, SIGNAL(clicked()), this,
SLOT(addattachment()) );
connect(removeButton, SIGNAL(clicked()), this,
SLOT(removeattachment()) );
/*listView = new QListView(this, "AttView");
listView->addColumn("Documents");*
- connect(listView, SIGNAL(doubleClicked(QListViewItem *)), this,
+ connect(listView, SIGNAL(doubleClicked(QListViewItem*)), this,
SLOT(addattachment()) );*/
attView = new QListView(this, "Selected");
attView->addColumn(tr("Attached"));
attView->addColumn(tr("File type"));
- connect(attView, SIGNAL(doubleClicked(QListViewItem *)), this,
+ connect(attView, SIGNAL(doubleClicked(QListViewItem*)), this,
SLOT(removeattachment()) );
//top->addWidget(ofs, 0,0);
top->addWidget(attView, 0,0);
clear();
}
void AddAtt::clear()
{
attView->clear();
//getFiles();
modified = FALSE;
}
/*void AddAtt::fileCategorySelected(int id)
{
fileCategoryButton->setText(fileCategories->text(id));
getFiles();
}*/
void AddAtt::addattachment()
{ // ### FIXME wrong use -zecke
OFileDialog ofs("Attachments",this,0,0,"/root/Documents");
ofs.showMaximized();
if (ofs.exec()==QDialog::Accepted)
{
DocLnk* dl=new DocLnk(ofs.selectedDocument());
FileItem* fi=new FileItem(attView,dl);
fi->setPixmap(0,dl->pixmap());
fi->setText(1,dl->type());
attView->insertItem(fi);
modified = TRUE;
}
}
void AddAtt::removeattachment()
{
if (attView->selectedItem() != NULL)
{
attView->takeItem(attView->selectedItem());
}
modified = TRUE;
}
void AddAtt::reject()
{
if (modified) {
attView->clear();
modified = FALSE;
}
}
void AddAtt::accept()
{
modified = FALSE;
hide();
}
void AddAtt::getFiles()
{
QString path, selected;
/*listView->clear();
selected = fileCategoryButton->text();
if (selected == "Picture") {
path = "../pics/";
} else if (selected == "Document") {
path = "" ; //sub-dirs not decided
} else if (selected == "Sound") {
path = "../sounds/"; //sub-dirs not decided
} else if (selected == "Movie") {
path = ""; //sub-dirs not decided
} else if (selected == "File") {
path = ""; //sub-dirs not decided
}
dir = new QDir(path);
dir->setFilter(QDir::Files);
const QFileInfoList *dirInfoList = dir->entryInfoList();
QFileInfoListIterator it(*dirInfoList); // create list iterator
while ( (fi=it.current()) ) { // for each file...
item = new FileItem(lis+ütView, *fi, selected);
++it; // goto next list element
}*/
}
QStringList AddAtt::returnattachedFiles()
{
diff --git a/noncore/unsupported/mailit/emailclient.cpp b/noncore/unsupported/mailit/emailclient.cpp
index 8359acf..86c7987 100644
--- a/noncore/unsupported/mailit/emailclient.cpp
+++ b/noncore/unsupported/mailit/emailclient.cpp
@@ -1,319 +1,319 @@
/**********************************************************************
** Copyright (C) 2001 Trolltech AS. All rights reserved.
**
** This file is part of Qt Palmtop Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include <qapplication.h>
#include <qmessagebox.h>
#include <qvbox.h>
#include <qfile.h>
#include <qcheckbox.h>
#include <qmenubar.h>
#include <qaction.h>
#include <qwhatsthis.h>
#include <qpe/resource.h>
#include "emailclient.h"
#include "writemail.h"
QCollection::Item AccountList::newItem(QCollection::Item d)
{
return dupl( (MailAccount *) d);
}
MailAccount* AccountList::dupl(MailAccount *in)
{
ac = new MailAccount(*in);
return ac;
}
EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl )
: QMainWindow( parent, name, fl )
{
emailHandler = new EmailHandler();
addressList = new AddressList();
sending = FALSE;
receiving = FALSE;
previewingMail = FALSE;
mailIdCount = 1;
accountIdCount = 1;
allAccounts = FALSE;
init();
connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) );
- connect(emailHandler, SIGNAL(smtpError(int,const QString &)), this,
- SLOT(smtpError(int,const QString &)) );
- connect(emailHandler, SIGNAL(popError(int,const QString &)), this,
- SLOT(popError(int,const QString &)) );
+ connect(emailHandler, SIGNAL(smtpError(int,const QString&)), this,
+ SLOT(smtpError(int,const QString&)) );
+ connect(emailHandler, SIGNAL(popError(int,const QString&)), this,
+ SLOT(popError(int,const QString&)) );
- connect(inboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(inboxItemSelected()) );
- connect(outboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(outboxItemSelected()) );
+ connect(inboxView, SIGNAL(doubleClicked(QListViewItem*)), this, SLOT(inboxItemSelected()) );
+ connect(outboxView, SIGNAL(doubleClicked(QListViewItem*)), this, SLOT(outboxItemSelected()) );
- connect(inboxView, SIGNAL(pressed(QListViewItem *)), this, SLOT(inboxItemPressed()) );
- connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemReleased()) );
+ connect(inboxView, SIGNAL(pressed(QListViewItem*)), this, SLOT(inboxItemPressed()) );
+ connect(inboxView, SIGNAL(clicked(QListViewItem*)), this, SLOT(inboxItemReleased()) );
- connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this,
- SLOT(mailArrived(const Email &, bool)) );
+ connect(emailHandler, SIGNAL(mailArrived(const Email&,bool)), this,
+ SLOT(mailArrived(const Email&,bool)) );
connect(emailHandler, SIGNAL(mailTransfered(int)), this,
SLOT(allMailArrived(int)) );
mailconf = new Config("mailit");
//In case Synchronize is not defined in settings.txt
readSettings();
updateAccounts();
lineShift = "\n";
readMail();
lineShift = "\r\n";
mailboxView->setCurrentTab(0); //ensure that inbox has focus
/*channel = new QCopChannel( "QPE/Application/mailit", this );
- connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
- this, SLOT(receive(const QCString&, const QByteArray&)) );*/
+ connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
+ this, SLOT(receive(const QCString&,const QByteArray&)) );*/
}
EmailClient::~EmailClient()
{
//needs to be moved from destructor to closewindow event
saveMail(getPath(FALSE) + "inbox.txt", inboxView);
//does not currently work. Defining outbox in the same
//format as inbox is not a good solution as they have
//different properties
saveMail(getPath(FALSE) + "outbox.txt", outboxView);
saveSettings();
mailconf->write();
delete mailconf;
}
void EmailClient::init()
{
initStatusBar(this);
setToolBarsMovable(FALSE);
bar = new QToolBar(this);
QWhatsThis::add(bar,tr("Main operation toolbar"));
bar->setHorizontalStretchable( TRUE );
mb = new QMenuBar( bar );
QPopupMenu *mail = new QPopupMenu(mb);
mb->insertItem( tr( "&Mail" ), mail);
QPopupMenu *configure = new QPopupMenu(mb);
mb->insertItem( tr( "Accounts" ), configure);
selectAccountMenu = new QPopupMenu(mb);
editAccountMenu = new QPopupMenu(mb);
deleteAccountMenu = new QPopupMenu(mb);
mail->insertItem(tr("Get Mail in"), selectAccountMenu);
configure->insertItem(tr("Edit account"), editAccountMenu);
configure->insertItem(tr("Delete account"), deleteAccountMenu);
bar = new QToolBar(this);
getMailButton = new QToolButton(Resource::loadPixmap("mailit/getmail"),tr("getMail"),tr("select account"), this,SLOT(getAllNewMail()),bar);
QWhatsThis::add(getMailButton,tr("Click to download mail via all available accounts.\n Press and hold to select the desired account."));
getMailButton->setPopup(selectAccountMenu);
sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendqueue"), QString::null, 0, this, 0);
connect(sendMailButton, SIGNAL(activated()), this, SLOT(sendQuedMail()) );
sendMailButton->addTo(bar);
sendMailButton->addTo(mail);
sendMailButton->setWhatsThis("Send mail queued in the outbox");
composeButton = new QAction(tr("Compose"), Resource::loadPixmap("new"), QString::null, 0, this, 0);
connect(composeButton, SIGNAL(activated()), this, SLOT(compose()) );
composeButton->addTo(bar);
composeButton->addTo(mail);
composeButton->setWhatsThis("Compose a new mail");
cancelButton = new QAction(tr("Cancel transfer"), Resource::loadPixmap("close"), QString::null, 0, this, 0);
connect(cancelButton, SIGNAL(activated()), this, SLOT(cancel()) );
cancelButton->addTo(mail);
cancelButton->addTo(bar);
cancelButton->setEnabled(FALSE);
cancelButton->setWhatsThis("Stop the currently active mail transfer");
deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 );
connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) );
deleteButton->addTo(bar);
deleteButton->setWhatsThis("Remove the currently selected eMail(s)");
mailboxView = new OTabWidget( this, "mailboxView" );
QWidget* widget = new QWidget( mailboxView, "widget" );
grid_2 = new QGridLayout( widget );
// grid_2->setSpacing(6);
// grid_2->setMargin( 11 );
inboxView = new QListView( widget, "inboxView" );
inboxView->addColumn( tr( "From" ) );
inboxView->addColumn( tr( "Subject" ) );
inboxView->addColumn( tr( "Date" ) );
inboxView->setMinimumSize( QSize( 0, 0 ) );
inboxView->setAllColumnsShowFocus(TRUE);
QWhatsThis::add(inboxView,QWidget::tr("This is the inbox view.\n"
"It keeps the fetched mail which can be \n"
"viewed by double clicking the entry.\n"
"blue attachment icon shows whether this \n"
"mailhas attachments.\n"));
grid_2->addWidget( inboxView, 2, 0 );
mailboxView->addTab( widget, "mailit/inbox", tr( "Inbox" ) );
QWidget* widget_2 = new QWidget( mailboxView, "widget_2" );
grid_3 = new QGridLayout( widget_2 );
// grid_3->setSpacing(6);
// grid_3->setMargin( 11 );
outboxView = new QListView( widget_2, "outboxView" );
outboxView->addColumn( tr( "To" ) );
outboxView->addColumn( tr( "Subject" ) );
outboxView->setAllColumnsShowFocus(TRUE);
QWhatsThis::add(outboxView,QWidget::tr("This is the outbox view.\n"
"It keeps the queued mails to send which can be \n"
"reviewed by double clicking the entry."));
grid_3->addWidget( outboxView, 0, 0 );
mailboxView->addTab( widget_2,"mailit/outbox", tr( "Outbox" ) );
setCentralWidget(mailboxView);
}
void EmailClient::initStatusBar(QWidget* parent)
{
statusBar = new QStatusBar(parent);
statusBar->setSizeGripEnabled(FALSE);
status1Label = new QLabel( tr("Idle"), statusBar);
status2Label = new QLabel("", statusBar);
- connect(emailHandler, SIGNAL(updatePopStatus(const QString &)),
- status2Label, SLOT(setText(const QString &)) );
- connect(emailHandler, SIGNAL(updateSmtpStatus(const QString &)),
- status2Label, SLOT(setText(const QString &)) );
+ connect(emailHandler, SIGNAL(updatePopStatus(const QString&)),
+ status2Label, SLOT(setText(const QString&)) );
+ connect(emailHandler, SIGNAL(updateSmtpStatus(const QString&)),
+ status2Label, SLOT(setText(const QString&)) );
progressBar = new QProgressBar(statusBar);
connect(emailHandler, SIGNAL(mailboxSize(int)),
this, SLOT(setTotalSize(int)) );
connect(emailHandler, SIGNAL(currentMailSize(int)),
this, SLOT(setMailSize(int)) );
connect(emailHandler, SIGNAL(downloadedSize(int)),
this, SLOT(setDownloadedSize(int)) );
statusBar->addWidget(status1Label);
statusBar->addWidget(progressBar);
statusBar->addWidget(status2Label);
}
void EmailClient::compose()
{
emit composeRequested();
}
void EmailClient::cancel()
{
emailHandler->cancel();
}
AddressList* EmailClient::getAdrListRef()
{
return addressList;
}
//this needs to be rewritten to syncronize with outboxView
void EmailClient::enqueMail(const Email &mail)
{
if (accountList.count() == 0) {
QMessageBox::warning(qApp->activeWindow(),
tr("No account selected"), tr("You must create an account"), "OK\n");
return;
}
if (accountList.count() > 0) {
currentAccount = accountList.first();
qWarning("using account " + currentAccount->name);
}
Email addMail = mail;
addMail.from = currentAccount->name;
addMail.fromMail = currentAccount->emailAddress;
addMail.rawMail.prepend("From: \"" + addMail.from + "\" <" + addMail.fromMail + ">\n");
item = new EmailListItem(outboxView, addMail, false);
mailboxView->setCurrentTab(1);
}
void EmailClient::sendQuedMail()
{
int count = 0;
if (accountList.count() == 0) {
QMessageBox::warning(qApp->activeWindow(), tr("No account selected"), tr("You must create an account"), "OK\n");
return;
}
//traverse listview, find messages to send
if (! sending) {
item = (EmailListItem *) outboxView->firstChild();
if (item != NULL) {
while (item != NULL) {
quedMessages.append(item->getMail());
item = (EmailListItem *) item->nextSibling();
count++;
}
setMailAccount();
emailHandler->sendMail(&quedMessages);
sending = TRUE;
sendMailButton->setEnabled(FALSE);
cancelButton->setEnabled(TRUE);
} else {
qWarning("sendQuedMail(): no messages to send");
}
}
}
void EmailClient::setMailAccount()
{
emailHandler->setAccount(*currentAccount);
}
void EmailClient::mailSent()
{
sending = FALSE;
sendMailButton->setEnabled(TRUE);
quedMessages.clear();
outboxView->clear(); //should be moved to an sentBox
}
diff --git a/noncore/unsupported/mailit/emailhandler.cpp b/noncore/unsupported/mailit/emailhandler.cpp
index 06e978d..02b3e9a 100644
--- a/noncore/unsupported/mailit/emailhandler.cpp
+++ b/noncore/unsupported/mailit/emailhandler.cpp
@@ -1,154 +1,154 @@
/**********************************************************************
** Copyright (C) 2001 Trolltech AS. All rights reserved.
**
** This file is part of Qt Palmtop Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include <qfileinfo.h>
#include <stdlib.h>
#include <qapplication.h>
#include <qmessagebox.h>
#include <qcstring.h>
#include "emailhandler.h"
#include <qpe/applnk.h>
#include <qpe/filemanager.h>
QCollection::Item EnclosureList::newItem(QCollection::Item d)
{
return dupl( (Enclosure *) d);
}
Enclosure* EnclosureList::dupl(Enclosure *in)
{
ac = new Enclosure(*in);
return ac;
}
EmailHandler::EmailHandler()
{
qDebug("EMailHandler::EmailHandler");
smtpClient = new SmtpClient();
popClient = new PopClient();
- connect(smtpClient, SIGNAL(errorOccurred(int, const QString &)), this,
- SIGNAL(smtpError(int, const QString &)) );
+ connect(smtpClient, SIGNAL(errorOccurred(int,const QString&)), this,
+ SIGNAL(smtpError(int,const QString&)) );
connect(smtpClient, SIGNAL(mailSent()), this, SIGNAL(mailSent()) );
- connect(smtpClient, SIGNAL(updateStatus(const QString &)), this,
- SIGNAL(updateSmtpStatus(const QString &)) );
-
- connect(popClient, SIGNAL(errorOccurred(int, const QString &)), this,
- SIGNAL(popError(int, const QString &)) );
- connect(popClient, SIGNAL(newMessage(const QString &, int, uint, bool)),
- this, SLOT(messageArrived(const QString &, int, uint, bool)) );
- connect(popClient, SIGNAL(updateStatus(const QString &)), this,
- SIGNAL(updatePopStatus(const QString &)) );
+ connect(smtpClient, SIGNAL(updateStatus(const QString&)), this,
+ SIGNAL(updateSmtpStatus(const QString&)) );
+
+ connect(popClient, SIGNAL(errorOccurred(int,const QString&)), this,
+ SIGNAL(popError(int,const QString&)) );
+ connect(popClient, SIGNAL(newMessage(const QString&,int,uint,bool)),
+ this, SLOT(messageArrived(const QString&,int,uint,bool)) );
+ connect(popClient, SIGNAL(updateStatus(const QString&)), this,
+ SIGNAL(updatePopStatus(const QString&)) );
connect(popClient, SIGNAL(mailTransfered(int)), this,
SIGNAL(mailTransfered(int)) );
//relaying size information
connect(popClient, SIGNAL(currentMailSize(int)),
this, SIGNAL(currentMailSize(int)) );
connect(popClient, SIGNAL(downloadedSize(int)),
this, SIGNAL(downloadedSize(int)) );
}
void EmailHandler::sendMail(QList<Email> *mailList)
{
Email *currentMail;
QString temp;
QString userName = QString::null;
// not supported by ALL SMTP servers in the MAIL From field
// userName = "\""+mailAccount.name+"\"";
userName += "<" + mailAccount.emailAddress + ">";
for (currentMail = mailList->first(); currentMail != 0;
currentMail = mailList->next()) {
if (encodeMime(currentMail) == 0) {
smtpClient->addMail(userName, currentMail->subject,
currentMail->recipients, currentMail->rawMail);
} else { //error
temp = tr("Could not locate all files in \nmail with subject: ") +
currentMail->subject;
temp += tr("\nMail has NOT been sent");
QMessageBox::warning(qApp->activeWindow(), tr("Attachment error"), temp, tr("OK\n"));
}
}
smtpClient->newConnection(mailAccount.smtpServer, 25);
}
void EmailHandler::setAccount(MailAccount account)
{
mailAccount = account;
}
void EmailHandler::getMail()
{
popClient->setAccount(mailAccount.popUserName, mailAccount.popPasswd);
if (mailAccount.synchronize) {
popClient->setSynchronize(mailAccount.lastServerMailCount);
} else {
popClient->removeSynchronize();
}
headers = FALSE;
//popClient->headersOnly(headers, 0);
popClient->newConnection(mailAccount.popServer, 110);
}
void EmailHandler::getMailHeaders()
{
popClient->setAccount(mailAccount.popUserName, mailAccount.popPasswd);
mailAccount.synchronize ? popClient->setSynchronize(mailAccount.lastServerMailCount): popClient->removeSynchronize();
headers = TRUE;
popClient->headersOnly(headers, mailAccount.syncLimit); //less than requested syncLimit, download all
qDebug("Initiating connection");
popClient->newConnection(mailAccount.popServer, 110);
}
void EmailHandler::getMailByList(MailList *mailList)
{
if (mailList->count() == 0) { //should not occur though
emit mailTransfered(0);
return;
}
headers = FALSE;
popClient->headersOnly(FALSE, 0);
popClient->setAccount(mailAccount.popUserName,mailAccount.popPasswd);
popClient->setSelectedMails(mailList);
popClient->newConnection(mailAccount.popServer, 110);
}
void EmailHandler::messageArrived(const QString &message, int id, uint size, bool complete)
{
Email mail;
mail.rawMail = message;
mail.serverId = id;
mail.size = size;
mail.downloaded = complete;
emit mailArrived(mail, FALSE);
}
bool EmailHandler::parse(const QString &in, const QString &lineShift, Email *mail)
{
diff --git a/noncore/unsupported/mailit/mailitwindow.cpp b/noncore/unsupported/mailit/mailitwindow.cpp
index 6e298c7..fec4d78 100644
--- a/noncore/unsupported/mailit/mailitwindow.cpp
+++ b/noncore/unsupported/mailit/mailitwindow.cpp
@@ -1,161 +1,161 @@
/**********************************************************************
** Copyright (C) 2001 Trolltech AS. All rights reserved.
**
** This file is part of Qt Palmtop Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include <qwhatsthis.h>
#include <qmessagebox.h>
#include "mailitwindow.h"
MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags /*fl*/)
: QMainWindow(parent, name, WStyle_ContextHelp)
{
currentCaption = tr("Mailit");
setCaption(tr(currentCaption));
views = new QWidgetStack(this);
setCentralWidget(views);
QWhatsThis::add(views,tr("Central view area"));
emailClient = new EmailClient(views, "client");
writeMail = new WriteMail(views, "writing");
readMail = new ReadMail(views, "reading");
views->raiseWidget(emailClient);
connect(emailClient, SIGNAL(composeRequested()),
this, SLOT(compose()) );
- connect(emailClient, SIGNAL(viewEmail(QListView *, Email *)), this,
- SLOT(viewMail(QListView *, Email *)) );
- connect(emailClient, SIGNAL(mailUpdated(Email *)), this,
- SLOT(updateMailView(Email *)) );
+ connect(emailClient, SIGNAL(viewEmail(QListView*,Email*)), this,
+ SLOT(viewMail(QListView*,Email*)) );
+ connect(emailClient, SIGNAL(mailUpdated(Email*)), this,
+ SLOT(updateMailView(Email*)) );
connect(writeMail, SIGNAL(cancelMail()), this, SLOT(showEmailClient()) );
- connect(writeMail, SIGNAL(sendMailRequested(const Email &)), this,
+ connect(writeMail, SIGNAL(sendMailRequested(const Email&)), this,
SLOT(showEmailClient()) );
- connect(writeMail, SIGNAL(sendMailRequested(const Email &)), emailClient,
- SLOT(enqueMail(const Email &)) );
+ connect(writeMail, SIGNAL(sendMailRequested(const Email&)), emailClient,
+ SLOT(enqueMail(const Email&)) );
connect(readMail, SIGNAL(cancelView()), this, SLOT(showEmailClient()) );
- connect(readMail, SIGNAL(replyRequested(Email &, bool&)), this,
- SLOT(composeReply(Email &, bool&)) );
- connect(readMail, SIGNAL(forwardRequested(Email &)), this,
- SLOT(composeForward(Email &)) );
+ connect(readMail, SIGNAL(replyRequested(Email&,bool&)), this,
+ SLOT(composeReply(Email&,bool&)) );
+ connect(readMail, SIGNAL(forwardRequested(Email&)), this,
+ SLOT(composeForward(Email&)) );
- connect(readMail, SIGNAL(removeItem(EmailListItem *, bool &)), emailClient,
- SLOT(deleteMail(EmailListItem *, bool &)) );
- connect(readMail, SIGNAL(viewingMail(Email *)), emailClient,
- SLOT(moveMailFront(Email *)) );
+ connect(readMail, SIGNAL(removeItem(EmailListItem*,bool&)), emailClient,
+ SLOT(deleteMail(EmailListItem*,bool&)) );
+ connect(readMail, SIGNAL(viewingMail(Email*)), emailClient,
+ SLOT(moveMailFront(Email*)) );
- connect(emailClient, SIGNAL(newCaption(const QString &)),
- this, SLOT(updateCaption(const QString &)) );
+ connect(emailClient, SIGNAL(newCaption(const QString&)),
+ this, SLOT(updateCaption(const QString&)) );
- connect(readMail, SIGNAL(download(Email *)), emailClient, SLOT(download(Email*)) );
+ connect(readMail, SIGNAL(download(Email*)), emailClient, SLOT(download(Email*)) );
viewingMail = FALSE;
}
MailItWindow::~MailItWindow()
{
}
void MailItWindow::closeEvent(QCloseEvent *e)
{
if (views->visibleWidget() == emailClient) {
e->accept();
} else {
showEmailClient();
}
}
void MailItWindow::compose()
{
viewingMail = FALSE;
emailClient->hide();
readMail->hide();
views->raiseWidget(writeMail);
writeMail->setAddressList(emailClient->getAdrListRef());
writeMail->newMail();
setCaption( tr( "Write mail" ) );
}
void MailItWindow::composeReply(Email &mail, bool& replyAll)
{
compose();
writeMail->reply(mail,replyAll) ;
}
void MailItWindow::composeForward(Email &mail)
{
compose();
writeMail->forward(mail) ;
}
void MailItWindow::showEmailClient()
{
viewingMail = FALSE;
writeMail->hide();
readMail->hide();
views->raiseWidget(emailClient);
setCaption( tr(currentCaption) );
}
void MailItWindow::viewMail(QListView *view, Email *mail)
{
viewingMail = TRUE;
emailClient->hide();
int result=0;
if ((mail->received)&&(!mail->downloaded))
{
QMessageBox mb( tr("Mail not downloaded"),
tr("The mail you have clicked \n"
"has not been downloaded yet.\n "
"Would you like to do it now ?"),
QMessageBox::Information,
QMessageBox::Yes | QMessageBox::Default,
QMessageBox::No | QMessageBox::Escape,0 );
result=mb.exec();
if (result==QMessageBox::Yes)
{
emailClient->download(mail);
}
}
readMail->update(view, mail);
views->raiseWidget(readMail);
setCaption( tr( "Read Mail" ) );
}
void MailItWindow::updateMailView(Email *mail)
{
if (viewingMail) {
readMail->mailUpdated(mail);
}
}
void MailItWindow::updateCaption(const QString &newCaption)
{
currentCaption = newCaption;
setCaption(tr(currentCaption));
}
void MailItWindow::setDocument(const QString &_address)
{
// strip leading 'mailto:'