Diffstat (limited to 'noncore/unsupported/mailit/addatt.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/mailit/addatt.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/unsupported/mailit/addatt.cpp b/noncore/unsupported/mailit/addatt.cpp index c8be865..d268f1f 100644 --- a/noncore/unsupported/mailit/addatt.cpp +++ b/noncore/unsupported/mailit/addatt.cpp | |||
@@ -1,162 +1,162 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qt Palmtop Environment. | 4 | ** This file is part of Qt Palmtop Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 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 | 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 | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
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 <qlayout.h> | 20 | #include <qlayout.h> |
21 | #include <qhbox.h> | 21 | #include <qhbox.h> |
22 | #include <qdir.h> | 22 | #include <qdir.h> |
23 | #include <qstringlist.h> | 23 | #include <qstringlist.h> |
24 | #include "resource.h" | 24 | #include <qpe/resource.h> |
25 | #include "addatt.h" | 25 | #include "addatt.h" |
26 | 26 | ||
27 | FileItem::FileItem(QListView *parent, DocLnk* dl) | 27 | FileItem::FileItem(QListView *parent, DocLnk* dl) |
28 | : QListViewItem(parent) | 28 | : QListViewItem(parent) |
29 | { | 29 | { |
30 | /*file = fileInfo; | 30 | /*file = fileInfo; |
31 | type = fileType;*/ | 31 | type = fileType;*/ |
32 | 32 | ||
33 | doclnk=dl; | 33 | doclnk=dl; |
34 | 34 | ||
35 | setText(0, doclnk->name()); | 35 | setText(0, doclnk->name()); |
36 | 36 | ||
37 | /*if (fileType == "Picture") { | 37 | /*if (fileType == "Picture") { |
38 | setPixmap(0, Resource::loadPixmap("pixmap")); | 38 | setPixmap(0, Resource::loadPixmap("pixmap")); |
39 | } else if (fileType == "Document") { | 39 | } else if (fileType == "Document") { |
40 | setPixmap(0, Resource::loadPixmap("txt")); | 40 | setPixmap(0, Resource::loadPixmap("txt")); |
41 | } else if (fileType == "Sound") { | 41 | } else if (fileType == "Sound") { |
42 | setPixmap(0, Resource::loadPixmap("play")); | 42 | setPixmap(0, Resource::loadPixmap("play")); |
43 | } else if (fileType == "Movie") { | 43 | } else if (fileType == "Movie") { |
44 | setPixmap(0, Resource::loadPixmap("MPEGPlayer")); | 44 | setPixmap(0, Resource::loadPixmap("MPEGPlayer")); |
45 | } else if (fileType == "File") { | 45 | } else if (fileType == "File") { |
46 | setPixmap(0, Resource::loadPixmap("exec")); | 46 | setPixmap(0, Resource::loadPixmap("exec")); |
47 | }*/ | 47 | }*/ |
48 | } | 48 | } |
49 | 49 | ||
50 | FileItem::~FileItem() | 50 | FileItem::~FileItem() |
51 | { | 51 | { |
52 | if (doclnk!=NULL) delete doclnk; | 52 | if (doclnk!=NULL) delete doclnk; |
53 | doclnk=NULL; | 53 | doclnk=NULL; |
54 | } | 54 | } |
55 | 55 | ||
56 | AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f) | 56 | AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f) |
57 | : QDialog(parent, name, f) | 57 | : QDialog(parent, name, f) |
58 | { | 58 | { |
59 | setCaption("Adding attatchments"); | 59 | setCaption("Adding attatchments"); |
60 | 60 | ||
61 | QGridLayout *top = new QGridLayout(this, 1,1 ); | 61 | QGridLayout *top = new QGridLayout(this, 1,1 ); |
62 | 62 | ||
63 | QHBox *buttons=new QHBox(this); | 63 | QHBox *buttons=new QHBox(this); |
64 | /*fileCategoryButton = new QPushButton(this);*/ | 64 | /*fileCategoryButton = new QPushButton(this);*/ |
65 | attatchButton = new QPushButton("Attatch ->", buttons); | 65 | attatchButton = new QPushButton(tr("Attatch..."), buttons); |
66 | removeButton = new QPushButton("Remove", buttons); | 66 | removeButton = new QPushButton(tr("Remove"), buttons); |
67 | 67 | ||
68 | /*fileCategories = new QPopupMenu(fileCategoryButton); | 68 | /*fileCategories = new QPopupMenu(fileCategoryButton); |
69 | fileCategoryButton->setPopup(fileCategories); | 69 | fileCategoryButton->setPopup(fileCategories); |
70 | fileCategories->insertItem("Document"); | 70 | fileCategories->insertItem("Document"); |
71 | fileCategories->insertItem("Picture"); | 71 | fileCategories->insertItem("Picture"); |
72 | fileCategories->insertItem("Sound"); | 72 | fileCategories->insertItem("Sound"); |
73 | fileCategories->insertItem("Movie"); | 73 | fileCategories->insertItem("Movie"); |
74 | fileCategories->insertItem("File"); | 74 | fileCategories->insertItem("File"); |
75 | 75 | ||
76 | fileCategoryButton->setText("Document"); | 76 | fileCategoryButton->setText("Document"); |
77 | top->addWidget(fileCategoryButton, 0, 0);*/ | 77 | top->addWidget(fileCategoryButton, 0, 0);*/ |
78 | 78 | ||
79 | 79 | ||
80 | top->addWidget(buttons,1,0); | 80 | top->addWidget(buttons,1,0); |
81 | //buttons->addWidget(attatchButton,0,0); | 81 | //buttons->addWidget(attatchButton,0,0); |
82 | //buttons->addWidget(removeButton,0,1); | 82 | //buttons->addWidget(removeButton,0,1); |
83 | 83 | ||
84 | //connect(fileCategories, SIGNAL(activated(int)), this, | 84 | //connect(fileCategories, SIGNAL(activated(int)), this, |
85 | //SLOT(fileCategorySelected(int)) );*/ | 85 | //SLOT(fileCategorySelected(int)) );*/ |
86 | connect(attatchButton, SIGNAL(clicked()), this, | 86 | connect(attatchButton, SIGNAL(clicked()), this, |
87 | SLOT(addAttatchment()) ); | 87 | SLOT(addAttatchment()) ); |
88 | connect(removeButton, SIGNAL(clicked()), this, | 88 | connect(removeButton, SIGNAL(clicked()), this, |
89 | SLOT(removeAttatchment()) ); | 89 | SLOT(removeAttatchment()) ); |
90 | 90 | ||
91 | /*listView = new QListView(this, "AttView"); | 91 | /*listView = new QListView(this, "AttView"); |
92 | listView->addColumn("Documents");* | 92 | listView->addColumn("Documents");* |
93 | connect(listView, SIGNAL(doubleClicked(QListViewItem *)), this, | 93 | connect(listView, SIGNAL(doubleClicked(QListViewItem *)), this, |
94 | SLOT(addAttatchment()) );*/ | 94 | SLOT(addAttatchment()) );*/ |
95 | 95 | ||
96 | 96 | ||
97 | attView = new QListView(this, "Selected"); | 97 | attView = new QListView(this, "Selected"); |
98 | attView->addColumn(tr("Attached")); | 98 | attView->addColumn(tr("Attached")); |
99 | attView->addColumn(tr("File type")); | 99 | attView->addColumn(tr("File type")); |
100 | connect(attView, SIGNAL(doubleClicked(QListViewItem *)), this, | 100 | connect(attView, SIGNAL(doubleClicked(QListViewItem *)), this, |
101 | SLOT(removeAttatchment()) ); | 101 | SLOT(removeAttatchment()) ); |
102 | 102 | ||
103 | //top->addWidget(ofs, 0,0); | 103 | //top->addWidget(ofs, 0,0); |
104 | top->addWidget(attView, 0,0); | 104 | top->addWidget(attView, 0,0); |
105 | 105 | ||
106 | clear(); | 106 | clear(); |
107 | 107 | ||
108 | 108 | ||
109 | } | 109 | } |
110 | 110 | ||
111 | void AddAtt::clear() | 111 | void AddAtt::clear() |
112 | { | 112 | { |
113 | attView->clear(); | 113 | attView->clear(); |
114 | //getFiles(); | 114 | //getFiles(); |
115 | modified = FALSE; | 115 | modified = FALSE; |
116 | } | 116 | } |
117 | 117 | ||
118 | /*void AddAtt::fileCategorySelected(int id) | 118 | /*void AddAtt::fileCategorySelected(int id) |
119 | { | 119 | { |
120 | fileCategoryButton->setText(fileCategories->text(id)); | 120 | fileCategoryButton->setText(fileCategories->text(id)); |
121 | getFiles(); | 121 | getFiles(); |
122 | }*/ | 122 | }*/ |
123 | 123 | ||
124 | void AddAtt::addAttatchment() | 124 | void AddAtt::addAttatchment() |
125 | { | 125 | { |
126 | OFileDialog ofs("Attachments",this,0,0,"/root/Documents"); | 126 | OFileDialog ofs("Attachments",this,0,0,"/root/Documents"); |
127 | 127 | ||
128 | ofs.showMaximized(); | 128 | ofs.showMaximized(); |
129 | 129 | ||
130 | if (ofs.exec()==QDialog::Accepted) | 130 | if (ofs.exec()==QDialog::Accepted) |
131 | { | 131 | { |
132 | DocLnk* dl=new DocLnk(ofs.selectedDocument()); | 132 | DocLnk* dl=new DocLnk(ofs.selectedDocument()); |
133 | FileItem* fi=new FileItem(attView,dl); | 133 | FileItem* fi=new FileItem(attView,dl); |
134 | fi->setPixmap(0,dl->pixmap()); | 134 | fi->setPixmap(0,dl->pixmap()); |
135 | fi->setText(1,dl->type()); | 135 | fi->setText(1,dl->type()); |
136 | attView->insertItem(fi); | 136 | attView->insertItem(fi); |
137 | modified = TRUE; | 137 | modified = TRUE; |
138 | } | 138 | } |
139 | } | 139 | } |
140 | 140 | ||
141 | void AddAtt::removeAttatchment() | 141 | void AddAtt::removeAttatchment() |
142 | { | 142 | { |
143 | if (attView->selectedItem() != NULL) | 143 | if (attView->selectedItem() != NULL) |
144 | { | 144 | { |
145 | attView->takeItem(attView->selectedItem()); | 145 | attView->takeItem(attView->selectedItem()); |
146 | } | 146 | } |
147 | modified = TRUE; | 147 | modified = TRUE; |
148 | } | 148 | } |
149 | 149 | ||
150 | void AddAtt::reject() | 150 | void AddAtt::reject() |
151 | { | 151 | { |
152 | if (modified) { | 152 | if (modified) { |
153 | attView->clear(); | 153 | attView->clear(); |
154 | modified = FALSE; | 154 | modified = FALSE; |
155 | } | 155 | } |
156 | } | 156 | } |
157 | 157 | ||
158 | void AddAtt::accept() | 158 | void AddAtt::accept() |
159 | { | 159 | { |
160 | modified = FALSE; | 160 | modified = FALSE; |
161 | hide(); | 161 | hide(); |
162 | } | 162 | } |