summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2005-07-03 21:03:44 (UTC)
committer mickeyl <mickeyl>2005-07-03 21:03:44 (UTC)
commit62842736cf871376f947f7b27ebc6f58fbc84fdc (patch) (unidiff)
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) (ignore 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,83 +1,85 @@
1 1
2#include "accountitem.h" 2#include "accountitem.h"
3#include "accountview.h" 3#include "accountview.h"
4#include "newmaildir.h" 4#include "newmaildir.h"
5#include "nntpgroupsdlg.h" 5#include "nntpgroupsdlg.h"
6#include "defines.h" 6#include "defines.h"
7 7
8#include <libmailwrapper/mailtypes.h> 8#include <libmailwrapper/mailtypes.h>
9#include <libmailwrapper/abstractmail.h> 9#include <libmailwrapper/abstractmail.h>
10#include <libmailwrapper/mailwrapper.h> 10#include <libmailwrapper/mailwrapper.h>
11
11/* OPIE */ 12/* OPIE */
12#include <opie2/odebug.h> 13#include <opie2/odebug.h>
14#include <opie2/oresource.h>
13#include <qpe/qpeapplication.h> 15#include <qpe/qpeapplication.h>
16using namespace Opie::Core;
14 17
15/* QT */ 18/* QT */
16#include <qpopupmenu.h> 19#include <qpopupmenu.h>
17#include <qmessagebox.h> 20#include <qmessagebox.h>
18 21
19using namespace Opie::Core;
20#define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );} 22#define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );}
21/** 23/**
22 * POP3 Account stuff 24 * POP3 Account stuff
23 */ 25 */
24POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent ) 26POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent )
25 : AccountViewItem( parent ) 27 : AccountViewItem( parent )
26{ 28{
27 account = a; 29 account = a;
28 wrapper = AbstractMail::getWrapper( account ); 30 wrapper = AbstractMail::getWrapper( account );
29 SETPIX(PIXMAP_POP3FOLDER); 31 SETPIX(PIXMAP_POP3FOLDER);
30#if 0 32#if 0
31 if (!account->getOffline()) 33 if (!account->getOffline())
32 { 34 {
33 setPixmap( 0, ); 35 setPixmap( 0, );
34 } 36 }
35 else 37 else
36 { 38 {
37 setPixmap( 0, PIXMAP_OFFLINE ); 39 setPixmap( 0, PIXMAP_OFFLINE );
38 } 40 }
39#endif 41#endif
40 setText( 0, account->getAccountName() ); 42 setText( 0, account->getAccountName() );
41 setOpen( true ); 43 setOpen( true );
42} 44}
43 45
44POP3viewItem::~POP3viewItem() 46POP3viewItem::~POP3viewItem()
45{ 47{
46 delete wrapper; 48 delete wrapper;
47} 49}
48 50
49AbstractMail *POP3viewItem::getWrapper() 51AbstractMail *POP3viewItem::getWrapper()
50{ 52{
51 return wrapper; 53 return wrapper;
52} 54}
53 55
54void POP3viewItem::refresh(QValueList<Opie::Core::OSmartPointer<RecMail> > & ) 56void POP3viewItem::refresh(QValueList<Opie::Core::OSmartPointer<RecMail> > & )
55{ 57{
56 refresh(); 58 refresh();
57} 59}
58 60
59void POP3viewItem::refresh() 61void POP3viewItem::refresh()
60{ 62{
61 if (account->getOffline()) return; 63 if (account->getOffline()) return;
62 QValueList<FolderP> *folders = wrapper->listFolders(); 64 QValueList<FolderP> *folders = wrapper->listFolders();
63 QListViewItem *child = firstChild(); 65 QListViewItem *child = firstChild();
64 while ( child ) 66 while ( child )
65 { 67 {
66 QListViewItem *tmp = child; 68 QListViewItem *tmp = child;
67 child = child->nextSibling(); 69 child = child->nextSibling();
68 delete tmp; 70 delete tmp;
69 } 71 }
70 QValueList<FolderP>::ConstIterator it; 72 QValueList<FolderP>::ConstIterator it;
71 QListViewItem*item = 0; 73 QListViewItem*item = 0;
72 for ( it = folders->begin(); it!=folders->end(); ++it) 74 for ( it = folders->begin(); it!=folders->end(); ++it)
73 { 75 {
74 item = new POP3folderItem( (*it), this , item ); 76 item = new POP3folderItem( (*it), this , item );
75 item->setSelectable( (*it)->may_select()); 77 item->setSelectable( (*it)->may_select());
76 } 78 }
77 delete folders; 79 delete folders;
78} 80}
79 81
80RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) 82RECBODYP POP3viewItem::fetchBody( const RecMailP &mail )
81{ 83{
82 odebug << "POP3 fetchBody" << oendl; 84 odebug << "POP3 fetchBody" << oendl;
83 return wrapper->fetchBody( mail ); 85 return wrapper->fetchBody( mail );
@@ -837,129 +839,129 @@ bool MHviewItem::contextMenuSelected(int which)
837 AccountView*view = 0; 839 AccountView*view = 0;
838 840
839 switch (which) 841 switch (which)
840 { 842 {
841 case SERVER_MENU_REFRESH_FOLDER: 843 case SERVER_MENU_REFRESH_FOLDER:
842 refresh(true); 844 refresh(true);
843 break; 845 break;
844 case FOLDER_MENU_NEW_SUBFOLDER: 846 case FOLDER_MENU_NEW_SUBFOLDER:
845 createFolder(); 847 createFolder();
846 break; 848 break;
847 case FOLDER_MENU_DELETE_ALL_MAILS: 849 case FOLDER_MENU_DELETE_ALL_MAILS:
848 deleteAllMail(getWrapper(),folder); 850 deleteAllMail(getWrapper(),folder);
849 break; 851 break;
850 case FOLDER_MENU_MOVE_MAILS: 852 case FOLDER_MENU_MOVE_MAILS:
851 downloadMails(); 853 downloadMails();
852 break; 854 break;
853 case FOLDER_MENU_REFRESH_HEADER: 855 case FOLDER_MENU_REFRESH_HEADER:
854 view = (AccountView*)listView(); 856 view = (AccountView*)listView();
855 if (view) view->refreshCurrent(); 857 if (view) view->refreshCurrent();
856 break; 858 break;
857 default: 859 default:
858 break; 860 break;
859 } 861 }
860 return false; 862 return false;
861} 863}
862 864
863MHfolderItem::~MHfolderItem() 865MHfolderItem::~MHfolderItem()
864{} 866{}
865 867
866MHfolderItem::MHfolderItem( const FolderP &folderInit, MHviewItem *parent , QListViewItem*after ) 868MHfolderItem::MHfolderItem( const FolderP &folderInit, MHviewItem *parent , QListViewItem*after )
867 : AccountViewItem(folderInit, parent,after ) 869 : AccountViewItem(folderInit, parent,after )
868{ 870{
869 mbox = parent; 871 mbox = parent;
870 initName(); 872 initName();
871} 873}
872 874
873MHfolderItem::MHfolderItem(const FolderP& folderInit, MHfolderItem *parent, QListViewItem*after, MHviewItem*master) 875MHfolderItem::MHfolderItem(const FolderP& folderInit, MHfolderItem *parent, QListViewItem*after, MHviewItem*master)
874 : AccountViewItem(folderInit, parent,after ) 876 : AccountViewItem(folderInit, parent,after )
875{ 877{
876 folder = folderInit; 878 folder = folderInit;
877 mbox = master; 879 mbox = master;
878 initName(); 880 initName();
879} 881}
880 882
881void MHfolderItem::initName() 883void MHfolderItem::initName()
882{ 884{
883 QString bName = folder->getDisplayName(); 885 QString bName = folder->getDisplayName();
884 if (bName.startsWith("/")&&bName.length()>1) 886 if (bName.startsWith("/")&&bName.length()>1)
885 { 887 {
886 bName.replace(0,1,""); 888 bName.replace(0,1,"");
887 } 889 }
888 int pos = bName.findRev("/"); 890 int pos = bName.findRev("/");
889 if (pos > 0) 891 if (pos > 0)
890 { 892 {
891 bName.replace(0,pos+1,""); 893 bName.replace(0,pos+1,"");
892 } 894 }
893 if (bName.lower() == "outgoing") 895 if (bName.lower() == "outgoing")
894 { 896 {
895 setPixmap( 0, PIXMAP_OUTBOXFOLDER ); 897 setPixmap( 0, PIXMAP_OUTBOXFOLDER );
896 } 898 }
897 else if (bName.lower() == "inbox") 899 else if (bName.lower() == "inbox")
898 { 900 {
899 setPixmap( 0, PIXMAP_INBOXFOLDER); 901 setPixmap( 0, PIXMAP_INBOXFOLDER);
900 } else if (bName.lower() == "drafts") { 902 } else if (bName.lower() == "drafts") {
901 setPixmap(0, Resource::loadPixmap("edit")); 903 setPixmap(0, Opie::Core::OResource::loadPixmap("edit", Opie::Core::OResource::SmallIcon));
902 } else { 904 } else {
903 setPixmap( 0, PIXMAP_MBOXFOLDER ); 905 setPixmap( 0, PIXMAP_MBOXFOLDER );
904 } 906 }
905 setText( 0, bName ); 907 setText( 0, bName );
906} 908}
907 909
908const FolderP&MHfolderItem::getFolder()const 910const FolderP&MHfolderItem::getFolder()const
909{ 911{
910 return folder; 912 return folder;
911} 913}
912 914
913void MHfolderItem::refresh(QValueList<RecMailP>&target) 915void MHfolderItem::refresh(QValueList<RecMailP>&target)
914{ 916{
915 if (folder->may_select()) 917 if (folder->may_select())
916 mbox->getWrapper()->listMessages( folder->getName(),target ); 918 mbox->getWrapper()->listMessages( folder->getName(),target );
917} 919}
918 920
919RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail) 921RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail)
920{ 922{
921 return mbox->getWrapper()->fetchBody(aMail); 923 return mbox->getWrapper()->fetchBody(aMail);
922} 924}
923 925
924bool MHfolderItem::deleteFolder() 926bool MHfolderItem::deleteFolder()
925{ 927{
926 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), 928 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName),
927 QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), 929 QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()),
928 QObject::tr("Yes",contextName), 930 QObject::tr("Yes",contextName),
929 QObject::tr("No",contextName),QString::null,1,1); 931 QObject::tr("No",contextName),QString::null,1,1);
930 odebug << "Auswahl: " << yesno << "" << oendl; 932 odebug << "Auswahl: " << yesno << "" << oendl;
931 if (yesno == 0) 933 if (yesno == 0)
932 { 934 {
933 if (mbox->getWrapper()->deleteMbox(folder)) 935 if (mbox->getWrapper()->deleteMbox(folder))
934 { 936 {
935 QListView*v=listView(); 937 QListView*v=listView();
936 MHviewItem * box = mbox; 938 MHviewItem * box = mbox;
937 /* be carefull - after that this object is destroyd so don't use 939 /* be carefull - after that this object is destroyd so don't use
938 * any member of it after that call!!*/ 940 * any member of it after that call!!*/
939 mbox->refresh(true); 941 mbox->refresh(true);
940 if (v) 942 if (v)
941 { 943 {
942 v->setSelected(box,true); 944 v->setSelected(box,true);
943 } 945 }
944 return true; 946 return true;
945 } 947 }
946 } 948 }
947 return false; 949 return false;
948} 950}
949 951
950QMap<int,QString> MHfolderItem::folderMenu() 952QMap<int,QString> MHfolderItem::folderMenu()
951{ 953{
952 QMap<int,QString> e; 954 QMap<int,QString> e;
953 e[FOLDER_MENU_NEW_SUBFOLDER]=QObject::tr("Create new subfolder",contextName); 955 e[FOLDER_MENU_NEW_SUBFOLDER]=QObject::tr("Create new subfolder",contextName);
954 e[FOLDER_MENU_REFRESH_HEADER]=QObject::tr("Refresh header list",contextName); 956 e[FOLDER_MENU_REFRESH_HEADER]=QObject::tr("Refresh header list",contextName);
955 e[FOLDER_MENU_MOVE_MAILS]=QObject::tr("Move/Copie all mails",contextName); 957 e[FOLDER_MENU_MOVE_MAILS]=QObject::tr("Move/Copie all mails",contextName);
956 e[FOLDER_MENU_DELETE_ALL_MAILS]=QObject::tr("Delete all mails",contextName); 958 e[FOLDER_MENU_DELETE_ALL_MAILS]=QObject::tr("Delete all mails",contextName);
957 e[FOLDER_MENU_DELETE_FOLDER]=QObject::tr("Delete folder",contextName); 959 e[FOLDER_MENU_DELETE_FOLDER]=QObject::tr("Delete folder",contextName);
958 return e; 960 return e;
959} 961}
960 962
961void MHfolderItem::downloadMails() 963void MHfolderItem::downloadMails()
962{ 964{
963 AccountView*bl = mbox->accountView(); 965 AccountView*bl = mbox->accountView();
964 if (!bl) return; 966 if (!bl) return;
965 bl->downloadMails(folder,mbox->getWrapper()); 967 bl->downloadMails(folder,mbox->getWrapper());
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,86 +1,86 @@
1 1
2#include "composemail.h" 2#include "composemail.h"
3 3
4/* OPIE */ 4/* OPIE */
5#include <opie2/ocontactaccess.h> 5#include <opie2/ocontactaccess.h>
6#include <opie2/opimcontact.h> 6#include <opie2/opimcontact.h>
7#include <qpe/resource.h> 7#include <opie2/oresource.h>
8#include <qpe/qpeapplication.h> 8#include <qpe/qpeapplication.h>
9 9
10/* QT */ 10/* QT */
11#include <qpushbutton.h> 11#include <qpushbutton.h>
12#include <qmessagebox.h> 12#include <qmessagebox.h>
13#include <qlistbox.h> 13#include <qlistbox.h>
14 14
15/* STD */ 15/* STD */
16#include <stdlib.h> 16#include <stdlib.h>
17 17
18AddressPicker::AddressPicker( QWidget *parent, const char *name, bool modal, WFlags flags ) 18AddressPicker::AddressPicker( QWidget *parent, const char *name, bool modal, WFlags flags )
19 : AddressPickerUI( parent, name, modal, flags ) 19 : AddressPickerUI( parent, name, modal, flags )
20{ 20{
21 okButton->setIconSet( Resource::loadPixmap( "enter" ) ); 21 okButton->setIconSet( Opie::Core::OResource::loadPixmap( "enter", Opie::Core::OResource::SmallIcon ) );
22 cancelButton->setIconSet( Resource::loadPixmap( "editdelete" ) ); 22 cancelButton->setIconSet( Opie::Core::OResource::loadPixmap( "editdelete", Opie::Core::OResource::SmallIcon ) );
23 23
24 connect(okButton, SIGNAL(clicked()), SLOT(accept())); 24 connect(okButton, SIGNAL(clicked()), SLOT(accept()));
25 connect(cancelButton, SIGNAL(clicked()), SLOT(close())); 25 connect(cancelButton, SIGNAL(clicked()), SLOT(close()));
26 Opie::OPimContactAccess::List::Iterator it; 26 Opie::OPimContactAccess::List::Iterator it;
27 27
28 QString lineEmail, lineName, contactLine; 28 QString lineEmail, lineName, contactLine;
29 /* what name has to set here???? */ 29 /* what name has to set here???? */
30 Opie::OPimContactAccess m_contactdb("opiemail"); 30 Opie::OPimContactAccess m_contactdb("opiemail");
31 31
32 QStringList mails; 32 QStringList mails;
33 QString pre,suf; 33 QString pre,suf;
34 Opie::OPimContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 ); 34 Opie::OPimContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 );
35 for ( it = m_list.begin(); it != m_list.end(); ++it ) 35 for ( it = m_list.begin(); it != m_list.end(); ++it )
36 { 36 {
37 if ((*it).defaultEmail().length()!=0) 37 if ((*it).defaultEmail().length()!=0)
38 { 38 {
39 mails = (*it).emailList(); 39 mails = (*it).emailList();
40 if ((*it).fileAs().length()>0) 40 if ((*it).fileAs().length()>0)
41 { 41 {
42 pre = "\""+(*it).firstName()+" "+(*it).lastName()+"\" <"; 42 pre = "\""+(*it).firstName()+" "+(*it).lastName()+"\" <";
43 suf = ">"; 43 suf = ">";
44 } 44 }
45 else 45 else
46 { 46 {
47 pre = ""; 47 pre = "";
48 suf = ""; 48 suf = "";
49 } 49 }
50 QStringList::ConstIterator sit = mails.begin(); 50 QStringList::ConstIterator sit = mails.begin();
51 for (;sit!=mails.end();++sit) 51 for (;sit!=mails.end();++sit)
52 { 52 {
53 contactLine=pre+(*sit)+suf; 53 contactLine=pre+(*sit)+suf;
54 addressList->insertItem(contactLine); 54 addressList->insertItem(contactLine);
55 } 55 }
56 } 56 }
57 } 57 }
58 if ( addressList->count() <= 0 ) 58 if ( addressList->count() <= 0 )
59 { 59 {
60#if 0 60#if 0
61 // makes this realy sense?? 61 // makes this realy sense??
62 addressList->insertItem( 62 addressList->insertItem(
63 tr( "There are no entries in the addressbook." ) ); 63 tr( "There are no entries in the addressbook." ) );
64#endif 64#endif
65 addressList->setEnabled( false ); 65 addressList->setEnabled( false );
66 okButton->setEnabled( false ); 66 okButton->setEnabled( false );
67 } 67 }
68 else 68 else
69 { 69 {
70 // addressList->sort(); 70 // addressList->sort();
71 } 71 }
72} 72}
73 73
74void AddressPicker::accept() 74void AddressPicker::accept()
75{ 75{
76 QListBoxItem *item = addressList->firstItem(); 76 QListBoxItem *item = addressList->firstItem();
77 QString names; 77 QString names;
78 78
79 while ( item ) 79 while ( item )
80 { 80 {
81 if ( item->selected() ) 81 if ( item->selected() )
82 names += item->text() + ", "; 82 names += item->text() + ", ";
83 item = item->next(); 83 item = item->next();
84 } 84 }
85 names.replace( names.length() - 2, 2, "" ); 85 names.replace( names.length() - 2, 2, "" );
86 86
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,86 +1,85 @@
1 1
2#include "composemail.h" 2#include "composemail.h"
3 3
4#include <libmailwrapper/smtpwrapper.h> 4#include <libmailwrapper/smtpwrapper.h>
5#include <libmailwrapper/storemail.h> 5#include <libmailwrapper/storemail.h>
6#include <libmailwrapper/abstractmail.h> 6#include <libmailwrapper/abstractmail.h>
7#include <libmailwrapper/mailtypes.h> 7#include <libmailwrapper/mailtypes.h>
8 8
9/* OPIE */ 9/* OPIE */
10#include <opie2/ofiledialog.h> 10#include <opie2/ofiledialog.h>
11#include <opie2/odebug.h> 11#include <opie2/odebug.h>
12#include <qpe/resource.h> 12#include <opie2/oresource.h>
13#include <qpe/config.h> 13#include <qpe/config.h>
14#include <qpe/global.h> 14#include <qpe/global.h>
15#include <qpe/contact.h> 15#include <qpe/contact.h>
16using namespace Opie::Core;
17using namespace Opie::Ui;
16 18
17/* QT */ 19/* QT */
18#include <qt.h> 20#include <qt.h>
19 21
20
21using namespace Opie::Core;
22using namespace Opie::Ui;
23ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) 22ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags )
24 : ComposeMailUI( parent, name, modal, flags ) 23 : ComposeMailUI( parent, name, modal, flags )
25{ 24{
26 settings = s; 25 settings = s;
27 m_replyid = ""; 26 m_replyid = "";
28 27
29 QString vfilename = Global::applicationFileName("addressbook", 28 QString vfilename = Global::applicationFileName("addressbook",
30 "businesscard.vcf"); 29 "businesscard.vcf");
31 Contact c; 30 Contact c;
32 if (QFile::exists(vfilename)) { 31 if (QFile::exists(vfilename)) {
33 c = Contact::readVCard( vfilename )[0]; 32 c = Contact::readVCard( vfilename )[0];
34 } 33 }
35 34
36 QStringList mails = c.emailList(); 35 QStringList mails = c.emailList();
37 QString defmail = c.defaultEmail(); 36 QString defmail = c.defaultEmail();
38 37
39 if (defmail.length()!=0) { 38 if (defmail.length()!=0) {
40 fromBox->insertItem(defmail); 39 fromBox->insertItem(defmail);
41 } 40 }
42 QStringList::ConstIterator sit = mails.begin(); 41 QStringList::ConstIterator sit = mails.begin();
43 for (;sit!=mails.end();++sit) { 42 for (;sit!=mails.end();++sit) {
44 if ( (*sit)==defmail) 43 if ( (*sit)==defmail)
45 continue; 44 continue;
46 fromBox->insertItem((*sit)); 45 fromBox->insertItem((*sit));
47 } 46 }
48 senderNameEdit->setText(c.firstName()+" "+c.lastName()); 47 senderNameEdit->setText(c.firstName()+" "+c.lastName());
49 Config cfg( "mail" ); 48 Config cfg( "mail" );
50 cfg.setGroup( "Compose" ); 49 cfg.setGroup( "Compose" );
51 checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); 50 checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) );
52 51
53 attList->addColumn( tr( "Name" ) ); 52 attList->addColumn( tr( "Name" ) );
54 attList->addColumn( tr( "Size" ) ); 53 attList->addColumn( tr( "Size" ) );
55 54
56 QList<Account> accounts = settings->getAccounts(); 55 QList<Account> accounts = settings->getAccounts();
57 56
58 Account *it; 57 Account *it;
59 for ( it = accounts.first(); it; it = accounts.next() ) { 58 for ( it = accounts.first(); it; it = accounts.next() ) {
60 if ( it->getType()==MAILLIB::A_SMTP ) { 59 if ( it->getType()==MAILLIB::A_SMTP ) {
61 SMTPaccount *smtp = static_cast<SMTPaccount *>(it); 60 SMTPaccount *smtp = static_cast<SMTPaccount *>(it);
62 smtpAccountBox->insertItem( smtp->getAccountName() ); 61 smtpAccountBox->insertItem( smtp->getAccountName() );
63 smtpAccounts.append( smtp ); 62 smtpAccounts.append( smtp );
64 } 63 }
65 } 64 }
66 65
67 if ( smtpAccounts.count() > 0 ) { 66 if ( smtpAccounts.count() > 0 ) {
68 fillValues( smtpAccountBox->currentItem() ); 67 fillValues( smtpAccountBox->currentItem() );
69 } else { 68 } else {
70 QMessageBox::information( this, tr( "Problem" ), 69 QMessageBox::information( this, tr( "Problem" ),
71 tr( "<p>Please create an SMTP account first.</p>" ), 70 tr( "<p>Please create an SMTP account first.</p>" ),
72 tr( "Ok" ) ); 71 tr( "Ok" ) );
73 return; 72 return;
74 } 73 }
75 74
76 connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); 75 connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) );
77 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); 76 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) );
78 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); 77 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) );
79 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); 78 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) );
80 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); 79 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) );
81 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); 80 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) );
82 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); 81 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) );
83} 82}
84 83
85void ComposeMail::pickAddress( QLineEdit *line ) 84void ComposeMail::pickAddress( QLineEdit *line )
86{ 85{
@@ -238,70 +237,70 @@ void ComposeMail::accept()
238void ComposeMail::reject() 237void ComposeMail::reject()
239{ 238{
240 int yesno = QMessageBox::warning(0,tr("Store message"), 239 int yesno = QMessageBox::warning(0,tr("Store message"),
241 tr("Store message into drafts?"), 240 tr("Store message into drafts?"),
242 tr("Yes"), 241 tr("Yes"),
243 tr("No"),QString::null,0,1); 242 tr("No"),QString::null,0,1);
244 243
245 if (yesno == 0) { 244 if (yesno == 0) {
246 Opie::Core::OSmartPointer<Mail> mail=new Mail(); 245 Opie::Core::OSmartPointer<Mail> mail=new Mail();
247 mail->setMail(fromBox->currentText()); 246 mail->setMail(fromBox->currentText());
248 mail->setTo( toLine->text() ); 247 mail->setTo( toLine->text() );
249 mail->setName(senderNameEdit->text()); 248 mail->setName(senderNameEdit->text());
250 mail->setCC( ccLine->text() ); 249 mail->setCC( ccLine->text() );
251 mail->setBCC( bccLine->text() ); 250 mail->setBCC( bccLine->text() );
252 mail->setReply( replyLine->text() ); 251 mail->setReply( replyLine->text() );
253 mail->setSubject( subjectLine->text() ); 252 mail->setSubject( subjectLine->text() );
254 if (!m_replyid.isEmpty()) { 253 if (!m_replyid.isEmpty()) {
255 QStringList ids; 254 QStringList ids;
256 ids.append(m_replyid); 255 ids.append(m_replyid);
257 mail->setInreply(ids); 256 mail->setInreply(ids);
258 } 257 }
259 QString txt = message->text(); 258 QString txt = message->text();
260 if ( !sigMultiLine->text().isEmpty() ) { 259 if ( !sigMultiLine->text().isEmpty() ) {
261 txt.append( "\n--\n" ); 260 txt.append( "\n--\n" );
262 txt.append( sigMultiLine->text() ); 261 txt.append( sigMultiLine->text() );
263 } 262 }
264 odebug << txt << oendl; 263 odebug << txt << oendl;
265 mail->setMessage( txt ); 264 mail->setMessage( txt );
266 265
267 /* only use the default drafts folder name! */ 266 /* only use the default drafts folder name! */
268 Storemail wrapper(AbstractMail::draftFolder()); 267 Storemail wrapper(AbstractMail::draftFolder());
269 wrapper.storeMail(mail); 268 wrapper.storeMail(mail);
270 269
271 AttachViewItem *it = (AttachViewItem *) attList->firstChild(); 270 AttachViewItem *it = (AttachViewItem *) attList->firstChild();
272 /* attachments we will ignore! */ 271 /* attachments we will ignore! */
273 if ( it != NULL ) { 272 if ( it != NULL ) {
274 QMessageBox::warning(0,tr("Store message"), 273 QMessageBox::warning(0,tr("Store message"),
275 tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); 274 tr("<center>Attachments will not be stored in \"Draft\" folder</center>"));
276 } 275 }
277 } 276 }
278 QDialog::reject(); 277 QDialog::reject();
279} 278}
280 279
281ComposeMail::~ComposeMail() 280ComposeMail::~ComposeMail()
282{ 281{
283} 282}
284 283
285void ComposeMail::reEditMail(const RecMailP&current) 284void ComposeMail::reEditMail(const RecMailP&current)
286{ 285{
287 RecMailP data = current; 286 RecMailP data = current;
288 message->setText(data->Wrapper()->fetchBody(current)->Bodytext()); 287 message->setText(data->Wrapper()->fetchBody(current)->Bodytext());
289 subjectLine->setText( data->getSubject()); 288 subjectLine->setText( data->getSubject());
290 toLine->setText(data->To().join(",")); 289 toLine->setText(data->To().join(","));
291 ccLine->setText(data->CC().join(",")); 290 ccLine->setText(data->CC().join(","));
292 bccLine->setText(data->Bcc().join(",")); 291 bccLine->setText(data->Bcc().join(","));
293 replyLine->setText(data->Replyto()); 292 replyLine->setText(data->Replyto());
294} 293}
295 294
296AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) 295AttachViewItem::AttachViewItem( QListView *parent, Attachment *att )
297 : QListViewItem( parent ) 296 : QListViewItem( parent )
298{ 297{
299 attachment = att; 298 attachment = att;
300 odebug << att->getMimeType() << oendl; 299 odebug << att->getMimeType() << oendl;
301 setPixmap( 0, attachment->getDocLnk().pixmap().isNull() ? 300 setPixmap( 0, attachment->getDocLnk().pixmap().isNull() ?
302 Resource::loadPixmap( "UnknownDocument-14" ) : 301 OResource::loadPixmap( "UnknownDocument", OResource::SmallIcon ) :
303 attachment->getDocLnk().pixmap() ); 302 attachment->getDocLnk().pixmap() );
304 setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); 303 setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() );
305 setText( 1, QString::number( att->getSize() ) ); 304 setText( 1, QString::number( att->getSize() ) );
306} 305}
307 306
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 @@
1source noncore/net/mail/libmailwrapper/config.in 1source noncore/net/mail/libmailwrapper/config.in
2 2
3config MAIL3 3config MAIL3
4 boolean "opie-mail3 (a mail client)" 4 boolean "opie-mail3 (a mail client)"
5 default "y" 5 default "y"
6 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2PIM && LIBOPIE2MM && LIBMAILWRAPPER 6 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI && LIBOPIE2PIM && LIBOPIE2MM && LIBMAILWRAPPER
7 comment "opie-mail3 needs a libqpe, libopie2core, libopie2pim and the libmailwrapper" 7 comment "opie-mail3 needs a libqpe, libopie2core, libopie2ui, libopie2pim and the libmailwrapper"
8 depends ! ( ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2PIM && LIBOPIE2MM && LIBMAILWRAPPER ) 8 depends ! ( ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI && LIBOPIE2PIM && LIBOPIE2MM && LIBMAILWRAPPER )
9 9
10source noncore/net/mail/taskbarapplet/config.in 10source 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 @@
1#ifndef DEFINE_CONSTANTS_H 1#ifndef DEFINE_CONSTANTS_H
2#define DEFINE_CONSTANTS_H 2#define DEFINE_CONSTANTS_H
3 3
4#include <qpe/resource.h> 4#include <opie2/oresource.h>
5using namespace Opie::Core;
5 6
6#define USER_AGENT "OpieMail v0.3" 7#define USER_AGENT "OpieMail v0.3"
7 8
8#define PIC_COMPOSEMAIL "mail/composemail" 9#define PIC_COMPOSEMAIL "mail/composemail"
9#define PIC_SENDQUEUED "mail/sendqueued" 10#define PIC_SENDQUEUED "mail/sendqueued"
10#define PIC_SHOWFOLDERS "mail/showfolders" 11#define PIC_SHOWFOLDERS "mail/showfolders"
11#define PIC_SYNC "mail/sync" 12#define PIC_SYNC "mail/sync"
12#define PIC_IMAPFOLDER "mail/imapfolder" 13#define PIC_IMAPFOLDER "mail/imapfolder"
13#define PIC_MBOXFOLDER "mail/mboxfolder" 14#define PIC_MBOXFOLDER "mail/mboxfolder"
14#define PIC_POP3FOLDER "mail/pop3folder" 15#define PIC_POP3FOLDER "mail/pop3folder"
15#define PIC_INBOXFOLDER "mail/inbox" 16#define PIC_INBOXFOLDER "mail/inbox"
16#define PIC_OUTBOXFOLDER "mail/outbox" 17#define PIC_OUTBOXFOLDER "mail/outbox"
17#define PIC_LOCALFOLDER "mail/localfolder" 18#define PIC_LOCALFOLDER "mail/localfolder"
18 19
19#define PIC_OFFLINE "mail/notconnected" 20#define PIC_OFFLINE "mail/notconnected"
20#define PIC_DOCUMENT "DocsIcon" 21#define PIC_DOCUMENT "DocsIcon"
21 22
22#define ICON_COMPOSEMAIL QIconSet( Resource::loadPixmap( PIC_COMPOSEMAIL ) ) 23#define ICON_COMPOSEMAIL QIconSet( OResource::loadPixmap( PIC_COMPOSEMAIL, OResource::SmallIcon ) )
23#define ICON_SENDQUEUED QIconSet( Resource::loadPixmap( PIC_SENDQUEUED ) ) 24#define ICON_SENDQUEUED QIconSet( OResource::loadPixmap( PIC_SENDQUEUED, OResource::SmallIcon ) )
24#define ICON_SHOWFOLDERS QIconSet( Resource::loadPixmap( PIC_SHOWFOLDERS ) ) 25#define ICON_SHOWFOLDERS QIconSet( OResource::loadPixmap( PIC_SHOWFOLDERS, OResource::SmallIcon ) )
25#define ICON_SEARCHMAILS QIconSet( Resource::loadPixmap( PIC_SEARCHMAILS ) ) 26#define ICON_SEARCHMAILS QIconSet( OResource::loadPixmap( PIC_SEARCHMAILS, OResource::SmallIcon ) )
26#define ICON_EDITSETTINGS QIconSet( Resource::loadPixmap( PIC_EDITSETTINGS ) ) 27#define ICON_EDITSETTINGS QIconSet( OResource::loadPixmap( PIC_EDITSETTINGS, OResource::SmallIcon ) )
27#define ICON_EDITACCOUNTS QIconSet( Resource::loadPixmap( PIC_EDITACCOUNTS ) ) 28#define ICON_EDITACCOUNTS QIconSet( OResource::loadPixmap( PIC_EDITACCOUNTS, OResource::SmallIcon ) )
28#define ICON_SYNC QIconSet( Resource::loadPixmap( PIC_SYNC ) ) 29#define ICON_SYNC QIconSet( OResource::loadPixmap( PIC_SYNC, OResource::SmallIcon ) )
29#define ICON_READMAIL QIconSet( Resource::loadPixmap( PIC_DOCUMENT)) 30#define ICON_READMAIL QIconSet( OResource::loadPixmap( PIC_DOCUMENT, OResource::SmallIcon) )
30 31
31#define PIXMAP_IMAPFOLDER QPixmap( Resource::loadPixmap( PIC_IMAPFOLDER ) ) 32#define PIXMAP_IMAPFOLDER QPixmap( OResource::loadPixmap( PIC_IMAPFOLDER, OResource::SmallIcon ) )
32#define PIXMAP_POP3FOLDER QPixmap( Resource::loadPixmap( PIC_POP3FOLDER ) ) 33#define PIXMAP_POP3FOLDER QPixmap( OResource::loadPixmap( PIC_POP3FOLDER, OResource::SmallIcon ) )
33#define PIXMAP_INBOXFOLDER QPixmap( Resource::loadPixmap( PIC_INBOXFOLDER) ) 34#define PIXMAP_INBOXFOLDER QPixmap( OResource::loadPixmap( PIC_INBOXFOLDER, OResource::SmallIcon ) )
34#define PIXMAP_MBOXFOLDER QPixmap( Resource::loadPixmap( PIC_MBOXFOLDER ) ) 35#define PIXMAP_MBOXFOLDER QPixmap( OResource::loadPixmap( PIC_MBOXFOLDER, OResource::SmallIcon ) )
35#define PIXMAP_OUTBOXFOLDER QPixmap( Resource::loadPixmap( PIC_OUTBOXFOLDER) ) 36#define PIXMAP_OUTBOXFOLDER QPixmap( OResource::loadPixmap( PIC_OUTBOXFOLDER, OResource::SmallIcon ) )
36#define PIXMAP_LOCALFOLDER QPixmap( Resource::loadPixmap( PIC_LOCALFOLDER) ) 37#define PIXMAP_LOCALFOLDER QPixmap( OResource::loadPixmap( PIC_LOCALFOLDER, OResource::SmallIcon ) )
37#define PIXMAP_OFFLINE QPixmap( Resource::loadPixmap( PIC_OFFLINE) ) 38#define PIXMAP_OFFLINE QPixmap( OResource::loadPixmap( PIC_OFFLINE, OResource::SmallIcon ) )
38 39
39#define IMAP_PORT "143" 40#define IMAP_PORT "143"
40#define IMAP_SSL_PORT "993" 41#define IMAP_SSL_PORT "993"
41#define SMTP_PORT "25" 42#define SMTP_PORT "25"
42#define SMTP_SSL_PORT "465" 43#define SMTP_SSL_PORT "465"
43#define POP3_PORT "110" 44#define POP3_PORT "110"
44#define POP3_SSL_PORT "995" 45#define POP3_SSL_PORT "995"
45#define NNTP_PORT "119" 46#define NNTP_PORT "119"
46#define NNTP_SSL_PORT "563" 47#define NNTP_SSL_PORT "563"
47 48
48/* used for decoding imapfoldername */ 49/* used for decoding imapfoldername */
49#define UNDEFINED 64 50#define UNDEFINED 64
50#define MAXLINE 76 51#define MAXLINE 76
51#define UTF16MASK 0x03FFUL 52#define UTF16MASK 0x03FFUL
52#define UTF16SHIFT 10 53#define UTF16SHIFT 10
53#define UTF16BASE 0x10000UL 54#define UTF16BASE 0x10000UL
54#define UTF16HIGHSTART 0xD800UL 55#define UTF16HIGHSTART 0xD800UL
55#define UTF16HIGHEND 0xDBFFUL 56#define UTF16HIGHEND 0xDBFFUL
56#define UTF16LOSTART 0xDC00UL 57#define UTF16LOSTART 0xDC00UL
57#define UTF16LOEND 0xDFFFUL 58#define UTF16LOEND 0xDFFFUL
58 59
59/* used for making menuids transparent */ 60/* used for making menuids transparent */
60#define FOLDER_MENU_REFRESH_HEADER 0 61#define FOLDER_MENU_REFRESH_HEADER 0
61#define FOLDER_MENU_DELETE_ALL_MAILS 1 62#define FOLDER_MENU_DELETE_ALL_MAILS 1
62#define FOLDER_MENU_NEW_SUBFOLDER 2 63#define FOLDER_MENU_NEW_SUBFOLDER 2
63#define FOLDER_MENU_DELETE_FOLDER 3 64#define FOLDER_MENU_DELETE_FOLDER 3
64#define FOLDER_MENU_MOVE_MAILS 4 65#define FOLDER_MENU_MOVE_MAILS 4
65 66
66#define SERVER_MENU_DISCONNECT 5 67#define SERVER_MENU_DISCONNECT 5
67#define SERVER_MENU_OFFLINE 6 68#define SERVER_MENU_OFFLINE 6
68#define SERVER_MENU_REFRESH_FOLDER 7 69#define SERVER_MENU_REFRESH_FOLDER 7
69#define SERVER_MENU_CREATE_FOLDER 8 70#define SERVER_MENU_CREATE_FOLDER 8
70#define SERVER_MENU_SUBSCRIBE 9 71#define SERVER_MENU_SUBSCRIBE 9
71 72
72#endif 73#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,85 +1,89 @@
1#include "mailistviewitem.h" 1#include "mailistviewitem.h"
2#include <libmailwrapper/abstractmail.h> 2#include <libmailwrapper/abstractmail.h>
3#include <qtextstream.h> 3
4#include <qpe/resource.h> 4/* OPIE */
5#include <opie2/oresource.h>
5#include <qpe/timestring.h> 6#include <qpe/timestring.h>
6 7
8/* QT */
9#include <qtextstream.h>
10
7MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) 11MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item )
8 :QListViewItem(parent,item),mail_data() 12 :QListViewItem(parent,item),mail_data()
9{ 13{
10} 14}
11 15
12void MailListViewItem::showEntry() 16void MailListViewItem::showEntry()
13{ 17{
14 if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) { 18 if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) {
15 setPixmap( 0, Resource::loadPixmap( "mail/kmmsgreplied") ); 19 setPixmap( 0, Opie::Core::OResource::loadPixmap( "mail/kmmsgreplied", Opie::Core::OResource::SmallIcon ) );
16 } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) { 20 } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) {
17 /* I think it looks nicer if there are not such a lot of icons but only on mails 21 /* I think it looks nicer if there are not such a lot of icons but only on mails
18 replied or new - Alwin*/ 22 replied or new - Alwin*/
19 //setPixmap( 0, Resource::loadPixmap( "mail/kmmsgunseen") ); 23 //setPixmap( 0, Opie::Core::OResource::loadPixmap( "mail/kmmsgunseen", Opie::Core::OResource::SmallIcon ) );
20 } else { 24 } else {
21 setPixmap( 0, Resource::loadPixmap( "mail/kmmsgnew") ); 25 setPixmap( 0, Opie::Core::OResource::loadPixmap( "mail/kmmsgnew", Opie::Core::OResource::SmallIcon ) );
22 } 26 }
23 double s = mail_data->Msgsize(); 27 double s = mail_data->Msgsize();
24 int w; 28 int w;
25 w=0; 29 w=0;
26 30
27 while (s>1024) { 31 while (s>1024) {
28 s/=1024; 32 s/=1024;
29 ++w; 33 ++w;
30 if (w>=2) break; 34 if (w>=2) break;
31 } 35 }
32 36
33 QString q=""; 37 QString q="";
34 QString fsize=""; 38 QString fsize="";
35 switch(w) { 39 switch(w) {
36 case 1: 40 case 1:
37 q="k"; 41 q="k";
38 break; 42 break;
39 case 2: 43 case 2:
40 q="M"; 44 q="M";
41 break; 45 break;
42 default: 46 default:
43 break; 47 break;
44 } 48 }
45 49
46 { 50 {
47 QTextOStream o(&fsize); 51 QTextOStream o(&fsize);
48 if (w>0) o.precision(2); else o.precision(0); 52 if (w>0) o.precision(2); else o.precision(0);
49 o.setf(QTextStream::fixed); 53 o.setf(QTextStream::fixed);
50 o << s << " " << q << "Byte"; 54 o << s << " " << q << "Byte";
51 } 55 }
52 setText(1,mail_data->getSubject()); 56 setText(1,mail_data->getSubject());
53 setText(2,mail_data->getFrom()); 57 setText(2,mail_data->getFrom());
54 setText(3,fsize); 58 setText(3,fsize);
55 setText(4,mail_data->getStringDate()); 59 setText(4,mail_data->getStringDate());
56} 60}
57 61
58QString MailListViewItem::key(int col,bool) const 62QString MailListViewItem::key(int col,bool) const
59{ 63{
60 QString temp; 64 QString temp;
61 if (col == 4) { 65 if (col == 4) {
62 temp.sprintf( "%08d",QDateTime().secsTo(mail_data->getDate())); 66 temp.sprintf( "%08d",QDateTime().secsTo(mail_data->getDate()));
63 return temp; 67 return temp;
64 } 68 }
65 if (col == 3) { 69 if (col == 3) {
66 temp.sprintf( "%020d",mail_data->Msgsize()); 70 temp.sprintf( "%020d",mail_data->Msgsize());
67 return temp; 71 return temp;
68 } 72 }
69 return text(col); 73 return text(col);
70} 74}
71 75
72void MailListViewItem::storeData(const RecMailP&data) 76void MailListViewItem::storeData(const RecMailP&data)
73{ 77{
74 mail_data = data; 78 mail_data = data;
75} 79}
76 80
77const RecMailP& MailListViewItem::data()const 81const RecMailP& MailListViewItem::data()const
78{ 82{
79 return mail_data; 83 return mail_data;
80} 84}
81 85
82MAILLIB::ATYPE MailListViewItem::wrapperType() 86MAILLIB::ATYPE MailListViewItem::wrapperType()
83{ 87{
84 if (!mail_data->Wrapper()) return MAILLIB::A_UNDEFINED; 88 if (!mail_data->Wrapper()) return MAILLIB::A_UNDEFINED;
85 return mail_data->Wrapper()->getType(); 89 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,179 +1,180 @@
1#include <qlabel.h> 1#include "defines.h"
2#include <qvbox.h> 2#include "mainwindow.h"
3#include <qheader.h>
4#include <qtimer.h>
5#include <qlayout.h>
6 3
4/* OPIE */
7#include <opie2/odebug.h> 5#include <opie2/odebug.h>
6#include <opie2/oresource.h>
8#include <qpe/qpeapplication.h> 7#include <qpe/qpeapplication.h>
9#include <qpe/qcopenvelope_qws.h> 8#include <qpe/qcopenvelope_qws.h>
10
11#include "defines.h"
12#include "mainwindow.h"
13
14using namespace Opie::Core; 9using namespace Opie::Core;
15 10
11/* QT */
12#include <qlabel.h>
13#include <qvbox.h>
14#include <qheader.h>
15#include <qtimer.h>
16#include <qlayout.h>
17
16MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 18MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
17 : QMainWindow( parent, name, flags ) 19 : QMainWindow( parent, name, flags )
18{ 20{
19
20 setCaption( tr( "Mail" ) ); 21 setCaption( tr( "Mail" ) );
21 setToolBarsMovable( false ); 22 setToolBarsMovable( false );
22 23
23 toolBar = new QToolBar( this ); 24 toolBar = new QToolBar( this );
24 menuBar = new QMenuBar( toolBar ); 25 menuBar = new QMenuBar( toolBar );
25 26
26 mailMenu = new QPopupMenu( menuBar ); 27 mailMenu = new QPopupMenu( menuBar );
27 menuBar->insertItem( tr( "Mail" ), mailMenu ); 28 menuBar->insertItem( tr( "Mail" ), mailMenu );
28 29
29 settingsMenu = new QPopupMenu( menuBar ); 30 settingsMenu = new QPopupMenu( menuBar );
30 menuBar->insertItem( tr( "Settings" ), settingsMenu ); 31 menuBar->insertItem( tr( "Settings" ), settingsMenu );
31 32
32 if (QApplication::desktop()->width()<330) { 33 if (QApplication::desktop()->width()<330) {
33 serverMenu = new QPopupMenu( mailMenu ); 34 serverMenu = new QPopupMenu( mailMenu );
34 folderMenu = new QPopupMenu( mailMenu ); 35 folderMenu = new QPopupMenu( mailMenu );
35 m_ServerMenuId = mailMenu->insertItem( tr( "Server" ), serverMenu ); 36 m_ServerMenuId = mailMenu->insertItem( tr( "Server" ), serverMenu );
36 m_FolderMenuId = mailMenu->insertItem( tr( "Folder" ), folderMenu ); 37 m_FolderMenuId = mailMenu->insertItem( tr( "Folder" ), folderMenu );
37 } else { 38 } else {
38 serverMenu = new QPopupMenu( menuBar ); 39 serverMenu = new QPopupMenu( menuBar );
39 folderMenu = new QPopupMenu( menuBar ); 40 folderMenu = new QPopupMenu( menuBar );
40 m_FolderMenuId = menuBar->insertItem( tr( "Folder" ), folderMenu ); 41 m_FolderMenuId = menuBar->insertItem( tr( "Folder" ), folderMenu );
41 m_ServerMenuId = menuBar->insertItem( tr( "Server" ), serverMenu ); 42 m_ServerMenuId = menuBar->insertItem( tr( "Server" ), serverMenu );
42 } 43 }
43 serverMenu->insertItem(tr("Disconnect"),SERVER_MENU_DISCONNECT); 44 serverMenu->insertItem(tr("Disconnect"),SERVER_MENU_DISCONNECT);
44 serverMenu->insertItem(tr("Set on/offline"),SERVER_MENU_OFFLINE); 45 serverMenu->insertItem(tr("Set on/offline"),SERVER_MENU_OFFLINE);
45 serverMenu->insertSeparator(); 46 serverMenu->insertSeparator();
46 serverMenu->insertItem(tr("Refresh folder list"),SERVER_MENU_REFRESH_FOLDER); 47 serverMenu->insertItem(tr("Refresh folder list"),SERVER_MENU_REFRESH_FOLDER);
47 serverMenu->insertItem(tr("Create new folder"),SERVER_MENU_CREATE_FOLDER); 48 serverMenu->insertItem(tr("Create new folder"),SERVER_MENU_CREATE_FOLDER);
48 serverMenu->insertSeparator(); 49 serverMenu->insertSeparator();
49 serverMenu->insertItem(tr("(Un-)Subscribe groups"),SERVER_MENU_SUBSCRIBE); 50 serverMenu->insertItem(tr("(Un-)Subscribe groups"),SERVER_MENU_SUBSCRIBE);
50 51
51 folderMenu->insertItem(tr("Refresh headerlist"),FOLDER_MENU_REFRESH_HEADER); 52 folderMenu->insertItem(tr("Refresh headerlist"),FOLDER_MENU_REFRESH_HEADER);
52 folderMenu->insertItem(tr("Delete all mails"),FOLDER_MENU_DELETE_ALL_MAILS); 53 folderMenu->insertItem(tr("Delete all mails"),FOLDER_MENU_DELETE_ALL_MAILS);
53 folderMenu->insertItem(tr("New subfolder"),FOLDER_MENU_NEW_SUBFOLDER); 54 folderMenu->insertItem(tr("New subfolder"),FOLDER_MENU_NEW_SUBFOLDER);
54 folderMenu->insertItem(tr("Delete folder"),FOLDER_MENU_DELETE_FOLDER); 55 folderMenu->insertItem(tr("Delete folder"),FOLDER_MENU_DELETE_FOLDER);
55 folderMenu->insertItem(tr("Move/Copie all mails"),FOLDER_MENU_MOVE_MAILS); 56 folderMenu->insertItem(tr("Move/Copie all mails"),FOLDER_MENU_MOVE_MAILS);
56 menuBar->setItemEnabled(m_ServerMenuId,false); 57 menuBar->setItemEnabled(m_ServerMenuId,false);
57 menuBar->setItemEnabled(m_FolderMenuId,false); 58 menuBar->setItemEnabled(m_FolderMenuId,false);
58 59
59 addToolBar( toolBar ); 60 addToolBar( toolBar );
60 toolBar->setHorizontalStretchable( true ); 61 toolBar->setHorizontalStretchable( true );
61 62
62 QLabel *spacer = new QLabel( toolBar ); 63 QLabel *spacer = new QLabel( toolBar );
63 spacer->setBackgroundMode( QWidget::PaletteButton ); 64 spacer->setBackgroundMode( QWidget::PaletteButton );
64 toolBar->setStretchableWidget( spacer ); 65 toolBar->setStretchableWidget( spacer );
65 66
66 readMail = new QAction(tr("Read current mail"),ICON_READMAIL,0,0,this); 67 readMail = new QAction(tr("Read current mail"),ICON_READMAIL,0,0,this);
67 readMail->addTo(toolBar); 68 readMail->addTo(toolBar);
68 readMail->addTo(mailMenu); 69 readMail->addTo(mailMenu);
69 connect(readMail,SIGNAL(activated()),this,SLOT(displayMail())); 70 connect(readMail,SIGNAL(activated()),this,SLOT(displayMail()));
70 71
71 composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL, 72 composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL,
72 0, 0, this ); 73 0, 0, this );
73 composeMail->addTo( toolBar ); 74 composeMail->addTo( toolBar );
74 composeMail->addTo( mailMenu ); 75 composeMail->addTo( mailMenu );
75 76
76 77
77 sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED, 78 sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED,
78 0, 0, this ); 79 0, 0, this );
79 sendQueued->addTo( toolBar ); 80 sendQueued->addTo( toolBar );
80 sendQueued->addTo( mailMenu ); 81 sendQueued->addTo( mailMenu );
81 82
82 /* 83 /*
83 syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, 84 syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC,
84 0, 0, this ); 85 0, 0, this );
85 syncFolders->addTo( toolBar ); 86 syncFolders->addTo( toolBar );
86 syncFolders->addTo( mailMenu ); 87 syncFolders->addTo( mailMenu );
87 */ 88 */
88 89
89 showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS, 90 showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS,
90 0, 0, this, 0, true ); 91 0, 0, this, 0, true );
91 showFolders->addTo( toolBar ); 92 showFolders->addTo( toolBar );
92 showFolders->addTo( mailMenu ); 93 showFolders->addTo( mailMenu );
93 showFolders->setOn( true ); 94 showFolders->setOn( true );
94 connect(showFolders, SIGNAL( toggled(bool) ), 95 connect(showFolders, SIGNAL( toggled(bool) ),
95 SLOT( slotShowFolders(bool) ) ); 96 SLOT( slotShowFolders(bool) ) );
96 97
97 /* 98 /*
98 searchMails = new QAction( tr( "Search mails" ), QIconSet( Resource::loadPixmap("find") ), 99 searchMails = new QAction( tr( "Search mails" ), OResource::loadPixmap("find", OResource::SmallIcon ),
99 0, 0, this ); 100 0, 0, this );
100 searchMails->addTo( toolBar ); 101 searchMails->addTo( toolBar );
101 searchMails->addTo( mailMenu ); 102 searchMails->addTo( mailMenu );
102 */ 103 */
103 104
104 deleteMails = new QAction(tr("Delete Mail"), QIconSet( Resource::loadPixmap("trash")), 0, 0, this); 105 deleteMails = new QAction(tr("Delete Mail"), OResource::loadPixmap("trash", OResource::SmallIcon ), 0, 0, this);
105 deleteMails->addTo( toolBar ); 106 deleteMails->addTo( toolBar );
106 deleteMails->addTo( mailMenu ); 107 deleteMails->addTo( mailMenu );
107 connect( deleteMails, SIGNAL( activated() ), 108 connect( deleteMails, SIGNAL( activated() ),
108 SLOT( slotDeleteMail() ) ); 109 SLOT( slotDeleteMail() ) );
109 110
110 editSettings = new QAction( tr( "Edit settings" ), QIconSet( Resource::loadPixmap("SettingsIcon") ) , 111 editSettings = new QAction( tr( "Edit settings" ), OResource::loadPixmap("SettingsIcon", OResource::SmallIcon ) ,
111 0, 0, this ); 112 0, 0, this );
112 editSettings->addTo( settingsMenu ); 113 editSettings->addTo( settingsMenu );
113 connect( editSettings, SIGNAL( activated() ), 114 connect( editSettings, SIGNAL( activated() ),
114 SLOT( slotEditSettings() ) ); 115 SLOT( slotEditSettings() ) );
115 editAccounts = new QAction( tr( "Configure accounts" ), QIconSet( Resource::loadPixmap("mail/editaccounts") ) , 116 editAccounts = new QAction( tr( "Configure accounts" ), OResource::loadPixmap("mail/editaccounts", OResource::SmallIcon ) ,
116 0, 0, this ); 117 0, 0, this );
117 editAccounts->addTo( settingsMenu ); 118 editAccounts->addTo( settingsMenu );
118 119
119 120
120 QWidget *view = new QWidget( this ); 121 QWidget *view = new QWidget( this );
121 setCentralWidget( view ); 122 setCentralWidget( view );
122 layout = new QBoxLayout ( view, QBoxLayout::LeftToRight ); 123 layout = new QBoxLayout ( view, QBoxLayout::LeftToRight );
123 124
124 folderView = new AccountView( view ); 125 folderView = new AccountView( view );
125 folderView->header()->hide(); 126 folderView->header()->hide();
126 folderView->setRootIsDecorated( true ); 127 folderView->setRootIsDecorated( true );
127 folderView->addColumn( tr( "Mailbox" ) ); 128 folderView->addColumn( tr( "Mailbox" ) );
128 connect(folderView,SIGNAL(serverSelected(int)),this,SLOT(serverSelected(int))); 129 connect(folderView,SIGNAL(serverSelected(int)),this,SLOT(serverSelected(int)));
129 connect(serverMenu,SIGNAL(activated(int)),folderView,SLOT(slotContextMenu(int))); 130 connect(serverMenu,SIGNAL(activated(int)),folderView,SLOT(slotContextMenu(int)));
130 connect(folderMenu,SIGNAL(activated(int)),folderView,SLOT(slotContextMenu(int))); 131 connect(folderMenu,SIGNAL(activated(int)),folderView,SLOT(slotContextMenu(int)));
131 connect(this,SIGNAL(settingsChanged()),folderView,SLOT(readSettings())); 132 connect(this,SIGNAL(settingsChanged()),folderView,SLOT(readSettings()));
132 133
133 134
134 layout->addWidget( folderView ); 135 layout->addWidget( folderView );
135 136
136 mailView = new QListView( view ); 137 mailView = new QListView( view );
137 mailView->addColumn( "" ); 138 mailView->addColumn( "" );
138 mailView->addColumn( tr( "Subject" ),QListView::Manual ); 139 mailView->addColumn( tr( "Subject" ),QListView::Manual );
139 mailView->addColumn( tr( "Sender" ),QListView::Manual ); 140 mailView->addColumn( tr( "Sender" ),QListView::Manual );
140 mailView->addColumn( tr( "Size" ),QListView::Manual); 141 mailView->addColumn( tr( "Size" ),QListView::Manual);
141 mailView->addColumn( tr( "Date" )); 142 mailView->addColumn( tr( "Date" ));
142 mailView->setAllColumnsShowFocus(true); 143 mailView->setAllColumnsShowFocus(true);
143 mailView->setShowSortIndicator(true); 144 mailView->setShowSortIndicator(true);
144 mailView->setSorting(4,false); 145 mailView->setSorting(4,false);
145 146
146 layout->addWidget( mailView ); 147 layout->addWidget( mailView );
147 layout->setStretchFactor( folderView, 1 ); 148 layout->setStretchFactor( folderView, 1 );
148 layout->setStretchFactor( mailView, 2 ); 149 layout->setStretchFactor( mailView, 2 );
149 150
150 m_Rotate = (QApplication::desktop()->width() > QApplication::desktop()->height()?0:90); 151 m_Rotate = (QApplication::desktop()->width() > QApplication::desktop()->height()?0:90);
151 152
152 slotAdjustLayout(); 153 slotAdjustLayout();
153 154
154 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); 155 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold);
155 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); 156 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold);
156 157
157 connect( mailView, SIGNAL( mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ),this, 158 connect( mailView, SIGNAL( mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ),this,
158 SLOT( mailLeftClicked(int,QListViewItem*,const QPoint&,int) ) ); 159 SLOT( mailLeftClicked(int,QListViewItem*,const QPoint&,int) ) );
159 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, 160 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
160 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); 161 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) );
161 162
162 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), 163 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)),
163 this,SLOT(refreshMailView(const QValueList<RecMailP>&))); 164 this,SLOT(refreshMailView(const QValueList<RecMailP>&)));
164 165
165 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); 166 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
166 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); 167 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
167 168
168// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); 169// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
169 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); 170 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
170 // Added by Stefan Eilers to allow starting by addressbook.. 171 // Added by Stefan Eilers to allow starting by addressbook..
171 // copied from old mail2 172 // copied from old mail2
172 173
173#if !defined(QT_NO_COP) 174#if !defined(QT_NO_COP)
174 connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), 175 connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ),
175 this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); 176 this, SLOT( appMessage(const QCString&,const QByteArray&) ) );
176 m_sysChannel = new QCopChannel( "QPE/System", this ); 177 m_sysChannel = new QCopChannel( "QPE/System", this );
177 connect( m_sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ), 178 connect( m_sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ),
178 this, SLOT( systemMessage(const QCString&,const QByteArray&) ) ); 179 this, SLOT( systemMessage(const QCString&,const QByteArray&) ) );
179#endif 180#endif
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,92 +1,91 @@
1 1
2#include "settingsdialog.h" 2#include "settingsdialog.h"
3#include "opiemail.h" 3#include "opiemail.h"
4#include "editaccounts.h" 4#include "editaccounts.h"
5#include "composemail.h" 5#include "composemail.h"
6#include "mailistviewitem.h" 6#include "mailistviewitem.h"
7#include "viewmail.h" 7#include "viewmail.h"
8#include "selectstore.h" 8#include "selectstore.h"
9#include "selectsmtp.h" 9#include "selectsmtp.h"
10 10
11#include <libmailwrapper/smtpwrapper.h> 11#include <libmailwrapper/smtpwrapper.h>
12#include <libmailwrapper/mailtypes.h> 12#include <libmailwrapper/mailtypes.h>
13#include <libmailwrapper/abstractmail.h> 13#include <libmailwrapper/abstractmail.h>
14
14/* OPIE */ 15/* OPIE */
15#include <opie2/odebug.h> 16#include <opie2/odebug.h>
16#include <qpe/resource.h>
17#include <qpe/qpeapplication.h> 17#include <qpe/qpeapplication.h>
18#include <qpe/config.h> 18#include <qpe/config.h>
19using namespace Opie::Core;
19 20
20/* QT */ 21/* QT */
21#include <qmap.h> 22#include <qmap.h>
22#include <qvaluelist.h> 23#include <qvaluelist.h>
23 24
24/* UNIX */ 25/* UNIX */
25#include <signal.h> 26#include <signal.h>
26 27
27using namespace Opie::Core;
28
29typedef QMapNode<QString,QString> tkeyvalues; 28typedef QMapNode<QString,QString> tkeyvalues;
30typedef QValueList<tkeyvalues> tvaluelist; 29typedef QValueList<tkeyvalues> tvaluelist;
31 30
32class ValueExplode 31class ValueExplode
33{ 32{
34protected: 33protected:
35 //! what was parsed last 34 //! what was parsed last
36 tvaluelist m_LastParsed; 35 tvaluelist m_LastParsed;
37 //! the delemiter to use 36 //! the delemiter to use
38 QString mDelemiter; 37 QString mDelemiter;
39 //! the inner delemiter 38 //! the inner delemiter
40 QString m2Delemiter; 39 QString m2Delemiter;
41 //! the real split routine 40 //! the real split routine
42 void splitit(); 41 void splitit();
43 //! the content 42 //! the content
44 QString m_Command; 43 QString m_Command;
45 //! constructor 44 //! constructor
46 ValueExplode(){} 45 ValueExplode(){}
47public: 46public:
48 //! constructor 47 //! constructor
49 /*! 48 /*!
50 * \param aCommand the string to be splitted 49 * \param aCommand the string to be splitted
51 * \param aDelemiter which sign will be the delemiter character 50 * \param aDelemiter which sign will be the delemiter character
52 * \param a2Delemiter which sign will delemiter the key-value-pairs between other delemiters 51 * \param a2Delemiter which sign will delemiter the key-value-pairs between other delemiters
53 */ 52 */
54 ValueExplode(const QString&aCommand,const char aDelemiter = '&',const char a2Delemiter='='); 53 ValueExplode(const QString&aCommand,const char aDelemiter = '&',const char a2Delemiter='=');
55 //! destructor 54 //! destructor
56 virtual ~ValueExplode(); 55 virtual ~ValueExplode();
57 //! assigen operator 56 //! assigen operator
58 /*! 57 /*!
59 * \return a list of substrings 58 * \return a list of substrings
60 */ 59 */
61 operator const tvaluelist& (){return m_LastParsed;} 60 operator const tvaluelist& (){return m_LastParsed;}
62}; 61};
63 62
64ValueExplode::~ValueExplode() 63ValueExplode::~ValueExplode()
65{ 64{
66} 65}
67 66
68ValueExplode::ValueExplode(const QString&aCommand,const char aDelemiter,const char a2Delemiter) 67ValueExplode::ValueExplode(const QString&aCommand,const char aDelemiter,const char a2Delemiter)
69 :m_LastParsed(),m_Command(aCommand) 68 :m_LastParsed(),m_Command(aCommand)
70{ 69{
71 mDelemiter = aDelemiter; 70 mDelemiter = aDelemiter;
72 m2Delemiter = a2Delemiter; 71 m2Delemiter = a2Delemiter;
73 splitit(); 72 splitit();
74} 73}
75 74
76void ValueExplode::splitit() 75void ValueExplode::splitit()
77{ 76{
78 QString iLine; 77 QString iLine;
79 m_LastParsed.clear(); 78 m_LastParsed.clear();
80 if (mDelemiter.isEmpty()||m2Delemiter.isEmpty()) { 79 if (mDelemiter.isEmpty()||m2Delemiter.isEmpty()) {
81 m_LastParsed.append(tkeyvalues(m_Command,"")); 80 m_LastParsed.append(tkeyvalues(m_Command,""));
82 return; 81 return;
83 } 82 }
84 int pos,pos2; 83 int pos,pos2;
85 unsigned startpos = 0; 84 unsigned startpos = 0;
86 iLine = m_Command; 85 iLine = m_Command;
87 while ( (pos = iLine.find(mDelemiter,startpos))!=-1) { 86 while ( (pos = iLine.find(mDelemiter,startpos))!=-1) {
88 pos2 = iLine.find(m2Delemiter,startpos); 87 pos2 = iLine.find(m2Delemiter,startpos);
89 if (pos2==-1||pos2>pos) { 88 if (pos2==-1||pos2>pos) {
90 m_LastParsed.append(tkeyvalues(iLine.mid(startpos,pos-startpos),"")); 89 m_LastParsed.append(tkeyvalues(iLine.mid(startpos,pos-startpos),""));
91 } else { 90 } else {
92 m_LastParsed.append(tkeyvalues(iLine.mid(startpos,pos2-startpos),iLine.mid(pos2+1,pos-pos2-1))); 91 m_LastParsed.append(tkeyvalues(iLine.mid(startpos,pos2-startpos),iLine.mid(pos2+1,pos-pos2-1)));
@@ -217,129 +216,129 @@ void OpieMail::slotSendQueued()
217 selsmtp.setSelectionlist(&smtpList); 216 selsmtp.setSelectionlist(&smtpList);
218 if ( QPEApplication::execDialog( &selsmtp ) == QDialog::Accepted ) 217 if ( QPEApplication::execDialog( &selsmtp ) == QDialog::Accepted )
219 { 218 {
220 smtp = selsmtp.selected_smtp(); 219 smtp = selsmtp.selected_smtp();
221 } 220 }
222 } 221 }
223 if (smtp) 222 if (smtp)
224 { 223 {
225 SMTPwrapper * wrap = new SMTPwrapper(smtp); 224 SMTPwrapper * wrap = new SMTPwrapper(smtp);
226 if ( wrap->flushOutbox() ) 225 if ( wrap->flushOutbox() )
227 { 226 {
228 QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); 227 QMessageBox::information(0,tr("Info"),tr("Mail queue flushed"));
229 } 228 }
230 delete wrap; 229 delete wrap;
231 } 230 }
232} 231}
233 232
234void OpieMail::slotSearchMails() 233void OpieMail::slotSearchMails()
235{ 234{
236 odebug << "Search Mails" << oendl; 235 odebug << "Search Mails" << oendl;
237} 236}
238 237
239void OpieMail::slotEditSettings() 238void OpieMail::slotEditSettings()
240{ 239{
241 SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); 240 SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp );
242 if (QPEApplication::execDialog( &settingsDialog )) { 241 if (QPEApplication::execDialog( &settingsDialog )) {
243 Config cfg("mail"); 242 Config cfg("mail");
244 cfg.setGroup( "Settings" ); 243 cfg.setGroup( "Settings" );
245 m_clickopens = cfg.readBoolEntry("clickOpensMail",true); 244 m_clickopens = cfg.readBoolEntry("clickOpensMail",true);
246 emit settingsChanged(); 245 emit settingsChanged();
247 } 246 }
248} 247}
249 248
250void OpieMail::slotEditAccounts() 249void OpieMail::slotEditAccounts()
251{ 250{
252 odebug << "Edit Accounts" << oendl; 251 odebug << "Edit Accounts" << oendl;
253 EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); 252 EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp );
254 eaDialog.slotAdjustColumns(); 253 eaDialog.slotAdjustColumns();
255 if (QPEApplication::execDialog( &eaDialog )==QDialog::Rejected);// return; 254 if (QPEApplication::execDialog( &eaDialog )==QDialog::Rejected);// return;
256 255
257 if ( settings ) delete settings; 256 if ( settings ) delete settings;
258 settings = new Settings(); 257 settings = new Settings();
259 mailView->clear(); 258 mailView->clear();
260 folderView->populate( settings->getAccounts() ); 259 folderView->populate( settings->getAccounts() );
261} 260}
262 261
263void OpieMail::displayMail() 262void OpieMail::displayMail()
264{ 263{
265 QListViewItem*item = mailView->currentItem(); 264 QListViewItem*item = mailView->currentItem();
266 if (!item) return; 265 if (!item) return;
267 RecMailP mail = ((MailListViewItem*)item)->data(); 266 RecMailP mail = ((MailListViewItem*)item)->data();
268 RecBodyP body = folderView->fetchBody(mail); 267 RecBodyP body = folderView->fetchBody(mail);
269 ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); 268 ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp );
270 readMail.setBody( body ); 269 readMail.setBody( body );
271 readMail.setMail( mail ); 270 readMail.setMail( mail );
272 readMail.showMaximized(); 271 readMail.showMaximized();
273 readMail.exec(); 272 readMail.exec();
274 273
275 if ( readMail.deleted ) 274 if ( readMail.deleted )
276 { 275 {
277 folderView->refreshCurrent(); 276 folderView->refreshCurrent();
278 } 277 }
279 else 278 else
280 { 279 {
281 ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "" ) ); 280 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
282 } 281 }
283} 282}
284 283
285void OpieMail::slotDeleteMail() 284void OpieMail::slotDeleteMail()
286{ 285{
287 if (!mailView->currentItem()) return; 286 if (!mailView->currentItem()) return;
288 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); 287 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
289 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 ) 288 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 )
290 { 289 {
291 mail->Wrapper()->deleteMail( mail ); 290 mail->Wrapper()->deleteMail( mail );
292 folderView->refreshCurrent(); 291 folderView->refreshCurrent();
293 } 292 }
294} 293}
295 294
296void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) 295void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
297{ 296{
298 if (!mailView->currentItem()) return; 297 if (!mailView->currentItem()) return;
299 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); 298 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType();
300 /* just the RIGHT button - or hold on pda */ 299 /* just the RIGHT button - or hold on pda */
301 if (button!=2) {return;} 300 if (button!=2) {return;}
302 odebug << "Event right/hold" << oendl; 301 odebug << "Event right/hold" << oendl;
303 if (!item) return; 302 if (!item) return;
304 QPopupMenu *m = new QPopupMenu(0); 303 QPopupMenu *m = new QPopupMenu(0);
305 if (m) 304 if (m)
306 { 305 {
307 if (mailtype==MAILLIB::A_NNTP) { 306 if (mailtype==MAILLIB::A_NNTP) {
308 m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); 307 m->insertItem(tr("Read this posting"),this,SLOT(displayMail()));
309// m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); 308// m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail()));
310 } else { 309 } else {
311 if (folderView->currentisDraft()) { 310 if (folderView->currentisDraft()) {
312 m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); 311 m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail()));
313 } 312 }
314 m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); 313 m->insertItem(tr("Read this mail"),this,SLOT(displayMail()));
315 m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); 314 m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail()));
316 m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail())); 315 m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail()));
317 } 316 }
318 m->setFocus(); 317 m->setFocus();
319 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); 318 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
320 delete m; 319 delete m;
321 } 320 }
322} 321}
323 322
324void OpieMail::slotShowFolders( bool show ) 323void OpieMail::slotShowFolders( bool show )
325{ 324{
326 odebug << "Show Folders" << oendl; 325 odebug << "Show Folders" << oendl;
327 if ( show && folderView->isHidden() ) 326 if ( show && folderView->isHidden() )
328 { 327 {
329 odebug << "-> showing" << oendl; 328 odebug << "-> showing" << oendl;
330 folderView->show(); 329 folderView->show();
331 } 330 }
332 else if ( !show && !folderView->isHidden() ) 331 else if ( !show && !folderView->isHidden() )
333 { 332 {
334 odebug << "-> hiding" << oendl; 333 odebug << "-> hiding" << oendl;
335 folderView->hide(); 334 folderView->hide();
336 } 335 }
337} 336}
338 337
339void OpieMail::refreshMailView(const QValueList<RecMailP>&list) 338void OpieMail::refreshMailView(const QValueList<RecMailP>&list)
340{ 339{
341 MailListViewItem*item = 0; 340 MailListViewItem*item = 0;
342 mailView->clear(); 341 mailView->clear();
343 342
344 QValueList<RecMailP>::ConstIterator it; 343 QValueList<RecMailP>::ConstIterator it;
345 for (it = list.begin(); it != list.end();++it) 344 for (it = list.begin(); it != list.end();++it)
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 @@
1#include "viewmailbase.h"
2
3/* OPIE */
4#include <opie2/oresource.h>
5using namespace Opie::Core;
6
7/* QT */
1#include <qtextbrowser.h> 8#include <qtextbrowser.h>
2#include <qlistview.h> 9#include <qlistview.h>
3#include <qaction.h> 10#include <qaction.h>
4#include <qlabel.h> 11#include <qlabel.h>
5#include <qvbox.h> 12#include <qvbox.h>
6
7#include <qtoolbar.h> 13#include <qtoolbar.h>
8#include <qlayout.h> 14#include <qlayout.h>
9#include <qmenubar.h> 15#include <qmenubar.h>
10#include <qpe/resource.h>
11
12#include "viewmailbase.h"
13//#include "opendiag.h"
14 16
15ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl) 17ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl)
16 : QMainWindow(parent, name, fl) 18 : QMainWindow(parent, name, fl)
17{ 19{
18 setCaption(tr("E-Mail view")); 20 setCaption(tr("E-Mail view"));
19 setToolBarsMovable(false); 21 setToolBarsMovable(false);
20 22
21 toolbar = new QToolBar(this); 23 toolbar = new QToolBar(this);
22 menubar = new QMenuBar( toolbar ); 24 menubar = new QMenuBar( toolbar );
23 mailmenu = new QPopupMenu( menubar ); 25 mailmenu = new QPopupMenu( menubar );
24 menubar->insertItem( tr( "Mail" ), mailmenu ); 26 menubar->insertItem( tr( "Mail" ), mailmenu );
25 toolbar->setHorizontalStretchable(true); 27 toolbar->setHorizontalStretchable(true);
26 addToolBar(toolbar); 28 addToolBar(toolbar);
27 QLabel *spacer = new QLabel(toolbar); 29 QLabel *spacer = new QLabel(toolbar);
28 spacer->setBackgroundMode(QWidget::PaletteButton); 30 spacer->setBackgroundMode(QWidget::PaletteButton);
29 toolbar->setStretchableWidget(spacer); 31 toolbar->setStretchableWidget(spacer);
30 32
31 reply = new QAction(tr("Reply"), QIconSet(Resource::loadPixmap("mail/reply")), 0, 0, this); 33 reply = new QAction(tr("Reply"), OResource::loadPixmap("mail/reply", OResource::SmallIcon), 0, 0, this);
32 reply->addTo(toolbar); 34 reply->addTo(toolbar);
33 reply->addTo(mailmenu); 35 reply->addTo(mailmenu);
34 36
35 forward = new QAction(tr("Forward"), QIconSet(Resource::loadPixmap("mail/forward")), 0, 0, this); 37 forward = new QAction(tr("Forward"), OResource::loadPixmap("mail/forward", OResource::SmallIcon), 0, 0, this);
36 forward->addTo(toolbar); 38 forward->addTo(toolbar);
37 forward->addTo(mailmenu); 39 forward->addTo(mailmenu);
38 40
39 attachbutton = new QAction(tr("Attachments"), QIconSet(Resource::loadPixmap("mail/attach")), 0, 0, this, 0, true); 41 attachbutton = new QAction(tr("Attachments"), OResource::loadPixmap("mail/attach", OResource::SmallIcon), 0, 0, this, 0, true);
40 attachbutton->addTo(toolbar); 42 attachbutton->addTo(toolbar);
41 attachbutton->addTo(mailmenu); 43 attachbutton->addTo(mailmenu);
42 connect(attachbutton, SIGNAL(toggled(bool)), SLOT(slotChangeAttachview(bool))); 44 connect(attachbutton, SIGNAL(toggled(bool)), SLOT(slotChangeAttachview(bool)));
43 45
44 46
45 showHtml = new QAction( tr( "Show Html" ), QIconSet( Resource::loadPixmap( "mail/html" ) ), 0, 0, this, 0, true ); 47 showHtml = new QAction( tr( "Show Html" ), OResource::loadPixmap( "mail/html", OResource::SmallIcon ), 0, 0, this, 0, true );
46 showHtml->addTo( toolbar ); 48 showHtml->addTo( toolbar );
47 showHtml->addTo( mailmenu ); 49 showHtml->addTo( mailmenu );
48 50
49 showPicsInline= new QAction(tr("Show image preview inline"), QIconSet(Resource::loadPixmap("pixmap")), 0, 0, this); 51 showPicsInline= new QAction(tr("Show image preview inline"), OResource::loadPixmap("pixmap", OResource::SmallIcon), 0, 0, this);
50 showPicsInline->setToggleAction(true); 52 showPicsInline->setToggleAction(true);
51 showPicsInline->addTo(toolbar); 53 showPicsInline->addTo(toolbar);
52 showPicsInline->addTo(mailmenu); 54 showPicsInline->addTo(mailmenu);
53 55
54 deleteMail = new QAction(tr("Delete Mail"), QIconSet(Resource::loadPixmap("trash")), 0, 0, this); 56 deleteMail = new QAction(tr("Delete Mail"), OResource::loadPixmap("trash", OResource::SmallIcon), 0, 0, this);
55 deleteMail->addTo(toolbar); 57 deleteMail->addTo(toolbar);
56 deleteMail->addTo(mailmenu); 58 deleteMail->addTo(mailmenu);
57 59
58 QVBox * view = new QVBox(this); 60 QVBox * view = new QVBox(this);
59 view->setSpacing(1); 61 view->setSpacing(1);
60 view->setMargin(0); 62 view->setMargin(0);
61 setCentralWidget(view); 63 setCentralWidget(view);
62 64
63 attachments = new QListView(view); 65 attachments = new QListView(view);
64 attachments->setMinimumHeight(90); 66 attachments->setMinimumHeight(90);
65 attachments->setMaximumHeight(90); 67 attachments->setMaximumHeight(90);
66 attachments->setAllColumnsShowFocus(true); 68 attachments->setAllColumnsShowFocus(true);
67 attachments->addColumn("Mime Type", 60); 69 attachments->addColumn("Mime Type", 60);
68 attachments->addColumn(tr("Description"), 100); 70 attachments->addColumn(tr("Description"), 100);
69 attachments->addColumn(tr("Filename"), 80); 71 attachments->addColumn(tr("Filename"), 80);
70 attachments->addColumn(tr("Size"), 80); 72 attachments->addColumn(tr("Size"), 80);
71 attachments->setSorting(-1); 73 attachments->setSorting(-1);
72 74
73 browser = new QTextBrowser(view); 75 browser = new QTextBrowser(view);
74 adjustSize(); 76 adjustSize();
75 attachments->hide(); 77 attachments->hide();
76} 78}
77 79
78void ViewMailBase::slotChangeAttachview(bool state) 80void ViewMailBase::slotChangeAttachview(bool state)
79{ 81{
80 if (state) attachments->show(); 82 if (state) attachments->show();
81 else attachments->hide(); 83 else attachments->hide();
82} 84}
83 85
84void ViewMailBase::keyPressEvent ( QKeyEvent * e ) 86void ViewMailBase::keyPressEvent ( QKeyEvent * e )
85{ 87{
86 if( e->key()==Qt::Key_Escape ) { 88 if( e->key()==Qt::Key_Escape ) {
87 close(); 89 close();
88 e->accept(); 90 e->accept();
89 return; 91 return;
90 } 92 }
91 QWidget::keyPressEvent(e); 93 QWidget::keyPressEvent(e);
92} 94}