summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2005-07-03 21:03:44 (UTC)
committer mickeyl <mickeyl>2005-07-03 21:03:44 (UTC)
commit62842736cf871376f947f7b27ebc6f58fbc84fdc (patch) (side-by-side diff)
treec37cb61624a0d6654eeeb218f93c5766bb9ff6f6
parentdf3947675e6e2fd46704810414005aa56aa391a1 (diff)
downloadopie-62842736cf871376f947f7b27ebc6f58fbc84fdc.zip
opie-62842736cf871376f947f7b27ebc6f58fbc84fdc.tar.gz
opie-62842736cf871376f947f7b27ebc6f58fbc84fdc.tar.bz2
Resource -> OResource
Dan, please check if I did everything correctly
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mail/accountitem.cpp6
-rw-r--r--noncore/net/mail/addresspicker.cpp6
-rw-r--r--noncore/net/mail/composemail.cpp9
-rw-r--r--noncore/net/mail/config.in6
-rw-r--r--noncore/net/mail/defines.h33
-rw-r--r--noncore/net/mail/mailistviewitem.cpp14
-rw-r--r--noncore/net/mail/mainwindow.cpp29
-rw-r--r--noncore/net/mail/opiemail.cpp7
-rw-r--r--noncore/net/mail/viewmailbase.cpp24
9 files changed, 71 insertions, 63 deletions
diff --git a/noncore/net/mail/accountitem.cpp b/noncore/net/mail/accountitem.cpp
index f7fdccd..f3f2182 100644
--- a/noncore/net/mail/accountitem.cpp
+++ b/noncore/net/mail/accountitem.cpp
@@ -1,115 +1,117 @@
#include "accountitem.h"
#include "accountview.h"
#include "newmaildir.h"
#include "nntpgroupsdlg.h"
#include "defines.h"
#include <libmailwrapper/mailtypes.h>
#include <libmailwrapper/abstractmail.h>
#include <libmailwrapper/mailwrapper.h>
+
/* OPIE */
#include <opie2/odebug.h>
+#include <opie2/oresource.h>
#include <qpe/qpeapplication.h>
+using namespace Opie::Core;
/* QT */
#include <qpopupmenu.h>
#include <qmessagebox.h>
-using namespace Opie::Core;
#define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );}
/**
* POP3 Account stuff
*/
POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent )
: AccountViewItem( parent )
{
account = a;
wrapper = AbstractMail::getWrapper( account );
SETPIX(PIXMAP_POP3FOLDER);
#if 0
if (!account->getOffline())
{
setPixmap( 0, );
}
else
{
setPixmap( 0, PIXMAP_OFFLINE );
}
#endif
setText( 0, account->getAccountName() );
setOpen( true );
}
POP3viewItem::~POP3viewItem()
{
delete wrapper;
}
AbstractMail *POP3viewItem::getWrapper()
{
return wrapper;
}
void POP3viewItem::refresh(QValueList<Opie::Core::OSmartPointer<RecMail> > & )
{
refresh();
}
void POP3viewItem::refresh()
{
if (account->getOffline()) return;
QValueList<FolderP> *folders = wrapper->listFolders();
QListViewItem *child = firstChild();
while ( child )
{
QListViewItem *tmp = child;
child = child->nextSibling();
delete tmp;
}
QValueList<FolderP>::ConstIterator it;
QListViewItem*item = 0;
for ( it = folders->begin(); it!=folders->end(); ++it)
{
item = new POP3folderItem( (*it), this , item );
item->setSelectable( (*it)->may_select());
}
delete folders;
}
RECBODYP POP3viewItem::fetchBody( const RecMailP &mail )
{
odebug << "POP3 fetchBody" << oendl;
return wrapper->fetchBody( mail );
}
QMap<int,QString> POP3viewItem::serverMenu()
{
QMap<int,QString> _entries;
if (!account->getOffline()) {
_entries[SERVER_MENU_DISCONNECT]=QObject::tr("Disconnect",contextName);
_entries[SERVER_MENU_OFFLINE]=QObject::tr("Set offline",contextName);
} else {
_entries[SERVER_MENU_OFFLINE]=QObject::tr("Set online",contextName);
}
return _entries;
}
void POP3viewItem::disconnect()
{
QListViewItem *child = firstChild();
while ( child )
{
QListViewItem *tmp = child;
child = child->nextSibling();
delete tmp;
}
wrapper->logout();
}
void POP3viewItem::setOnOffline()
{
if (!account->getOffline())
{
disconnect();
}
@@ -805,193 +807,193 @@ QMap<int,QString> MHviewItem::folderMenu()
e[FOLDER_MENU_DELETE_ALL_MAILS]=QObject::tr("Delete all mails",contextName);
e[FOLDER_MENU_MOVE_MAILS]=QObject::tr("Move/Copie all mails",contextName);
return e;
}
void MHviewItem::createFolder()
{
Newmdirdlg ndirdlg(0,0,true);
if ( QPEApplication::execDialog( &ndirdlg ) )
{
QString ndir = ndirdlg.Newdir();
if (wrapper->createMbox(ndir))
{
refresh(true);
}
}
}
void MHviewItem::downloadMails()
{
AccountView*bl = accountView();
if (!bl) return;
bl->downloadMails(folder,getWrapper());
}
QStringList MHviewItem::subFolders()
{
return currentFolders;
}
bool MHviewItem::contextMenuSelected(int which)
{
AccountView*view = 0;
switch (which)
{
case SERVER_MENU_REFRESH_FOLDER:
refresh(true);
break;
case FOLDER_MENU_NEW_SUBFOLDER:
createFolder();
break;
case FOLDER_MENU_DELETE_ALL_MAILS:
deleteAllMail(getWrapper(),folder);
break;
case FOLDER_MENU_MOVE_MAILS:
downloadMails();
break;
case FOLDER_MENU_REFRESH_HEADER:
view = (AccountView*)listView();
if (view) view->refreshCurrent();
break;
default:
break;
}
return false;
}
MHfolderItem::~MHfolderItem()
{}
MHfolderItem::MHfolderItem( const FolderP &folderInit, MHviewItem *parent , QListViewItem*after )
: AccountViewItem(folderInit, parent,after )
{
mbox = parent;
initName();
}
MHfolderItem::MHfolderItem(const FolderP& folderInit, MHfolderItem *parent, QListViewItem*after, MHviewItem*master)
: AccountViewItem(folderInit, parent,after )
{
folder = folderInit;
mbox = master;
initName();
}
void MHfolderItem::initName()
{
QString bName = folder->getDisplayName();
if (bName.startsWith("/")&&bName.length()>1)
{
bName.replace(0,1,"");
}
int pos = bName.findRev("/");
if (pos > 0)
{
bName.replace(0,pos+1,"");
}
if (bName.lower() == "outgoing")
{
setPixmap( 0, PIXMAP_OUTBOXFOLDER );
}
else if (bName.lower() == "inbox")
{
setPixmap( 0, PIXMAP_INBOXFOLDER);
} else if (bName.lower() == "drafts") {
- setPixmap(0, Resource::loadPixmap("edit"));
+ setPixmap(0, Opie::Core::OResource::loadPixmap("edit", Opie::Core::OResource::SmallIcon));
} else {
setPixmap( 0, PIXMAP_MBOXFOLDER );
}
setText( 0, bName );
}
const FolderP&MHfolderItem::getFolder()const
{
return folder;
}
void MHfolderItem::refresh(QValueList<RecMailP>&target)
{
if (folder->may_select())
mbox->getWrapper()->listMessages( folder->getName(),target );
}
RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail)
{
return mbox->getWrapper()->fetchBody(aMail);
}
bool MHfolderItem::deleteFolder()
{
int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName),
QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()),
QObject::tr("Yes",contextName),
QObject::tr("No",contextName),QString::null,1,1);
odebug << "Auswahl: " << yesno << "" << oendl;
if (yesno == 0)
{
if (mbox->getWrapper()->deleteMbox(folder))
{
QListView*v=listView();
MHviewItem * box = mbox;
/* be carefull - after that this object is destroyd so don't use
* any member of it after that call!!*/
mbox->refresh(true);
if (v)
{
v->setSelected(box,true);
}
return true;
}
}
return false;
}
QMap<int,QString> MHfolderItem::folderMenu()
{
QMap<int,QString> e;
e[FOLDER_MENU_NEW_SUBFOLDER]=QObject::tr("Create new subfolder",contextName);
e[FOLDER_MENU_REFRESH_HEADER]=QObject::tr("Refresh header list",contextName);
e[FOLDER_MENU_MOVE_MAILS]=QObject::tr("Move/Copie all mails",contextName);
e[FOLDER_MENU_DELETE_ALL_MAILS]=QObject::tr("Delete all mails",contextName);
e[FOLDER_MENU_DELETE_FOLDER]=QObject::tr("Delete folder",contextName);
return e;
}
void MHfolderItem::downloadMails()
{
AccountView*bl = mbox->accountView();
if (!bl) return;
bl->downloadMails(folder,mbox->getWrapper());
}
void MHfolderItem::createFolder()
{
Newmdirdlg ndirdlg(0,0,true);
if ( QPEApplication::execDialog( &ndirdlg ) )
{
QString ndir = ndirdlg.Newdir();
if (mbox->getWrapper()->createMbox(ndir,folder))
{
QListView*v=listView();
MHviewItem * box = mbox;
/* be carefull - after that this object is destroyd so don't use
* any member of it after that call!!*/
mbox->refresh(true);
if (v)
{
v->setSelected(box,true);
}
}
}
}
bool MHfolderItem::contextMenuSelected(int which)
{
AccountView*view = 0;
switch(which)
{
case FOLDER_MENU_DELETE_ALL_MAILS:
deleteAllMail(mbox->getWrapper(),folder);
break;
case FOLDER_MENU_DELETE_FOLDER:
diff --git a/noncore/net/mail/addresspicker.cpp b/noncore/net/mail/addresspicker.cpp
index 50c82e5..4e328d4 100644
--- a/noncore/net/mail/addresspicker.cpp
+++ b/noncore/net/mail/addresspicker.cpp
@@ -1,112 +1,112 @@
#include "composemail.h"
/* OPIE */
#include <opie2/ocontactaccess.h>
#include <opie2/opimcontact.h>
-#include <qpe/resource.h>
+#include <opie2/oresource.h>
#include <qpe/qpeapplication.h>
/* QT */
#include <qpushbutton.h>
#include <qmessagebox.h>
#include <qlistbox.h>
/* STD */
#include <stdlib.h>
AddressPicker::AddressPicker( QWidget *parent, const char *name, bool modal, WFlags flags )
: AddressPickerUI( parent, name, modal, flags )
{
- okButton->setIconSet( Resource::loadPixmap( "enter" ) );
- cancelButton->setIconSet( Resource::loadPixmap( "editdelete" ) );
+ okButton->setIconSet( Opie::Core::OResource::loadPixmap( "enter", Opie::Core::OResource::SmallIcon ) );
+ cancelButton->setIconSet( Opie::Core::OResource::loadPixmap( "editdelete", Opie::Core::OResource::SmallIcon ) );
connect(okButton, SIGNAL(clicked()), SLOT(accept()));
connect(cancelButton, SIGNAL(clicked()), SLOT(close()));
Opie::OPimContactAccess::List::Iterator it;
QString lineEmail, lineName, contactLine;
/* what name has to set here???? */
Opie::OPimContactAccess m_contactdb("opiemail");
QStringList mails;
QString pre,suf;
Opie::OPimContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 );
for ( it = m_list.begin(); it != m_list.end(); ++it )
{
if ((*it).defaultEmail().length()!=0)
{
mails = (*it).emailList();
if ((*it).fileAs().length()>0)
{
pre = "\""+(*it).firstName()+" "+(*it).lastName()+"\" <";
suf = ">";
}
else
{
pre = "";
suf = "";
}
QStringList::ConstIterator sit = mails.begin();
for (;sit!=mails.end();++sit)
{
contactLine=pre+(*sit)+suf;
addressList->insertItem(contactLine);
}
}
}
if ( addressList->count() <= 0 )
{
#if 0
// makes this realy sense??
addressList->insertItem(
tr( "There are no entries in the addressbook." ) );
#endif
addressList->setEnabled( false );
okButton->setEnabled( false );
}
else
{
// addressList->sort();
}
}
void AddressPicker::accept()
{
QListBoxItem *item = addressList->firstItem();
QString names;
while ( item )
{
if ( item->selected() )
names += item->text() + ", ";
item = item->next();
}
names.replace( names.length() - 2, 2, "" );
if ( names.isEmpty() )
{
QMessageBox::information(this, tr("Error"), tr("<p>You have to select"
" at least one address entry.</p>"), tr("Ok"));
return;
}
selectedNames = names;
QDialog::accept();
}
QString AddressPicker::getNames()
{
QString names = 0;
AddressPicker picker(0, 0, true);
int ret = QPEApplication::execDialog( &picker );
if ( QDialog::Accepted == ret )
{
return picker.selectedNames;
}
return 0;
}
diff --git a/noncore/net/mail/composemail.cpp b/noncore/net/mail/composemail.cpp
index 154c1d5..9d04de3 100644
--- a/noncore/net/mail/composemail.cpp
+++ b/noncore/net/mail/composemail.cpp
@@ -1,118 +1,117 @@
#include "composemail.h"
#include <libmailwrapper/smtpwrapper.h>
#include <libmailwrapper/storemail.h>
#include <libmailwrapper/abstractmail.h>
#include <libmailwrapper/mailtypes.h>
/* OPIE */
#include <opie2/ofiledialog.h>
#include <opie2/odebug.h>
-#include <qpe/resource.h>
+#include <opie2/oresource.h>
#include <qpe/config.h>
#include <qpe/global.h>
#include <qpe/contact.h>
+using namespace Opie::Core;
+using namespace Opie::Ui;
/* QT */
#include <qt.h>
-
-using namespace Opie::Core;
-using namespace Opie::Ui;
ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags )
: ComposeMailUI( parent, name, modal, flags )
{
settings = s;
m_replyid = "";
QString vfilename = Global::applicationFileName("addressbook",
"businesscard.vcf");
Contact c;
if (QFile::exists(vfilename)) {
c = Contact::readVCard( vfilename )[0];
}
QStringList mails = c.emailList();
QString defmail = c.defaultEmail();
if (defmail.length()!=0) {
fromBox->insertItem(defmail);
}
QStringList::ConstIterator sit = mails.begin();
for (;sit!=mails.end();++sit) {
if ( (*sit)==defmail)
continue;
fromBox->insertItem((*sit));
}
senderNameEdit->setText(c.firstName()+" "+c.lastName());
Config cfg( "mail" );
cfg.setGroup( "Compose" );
checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) );
attList->addColumn( tr( "Name" ) );
attList->addColumn( tr( "Size" ) );
QList<Account> accounts = settings->getAccounts();
Account *it;
for ( it = accounts.first(); it; it = accounts.next() ) {
if ( it->getType()==MAILLIB::A_SMTP ) {
SMTPaccount *smtp = static_cast<SMTPaccount *>(it);
smtpAccountBox->insertItem( smtp->getAccountName() );
smtpAccounts.append( smtp );
}
}
if ( smtpAccounts.count() > 0 ) {
fillValues( smtpAccountBox->currentItem() );
} else {
QMessageBox::information( this, tr( "Problem" ),
tr( "<p>Please create an SMTP account first.</p>" ),
tr( "Ok" ) );
return;
}
connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) );
connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) );
connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) );
connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) );
connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) );
connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) );
connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) );
}
void ComposeMail::pickAddress( QLineEdit *line )
{
QString names = AddressPicker::getNames();
if ( line->text().isEmpty() ) {
line->setText( names );
} else if ( !names.isEmpty() ) {
line->setText( line->text() + ", " + names );
}
}
void ComposeMail::setTo( const QString & to )
{
toLine->setText( to );
}
void ComposeMail::setSubject( const QString & subject )
{
subjectLine->setText( subject );
}
void ComposeMail::setInReplyTo( const QString & messageId )
{
m_replyid = messageId;
}
void ComposeMail::setMessage( const QString & text )
{
message->setText( text );
}
void ComposeMail::pickAddressTo()
{
@@ -206,102 +205,102 @@ void ComposeMail::accept()
QMessageBox::warning(0,tr("Sending mail"),
tr("No Receiver specified" ) );
return;
}
mail->setName(senderNameEdit->text());
mail->setCC( ccLine->text() );
mail->setBCC( bccLine->text() );
mail->setReply( replyLine->text() );
mail->setSubject( subjectLine->text() );
if (!m_replyid.isEmpty()) {
QStringList ids;
ids.append(m_replyid);
mail->setInreply(ids);
}
QString txt = message->text();
if ( !sigMultiLine->text().isEmpty() ) {
txt.append( "\n--\n" );
txt.append( sigMultiLine->text() );
}
mail->setMessage( txt );
AttachViewItem *it = (AttachViewItem *) attList->firstChild();
while ( it != NULL ) {
mail->addAttachment( it->getAttachment() );
it = (AttachViewItem *) it->nextSibling();
}
SMTPwrapper wrapper( smtp );
wrapper.sendMail( mail,checkBoxLater->isChecked() );
QDialog::accept();
}
void ComposeMail::reject()
{
int yesno = QMessageBox::warning(0,tr("Store message"),
tr("Store message into drafts?"),
tr("Yes"),
tr("No"),QString::null,0,1);
if (yesno == 0) {
Opie::Core::OSmartPointer<Mail> mail=new Mail();
mail->setMail(fromBox->currentText());
mail->setTo( toLine->text() );
mail->setName(senderNameEdit->text());
mail->setCC( ccLine->text() );
mail->setBCC( bccLine->text() );
mail->setReply( replyLine->text() );
mail->setSubject( subjectLine->text() );
if (!m_replyid.isEmpty()) {
QStringList ids;
ids.append(m_replyid);
mail->setInreply(ids);
}
QString txt = message->text();
if ( !sigMultiLine->text().isEmpty() ) {
txt.append( "\n--\n" );
txt.append( sigMultiLine->text() );
}
odebug << txt << oendl;
mail->setMessage( txt );
/* only use the default drafts folder name! */
Storemail wrapper(AbstractMail::draftFolder());
wrapper.storeMail(mail);
AttachViewItem *it = (AttachViewItem *) attList->firstChild();
/* attachments we will ignore! */
if ( it != NULL ) {
QMessageBox::warning(0,tr("Store message"),
tr("<center>Attachments will not be stored in \"Draft\" folder</center>"));
}
}
QDialog::reject();
}
ComposeMail::~ComposeMail()
{
}
void ComposeMail::reEditMail(const RecMailP&current)
{
RecMailP data = current;
message->setText(data->Wrapper()->fetchBody(current)->Bodytext());
subjectLine->setText( data->getSubject());
toLine->setText(data->To().join(","));
ccLine->setText(data->CC().join(","));
bccLine->setText(data->Bcc().join(","));
replyLine->setText(data->Replyto());
}
AttachViewItem::AttachViewItem( QListView *parent, Attachment *att )
: QListViewItem( parent )
{
attachment = att;
odebug << att->getMimeType() << oendl;
setPixmap( 0, attachment->getDocLnk().pixmap().isNull() ?
- Resource::loadPixmap( "UnknownDocument-14" ) :
+ OResource::loadPixmap( "UnknownDocument", OResource::SmallIcon ) :
attachment->getDocLnk().pixmap() );
setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() );
setText( 1, QString::number( att->getSize() ) );
}
diff --git a/noncore/net/mail/config.in b/noncore/net/mail/config.in
index f7fce91..b18feb7 100644
--- a/noncore/net/mail/config.in
+++ b/noncore/net/mail/config.in
@@ -1,10 +1,10 @@
source noncore/net/mail/libmailwrapper/config.in
config MAIL3
boolean "opie-mail3 (a mail client)"
default "y"
- depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2PIM && LIBOPIE2MM && LIBMAILWRAPPER
- comment "opie-mail3 needs a libqpe, libopie2core, libopie2pim and the libmailwrapper"
- depends ! ( ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2PIM && LIBOPIE2MM && LIBMAILWRAPPER )
+ depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI && LIBOPIE2PIM && LIBOPIE2MM && LIBMAILWRAPPER
+ comment "opie-mail3 needs a libqpe, libopie2core, libopie2ui, libopie2pim and the libmailwrapper"
+ depends ! ( ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI && LIBOPIE2PIM && LIBOPIE2MM && LIBMAILWRAPPER )
source noncore/net/mail/taskbarapplet/config.in
diff --git a/noncore/net/mail/defines.h b/noncore/net/mail/defines.h
index 50d63dd..36ac5a1 100644
--- a/noncore/net/mail/defines.h
+++ b/noncore/net/mail/defines.h
@@ -1,72 +1,73 @@
#ifndef DEFINE_CONSTANTS_H
#define DEFINE_CONSTANTS_H
-#include <qpe/resource.h>
+#include <opie2/oresource.h>
+using namespace Opie::Core;
#define USER_AGENT "OpieMail v0.3"
#define PIC_COMPOSEMAIL "mail/composemail"
#define PIC_SENDQUEUED "mail/sendqueued"
#define PIC_SHOWFOLDERS "mail/showfolders"
#define PIC_SYNC "mail/sync"
#define PIC_IMAPFOLDER "mail/imapfolder"
#define PIC_MBOXFOLDER "mail/mboxfolder"
#define PIC_POP3FOLDER "mail/pop3folder"
#define PIC_INBOXFOLDER "mail/inbox"
#define PIC_OUTBOXFOLDER "mail/outbox"
#define PIC_LOCALFOLDER "mail/localfolder"
#define PIC_OFFLINE "mail/notconnected"
#define PIC_DOCUMENT "DocsIcon"
-#define ICON_COMPOSEMAIL QIconSet( Resource::loadPixmap( PIC_COMPOSEMAIL ) )
-#define ICON_SENDQUEUED QIconSet( Resource::loadPixmap( PIC_SENDQUEUED ) )
-#define ICON_SHOWFOLDERS QIconSet( Resource::loadPixmap( PIC_SHOWFOLDERS ) )
-#define ICON_SEARCHMAILS QIconSet( Resource::loadPixmap( PIC_SEARCHMAILS ) )
-#define ICON_EDITSETTINGS QIconSet( Resource::loadPixmap( PIC_EDITSETTINGS ) )
-#define ICON_EDITACCOUNTS QIconSet( Resource::loadPixmap( PIC_EDITACCOUNTS ) )
-#define ICON_SYNC QIconSet( Resource::loadPixmap( PIC_SYNC ) )
-#define ICON_READMAIL QIconSet( Resource::loadPixmap( PIC_DOCUMENT))
+#define ICON_COMPOSEMAIL QIconSet( OResource::loadPixmap( PIC_COMPOSEMAIL, OResource::SmallIcon ) )
+#define ICON_SENDQUEUED QIconSet( OResource::loadPixmap( PIC_SENDQUEUED, OResource::SmallIcon ) )
+#define ICON_SHOWFOLDERS QIconSet( OResource::loadPixmap( PIC_SHOWFOLDERS, OResource::SmallIcon ) )
+#define ICON_SEARCHMAILS QIconSet( OResource::loadPixmap( PIC_SEARCHMAILS, OResource::SmallIcon ) )
+#define ICON_EDITSETTINGS QIconSet( OResource::loadPixmap( PIC_EDITSETTINGS, OResource::SmallIcon ) )
+#define ICON_EDITACCOUNTS QIconSet( OResource::loadPixmap( PIC_EDITACCOUNTS, OResource::SmallIcon ) )
+#define ICON_SYNC QIconSet( OResource::loadPixmap( PIC_SYNC, OResource::SmallIcon ) )
+#define ICON_READMAIL QIconSet( OResource::loadPixmap( PIC_DOCUMENT, OResource::SmallIcon) )
-#define PIXMAP_IMAPFOLDER QPixmap( Resource::loadPixmap( PIC_IMAPFOLDER ) )
-#define PIXMAP_POP3FOLDER QPixmap( Resource::loadPixmap( PIC_POP3FOLDER ) )
-#define PIXMAP_INBOXFOLDER QPixmap( Resource::loadPixmap( PIC_INBOXFOLDER) )
-#define PIXMAP_MBOXFOLDER QPixmap( Resource::loadPixmap( PIC_MBOXFOLDER ) )
-#define PIXMAP_OUTBOXFOLDER QPixmap( Resource::loadPixmap( PIC_OUTBOXFOLDER) )
-#define PIXMAP_LOCALFOLDER QPixmap( Resource::loadPixmap( PIC_LOCALFOLDER) )
-#define PIXMAP_OFFLINE QPixmap( Resource::loadPixmap( PIC_OFFLINE) )
+#define PIXMAP_IMAPFOLDER QPixmap( OResource::loadPixmap( PIC_IMAPFOLDER, OResource::SmallIcon ) )
+#define PIXMAP_POP3FOLDER QPixmap( OResource::loadPixmap( PIC_POP3FOLDER, OResource::SmallIcon ) )
+#define PIXMAP_INBOXFOLDER QPixmap( OResource::loadPixmap( PIC_INBOXFOLDER, OResource::SmallIcon ) )
+#define PIXMAP_MBOXFOLDER QPixmap( OResource::loadPixmap( PIC_MBOXFOLDER, OResource::SmallIcon ) )
+#define PIXMAP_OUTBOXFOLDER QPixmap( OResource::loadPixmap( PIC_OUTBOXFOLDER, OResource::SmallIcon ) )
+#define PIXMAP_LOCALFOLDER QPixmap( OResource::loadPixmap( PIC_LOCALFOLDER, OResource::SmallIcon ) )
+#define PIXMAP_OFFLINE QPixmap( OResource::loadPixmap( PIC_OFFLINE, OResource::SmallIcon ) )
#define IMAP_PORT "143"
#define IMAP_SSL_PORT "993"
#define SMTP_PORT "25"
#define SMTP_SSL_PORT "465"
#define POP3_PORT "110"
#define POP3_SSL_PORT "995"
#define NNTP_PORT "119"
#define NNTP_SSL_PORT "563"
/* used for decoding imapfoldername */
#define UNDEFINED 64
#define MAXLINE 76
#define UTF16MASK 0x03FFUL
#define UTF16SHIFT 10
#define UTF16BASE 0x10000UL
#define UTF16HIGHSTART 0xD800UL
#define UTF16HIGHEND 0xDBFFUL
#define UTF16LOSTART 0xDC00UL
#define UTF16LOEND 0xDFFFUL
/* used for making menuids transparent */
#define FOLDER_MENU_REFRESH_HEADER 0
#define FOLDER_MENU_DELETE_ALL_MAILS 1
#define FOLDER_MENU_NEW_SUBFOLDER 2
#define FOLDER_MENU_DELETE_FOLDER 3
#define FOLDER_MENU_MOVE_MAILS 4
#define SERVER_MENU_DISCONNECT 5
#define SERVER_MENU_OFFLINE 6
#define SERVER_MENU_REFRESH_FOLDER 7
#define SERVER_MENU_CREATE_FOLDER 8
#define SERVER_MENU_SUBSCRIBE 9
#endif
diff --git a/noncore/net/mail/mailistviewitem.cpp b/noncore/net/mail/mailistviewitem.cpp
index d3a0723..5254616 100644
--- a/noncore/net/mail/mailistviewitem.cpp
+++ b/noncore/net/mail/mailistviewitem.cpp
@@ -1,86 +1,90 @@
#include "mailistviewitem.h"
#include <libmailwrapper/abstractmail.h>
-#include <qtextstream.h>
-#include <qpe/resource.h>
+
+/* OPIE */
+#include <opie2/oresource.h>
#include <qpe/timestring.h>
+/* QT */
+#include <qtextstream.h>
+
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") );
+ setPixmap( 0, Opie::Core::OResource::loadPixmap( "mail/kmmsgreplied", Opie::Core::OResource::SmallIcon ) );
} else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) {
/* I think it looks nicer if there are not such a lot of icons but only on mails
replied or new - Alwin*/
- //setPixmap( 0, Resource::loadPixmap( "mail/kmmsgunseen") );
+ //setPixmap( 0, Opie::Core::OResource::loadPixmap( "mail/kmmsgunseen", Opie::Core::OResource::SmallIcon ) );
} else {
- setPixmap( 0, Resource::loadPixmap( "mail/kmmsgnew") );
+ setPixmap( 0, Opie::Core::OResource::loadPixmap( "mail/kmmsgnew", Opie::Core::OResource::SmallIcon ) );
}
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->getStringDate());
}
QString MailListViewItem::key(int col,bool) const
{
QString temp;
if (col == 4) {
temp.sprintf( "%08d",QDateTime().secsTo(mail_data->getDate()));
return temp;
}
if (col == 3) {
temp.sprintf( "%020d",mail_data->Msgsize());
return temp;
}
return text(col);
}
void MailListViewItem::storeData(const RecMailP&data)
{
mail_data = data;
}
const RecMailP& MailListViewItem::data()const
{
return mail_data;
}
MAILLIB::ATYPE MailListViewItem::wrapperType()
{
if (!mail_data->Wrapper()) return MAILLIB::A_UNDEFINED;
return mail_data->Wrapper()->getType();
}
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index b587424..bce4c0d 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -1,211 +1,212 @@
-#include <qlabel.h>
-#include <qvbox.h>
-#include <qheader.h>
-#include <qtimer.h>
-#include <qlayout.h>
+#include "defines.h"
+#include "mainwindow.h"
+/* OPIE */
#include <opie2/odebug.h>
+#include <opie2/oresource.h>
#include <qpe/qpeapplication.h>
#include <qpe/qcopenvelope_qws.h>
-
-#include "defines.h"
-#include "mainwindow.h"
-
using namespace Opie::Core;
+/* QT */
+#include <qlabel.h>
+#include <qvbox.h>
+#include <qheader.h>
+#include <qtimer.h>
+#include <qlayout.h>
+
MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
: QMainWindow( parent, name, flags )
{
-
setCaption( tr( "Mail" ) );
setToolBarsMovable( false );
toolBar = new QToolBar( this );
menuBar = new QMenuBar( toolBar );
mailMenu = new QPopupMenu( menuBar );
menuBar->insertItem( tr( "Mail" ), mailMenu );
settingsMenu = new QPopupMenu( menuBar );
menuBar->insertItem( tr( "Settings" ), settingsMenu );
if (QApplication::desktop()->width()<330) {
serverMenu = new QPopupMenu( mailMenu );
folderMenu = new QPopupMenu( mailMenu );
m_ServerMenuId = mailMenu->insertItem( tr( "Server" ), serverMenu );
m_FolderMenuId = mailMenu->insertItem( tr( "Folder" ), folderMenu );
} else {
serverMenu = new QPopupMenu( menuBar );
folderMenu = new QPopupMenu( menuBar );
m_FolderMenuId = menuBar->insertItem( tr( "Folder" ), folderMenu );
m_ServerMenuId = menuBar->insertItem( tr( "Server" ), serverMenu );
}
serverMenu->insertItem(tr("Disconnect"),SERVER_MENU_DISCONNECT);
serverMenu->insertItem(tr("Set on/offline"),SERVER_MENU_OFFLINE);
serverMenu->insertSeparator();
serverMenu->insertItem(tr("Refresh folder list"),SERVER_MENU_REFRESH_FOLDER);
serverMenu->insertItem(tr("Create new folder"),SERVER_MENU_CREATE_FOLDER);
serverMenu->insertSeparator();
serverMenu->insertItem(tr("(Un-)Subscribe groups"),SERVER_MENU_SUBSCRIBE);
folderMenu->insertItem(tr("Refresh headerlist"),FOLDER_MENU_REFRESH_HEADER);
folderMenu->insertItem(tr("Delete all mails"),FOLDER_MENU_DELETE_ALL_MAILS);
folderMenu->insertItem(tr("New subfolder"),FOLDER_MENU_NEW_SUBFOLDER);
folderMenu->insertItem(tr("Delete folder"),FOLDER_MENU_DELETE_FOLDER);
folderMenu->insertItem(tr("Move/Copie all mails"),FOLDER_MENU_MOVE_MAILS);
menuBar->setItemEnabled(m_ServerMenuId,false);
menuBar->setItemEnabled(m_FolderMenuId,false);
addToolBar( toolBar );
toolBar->setHorizontalStretchable( true );
QLabel *spacer = new QLabel( toolBar );
spacer->setBackgroundMode( QWidget::PaletteButton );
toolBar->setStretchableWidget( spacer );
readMail = new QAction(tr("Read current mail"),ICON_READMAIL,0,0,this);
readMail->addTo(toolBar);
readMail->addTo(mailMenu);
connect(readMail,SIGNAL(activated()),this,SLOT(displayMail()));
composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL,
0, 0, this );
composeMail->addTo( toolBar );
composeMail->addTo( mailMenu );
sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED,
0, 0, this );
sendQueued->addTo( toolBar );
sendQueued->addTo( mailMenu );
/*
syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC,
0, 0, this );
syncFolders->addTo( toolBar );
syncFolders->addTo( mailMenu );
*/
showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS,
0, 0, this, 0, true );
showFolders->addTo( toolBar );
showFolders->addTo( mailMenu );
showFolders->setOn( true );
connect(showFolders, SIGNAL( toggled(bool) ),
SLOT( slotShowFolders(bool) ) );
/*
- searchMails = new QAction( tr( "Search mails" ), QIconSet( Resource::loadPixmap("find") ),
+ searchMails = new QAction( tr( "Search mails" ), OResource::loadPixmap("find", OResource::SmallIcon ),
0, 0, this );
searchMails->addTo( toolBar );
searchMails->addTo( mailMenu );
*/
- deleteMails = new QAction(tr("Delete Mail"), QIconSet( Resource::loadPixmap("trash")), 0, 0, this);
+ deleteMails = new QAction(tr("Delete Mail"), OResource::loadPixmap("trash", OResource::SmallIcon ), 0, 0, this);
deleteMails->addTo( toolBar );
deleteMails->addTo( mailMenu );
connect( deleteMails, SIGNAL( activated() ),
SLOT( slotDeleteMail() ) );
- editSettings = new QAction( tr( "Edit settings" ), QIconSet( Resource::loadPixmap("SettingsIcon") ) ,
+ editSettings = new QAction( tr( "Edit settings" ), OResource::loadPixmap("SettingsIcon", OResource::SmallIcon ) ,
0, 0, this );
editSettings->addTo( settingsMenu );
connect( editSettings, SIGNAL( activated() ),
SLOT( slotEditSettings() ) );
- editAccounts = new QAction( tr( "Configure accounts" ), QIconSet( Resource::loadPixmap("mail/editaccounts") ) ,
+ editAccounts = new QAction( tr( "Configure accounts" ), OResource::loadPixmap("mail/editaccounts", OResource::SmallIcon ) ,
0, 0, this );
editAccounts->addTo( settingsMenu );
QWidget *view = new QWidget( this );
setCentralWidget( view );
layout = new QBoxLayout ( view, QBoxLayout::LeftToRight );
folderView = new AccountView( view );
folderView->header()->hide();
folderView->setRootIsDecorated( true );
folderView->addColumn( tr( "Mailbox" ) );
connect(folderView,SIGNAL(serverSelected(int)),this,SLOT(serverSelected(int)));
connect(serverMenu,SIGNAL(activated(int)),folderView,SLOT(slotContextMenu(int)));
connect(folderMenu,SIGNAL(activated(int)),folderView,SLOT(slotContextMenu(int)));
connect(this,SIGNAL(settingsChanged()),folderView,SLOT(readSettings()));
layout->addWidget( folderView );
mailView = new QListView( view );
mailView->addColumn( "" );
mailView->addColumn( tr( "Subject" ),QListView::Manual );
mailView->addColumn( tr( "Sender" ),QListView::Manual );
mailView->addColumn( tr( "Size" ),QListView::Manual);
mailView->addColumn( tr( "Date" ));
mailView->setAllColumnsShowFocus(true);
mailView->setShowSortIndicator(true);
mailView->setSorting(4,false);
layout->addWidget( mailView );
layout->setStretchFactor( folderView, 1 );
layout->setStretchFactor( mailView, 2 );
m_Rotate = (QApplication::desktop()->width() > QApplication::desktop()->height()?0:90);
slotAdjustLayout();
QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold);
QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold);
connect( mailView, SIGNAL( mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ),this,
SLOT( mailLeftClicked(int,QListViewItem*,const QPoint&,int) ) );
connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) );
connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)),
this,SLOT(refreshMailView(const QValueList<RecMailP>&)));
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&) ) );
m_sysChannel = new QCopChannel( "QPE/System", this );
connect( m_sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ),
this, SLOT( systemMessage(const QCString&,const QByteArray&) ) );
#endif
QTimer::singleShot( 10, this, SLOT( slotAdjustColumns() ) );
}
MainWindow::~MainWindow()
{
}
void MainWindow::serverSelected(int)
{
odebug << "slotShowFolders not reached" << oendl;
}
void MainWindow::systemMessage( const QCString& msg, const QByteArray& data )
{
int _newrotation;
QDataStream stream( data, IO_ReadOnly );
if ( msg == "setCurrentRotation(int)" )
{
stream >> _newrotation;
if (m_Rotate != _newrotation) {
slotAdjustLayout();
m_Rotate = _newrotation;
}
}
}
void MainWindow::appMessage(const QCString &, const QByteArray &)
{
odebug << "appMessage not reached" << oendl;
}
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp
index fb8877a..e07ed6f 100644
--- a/noncore/net/mail/opiemail.cpp
+++ b/noncore/net/mail/opiemail.cpp
@@ -1,124 +1,123 @@
#include "settingsdialog.h"
#include "opiemail.h"
#include "editaccounts.h"
#include "composemail.h"
#include "mailistviewitem.h"
#include "viewmail.h"
#include "selectstore.h"
#include "selectsmtp.h"
#include <libmailwrapper/smtpwrapper.h>
#include <libmailwrapper/mailtypes.h>
#include <libmailwrapper/abstractmail.h>
+
/* OPIE */
#include <opie2/odebug.h>
-#include <qpe/resource.h>
#include <qpe/qpeapplication.h>
#include <qpe/config.h>
+using namespace Opie::Core;
/* QT */
#include <qmap.h>
#include <qvaluelist.h>
/* UNIX */
#include <signal.h>
-using namespace Opie::Core;
-
typedef QMapNode<QString,QString> tkeyvalues;
typedef QValueList<tkeyvalues> tvaluelist;
class ValueExplode
{
protected:
//! what was parsed last
tvaluelist m_LastParsed;
//! the delemiter to use
QString mDelemiter;
//! the inner delemiter
QString m2Delemiter;
//! the real split routine
void splitit();
//! the content
QString m_Command;
//! constructor
ValueExplode(){}
public:
//! constructor
/*!
* \param aCommand the string to be splitted
* \param aDelemiter which sign will be the delemiter character
* \param a2Delemiter which sign will delemiter the key-value-pairs between other delemiters
*/
ValueExplode(const QString&aCommand,const char aDelemiter = '&',const char a2Delemiter='=');
//! destructor
virtual ~ValueExplode();
//! assigen operator
/*!
* \return a list of substrings
*/
operator const tvaluelist& (){return m_LastParsed;}
};
ValueExplode::~ValueExplode()
{
}
ValueExplode::ValueExplode(const QString&aCommand,const char aDelemiter,const char a2Delemiter)
:m_LastParsed(),m_Command(aCommand)
{
mDelemiter = aDelemiter;
m2Delemiter = a2Delemiter;
splitit();
}
void ValueExplode::splitit()
{
QString iLine;
m_LastParsed.clear();
if (mDelemiter.isEmpty()||m2Delemiter.isEmpty()) {
m_LastParsed.append(tkeyvalues(m_Command,""));
return;
}
int pos,pos2;
unsigned startpos = 0;
iLine = m_Command;
while ( (pos = iLine.find(mDelemiter,startpos))!=-1) {
pos2 = iLine.find(m2Delemiter,startpos);
if (pos2==-1||pos2>pos) {
m_LastParsed.append(tkeyvalues(iLine.mid(startpos,pos-startpos),""));
} else {
m_LastParsed.append(tkeyvalues(iLine.mid(startpos,pos2-startpos),iLine.mid(pos2+1,pos-pos2-1)));
}
startpos = pos+1;
}
if (startpos<iLine.length()) {
pos2 = iLine.find(m2Delemiter,startpos);
if (pos2==-1) {
m_LastParsed.append(tkeyvalues(iLine.mid(startpos),""));
} else {
m_LastParsed.append(tkeyvalues(iLine.mid(startpos,pos2-startpos),iLine.mid(pos2+1)));
}
}
}
OpieMail::OpieMail( QWidget *parent, const char *name, WFlags )
: MainWindow( parent, name, WStyle_ContextHelp )
{
setup_signalblocking();
Config cfg("mail");
cfg.setGroup( "Settings" );
m_clickopens = cfg.readBoolEntry("clickOpensMail",true);
settings = new Settings();
folderView->populate( settings->getAccounts() );
connect(folderView,SIGNAL(refreshMenues(int)),this,SLOT(refreshMenu(int)));
}
OpieMail::~OpieMail()
{
if (settings) delete settings;
}
void OpieMail::setup_signalblocking()
@@ -185,193 +184,193 @@ void OpieMail::slotComposeMail()
}
void OpieMail::slotSendQueued()
{
odebug << "Send Queued" << oendl;
SMTPaccount *smtp = 0;
QList<Account> list = settings->getAccounts();
QList<SMTPaccount> smtpList;
smtpList.setAutoDelete(false);
Account *it;
for ( it = list.first(); it; it = list.next() )
{
if ( it->getType() == MAILLIB::A_SMTP )
{
smtp = static_cast<SMTPaccount *>(it);
smtpList.append(smtp);
}
}
if (smtpList.count()==0)
{
QMessageBox::information(0,tr("Info"),tr("Define a smtp account first"));
return;
}
if (smtpList.count()==1)
{
smtp = smtpList.at(0);
}
else
{
smtp = 0;
selectsmtp selsmtp;
selsmtp.setSelectionlist(&smtpList);
if ( QPEApplication::execDialog( &selsmtp ) == QDialog::Accepted )
{
smtp = selsmtp.selected_smtp();
}
}
if (smtp)
{
SMTPwrapper * wrap = new SMTPwrapper(smtp);
if ( wrap->flushOutbox() )
{
QMessageBox::information(0,tr("Info"),tr("Mail queue flushed"));
}
delete wrap;
}
}
void OpieMail::slotSearchMails()
{
odebug << "Search Mails" << oendl;
}
void OpieMail::slotEditSettings()
{
SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp );
if (QPEApplication::execDialog( &settingsDialog )) {
Config cfg("mail");
cfg.setGroup( "Settings" );
m_clickopens = cfg.readBoolEntry("clickOpensMail",true);
emit settingsChanged();
}
}
void OpieMail::slotEditAccounts()
{
odebug << "Edit Accounts" << oendl;
EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp );
eaDialog.slotAdjustColumns();
if (QPEApplication::execDialog( &eaDialog )==QDialog::Rejected);// return;
if ( settings ) delete settings;
settings = new Settings();
mailView->clear();
folderView->populate( settings->getAccounts() );
}
void OpieMail::displayMail()
{
QListViewItem*item = mailView->currentItem();
if (!item) return;
RecMailP mail = ((MailListViewItem*)item)->data();
RecBodyP body = folderView->fetchBody(mail);
ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp );
readMail.setBody( body );
readMail.setMail( mail );
readMail.showMaximized();
readMail.exec();
if ( readMail.deleted )
{
folderView->refreshCurrent();
}
else
{
- ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "" ) );
+ ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
}
}
void OpieMail::slotDeleteMail()
{
if (!mailView->currentItem()) return;
RecMailP 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 OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
{
if (!mailView->currentItem()) return;
MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType();
/* just the RIGHT button - or hold on pda */
if (button!=2) {return;}
odebug << "Event right/hold" << oendl;
if (!item) return;
QPopupMenu *m = new QPopupMenu(0);
if (m)
{
if (mailtype==MAILLIB::A_NNTP) {
m->insertItem(tr("Read this posting"),this,SLOT(displayMail()));
// m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail()));
} else {
if (folderView->currentisDraft()) {
m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail()));
}
m->insertItem(tr("Read this mail"),this,SLOT(displayMail()));
m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail()));
m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail()));
}
m->setFocus();
m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
delete m;
}
}
void OpieMail::slotShowFolders( bool show )
{
odebug << "Show Folders" << oendl;
if ( show && folderView->isHidden() )
{
odebug << "-> showing" << oendl;
folderView->show();
}
else if ( !show && !folderView->isHidden() )
{
odebug << "-> hiding" << oendl;
folderView->hide();
}
}
void OpieMail::refreshMailView(const QValueList<RecMailP>&list)
{
MailListViewItem*item = 0;
mailView->clear();
QValueList<RecMailP>::ConstIterator it;
for (it = list.begin(); it != list.end();++it)
{
item = new MailListViewItem(mailView,item);
item->storeData((*it));
item->showEntry();
}
}
void OpieMail::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int )
{
if (!m_clickopens) return;
/* just LEFT button - or tap with stylus on pda */
if (button!=1) return;
if (!item) return;
if (folderView->currentisDraft()) {
reEditMail();
} else {
displayMail();
}
}
void OpieMail::slotMoveCopyMail()
{
if (!mailView->currentItem()) return;
RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
AbstractMail*targetMail = 0;
QString targetFolder = "";
Selectstore sels;
folderView->setupFolderselect(&sels);
if (!sels.exec()) return;
targetMail = sels.currentMail();
targetFolder = sels.currentFolder();
if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) ||
diff --git a/noncore/net/mail/viewmailbase.cpp b/noncore/net/mail/viewmailbase.cpp
index 65ad0d6..9e17439 100644
--- a/noncore/net/mail/viewmailbase.cpp
+++ b/noncore/net/mail/viewmailbase.cpp
@@ -1,92 +1,94 @@
+#include "viewmailbase.h"
+
+/* OPIE */
+#include <opie2/oresource.h>
+using namespace Opie::Core;
+
+/* QT */
#include <qtextbrowser.h>
#include <qlistview.h>
#include <qaction.h>
#include <qlabel.h>
#include <qvbox.h>
-
#include <qtoolbar.h>
#include <qlayout.h>
#include <qmenubar.h>
-#include <qpe/resource.h>
-
-#include "viewmailbase.h"
-//#include "opendiag.h"
ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl)
: QMainWindow(parent, name, fl)
{
setCaption(tr("E-Mail view"));
setToolBarsMovable(false);
toolbar = new QToolBar(this);
menubar = new QMenuBar( toolbar );
mailmenu = new QPopupMenu( menubar );
menubar->insertItem( tr( "Mail" ), mailmenu );
toolbar->setHorizontalStretchable(true);
addToolBar(toolbar);
QLabel *spacer = new QLabel(toolbar);
spacer->setBackgroundMode(QWidget::PaletteButton);
toolbar->setStretchableWidget(spacer);
- reply = new QAction(tr("Reply"), QIconSet(Resource::loadPixmap("mail/reply")), 0, 0, this);
+ reply = new QAction(tr("Reply"), OResource::loadPixmap("mail/reply", OResource::SmallIcon), 0, 0, this);
reply->addTo(toolbar);
reply->addTo(mailmenu);
- forward = new QAction(tr("Forward"), QIconSet(Resource::loadPixmap("mail/forward")), 0, 0, this);
+ forward = new QAction(tr("Forward"), OResource::loadPixmap("mail/forward", OResource::SmallIcon), 0, 0, this);
forward->addTo(toolbar);
forward->addTo(mailmenu);
- attachbutton = new QAction(tr("Attachments"), QIconSet(Resource::loadPixmap("mail/attach")), 0, 0, this, 0, true);
+ attachbutton = new QAction(tr("Attachments"), OResource::loadPixmap("mail/attach", OResource::SmallIcon), 0, 0, this, 0, true);
attachbutton->addTo(toolbar);
attachbutton->addTo(mailmenu);
connect(attachbutton, SIGNAL(toggled(bool)), SLOT(slotChangeAttachview(bool)));
- showHtml = new QAction( tr( "Show Html" ), QIconSet( Resource::loadPixmap( "mail/html" ) ), 0, 0, this, 0, true );
+ showHtml = new QAction( tr( "Show Html" ), OResource::loadPixmap( "mail/html", OResource::SmallIcon ), 0, 0, this, 0, true );
showHtml->addTo( toolbar );
showHtml->addTo( mailmenu );
- showPicsInline= new QAction(tr("Show image preview inline"), QIconSet(Resource::loadPixmap("pixmap")), 0, 0, this);
+ showPicsInline= new QAction(tr("Show image preview inline"), OResource::loadPixmap("pixmap", OResource::SmallIcon), 0, 0, this);
showPicsInline->setToggleAction(true);
showPicsInline->addTo(toolbar);
showPicsInline->addTo(mailmenu);
- deleteMail = new QAction(tr("Delete Mail"), QIconSet(Resource::loadPixmap("trash")), 0, 0, this);
+ deleteMail = new QAction(tr("Delete Mail"), OResource::loadPixmap("trash", OResource::SmallIcon), 0, 0, this);
deleteMail->addTo(toolbar);
deleteMail->addTo(mailmenu);
QVBox * view = new QVBox(this);
view->setSpacing(1);
view->setMargin(0);
setCentralWidget(view);
attachments = new QListView(view);
attachments->setMinimumHeight(90);
attachments->setMaximumHeight(90);
attachments->setAllColumnsShowFocus(true);
attachments->addColumn("Mime Type", 60);
attachments->addColumn(tr("Description"), 100);
attachments->addColumn(tr("Filename"), 80);
attachments->addColumn(tr("Size"), 80);
attachments->setSorting(-1);
browser = new QTextBrowser(view);
adjustSize();
attachments->hide();
}
void ViewMailBase::slotChangeAttachview(bool state)
{
if (state) attachments->show();
else attachments->hide();
}
void ViewMailBase::keyPressEvent ( QKeyEvent * e )
{
if( e->key()==Qt::Key_Escape ) {
close();
e->accept();
return;
}
QWidget::keyPressEvent(e);
}