summaryrefslogtreecommitdiff
path: root/noncore/unsupported/mailit/viewatt.cpp
Unidiff
Diffstat (limited to 'noncore/unsupported/mailit/viewatt.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/mailit/viewatt.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/noncore/unsupported/mailit/viewatt.cpp b/noncore/unsupported/mailit/viewatt.cpp
index 86f119f..b6f5015 100644
--- a/noncore/unsupported/mailit/viewatt.cpp
+++ b/noncore/unsupported/mailit/viewatt.cpp
@@ -11,79 +11,88 @@
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "resource.h" 20#include "resource.h"
21#include "viewatt.h" 21#include "viewatt.h"
22#include <qpe/applnk.h> 22#include <qpe/applnk.h>
23#include <qpe/mimetype.h>
23 24
24ViewAtt::ViewAtt(QWidget *parent, const char *name, WFlags f) 25ViewAtt::ViewAtt(QWidget *parent, const char *name, WFlags f)
25 : QMainWindow(parent, name, f) 26 : QMainWindow(parent, name, f)
26{ 27{
27 setCaption("Exploring attatchments"); 28 setCaption("Exploring attatchments");
28 29
29 setToolBarsMovable( FALSE ); 30 setToolBarsMovable( FALSE );
30 bar = new QToolBar(this); 31 bar = new QToolBar(this);
31 installButton = new QAction( tr( "Install" ), Resource::loadPixmap( "exec" ), QString::null, CTRL + Key_C, this, 0 ); 32 installButton = new QAction( tr( "Install" ), Resource::loadPixmap( "exec" ), QString::null, CTRL + Key_C, this, 0 );
32 connect(installButton, SIGNAL(activated()), this, SLOT(install()) ); 33 connect(installButton, SIGNAL(activated()), this, SLOT(install()) );
33 34
34 listView = new QListView(this, "AttView"); 35 listView = new QListView(this, "AttView");
35 listView->addColumn( "Attatchment" ); 36 listView->addColumn( "Attatchment" );
36 listView->addColumn( "Type" ); 37 listView->addColumn( "Type" );
37 listView->addColumn( "Installed" ); 38 listView->addColumn( "Installed" );
38 setCentralWidget(listView); 39 setCentralWidget(listView);
39} 40}
40 41
41void ViewAtt::update(Email *mailIn, bool inbox) 42void ViewAtt::update(Email *mailIn, bool inbox)
42{ 43{
43 QListViewItem *item; 44 QListViewItem *item;
44 Enclosure *ePtr; 45 Enclosure *ePtr;
45 46
47
48
46 listView->clear(); 49 listView->clear();
47 if (inbox) { 50 if (inbox) {
48 bar->clear(); 51 bar->clear();
49 installButton->addTo( bar ); 52 installButton->addTo( bar );
50 bar->show(); 53 bar->show();
51 } else { 54 } else {
52 bar->hide(); 55 bar->hide();
53 } 56 }
54 57
55 mail = mailIn; 58 mail = mailIn;
56 for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) { 59 for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) {
57 60
58 QString isInstalled = "No"; 61 QString isInstalled = "No";
59 if (ePtr->installed) 62 if (ePtr->installed)
60 isInstalled = "Yes"; 63 isInstalled = "Yes";
61 item = new QListViewItem(listView, ePtr->originalName, ePtr->contentType, isInstalled); 64 item = new QListViewItem(listView, ePtr->originalName, ePtr->contentType, isInstalled);
62 65
66 const QString& mtypeDef=(const QString&) ePtr->contentType+"/"+ePtr->contentAttribute;
67
68 MimeType mt(mtypeDef);
69
70 item->setPixmap(0, mt.pixmap());
71
72 /*
63 if (ePtr->contentType == "TEXT") { 73 if (ePtr->contentType == "TEXT") {
64 actions = new QAction( tr("View"), Resource::loadPixmap("TextEditor"), QString::null, CTRL + Key_C, this, 0); 74 actions = new QAction( tr("View"), Resource::loadPixmap("TextEditor"), QString::null, CTRL + Key_C, this, 0);
65 actions->addTo(bar); 75 actions->addTo(bar);
66 item->setPixmap(0, Resource::loadPixmap("txt")); 76 }
67 }
68 if (ePtr->contentType == "AUDIO") { 77 if (ePtr->contentType == "AUDIO") {
69 actions = new QAction( tr("Play"), Resource::loadPixmap("SoundPlayer"), QString::null, CTRL + Key_C, this, 0); 78 actions = new QAction( tr("Play"), Resource::loadPixmap("SoundPlayer"), QString::null, CTRL + Key_C, this, 0);
70 actions->addTo(bar); 79 actions->addTo(bar);
71 item->setPixmap(0, Resource::loadPixmap("play")); 80 item->setPixmap(0, Resource::loadPixmap("play"));
72 } 81 }
73 if (ePtr->contentType == "IMAGE") { 82 if (ePtr->contentType == "IMAGE") {
74 actions = new QAction( tr("Show"), Resource::loadPixmap("pixmap"), QString::null, CTRL + Key_C, this, 0); 83 actions = new QAction( tr("Show"), Resource::loadPixmap("pixmap"), QString::null, CTRL + Key_C, this, 0);
75 actions->addTo(bar); 84 actions->addTo(bar);
76 item->setPixmap(0, Resource::loadPixmap("pixmap")); 85 item->setPixmap(0, Resource::loadPixmap("pixmap"));
77 } 86 }*/
78 } 87 }
79} 88}
80 89
81void ViewAtt::install() 90void ViewAtt::install()
82{ 91{
83 Enclosure *ePtr, *selPtr; 92 Enclosure *ePtr, *selPtr;
84 QListViewItem *item; 93 QListViewItem *item;
85 QString filename; 94 QString filename;
86 DocLnk d; 95 DocLnk d;
87 96
88 item = listView->selectedItem(); 97 item = listView->selectedItem();
89 if (item != NULL) { 98 if (item != NULL) {