summaryrefslogtreecommitdiff
path: root/noncore/net/mailit/addatt.cpp
Unidiff
Diffstat (limited to 'noncore/net/mailit/addatt.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mailit/addatt.cpp224
1 files changed, 0 insertions, 224 deletions
diff --git a/noncore/net/mailit/addatt.cpp b/noncore/net/mailit/addatt.cpp
deleted file mode 100644
index 19ac58f..0000000
--- a/noncore/net/mailit/addatt.cpp
+++ b/dev/null
@@ -1,224 +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 <qlayout.h>
21#include <qhbox.h>
22#include <qdir.h>
23#include <qstringlist.h>
24#include <qpe/resource.h>
25#include "addatt.h"
26
27FileItem::FileItem(QListView *parent, DocLnk* dl)
28 : QListViewItem(parent)
29{
30 /*file = fileInfo;
31 type = fileType;*/
32
33 doclnk=dl;
34
35 setText(0, doclnk->name());
36
37 /*if (fileType == "Picture") {
38 setPixmap(0, Resource::loadPixmap("pixmap"));
39 } else if (fileType == "Document") {
40 setPixmap(0, Resource::loadPixmap("txt"));
41 } else if (fileType == "Sound") {
42 setPixmap(0, Resource::loadPixmap("play"));
43 } else if (fileType == "Movie") {
44 setPixmap(0, Resource::loadPixmap("MPEGPlayer"));
45 } else if (fileType == "File") {
46 setPixmap(0, Resource::loadPixmap("exec"));
47 }*/
48}
49
50FileItem::~FileItem()
51{
52 if (doclnk!=NULL) delete doclnk;
53 doclnk=NULL;
54}
55
56AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f)
57 : QDialog(parent, name, f)
58{
59 setCaption(tr("Adding attachments") );
60
61 QGridLayout *top = new QGridLayout(this, 1,1 );
62
63 QHBox *buttons=new QHBox(this);
64 /*fileCategoryButton = new QPushButton(this);*/
65 attachButton = new QPushButton(tr("attach..."), buttons);
66 removeButton = new QPushButton(tr("Remove"), buttons);
67
68 /*fileCategories = new QPopupMenu(fileCategoryButton);
69 fileCategoryButton->setPopup(fileCategories);
70 fileCategories->insertItem("Document");
71 fileCategories->insertItem("Picture");
72 fileCategories->insertItem("Sound");
73 fileCategories->insertItem("Movie");
74 fileCategories->insertItem("File");
75
76 fileCategoryButton->setText("Document");
77 top->addWidget(fileCategoryButton, 0, 0);*/
78
79
80 top->addWidget(buttons,1,0);
81 //buttons->addWidget(attachButton,0,0);
82 //buttons->addWidget(removeButton,0,1);
83
84 //connect(fileCategories, SIGNAL(activated(int)), this,
85 //SLOT(fileCategorySelected(int)) );*/
86 connect(attachButton, SIGNAL(clicked()), this,
87 SLOT(addattachment()) );
88 connect(removeButton, SIGNAL(clicked()), this,
89 SLOT(removeattachment()) );
90
91 /*listView = new QListView(this, "AttView");
92 listView->addColumn("Documents");*
93 connect(listView, SIGNAL(doubleClicked(QListViewItem *)), this,
94 SLOT(addattachment()) );*/
95
96
97 attView = new QListView(this, "Selected");
98 attView->addColumn(tr("Attached"));
99 attView->addColumn(tr("File type"));
100 connect(attView, SIGNAL(doubleClicked(QListViewItem *)), this,
101 SLOT(removeattachment()) );
102
103 //top->addWidget(ofs, 0,0);
104 top->addWidget(attView, 0,0);
105
106 clear();
107
108
109}
110
111void AddAtt::clear()
112{
113 attView->clear();
114 //getFiles();
115 modified = FALSE;
116}
117
118/*void AddAtt::fileCategorySelected(int id)
119{
120 fileCategoryButton->setText(fileCategories->text(id));
121 getFiles();
122}*/
123
124void AddAtt::addattachment()
125 {// ### FIXME wrong use -zecke
126 OFileDialog ofs("Attachments",this,0,0,"/root/Documents");
127
128 ofs.showMaximized();
129
130 if (ofs.exec()==QDialog::Accepted)
131 {
132 DocLnk* dl=new DocLnk(ofs.selectedDocument());
133 FileItem* fi=new FileItem(attView,dl);
134 fi->setPixmap(0,dl->pixmap());
135 fi->setText(1,dl->type());
136 attView->insertItem(fi);
137 modified = TRUE;
138 }
139}
140
141void AddAtt::removeattachment()
142{
143 if (attView->selectedItem() != NULL)
144 {
145 attView->takeItem(attView->selectedItem());
146 }
147 modified = TRUE;
148}
149
150void AddAtt::reject()
151{
152 if (modified) {
153 attView->clear();
154 modified = FALSE;
155 }
156}
157
158void AddAtt::accept()
159{
160 modified = FALSE;
161 hide();
162}
163
164void AddAtt::getFiles()
165{
166 QString path, selected;
167
168 /*listView->clear();
169
170 selected = fileCategoryButton->text();
171 if (selected == "Picture") {
172 path = "../pics/";
173 } else if (selected == "Document") {
174 path = "" ; //sub-dirs not decided
175 } else if (selected == "Sound") {
176 path = "../sounds/"; //sub-dirs not decided
177 } else if (selected == "Movie") {
178 path = ""; //sub-dirs not decided
179 } else if (selected == "File") {
180 path = ""; //sub-dirs not decided
181 }
182
183 dir = new QDir(path);
184 dir->setFilter(QDir::Files);
185 const QFileInfoList *dirInfoList = dir->entryInfoList();
186
187 QFileInfoListIterator it(*dirInfoList); // create list iterator
188
189 while ( (fi=it.current()) ) { // for each file...
190 item = new FileItem(lis+ütView, *fi, selected);
191 ++it; // goto next list element
192 }*/
193}
194
195QStringList AddAtt::returnattachedFiles()
196{
197 QFileInfo info;
198 QStringList list;
199
200 item = (FileItem *) attView->firstChild();
201
202
203 while (item != NULL) {
204 DocLnk* dl=item->getDocLnk();
205 list+=dl->file();
206 /*info = item->getFileInfo();
207 list += info.filePath();*/
208 item = (FileItem *) item->nextSibling();
209 }
210 return list;
211}
212
213QStringList AddAtt::returnFileTypes()
214{
215 QStringList list;
216
217 item = (FileItem *) attView->firstChild();
218
219 while (item != NULL) {
220 list += item->getDocLnk()->type();
221 item = (FileItem *) item->nextSibling();
222 }
223 return list;
224}