summaryrefslogtreecommitdiffabout
path: root/kmicromail
Unidiff
Diffstat (limited to 'kmicromail') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/accountitem.cpp4
-rw-r--r--kmicromail/accountview.cpp15
-rw-r--r--kmicromail/mainwindow.cpp24
-rw-r--r--kmicromail/mainwindow.h1
-rw-r--r--kmicromail/opiemail.cpp4
5 files changed, 39 insertions, 9 deletions
diff --git a/kmicromail/accountitem.cpp b/kmicromail/accountitem.cpp
index fcb2052..985a762 100644
--- a/kmicromail/accountitem.cpp
+++ b/kmicromail/accountitem.cpp
@@ -690,195 +690,195 @@ QPopupMenu * IMAPfolderItem::getContextMenu()
690 { 690 {
691 m->insertItem(i18n("Delete folder"),3); 691 m->insertItem(i18n("Delete folder"),3);
692 } 692 }
693 } 693 }
694 return m; 694 return m;
695} 695}
696 696
697void IMAPfolderItem::createNewFolder() 697void IMAPfolderItem::createNewFolder()
698{ 698{
699 Newmdirdlg ndirdlg; 699 Newmdirdlg ndirdlg;
700 //ndirdlg.showMaximized(); 700 //ndirdlg.showMaximized();
701 if ( ndirdlg.exec() ) 701 if ( ndirdlg.exec() )
702 { 702 {
703 QString ndir = ndirdlg.Newdir(); 703 QString ndir = ndirdlg.Newdir();
704 bool makesubs = ndirdlg.subpossible(); 704 bool makesubs = ndirdlg.subpossible();
705 QString delemiter = Delemiter(); 705 QString delemiter = Delemiter();
706 if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) 706 if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs))
707 { 707 {
708 imap->refreshFolders(true); 708 imap->refreshFolders(true);
709 } 709 }
710 } 710 }
711} 711}
712 712
713void IMAPfolderItem::deleteFolder() 713void IMAPfolderItem::deleteFolder()
714{ 714{
715 int yesno = QMessageBox::warning(0,i18n("Delete folder"), 715 int yesno = QMessageBox::warning(0,i18n("Delete folder"),
716 i18n("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>").arg(folder->getDisplayName()), 716 i18n("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>").arg(folder->getDisplayName()),
717 i18n("Yes"), 717 i18n("Yes"),
718 i18n("No"),QString::null,1,1); 718 i18n("No"),QString::null,1,1);
719 719
720 if (yesno == 0) 720 if (yesno == 0)
721 { 721 {
722 if (imap->getWrapper()->deleteMbox(folder)) 722 if (imap->getWrapper()->deleteMbox(folder))
723 { 723 {
724 QListView*v=listView(); 724 QListView*v=listView();
725 IMAPviewItem * box = imap; 725 IMAPviewItem * box = imap;
726 /* be carefull - after that this object is destroyd so don't use 726 /* be carefull - after that this object is destroyd so don't use
727 * any member of it after that call!!*/ 727 * any member of it after that call!!*/
728 imap->refreshFolders(true); 728 imap->refreshFolders(true);
729 if (v) 729 if (v)
730 { 730 {
731 v->setSelected(box,true); 731 v->setSelected(box,true);
732 } 732 }
733 } 733 }
734 } 734 }
735} 735}
736 736
737void IMAPfolderItem::downloadMails() 737void IMAPfolderItem::downloadMails()
738{ 738{
739 AccountView*bl = imap->accountView(); 739 AccountView*bl = imap->accountView();
740 if (!bl) return; 740 if (!bl) return;
741 bl->downloadMails(folder,imap->getWrapper()); 741 bl->downloadMails(folder,imap->getWrapper());
742} 742}
743 743
744void IMAPfolderItem::contextMenuSelected(int id) 744void IMAPfolderItem::contextMenuSelected(int id)
745{ 745{
746 746
747 AccountView * view = (AccountView*)listView(); 747 AccountView * view = (AccountView*)listView();
748 switch(id) 748 switch(id)
749 { 749 {
750 case 0: 750 case 0:
751 view->refreshCurrent(); 751 view->refreshCurrent();
752 break; 752 break;
753 case 1: 753 case 1:
754 deleteAllMail(imap->getWrapper(),folder); 754 deleteAllMail(imap->getWrapper(),folder);
755 break; 755 break;
756 case 2: 756 case 2:
757 createNewFolder(); 757 createNewFolder();
758 break; 758 break;
759 case 3: 759 case 3:
760 deleteFolder(); 760 deleteFolder();
761 break; 761 break;
762 case 4: 762 case 4:
763 downloadMails(); 763 downloadMails();
764 break; 764 break;
765 case GET_NEW_MAILS: // daunlood 765 case GET_NEW_MAILS: // daunlood
766 { 766 {
767 if (!view) return; 767 if (!view) return;
768 view->downloadMailsInbox(getFolder(),imap->getWrapper()); 768 view->downloadMailsInbox(getFolder(),imap->getWrapper());
769 } 769 }
770 break; 770 break;
771 default: 771 default:
772 break; 772 break;
773 } 773 }
774} 774}
775 775
776/** 776/**
777 * MH Account stuff 777 * MH Account stuff
778 */ 778 */
779/* MH is a little bit different - the top folder can contains messages other than in IMAP and 779/* MH is a little bit different - the top folder can contains messages other than in IMAP and
780 POP3 and MBOX */ 780 POP3 and MBOX */
781MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) 781MHviewItem::MHviewItem( const QString&aPath, AccountView *parent )
782 : AccountViewItem( parent ) 782 : AccountViewItem( parent )
783{ 783{
784 m_Path = aPath; 784 m_Path = aPath;
785 /* be carefull - the space within settext is wanted - thats why the string twice */ 785 /* be carefull - the space within settext is wanted - thats why the string twice */
786 wrapper = AbstractMail::getWrapper( m_Path,"Local Folders"); 786 wrapper = AbstractMail::getWrapper( m_Path,"Local Mailfolders");
787 setPixmap( 0, PIXMAP_LOCALFOLDER ); 787 setPixmap( 0, PIXMAP_LOCALFOLDER );
788 setText( 0, " Local Folders" ); 788 setText( 0, i18n(" Local Mailfolders") );
789 setOpen( true ); 789 setOpen( true );
790 folder = 0; 790 folder = 0;
791} 791}
792 792
793MHviewItem::~MHviewItem() 793MHviewItem::~MHviewItem()
794{ 794{
795 delete wrapper; 795 delete wrapper;
796} 796}
797 797
798AbstractMail *MHviewItem::getWrapper() 798AbstractMail *MHviewItem::getWrapper()
799{ 799{
800 return wrapper; 800 return wrapper;
801} 801}
802 802
803void MHviewItem::refresh( QValueList<RecMailP> & target) 803void MHviewItem::refresh( QValueList<RecMailP> & target)
804{ 804{
805 refresh(false); 805 refresh(false);
806 getWrapper()->listMessages( "",target ); 806 getWrapper()->listMessages( "",target );
807} 807}
808 808
809void MHviewItem::refresh(bool force) 809void MHviewItem::refresh(bool force)
810{ 810{
811 if (childCount()>0 && force==false) return; 811 if (childCount()>0 && force==false) return;
812 removeChilds(); 812 removeChilds();
813 currentFolders.clear(); 813 currentFolders.clear();
814 QValueList<FolderP> *folders = wrapper->listFolders(); 814 QValueList<FolderP> *folders = wrapper->listFolders();
815 QValueList<FolderP>::ConstIterator it; 815 QValueList<FolderP>::ConstIterator it;
816 MHfolderItem*item = 0; 816 MHfolderItem*item = 0;
817 MHfolderItem*pmaster = 0; 817 MHfolderItem*pmaster = 0;
818 QString fname = ""; 818 QString fname = "";
819 int pos; 819 int pos;
820 for ( it = folders->begin(); it!=folders->end(); ++it) 820 for ( it = folders->begin(); it!=folders->end(); ++it)
821 { 821 {
822 fname = (*it)->getDisplayName(); 822 fname = (*it)->getDisplayName();
823 /* this folder itself */ 823 /* this folder itself */
824 if (fname=="/") 824 if (fname=="/")
825 { 825 {
826 currentFolders.append(fname); 826 currentFolders.append(fname);
827 folder = (*it); 827 folder = (*it);
828 continue; 828 continue;
829 } 829 }
830 currentFolders.append(fname); 830 currentFolders.append(fname);
831 pos = fname.findRev("/"); 831 pos = fname.findRev("/");
832 if (pos > 0) 832 if (pos > 0)
833 { 833 {
834 fname = fname.left(pos); 834 fname = fname.left(pos);
835 pmaster = (MHfolderItem*)findSubItem(fname); 835 pmaster = (MHfolderItem*)findSubItem(fname);
836 } 836 }
837 else 837 else
838 { 838 {
839 pmaster = 0; 839 pmaster = 0;
840 } 840 }
841 if (pmaster) 841 if (pmaster)
842 { 842 {
843 item = new MHfolderItem( (*it), pmaster, item, this ); 843 item = new MHfolderItem( (*it), pmaster, item, this );
844 } 844 }
845 else 845 else
846 { 846 {
847 item = new MHfolderItem( (*it), this , item ); 847 item = new MHfolderItem( (*it), this , item );
848 } 848 }
849 item->setSelectable((*it)->may_select()); 849 item->setSelectable((*it)->may_select());
850 } 850 }
851 delete folders; 851 delete folders;
852} 852}
853 853
854RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) 854RECBODYP MHviewItem::fetchBody( const RecMailP &mail )
855{ 855{
856 856
857 return wrapper->fetchBody( mail ); 857 return wrapper->fetchBody( mail );
858} 858}
859 859
860QPopupMenu * MHviewItem::getContextMenu() 860QPopupMenu * MHviewItem::getContextMenu()
861{ 861{
862 QPopupMenu *m = new QPopupMenu(0); 862 QPopupMenu *m = new QPopupMenu(0);
863 if (m) 863 if (m)
864 { 864 {
865 m->insertItem(i18n("Refresh folder list"),0); 865 m->insertItem(i18n("Refresh folder list"),0);
866 m->insertItem(i18n("Create new folder"),1); 866 m->insertItem(i18n("Create new folder"),1);
867 m->insertItem(i18n("Delete all mails"),2); 867 m->insertItem(i18n("Delete all mails"),2);
868 m->insertItem(i18n("Move/Copie all mails"),3); 868 m->insertItem(i18n("Move/Copie all mails"),3);
869 } 869 }
870 return m; 870 return m;
871} 871}
872 872
873void MHviewItem::createFolder() 873void MHviewItem::createFolder()
874{ 874{
875 Newmdirdlg ndirdlg(0,0,true); 875 Newmdirdlg ndirdlg(0,0,true);
876 //ndirdlg.showMaximized(); 876 //ndirdlg.showMaximized();
877 if ( ndirdlg.exec() ) 877 if ( ndirdlg.exec() )
878 { 878 {
879 QString ndir = ndirdlg.Newdir(); 879 QString ndir = ndirdlg.Newdir();
880 if (wrapper->createMbox(ndir)) 880 if (wrapper->createMbox(ndir))
881 { 881 {
882 refresh(true); 882 refresh(true);
883 } 883 }
884 } 884 }
diff --git a/kmicromail/accountview.cpp b/kmicromail/accountview.cpp
index cef55ab..4879d57 100644
--- a/kmicromail/accountview.cpp
+++ b/kmicromail/accountview.cpp
@@ -4,197 +4,208 @@
4#include "selectstore.h" 4#include "selectstore.h"
5 5
6#include <libmailwrapper/settings.h> 6#include <libmailwrapper/settings.h>
7#include <libmailwrapper/mailwrapper.h> 7#include <libmailwrapper/mailwrapper.h>
8#include <libmailwrapper/mailtypes.h> 8#include <libmailwrapper/mailtypes.h>
9#include <libmailwrapper/abstractmail.h> 9#include <libmailwrapper/abstractmail.h>
10 10
11/* OPIE */ 11/* OPIE */
12#include <qpe/qpeapplication.h> 12#include <qpe/qpeapplication.h>
13 13
14/* QT */ 14/* QT */
15#include <qmessagebox.h> 15#include <qmessagebox.h>
16#include <qpopupmenu.h> 16#include <qpopupmenu.h>
17#include <qcheckbox.h> 17#include <qcheckbox.h>
18#include <qtimer.h> 18#include <qtimer.h>
19#include <qspinbox.h> 19#include <qspinbox.h>
20#include <klocale.h> 20#include <klocale.h>
21#include <kmessagebox.h> 21#include <kmessagebox.h>
22 22
23using namespace Opie::Core; 23using namespace Opie::Core;
24AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) 24AccountView::AccountView( QWidget *parent, const char *name, WFlags flags )
25 : QListView( parent, name, flags ) 25 : QListView( parent, name, flags )
26{ 26{
27 //connect( this, SIGNAL( selectionChanged(QListViewItem*) ), 27 //connect( this, SIGNAL( selectionChanged(QListViewItem*) ),
28 // SLOT( refresh(QListViewItem*) ) ); 28 // SLOT( refresh(QListViewItem*) ) );
29 connect( this, SIGNAL( clicked(QListViewItem*) ), 29 connect( this, SIGNAL( clicked(QListViewItem*) ),
30 SLOT( refresh(QListViewItem*) ) ); 30 SLOT( refresh(QListViewItem*) ) );
31 connect( this, SIGNAL( returnPressed(QListViewItem*) ), 31 connect( this, SIGNAL( returnPressed(QListViewItem*) ),
32 SLOT( refresh(QListViewItem*) ) ); 32 SLOT( refresh(QListViewItem*) ) );
33 connect( this, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, 33 connect( this, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
34 SLOT( slotHold(int,QListViewItem*,const QPoint&,int) ) ); 34 SLOT( slotHold(int,QListViewItem*,const QPoint&,int) ) );
35 setSorting(0); 35 setSorting(0);
36} 36}
37 37
38AccountView::~AccountView() 38AccountView::~AccountView()
39{ 39{
40 imapAccounts.clear(); 40 imapAccounts.clear();
41 mhAccounts.clear(); 41 mhAccounts.clear();
42} 42}
43 43
44void AccountView::slotContextMenu(int id) 44void AccountView::slotContextMenu(int id)
45{ 45{
46 AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); 46 AccountViewItem *view = static_cast<AccountViewItem *>(currentItem());
47 if (!view) return; 47 if (!view) return;
48 view->contextMenuSelected(id); 48 view->contextMenuSelected(id);
49} 49}
50 50
51void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int) 51void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int)
52{ 52{
53 if (button==1) {return;} 53 if (button==1) {return;}
54 if (!item) return; 54 if (!item) return;
55 AccountViewItem *view = static_cast<AccountViewItem *>(item); 55 AccountViewItem *view = static_cast<AccountViewItem *>(item);
56 QPopupMenu*m = view->getContextMenu(); 56 QPopupMenu*m = view->getContextMenu();
57 if (!m) return; 57 if (!m) return;
58 connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); 58 connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int)));
59 m->setFocus(); 59 m->setFocus();
60 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); 60 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
61 delete m; 61 delete m;
62} 62}
63 63
64void AccountView::populate( QList<Account> list ) 64void AccountView::populate( QList<Account> list )
65{ 65{
66 clear(); 66 clear();
67 67
68 imapAccounts.clear(); 68 imapAccounts.clear();
69 mhAccounts.clear(); 69 mhAccounts.clear();
70 70
71 mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); 71 mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this));
72 72
73 Account *it; 73 Account *it;
74 for ( it = list.first(); it; it = list.next() ) 74 for ( it = list.first(); it; it = list.next() )
75 { 75 {
76 if ( it->getType() == MAILLIB::A_IMAP ) 76 if ( it->getType() == MAILLIB::A_IMAP )
77 { 77 {
78 IMAPaccount *imap = static_cast<IMAPaccount *>(it); 78 IMAPaccount *imap = static_cast<IMAPaccount *>(it);
79 imapAccounts.append(new IMAPviewItem( imap, this )); 79 imapAccounts.append(new IMAPviewItem( imap, this ));
80 } 80 }
81 else if ( it->getType() == MAILLIB::A_POP3 ) 81 else if ( it->getType() == MAILLIB::A_POP3 )
82 { 82 {
83 POP3account *pop3 = static_cast<POP3account *>(it); 83 POP3account *pop3 = static_cast<POP3account *>(it);
84 /* must not be hold 'cause it isn't required */ 84 /* must not be hold 'cause it isn't required */
85 (void) new POP3viewItem( pop3, this ); 85 (void) new POP3viewItem( pop3, this );
86 } 86 }
87 else if ( it->getType() == MAILLIB::A_NNTP ) 87 else if ( it->getType() == MAILLIB::A_NNTP )
88 { 88 {
89 NNTPaccount *nntp = static_cast<NNTPaccount *>(it); 89 NNTPaccount *nntp = static_cast<NNTPaccount *>(it);
90 /* must not be hold 'cause it isn't required */ 90 /* must not be hold 'cause it isn't required */
91 (void) new NNTPviewItem( nntp, this ); 91 (void) new NNTPviewItem( nntp, this );
92 } 92 }
93 } 93 }
94} 94}
95 95
96void AccountView::refresh(QListViewItem *item) 96void AccountView::refresh(QListViewItem *item)
97{ 97{
98 if ( item ) 98 if ( item )
99 { 99 {
100 int result = KMessageBox::warningContinueCancel(this, 100 bool ask = true;
101 qDebug("text -%s- ",item->text( 0 ).latin1() );
102 if ( item->text( 0 ) == i18n (" Local Mailfolders") )
103 ask = false;
104 else {
105 if ( item->parent() )
106 if ( item->parent()->text( 0 ) == i18n (" Local Mailfolders") )
107 ask = false;
108 }
109 if ( ask ) {
110 int result = KMessageBox::warningContinueCancel(this,
101 i18n("Refresh\n%1\n?").arg( item->text(0) ), 111 i18n("Refresh\n%1\n?").arg( item->text(0) ),
102 i18n("Refresh"),i18n("Refresh"),i18n("Cancel"), 112 i18n("Refresh"),i18n("Refresh"),i18n("Cancel"),
103 true); 113 true);
104 if (result != KMessageBox::Continue) return; 114 if (result != KMessageBox::Continue) return;
115 }
105 m_currentItem = item; 116 m_currentItem = item;
106 topLevelWidget()->setCaption( i18n ( "Refreshing %1 ... please wait" ). arg ( m_currentItem->text( 0 ) ) ) ; 117 topLevelWidget()->setCaption( i18n ( "Refreshing %1 ... please wait" ). arg ( m_currentItem->text( 0 ) ) ) ;
107 QTimer::singleShot( 500, this, SLOT ( refreshCurrentSelected() ) ); 118 QTimer::singleShot( 500, this, SLOT ( refreshCurrentSelected() ) );
108 119
109 } 120 }
110} 121}
111void AccountView::refreshOutgoing() 122void AccountView::refreshOutgoing()
112{ 123{
113 m_currentItem = currentItem(); 124 m_currentItem = currentItem();
114 if ( !m_currentItem ) return; 125 if ( !m_currentItem ) return;
115 AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); 126 AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem);
116 if ( !view->getFolder() ) 127 if ( !view->getFolder() )
117 return; 128 return;
118 QString bName = view->getFolder()->getDisplayName(); 129 QString bName = view->getFolder()->getDisplayName();
119 if (bName.startsWith("/")&&bName.length()>1) 130 if (bName.startsWith("/")&&bName.length()>1)
120 { 131 {
121 bName.replace(0,1,""); 132 bName.replace(0,1,"");
122 } 133 }
123 int pos = bName.findRev("/"); 134 int pos = bName.findRev("/");
124 if (pos > 0) 135 if (pos > 0)
125 { 136 {
126 bName.replace(0,pos+1,""); 137 bName.replace(0,pos+1,"");
127 } 138 }
128 //qDebug("name *%s* ",bName.lower().latin1() ); 139 //qDebug("name *%s* ",bName.lower().latin1() );
129 if ( bName.lower() == "outgoing" || bName.lower() == "sent" || bName.lower() == "sendfailed" ) { 140 if ( bName.lower() == "outgoing" || bName.lower() == "sent" || bName.lower() == "sendfailed" ) {
130 refreshCurrent(); 141 refreshCurrent();
131 // qDebug("refresh "); 142 // qDebug("refresh ");
132 } 143 }
133} 144}
134void AccountView::refreshCurrentSelected() 145void AccountView::refreshCurrentSelected()
135{ 146{
136 if ( !m_currentItem ) return; 147 if ( !m_currentItem ) return;
137 QValueList<RecMailP> headerlist; 148 QValueList<RecMailP> headerlist;
138 AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); 149 AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem);
139 view->refresh(headerlist); 150 view->refresh(headerlist);
140 emit refreshMailview(headerlist); 151 emit refreshMailview(headerlist);
141 topLevelWidget()->setCaption( i18n ( "KOpieMail/Pi" ) ) ; 152 topLevelWidget()->setCaption( i18n ( "KOpieMail/Pi" ) ) ;
142} 153}
143 154
144void AccountView::refreshCurrent() 155void AccountView::refreshCurrent()
145{ 156{
146 m_currentItem = currentItem(); 157 m_currentItem = currentItem();
147 if ( !m_currentItem ) return; 158 if ( !m_currentItem ) return;
148 topLevelWidget()->setCaption( i18n ( "Refreshing %1 ... please wait" ). arg ( m_currentItem->text( 0 ) ) ) ; 159 topLevelWidget()->setCaption( i18n ( "Refreshing %1 ... please wait" ). arg ( m_currentItem->text( 0 ) ) ) ;
149 QTimer::singleShot( 500, this, SLOT ( refreshCurrentSelected() ) ); 160 QTimer::singleShot( 500, this, SLOT ( refreshCurrentSelected() ) );
150} 161}
151 162
152void AccountView::refreshAll() 163void AccountView::refreshAll()
153{ 164{
154} 165}
155 166
156RecBodyP AccountView::fetchBody(const RecMailP&aMail) 167RecBodyP AccountView::fetchBody(const RecMailP&aMail)
157{ 168{
158 QListViewItem*item = selectedItem (); 169 QListViewItem*item = selectedItem ();
159 if (!item) return new RecBody(); 170 if (!item) return new RecBody();
160 AccountViewItem *view = static_cast<AccountViewItem *>(item); 171 AccountViewItem *view = static_cast<AccountViewItem *>(item);
161 return view->fetchBody(aMail); 172 return view->fetchBody(aMail);
162} 173}
163 174
164void AccountView::setupFolderselect(Selectstore*sels) 175void AccountView::setupFolderselect(Selectstore*sels)
165{ 176{
166 177
167#ifndef DESKTOP_VERSION 178#ifndef DESKTOP_VERSION
168 sels->showMaximized(); 179 sels->showMaximized();
169#else 180#else
170 sels->show(); 181 sels->show();
171#endif 182#endif
172 QStringList sFolders; 183 QStringList sFolders;
173 unsigned int i = 0; 184 unsigned int i = 0;
174 for (i=0; i < mhAccounts.count();++i) 185 for (i=0; i < mhAccounts.count();++i)
175 { 186 {
176 mhAccounts[i]->refresh(false); 187 mhAccounts[i]->refresh(false);
177 sFolders = mhAccounts[i]->subFolders(); 188 sFolders = mhAccounts[i]->subFolders();
178 sels->addAccounts(mhAccounts[i]->getWrapper(),sFolders); 189 sels->addAccounts(mhAccounts[i]->getWrapper(),sFolders);
179 } 190 }
180 for (i=0; i < imapAccounts.count();++i) 191 for (i=0; i < imapAccounts.count();++i)
181 { 192 {
182 if (imapAccounts[i]->offline()) 193 if (imapAccounts[i]->offline())
183 continue; 194 continue;
184 imapAccounts[i]->refreshFolders(false); 195 imapAccounts[i]->refreshFolders(false);
185 sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders()); 196 sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders());
186 } 197 }
187} 198}
188void AccountView::downloadMailsInbox(const FolderP&fromFolder,AbstractMail*fromWrapper) 199void AccountView::downloadMailsInbox(const FolderP&fromFolder,AbstractMail*fromWrapper)
189{ 200{
190#if 0 201#if 0
191 AbstractMail*targetMail = 0; 202 AbstractMail*targetMail = 0;
192 QString targetFolder = ""; 203 QString targetFolder = "";
193 Selectstore sels; 204 Selectstore sels;
194 setupFolderselect(&sels); 205 setupFolderselect(&sels);
195 if (!sels.exec()) return; 206 if (!sels.exec()) return;
196 targetMail = sels.currentMail(); 207 targetMail = sels.currentMail();
197 targetFolder = sels.currentFolder(); 208 targetFolder = sels.currentFolder();
198 if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || 209 if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) ||
199 targetFolder.isEmpty()) 210 targetFolder.isEmpty())
200 { 211 {
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp
index 82a915e..3dde3cd 100644
--- a/kmicromail/mainwindow.cpp
+++ b/kmicromail/mainwindow.cpp
@@ -272,162 +272,176 @@ void MainWindow::setInfoFields(QListViewItem* item )
272 if ( fromLE ) fromLE->setText(mail->getFrom()); 272 if ( fromLE ) fromLE->setText(mail->getFrom());
273 if ( toLE ) toLE->setText(mail->To().join(";" )); 273 if ( toLE ) toLE->setText(mail->To().join(";" ));
274 if ( subLE ) subLE->setCursorPosition(0); 274 if ( subLE ) subLE->setCursorPosition(0);
275 if ( fromLE ) fromLE->setCursorPosition(0); 275 if ( fromLE ) fromLE->setCursorPosition(0);
276 if ( toLE ) toLE->setCursorPosition(0); 276 if ( toLE ) toLE->setCursorPosition(0);
277 277
278} 278}
279void MainWindow::slotSetCodec( int codec ) 279void MainWindow::slotSetCodec( int codec )
280{ 280{
281 codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, false ); 281 codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, false );
282 //qDebug("codec %d ", codec); 282 //qDebug("codec %d ", codec);
283 KOPrefs::instance()->mCurrentCodec = codec; 283 KOPrefs::instance()->mCurrentCodec = codec;
284 KOPrefs::instance()->isDirty = true; 284 KOPrefs::instance()->isDirty = true;
285 QString name; 285 QString name;
286 switch ( codec ) { 286 switch ( codec ) {
287 case 0: 287 case 0:
288 name = "iso-8859-1"; 288 name = "iso-8859-1";
289 break; 289 break;
290 case 1: 290 case 1:
291 name = "iso-8859-5"; 291 name = "iso-8859-5";
292 break; 292 break;
293 case 2: 293 case 2:
294 name = "iso-8859-15"; 294 name = "iso-8859-15";
295 break; 295 break;
296 case 3: 296 case 3:
297 name = "big-5"; 297 name = "big-5";
298 break; 298 break;
299 case 4: 299 case 4:
300 name = "utf-8"; 300 name = "utf-8";
301 break; 301 break;
302 case 5: 302 case 5:
303 name = KOPrefs::instance()->mSendCodec.lower(); 303 name = KOPrefs::instance()->mSendCodec.lower();
304 break; 304 break;
305 } 305 }
306 KOPrefs::instance()->mCurrentCodeName = name ; 306 KOPrefs::instance()->mCurrentCodeName = name ;
307 codecMenu->changeItem ( 5, "Userdefined ("+KOPrefs::instance()->mSendCodec+")"); 307 codecMenu->changeItem ( 5, "Userdefined ("+KOPrefs::instance()->mSendCodec+")");
308 codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, true ); 308 codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, true );
309} 309}
310void MainWindow::showLicence() 310void MainWindow::showLicence()
311{ 311{
312 KApplication::showLicence(); 312 KApplication::showLicence();
313} 313}
314void MainWindow::showAbout() 314void MainWindow::showAbout()
315{ 315{
316 QString version; 316 QString version;
317#include <../version> 317#include <../version>
318 318
319 QString cap = "About KOpieMail/Pi"; 319 QString cap = "About KOpieMail/Pi";
320 QString text =i18n("KOpieMail/Platform-independent\n") + 320 QString text =i18n("KOpieMail/Platform-independent\n") +
321 "(OM/Pi) " + version + " - " 321 "(OM/Pi) " + version + " - "
322 322
323#ifdef DESKTOP_VERSION 323#ifdef DESKTOP_VERSION
324 "Desktop Edition\n" 324 "Desktop Edition\n"
325#else 325#else
326 "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n" 326 "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n"
327#endif 327#endif
328 "www.pi-sync.info\n\n" 328 "www.pi-sync.info\n\n"
329 329
330 330
331 331
332"Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.info>\n" 332"Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.info>\n"
333 "KOpieMail/Pi is based on Opie Mail\n" 333 "KOpieMail/Pi is based on Opie Mail\n"
334 "Copyright (c) Rajko Albrecht and the Opie team\n" 334 "Copyright (c) Rajko Albrecht and the Opie team\n"
335 "KOpieMail/Pi is licensed under the GPL\n" 335 "KOpieMail/Pi is licensed under the GPL\n"
336 "\n" 336 "\n"
337 "KOpieMail/Pi uses LibEtPan - a mail stuff library\n" 337 "KOpieMail/Pi uses LibEtPan - a mail stuff library\n"
338 "Copyright (C) 2001, 2002 - DINH Viet Hoa\n" 338 "Copyright (C) 2001, 2002 - DINH Viet Hoa\n"
339 "libEtPan has its own licence - see LibEtPan licence\n"; 339 "libEtPan has its own licence - see LibEtPan licence\n";
340 340
341 KApplication::showText( cap, text ); 341 KApplication::showText( cap, text );
342} 342}
343void MainWindow::showEtpanLicence() 343void MainWindow::showEtpanLicence()
344{ 344{
345 KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" ); 345 KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" );
346 346
347} 347}
348void MainWindow::appMessage(const QCString &, const QByteArray &) 348void MainWindow::appMessage(const QCString &, const QByteArray &)
349{ 349{
350 qDebug("appMessage implemented by subclass"); 350 qDebug("appMessage implemented by subclass");
351} 351}
352 352
353void MainWindow::slotAdjustLayout() { 353void MainWindow::slotAdjustLayout() {
354 354
355 /* 355 /*
356 QWidget *d = QApplication::desktop(); 356 QWidget *d = QApplication::desktop();
357 357
358 if ( d->width() < d->height() ) { 358 if ( d->width() < d->height() ) {
359 layout->setDirection( QBoxLayout::TopToBottom ); 359 layout->setDirection( QBoxLayout::TopToBottom );
360 } else { 360 } else {
361 layout->setDirection( QBoxLayout::LeftToRight ); 361 layout->setDirection( QBoxLayout::LeftToRight );
362 } 362 }
363 */ 363 */
364} 364}
365 365
366void MainWindow::slotAdjustColumns() 366void MainWindow::slotAdjustColumns()
367{ 367{
368 bool hidden = folderView->isHidden(); 368
369 if ( hidden ) folderView->show(); 369 if ( !folderView->isHidden() )
370 folderView->setColumnWidth( 0, folderView->visibleWidth() ); 370 folderView->setColumnWidth( 0, folderView->visibleWidth() );
371 if ( hidden ) folderView->hide();
372 371
373 mailView->setColumnWidth( 0, 10 ); 372 mailView->setColumnWidth( 0, 10 );
374 mailView->setColumnWidth( 1, 100 ); 373 mailView->setColumnWidth( 1, 100 );
375 mailView->setColumnWidth( 2, 100 ); 374 mailView->setColumnWidth( 2, 100 );
376 mailView->setColumnWidth( 3, 70 ); 375 mailView->setColumnWidth( 3, 70 );
377 mailView->setColumnWidth( 4, 170 ); 376 mailView->setColumnWidth( 4, 180 );
377 if ( KOPrefs::instance()->mShowToField )
378 mailView->setColumnWidth( 5, 100 );
379 mailView->setColumnAlignment( 3, AlignRight);
380 mailView->setColumnAlignment( 4, AlignRight);
381}
382void MainWindow::slotAdjustColumnsWide()
383{
384 if ( !folderView->isHidden() )
385 folderView->setColumnWidth( 0, folderView->visibleWidth() );
386
387 mailView->setColumnWidth( 0, 10 );
388 mailView->setColumnWidth( 1, 200 );
389 mailView->setColumnWidth( 2, 200 );
390 mailView->setColumnWidth( 3, 70 );
391 mailView->setColumnWidth( 4, 180 );
378 if ( KOPrefs::instance()->mShowToField ) 392 if ( KOPrefs::instance()->mShowToField )
379 mailView->setColumnWidth( 5, 100 ); 393 mailView->setColumnWidth( 5, 100 );
380 mailView->setColumnAlignment( 3, AlignRight); 394 mailView->setColumnAlignment( 3, AlignRight);
381} 395}
382 396
383void MainWindow::slotEditSettings() 397void MainWindow::slotEditSettings()
384{ 398{
385} 399}
386void MainWindow::slotEditGlobalSettings() 400void MainWindow::slotEditGlobalSettings()
387{ 401{
388} 402}
389 403
390void MainWindow::slotShowFolders( bool ) 404void MainWindow::slotShowFolders( bool )
391{ 405{
392 qDebug("not implemented: "); 406 qDebug("not implemented: ");
393} 407}
394 408
395void MainWindow::refreshMailView(const QValueList<RecMailP>&) 409void MainWindow::refreshMailView(const QValueList<RecMailP>&)
396{ 410{
397 qDebug("not implemented: "); 411 qDebug("not implemented: ");
398} 412}
399 413
400void MainWindow::mailLeftClicked(QListViewItem * ) 414void MainWindow::mailLeftClicked(QListViewItem * )
401{ 415{
402 qDebug("not implemented: "); 416 qDebug("not implemented: ");
403} 417}
404 418
405void MainWindow::displayMail() 419void MainWindow::displayMail()
406{ 420{
407 qDebug("not implemented: "); 421 qDebug("not implemented: ");
408} 422}
409 423
410void MainWindow::slotDeleteMail() 424void MainWindow::slotDeleteMail()
411{ 425{
412 qDebug("not implemented: "); 426 qDebug("not implemented: ");
413} 427}
414 428
415void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) 429void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int )
416{ 430{
417 qDebug("not implemented: "); 431 qDebug("not implemented: ");
418} 432}
419 433
420void MainWindow::slotSendQueued() 434void MainWindow::slotSendQueued()
421{ 435{
422 qDebug("not implemented: "); 436 qDebug("not implemented: ");
423} 437}
424 438
425void MainWindow::slotEditAccounts() 439void MainWindow::slotEditAccounts()
426{ 440{
427 qDebug("not implemented: "); 441 qDebug("not implemented: ");
428} 442}
429 443
430void MainWindow::slotComposeMail() 444void MainWindow::slotComposeMail()
431{ 445{
432 qDebug("not implemented: "); 446 qDebug("not implemented: ");
433} 447}
diff --git a/kmicromail/mainwindow.h b/kmicromail/mainwindow.h
index 178d2bb..f65f3b4 100644
--- a/kmicromail/mainwindow.h
+++ b/kmicromail/mainwindow.h
@@ -1,74 +1,75 @@
1 1
2// CHANGED 2004-08-06 Lutz Rogowski 2// CHANGED 2004-08-06 Lutz Rogowski
3#ifndef MAINWINDOW_H 3#ifndef MAINWINDOW_H
4#define MAINWINDOW_H 4#define MAINWINDOW_H
5 5
6#include <qmainwindow.h> 6#include <qmainwindow.h>
7#include <klistview.h> 7#include <klistview.h>
8#include <qaction.h> 8#include <qaction.h>
9#include <qlineedit.h> 9#include <qlineedit.h>
10 10
11#include <qtoolbar.h> 11#include <qtoolbar.h>
12#ifdef DESKTOP_VERSION 12#ifdef DESKTOP_VERSION
13#include <qmenubar.h> 13#include <qmenubar.h>
14#define QPEMenuBar QMenuBar 14#define QPEMenuBar QMenuBar
15#else 15#else
16#include <qpe/qpemenubar.h> 16#include <qpe/qpemenubar.h>
17#endif 17#endif
18 18
19#include "accountview.h" 19#include "accountview.h"
20#include "statuswidget.h" 20#include "statuswidget.h"
21 21
22#include <libmailwrapper/mailtypes.h> 22#include <libmailwrapper/mailtypes.h>
23#include <opie2/osmartpointer.h> 23#include <opie2/osmartpointer.h>
24 24
25class RecMail; 25class RecMail;
26 26
27class MainWindow : public QMainWindow 27class MainWindow : public QMainWindow
28{ 28{
29 Q_OBJECT 29 Q_OBJECT
30 30
31public: 31public:
32 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); 32 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 );
33 virtual ~MainWindow(); 33 virtual ~MainWindow();
34 34
35public slots: 35public slots:
36 virtual void slotAdjustColumns(); 36 virtual void slotAdjustColumns();
37 virtual void slotAdjustColumnsWide();
37 virtual void appMessage(const QCString &msg, const QByteArray &data); 38 virtual void appMessage(const QCString &msg, const QByteArray &data);
38 virtual void slotComposeMail(); 39 virtual void slotComposeMail();
39 40
40protected slots: 41protected slots:
41 virtual void setInfoFields(QListViewItem* ); 42 virtual void setInfoFields(QListViewItem* );
42 virtual void slotSendQueued(); 43 virtual void slotSendQueued();
43 virtual void slotEditAccounts(); 44 virtual void slotEditAccounts();
44 virtual void slotShowFolders( bool show ); 45 virtual void slotShowFolders( bool show );
45 virtual void refreshMailView(const QValueList<RecMailP>&); 46 virtual void refreshMailView(const QValueList<RecMailP>&);
46 virtual void displayMail(); 47 virtual void displayMail();
47 virtual void slotGetMail() = 0; 48 virtual void slotGetMail() = 0;
48 virtual void slotGetAllMail() = 0; 49 virtual void slotGetAllMail() = 0;
49 virtual void slotDeleteMail(); 50 virtual void slotDeleteMail();
50 virtual void slotDeleteAllMail() = 0; 51 virtual void slotDeleteAllMail() = 0;
51 virtual void slotSetCodec(int); 52 virtual void slotSetCodec(int);
52 virtual void mailHold(int, QListViewItem *,const QPoint&,int); 53 virtual void mailHold(int, QListViewItem *,const QPoint&,int);
53 virtual void slotAdjustLayout(); 54 virtual void slotAdjustLayout();
54 virtual void slotEditSettings(); 55 virtual void slotEditSettings();
55 virtual void slotEditGlobalSettings(); 56 virtual void slotEditGlobalSettings();
56 virtual void mailLeftClicked( QListViewItem * ); 57 virtual void mailLeftClicked( QListViewItem * );
57 void showLicence(); 58 void showLicence();
58 void showAbout(); 59 void showAbout();
59 void showEtpanLicence(); 60 void showEtpanLicence();
60 61
61protected: 62protected:
62 QToolBar *toolBar; 63 QToolBar *toolBar;
63 StatusWidget *statusWidget; 64 StatusWidget *statusWidget;
64 QPEMenuBar *menuBar; 65 QPEMenuBar *menuBar;
65 QPopupMenu *mailMenu, *settingsMenu, *codecMenu; 66 QPopupMenu *mailMenu, *settingsMenu, *codecMenu;
66 QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails, 67 QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails,
67 *editSettings, *editAccounts, *syncFolders; 68 *editSettings, *editAccounts, *syncFolders;
68 AccountView *folderView; 69 AccountView *folderView;
69 KListView *mailView; 70 KListView *mailView;
70 QLineEdit* toLE,*fromLE,*subLE; 71 QLineEdit* toLE,*fromLE,*subLE;
71 //QBoxLayout *layout; 72 //QBoxLayout *layout;
72}; 73};
73 74
74#endif 75#endif
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index e296d9c..75a75b9 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -448,197 +448,201 @@ void OpieMail::slotGetAllMail()
448void OpieMail::slotGetMail() 448void OpieMail::slotGetMail()
449{ 449{
450 QListViewItem * item = folderView->currentItem(); 450 QListViewItem * item = folderView->currentItem();
451 if ( ! item ) return; 451 if ( ! item ) return;
452 ((AccountViewItem *)item)->contextMenuSelected( 101 ); 452 ((AccountViewItem *)item)->contextMenuSelected( 101 );
453} 453}
454void OpieMail::slotDeleteMail() 454void OpieMail::slotDeleteMail()
455{ 455{
456 if (!mailView->currentItem()) return; 456 if (!mailView->currentItem()) return;
457 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); 457 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
458 if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 458 if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
459 { 459 {
460 mail->Wrapper()->deleteMail( mail ); 460 mail->Wrapper()->deleteMail( mail );
461 folderView->refreshCurrent(); 461 folderView->refreshCurrent();
462 } 462 }
463} 463}
464void OpieMail::slotDeleteAllMail() 464void OpieMail::slotDeleteAllMail()
465{ 465{
466 466
467 QValueList<RecMailP> t; 467 QValueList<RecMailP> t;
468 if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 468 if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
469 { 469 {
470 MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); 470 MailListViewItem* item = (MailListViewItem*)mailView->firstChild ();
471 while ( item ) { 471 while ( item ) {
472 if ( item->isSelected() ) { 472 if ( item->isSelected() ) {
473 t.append( item->data() ); 473 t.append( item->data() );
474 } 474 }
475 item = (MailListViewItem*)item->nextSibling(); 475 item = (MailListViewItem*)item->nextSibling();
476 } 476 }
477 } 477 }
478 else 478 else
479 return; 479 return;
480 if ( t.count() == 0 ) 480 if ( t.count() == 0 )
481 return; 481 return;
482 RecMailP mail = t.first(); 482 RecMailP mail = t.first();
483 mail->Wrapper()->deleteMailList(t); 483 mail->Wrapper()->deleteMailList(t);
484 folderView->refreshCurrent(); 484 folderView->refreshCurrent();
485 485
486 486
487} 487}
488void OpieMail::clearSelection() 488void OpieMail::clearSelection()
489{ 489{
490 mailView->clearSelection(); 490 mailView->clearSelection();
491 491
492} 492}
493void OpieMail::selectAll() 493void OpieMail::selectAll()
494{ 494{
495 QListViewItem* item = mailView->firstChild (); 495 QListViewItem* item = mailView->firstChild ();
496 while ( item ) { 496 while ( item ) {
497 mailView->setSelected ( item, true ); 497 mailView->setSelected ( item, true );
498 item = item->nextSibling(); 498 item = item->nextSibling();
499 } 499 }
500} 500}
501 501
502void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) 502void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
503{ 503{
504 if (!mailView->currentItem()) return; 504 if (!mailView->currentItem()) return;
505 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); 505 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType();
506 /* just the RIGHT button - or hold on pda */ 506 /* just the RIGHT button - or hold on pda */
507 if (button!=2) {return;} 507 if (button!=2) {return;}
508 if (!item) return; 508 if (!item) return;
509 QPopupMenu *m = new QPopupMenu(0); 509 QPopupMenu *m = new QPopupMenu(0);
510 if (m) 510 if (m)
511 { 511 {
512 if (mailtype==MAILLIB::A_NNTP) { 512 if (mailtype==MAILLIB::A_NNTP) {
513 m->insertItem(i18n("Read this posting"),this,SLOT(displayMail())); 513 m->insertItem(i18n("Read this posting"),this,SLOT(displayMail()));
514 m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail())); 514 m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail()));
515 m->insertSeparator(); 515 m->insertSeparator();
516 m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail())); 516 m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail()));
517 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); 517 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection()));
518 } else { 518 } else {
519 if (folderView->currentisDraft()) { 519 if (folderView->currentisDraft()) {
520 m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail())); 520 m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail()));
521 } 521 }
522 m->insertItem(i18n("Reply to this mail"),this,SLOT(replyMail())); 522 m->insertItem(i18n("Reply to this mail"),this,SLOT(replyMail()));
523 m->insertItem(i18n("Read this mail"),this,SLOT(displayMail())); 523 m->insertItem(i18n("Read this mail"),this,SLOT(displayMail()));
524 m->insertSeparator(); 524 m->insertSeparator();
525 m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); 525 m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail()));
526 m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail())); 526 m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail()));
527 m->insertSeparator(); 527 m->insertSeparator();
528 m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); 528 m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail()));
529 m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); 529 m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail()));
530 m->insertSeparator(); 530 m->insertSeparator();
531 m->insertItem(i18n("Select all"),this,SLOT(selectAll())); 531 m->insertItem(i18n("Select all"),this,SLOT(selectAll()));
532 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); 532 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection()));
533 } 533 }
534 m->setFocus(); 534 m->setFocus();
535 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); 535 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
536 delete m; 536 delete m;
537 } 537 }
538} 538}
539 539
540void OpieMail::slotShowFolders( bool show ) 540void OpieMail::slotShowFolders( bool show )
541{ 541{
542 if ( show && folderView->isHidden() ) 542 if ( show && folderView->isHidden() )
543 { 543 {
544 slotAdjustColumns();
544 folderView->show(); 545 folderView->show();
546 //slotAdjustColumns();
545 } 547 }
546 else if ( !show && !folderView->isHidden() ) 548 else if ( !show && !folderView->isHidden() )
547 { 549 {
550 slotAdjustColumnsWide();
548 folderView->hide(); 551 folderView->hide();
552 //slotAdjustColumnsWide();
549 } 553 }
550} 554}
551 555
552void OpieMail::refreshMailView(const QValueList<RecMailP>&list) 556void OpieMail::refreshMailView(const QValueList<RecMailP>&list)
553{ 557{
554 MailListViewItem*item = 0; 558 MailListViewItem*item = 0;
555 mailView->clear(); 559 mailView->clear();
556 560
557 QValueList<RecMailP>::ConstIterator it; 561 QValueList<RecMailP>::ConstIterator it;
558 for (it = list.begin(); it != list.end();++it) 562 for (it = list.begin(); it != list.end();++it)
559 { 563 {
560 item = new MailListViewItem(mailView,item); 564 item = new MailListViewItem(mailView,item);
561 item->storeData((*it)); 565 item->storeData((*it));
562 item->showEntry(); 566 item->showEntry();
563 } 567 }
564 mailView->setSorting ( 4, false ); 568 mailView->setSorting ( 4, false );
565} 569}
566 570
567void OpieMail::mailLeftClicked( QListViewItem *item ) 571void OpieMail::mailLeftClicked( QListViewItem *item )
568{ 572{
569 mailView->clearSelection(); 573 mailView->clearSelection();
570 /* just LEFT button - or tap with stylus on pda */ 574 /* just LEFT button - or tap with stylus on pda */
571 //if (button!=1) return; 575 //if (button!=1) return;
572 if (!item) return; 576 if (!item) return;
573 if (folderView->currentisDraft()) { 577 if (folderView->currentisDraft()) {
574 reEditMail(); 578 reEditMail();
575 } else { 579 } else {
576 displayMail(); 580 displayMail();
577 } 581 }
578} 582}
579 583
580void OpieMail::slotMoveCopyMail() 584void OpieMail::slotMoveCopyMail()
581{ 585{
582 if (!mailView->currentItem()) return; 586 if (!mailView->currentItem()) return;
583 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); 587 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
584 AbstractMail*targetMail = 0; 588 AbstractMail*targetMail = 0;
585 QString targetFolder = ""; 589 QString targetFolder = "";
586 Selectstore sels; 590 Selectstore sels;
587 folderView->setupFolderselect(&sels); 591 folderView->setupFolderselect(&sels);
588 if (!sels.exec()) return; 592 if (!sels.exec()) return;
589 targetMail = sels.currentMail(); 593 targetMail = sels.currentMail();
590 targetFolder = sels.currentFolder(); 594 targetFolder = sels.currentFolder();
591 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || 595 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) ||
592 targetFolder.isEmpty()) 596 targetFolder.isEmpty())
593 { 597 {
594 return; 598 return;
595 } 599 }
596 if (sels.newFolder() && !targetMail->createMbox(targetFolder)) 600 if (sels.newFolder() && !targetMail->createMbox(targetFolder))
597 { 601 {
598 QMessageBox::critical(0,i18n("Error creating new Folder"), 602 QMessageBox::critical(0,i18n("Error creating new Folder"),
599 i18n("<center>Error while creating<br>new folder - breaking.</center>")); 603 i18n("<center>Error while creating<br>new folder - breaking.</center>"));
600 return; 604 return;
601 } 605 }
602 sels.hide(); 606 sels.hide();
603 qApp->processEvents(); 607 qApp->processEvents();
604 // qDebug("hiding sels "); 608 // qDebug("hiding sels ");
605 mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); 609 mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails());
606 folderView->refreshCurrent(); 610 folderView->refreshCurrent();
607} 611}
608 612
609void OpieMail::slotMoveCopyAllMail() 613void OpieMail::slotMoveCopyAllMail()
610{ 614{
611 615
612 if (!mailView->currentItem()) return; 616 if (!mailView->currentItem()) return;
613 QValueList<RecMailP> t; 617 QValueList<RecMailP> t;
614 // if ( QMessageBox::warning(this, i18n("Move/Copy all selected mails"), i18n("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 618 // if ( QMessageBox::warning(this, i18n("Move/Copy all selected mails"), i18n("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
615 { 619 {
616 MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); 620 MailListViewItem* item = (MailListViewItem*)mailView->firstChild ();
617 while ( item ) { 621 while ( item ) {
618 if ( item->isSelected() ) { 622 if ( item->isSelected() ) {
619 t.append( item->data() ); 623 t.append( item->data() );
620 } 624 }
621 item = (MailListViewItem*)item->nextSibling(); 625 item = (MailListViewItem*)item->nextSibling();
622 } 626 }
623 } 627 }
624 // else 628 // else
625 // return; 629 // return;
626 if ( t.count() == 0 ) 630 if ( t.count() == 0 )
627 return; 631 return;
628 RecMailP mail = t.first(); 632 RecMailP mail = t.first();
629 AbstractMail*targetMail = 0; 633 AbstractMail*targetMail = 0;
630 QString targetFolder = ""; 634 QString targetFolder = "";
631 Selectstore sels; 635 Selectstore sels;
632 folderView->setupFolderselect(&sels); 636 folderView->setupFolderselect(&sels);
633 if (!sels.exec()) return; 637 if (!sels.exec()) return;
634 targetMail = sels.currentMail(); 638 targetMail = sels.currentMail();
635 targetFolder = sels.currentFolder(); 639 targetFolder = sels.currentFolder();
636 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || 640 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) ||
637 targetFolder.isEmpty()) 641 targetFolder.isEmpty())
638 { 642 {
639 return; 643 return;
640 } 644 }
641 if (sels.newFolder() && !targetMail->createMbox(targetFolder)) 645 if (sels.newFolder() && !targetMail->createMbox(targetFolder))
642 { 646 {
643 QMessageBox::critical(0,i18n("Error creating new Folder"), 647 QMessageBox::critical(0,i18n("Error creating new Folder"),
644 i18n("<center>Error while creating<br>new folder - breaking.</center>")); 648 i18n("<center>Error while creating<br>new folder - breaking.</center>"));