summaryrefslogtreecommitdiff
path: root/noncore/net/mailit/viewatt.cpp
Unidiff
Diffstat (limited to 'noncore/net/mailit/viewatt.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mailit/viewatt.cpp121
1 files changed, 0 insertions, 121 deletions
diff --git a/noncore/net/mailit/viewatt.cpp b/noncore/net/mailit/viewatt.cpp
deleted file mode 100644
index 3515ba5..0000000
--- a/noncore/net/mailit/viewatt.cpp
+++ b/dev/null
@@ -1,121 +0,0 @@
1/**********************************************************************
2** Copyright (C) 2001 Trolltech AS. All rights reserved.
3**
4** This file is part of Qt Palmtop Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#include <qpe/resource.h>
21#include "viewatt.h"
22#include <qwhatsthis.h>
23#include <qpe/applnk.h>
24#include <qpe/mimetype.h>
25
26ViewAtt::ViewAtt(QWidget *parent, const char *name, WFlags f)
27 : QMainWindow(parent, name, f)
28{
29 setCaption(tr("Exploring attatchments"));
30
31 setToolBarsMovable( FALSE );
32 bar = new QToolBar(this);
33 installButton = new QAction( tr( "Install" ), Resource::loadPixmap( "exec" ), QString::null, CTRL + Key_C, this, 0 );
34 connect(installButton, SIGNAL(activated()), this, SLOT(install()) );
35 installButton->setWhatsThis(tr("Click here to install the attachment to your Documents"));
36
37 listView = new QListView(this, "AttView");
38 listView->addColumn( tr("Attatchment") );
39 listView->addColumn( tr("Type") );
40 listView->addColumn( tr("Installed") );
41 setCentralWidget(listView);
42 QWhatsThis::add(listView,QWidget::tr("This is an overview about all attachments in the mail"));
43}
44
45void ViewAtt::update(Email *mailIn, bool inbox)
46{
47 QListViewItem *item;
48 Enclosure *ePtr;
49
50
51
52 listView->clear();
53 if (inbox) {
54 bar->clear();
55 installButton->addTo( bar );
56 bar->show();
57 } else {
58 bar->hide();
59 }
60
61 mail = mailIn;
62 for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) {
63
64 QString isInstalled = tr("No");
65 if (ePtr->installed)
66 isInstalled = tr("Yes");
67 item = new QListViewItem(listView, ePtr->originalName, ePtr->contentType, isInstalled);
68
69 const QString& mtypeDef=(const QString&) ePtr->contentType+"/"+ePtr->contentAttribute;
70
71 MimeType mt(mtypeDef);
72
73 item->setPixmap(0, mt.pixmap());
74
75 /*
76 if (ePtr->contentType == "TEXT") {
77 actions = new QAction( tr("View"), Resource::loadPixmap("TextEditor"), QString::null, CTRL + Key_C, this, 0);
78 actions->addTo(bar);
79 }
80 if (ePtr->contentType == "AUDIO") {
81 actions = new QAction( tr("Play"), Resource::loadPixmap("SoundPlayer"), QString::null, CTRL + Key_C, this, 0);
82 actions->addTo(bar);
83 item->setPixmap(0, Resource::loadPixmap("play"));
84 }
85 if (ePtr->contentType == "IMAGE") {
86 actions = new QAction( tr("Show"), Resource::loadPixmap("pixmap"), QString::null, CTRL + Key_C, this, 0);
87 actions->addTo(bar);
88 item->setPixmap(0, Resource::loadPixmap("pixmap"));
89 }*/
90 }
91}
92
93void ViewAtt::install()
94{
95 Enclosure *ePtr, *selPtr;
96 QListViewItem *item;
97 QString filename;
98 DocLnk d;
99
100 item = listView->selectedItem();
101 if (item != NULL) {
102 filename = item->text(0);
103 selPtr = NULL;
104 for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) {
105 if (ePtr->originalName == filename)
106 selPtr = ePtr;
107 }
108
109 if (selPtr == NULL) {
110 qWarning("Internal error, file is not installed to documents");
111 return;
112 }
113
114 d.setName(selPtr->originalName);
115 d.setFile(selPtr->path + selPtr->name);
116 d.setType(selPtr->contentType + "/" + selPtr->contentAttribute);
117 d.writeLink();
118 selPtr->installed = TRUE;
119 item->setText(2, tr("Yes"));
120 }
121}