summaryrefslogtreecommitdiffabout
path: root/kmicromail/viewmail.cpp
authorzautrix <zautrix>2004-08-06 22:27:51 (UTC)
committer zautrix <zautrix>2004-08-06 22:27:51 (UTC)
commit81a027fdb113968401105258cf89b56b96987103 (patch) (unidiff)
tree1e5e91873d80618f296190c64bf4c056a3a79ea2 /kmicromail/viewmail.cpp
parentc07b730f8f38aabf365a67578df6140080824f10 (diff)
downloadkdepimpi-81a027fdb113968401105258cf89b56b96987103.zip
kdepimpi-81a027fdb113968401105258cf89b56b96987103.tar.gz
kdepimpi-81a027fdb113968401105258cf89b56b96987103.tar.bz2
SOme change logs
Diffstat (limited to 'kmicromail/viewmail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/viewmail.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp
index 703711d..67b77f8 100644
--- a/kmicromail/viewmail.cpp
+++ b/kmicromail/viewmail.cpp
@@ -1,128 +1,129 @@
1// CHANGED 2004-08-06 Lutz Rogowski
1#include "composemail.h" 2#include "composemail.h"
2#include "viewmail.h" 3#include "viewmail.h"
3 4
4#include <libmailwrapper/settings.h> 5#include <libmailwrapper/settings.h>
5#include <libmailwrapper/abstractmail.h> 6#include <libmailwrapper/abstractmail.h>
6#include <libmailwrapper/mailtypes.h> 7#include <libmailwrapper/mailtypes.h>
7#include <kapplication.h> 8#include <kapplication.h>
8 9
9/* OPIE */ 10/* OPIE */
10//#include <opie2/odebug.h> 11//#include <opie2/odebug.h>
11//#include <opie2/ofiledialog.h> 12//#include <opie2/ofiledialog.h>
12//#include <opie2/oimagescrollview.h> 13//#include <opie2/oimagescrollview.h>
13 14
14#include <kfiledialog.h> 15#include <kfiledialog.h>
15#include <kdialog.h> 16#include <kdialog.h>
16 17
17#include <qpe/config.h> 18#include <qpe/config.h>
18#include <qpe/qpeapplication.h> 19#include <qpe/qpeapplication.h>
19 20
20/* QT */ 21/* QT */
21#include <qtextbrowser.h> 22#include <qtextbrowser.h>
22#include <qmessagebox.h> 23#include <qmessagebox.h>
23#include <qtextstream.h> 24#include <qtextstream.h>
24#include <qaction.h> 25#include <qaction.h>
25#include <qpopupmenu.h> 26#include <qpopupmenu.h>
26#include <qfile.h> 27#include <qfile.h>
27#include <qlayout.h> 28#include <qlayout.h>
28 29
29//using namespace Opie::Ui; 30//using namespace Opie::Ui;
30//using namespace Opie::Core; 31//using namespace Opie::Core;
31 32
32AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, 33AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
33 const QString&fsize,int num,const QValueList<int>&path) 34 const QString&fsize,int num,const QValueList<int>&path)
34 : QListViewItem(parent,after),_partNum(num) 35 : QListViewItem(parent,after),_partNum(num)
35{ 36{
36 _path=path; 37 _path=path;
37 setText(0, mime); 38 setText(0, mime);
38 setText(1, desc); 39 setText(1, desc);
39 setText(2, file); 40 setText(2, file);
40 setText(3, fsize); 41 setText(3, fsize);
41} 42}
42 43
43AttachItem::AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, 44AttachItem::AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
44 const QString&fsize,int num,const QValueList<int>&path) 45 const QString&fsize,int num,const QValueList<int>&path)
45 : QListViewItem(parent,after),_partNum(num) 46 : QListViewItem(parent,after),_partNum(num)
46{ 47{
47 _path=path; 48 _path=path;
48 setText(0, mime); 49 setText(0, mime);
49 setText(1, desc); 50 setText(1, desc);
50 setText(2, file); 51 setText(2, file);
51 setText(3, fsize); 52 setText(3, fsize);
52} 53}
53 54
54bool AttachItem::isParentof(const QValueList<int>&path) 55bool AttachItem::isParentof(const QValueList<int>&path)
55{ 56{
56 /* if not set, then no parent */ 57 /* if not set, then no parent */
57 if (path.count()==0||_path.count()==0) return false; 58 if (path.count()==0||_path.count()==0) return false;
58 /* the parent must have one digit less then a child */ 59 /* the parent must have one digit less then a child */
59 if (path.count()!=_path.count()+1) return false; 60 if (path.count()!=_path.count()+1) return false;
60 for (unsigned int i=0; i < _path.count();++i) 61 for (unsigned int i=0; i < _path.count();++i)
61 { 62 {
62 if (_path[i]!=path[i]) return false; 63 if (_path[i]!=path[i]) return false;
63 } 64 }
64 return true; 65 return true;
65} 66}
66 67
67AttachItem* ViewMail::searchParent(const QValueList<int>&path) 68AttachItem* ViewMail::searchParent(const QValueList<int>&path)
68{ 69{
69 QListViewItemIterator it( attachments ); 70 QListViewItemIterator it( attachments );
70 for ( ; it.current(); ++it ) 71 for ( ; it.current(); ++it )
71 { 72 {
72 AttachItem*ati = (AttachItem*)it.current(); 73 AttachItem*ati = (AttachItem*)it.current();
73 if (ati->isParentof(path)) return ati; 74 if (ati->isParentof(path)) return ati;
74 } 75 }
75 return 0; 76 return 0;
76} 77}
77 78
78AttachItem* ViewMail::lastChild(AttachItem*parent) 79AttachItem* ViewMail::lastChild(AttachItem*parent)
79{ 80{
80 if (!parent) return 0; 81 if (!parent) return 0;
81 AttachItem* item = (AttachItem*)parent->firstChild(); 82 AttachItem* item = (AttachItem*)parent->firstChild();
82 if (!item) return item; 83 if (!item) return item;
83 AttachItem*temp=0; 84 AttachItem*temp=0;
84 while( (temp=(AttachItem*)item->nextSibling())) 85 while( (temp=(AttachItem*)item->nextSibling()))
85 { 86 {
86 item = temp; 87 item = temp;
87 } 88 }
88 return item; 89 return item;
89} 90}
90 91
91void ViewMail::setBody(const RecBodyP&body ) 92void ViewMail::setBody(const RecBodyP&body )
92{ 93{
93 94
94 m_body = body; 95 m_body = body;
95 m_mail[2] = body->Bodytext(); 96 m_mail[2] = body->Bodytext();
96 attachbutton->setEnabled(body->Parts().count()>0); 97 attachbutton->setEnabled(body->Parts().count()>0);
97 attachments->setEnabled(body->Parts().count()>0); 98 attachments->setEnabled(body->Parts().count()>0);
98 if (body->Parts().count()==0) 99 if (body->Parts().count()==0)
99 { 100 {
100 return; 101 return;
101 } 102 }
102 AttachItem * curItem=0; 103 AttachItem * curItem=0;
103 AttachItem * parentItem = 0; 104 AttachItem * parentItem = 0;
104 QString type=body->Description()->Type()+"/"+body->Description()->Subtype(); 105 QString type=body->Description()->Type()+"/"+body->Description()->Subtype();
105 QString desc,fsize; 106 QString desc,fsize;
106 double s = body->Description()->Size(); 107 double s = body->Description()->Size();
107 int w; 108 int w;
108 w=0; 109 w=0;
109 110
110 while (s>1024) 111 while (s>1024)
111 { 112 {
112 s/=1024; 113 s/=1024;
113 ++w; 114 ++w;
114 if (w>=2) break; 115 if (w>=2) break;
115 } 116 }
116 117
117 QString q=""; 118 QString q="";
118 switch(w) 119 switch(w)
119 { 120 {
120 case 1: 121 case 1:
121 q="k"; 122 q="k";
122 break; 123 break;
123 case 2: 124 case 2:
124 q="M"; 125 q="M";
125 break; 126 break;
126 default: 127 default:
127 break; 128 break;
128 } 129 }