author | groucho <groucho> | 2003-04-11 14:48:19 (UTC) |
---|---|---|
committer | groucho <groucho> | 2003-04-11 14:48:19 (UTC) |
commit | d37f3eac6b876285eb7a03ab01194ea261458ea5 (patch) (unidiff) | |
tree | 47420d872c6d298db7e26715c80cf3aebb055033 | |
parent | ebf5bb083d47179918d47f083a3cc98a5ed5d2e0 (diff) | |
download | opie-d37f3eac6b876285eb7a03ab01194ea261458ea5.zip opie-d37f3eac6b876285eb7a03ab01194ea261458ea5.tar.gz opie-d37f3eac6b876285eb7a03ab01194ea261458ea5.tar.bz2 |
Lots of improvements regarding usability and stability:
- Now uses ofileselector for sending attachments (reading follows, does not crash any more)
- Uses DocLnks for attachments (when composing a message)
- Beautified the attachments dialog with doc icons
- removed a crash when sending attachments and no account was set
- smaller fixes
ToDo:
- Attachment viewer should use doclnk too
- get rid of teh save button in ofileselector
- fix the bug with GMX mail provider sending mail (user encoding wrong)
- replace the Attach and Remove buttons with a nice toolbar
- Maybe integrate attview into the mail sending window on demand
- get rid of crashes
-rw-r--r-- | noncore/net/mailit/addatt.cpp | 119 | ||||
-rw-r--r-- | noncore/net/mailit/addatt.h | 24 | ||||
-rw-r--r-- | noncore/net/mailit/emailclient.cpp | 10 | ||||
-rw-r--r-- | noncore/net/mailit/emailhandler.cpp | 7 | ||||
-rw-r--r-- | noncore/net/mailit/writemail.cpp | 6 | ||||
-rw-r--r-- | noncore/unsupported/mailit/addatt.cpp | 119 | ||||
-rw-r--r-- | noncore/unsupported/mailit/addatt.h | 24 | ||||
-rw-r--r-- | noncore/unsupported/mailit/emailclient.cpp | 10 | ||||
-rw-r--r-- | noncore/unsupported/mailit/emailhandler.cpp | 7 | ||||
-rw-r--r-- | noncore/unsupported/mailit/writemail.cpp | 6 |
10 files changed, 200 insertions, 132 deletions
diff --git a/noncore/net/mailit/addatt.cpp b/noncore/net/mailit/addatt.cpp index c030e36..f279f52 100644 --- a/noncore/net/mailit/addatt.cpp +++ b/noncore/net/mailit/addatt.cpp | |||
@@ -22,17 +22,19 @@ | |||
22 | #include <qstringlist.h> | 22 | #include <qstringlist.h> |
23 | #include "resource.h" | 23 | #include "resource.h" |
24 | #include "addatt.h" | 24 | #include "addatt.h" |
25 | 25 | ||
26 | FileItem::FileItem(QListView *parent, QFileInfo fileInfo, QString fileType) | 26 | FileItem::FileItem(QListView *parent, DocLnk* dl) |
27 | : QListViewItem(parent) | 27 | : QListViewItem(parent) |
28 | { | 28 | { |
29 | file = fileInfo; | 29 | /*file = fileInfo; |
30 | type = fileType; | 30 | type = fileType;*/ |
31 | |||
32 | doclnk=dl; | ||
31 | 33 | ||
32 | setText(0, fileInfo.baseName()); | 34 | setText(0, doclnk->name()); |
33 | 35 | ||
34 | if (fileType == "Picture") { | 36 | /*if (fileType == "Picture") { |
35 | setPixmap(0, Resource::loadPixmap("pixmap")); | 37 | setPixmap(0, Resource::loadPixmap("pixmap")); |
36 | } else if (fileType == "Document") { | 38 | } else if (fileType == "Document") { |
37 | setPixmap(0, Resource::loadPixmap("txt")); | 39 | setPixmap(0, Resource::loadPixmap("txt")); |
38 | } else if (fileType == "Sound") { | 40 | } else if (fileType == "Sound") { |
@@ -40,98 +42,113 @@ FileItem::FileItem(QListView *parent, QFileInfo fileInfo, QString fileType) | |||
40 | } else if (fileType == "Movie") { | 42 | } else if (fileType == "Movie") { |
41 | setPixmap(0, Resource::loadPixmap("MPEGPlayer")); | 43 | setPixmap(0, Resource::loadPixmap("MPEGPlayer")); |
42 | } else if (fileType == "File") { | 44 | } else if (fileType == "File") { |
43 | setPixmap(0, Resource::loadPixmap("exec")); | 45 | setPixmap(0, Resource::loadPixmap("exec")); |
44 | } | 46 | }*/ |
45 | } | 47 | } |
46 | 48 | ||
47 | QFileInfo FileItem::getFileInfo() | 49 | FileItem::~FileItem() |
48 | { | 50 | { |
49 | return file; | 51 | if (doclnk!=NULL) delete doclnk; |
50 | } | 52 | doclnk=NULL; |
51 | |||
52 | QString FileItem::getFileType() | ||
53 | { | ||
54 | return type; | ||
55 | } | 53 | } |
56 | 54 | ||
57 | AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f) | 55 | AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f) |
58 | : QDialog(parent, name, f) | 56 | : QDialog(parent, name, f) |
59 | { | 57 | { |
60 | setCaption("Adding attatchments"); | 58 | setCaption("Adding attatchments"); |
61 | 59 | ||
62 | QGridLayout *top = new QGridLayout(this, 3, 2); | 60 | QGridLayout *top = new QGridLayout(this, 3,1 ); |
61 | |||
63 | 62 | ||
64 | fileCategoryButton = new QPushButton(this); | 63 | /*fileCategoryButton = new QPushButton(this);*/ |
65 | attatchButton = new QPushButton("Attatch ->", this); | 64 | attatchButton = new QPushButton("Attatch ->", this); |
66 | removeButton = new QPushButton("Remove", this); | 65 | removeButton = new QPushButton("Remove", this); |
67 | 66 | ||
68 | fileCategories = new QPopupMenu(fileCategoryButton); | 67 | /*fileCategories = new QPopupMenu(fileCategoryButton); |
69 | fileCategoryButton->setPopup(fileCategories); | 68 | fileCategoryButton->setPopup(fileCategories); |
70 | fileCategories->insertItem("Document"); | 69 | fileCategories->insertItem("Document"); |
71 | fileCategories->insertItem("Picture"); | 70 | fileCategories->insertItem("Picture"); |
72 | fileCategories->insertItem("Sound"); | 71 | fileCategories->insertItem("Sound"); |
73 | fileCategories->insertItem("Movie"); | 72 | fileCategories->insertItem("Movie"); |
74 | fileCategories->insertItem("File"); | 73 | fileCategories->insertItem("File"); |
75 | 74 | ||
76 | fileCategoryButton->setText("Document"); | 75 | fileCategoryButton->setText("Document"); |
77 | top->addWidget(fileCategoryButton, 0, 0); | 76 | top->addWidget(fileCategoryButton, 0, 0);*/ |
78 | top->addWidget(attatchButton, 2, 0); | 77 | |
79 | top->addWidget(removeButton, 2, 1); | 78 | //ofs=new OFileSelector(this,2,0,"/root/Documents"); |
79 | |||
80 | |||
81 | top->addWidget(attatchButton,1,0); | ||
82 | top->addWidget(removeButton,2,0); | ||
80 | 83 | ||
81 | connect(fileCategories, SIGNAL(activated(int)), this, | 84 | /*connect(fileCategories, SIGNAL(activated(int)), this, |
82 | SLOT(fileCategorySelected(int)) ); | 85 | SLOT(fileCategorySelected(int)) );*/ |
83 | connect(attatchButton, SIGNAL(clicked()), this, | 86 | connect(attatchButton, SIGNAL(clicked()), this, |
84 | SLOT(addAttatchment()) ); | 87 | SLOT(addAttatchment()) ); |
85 | connect(removeButton, SIGNAL(clicked()), this, | 88 | connect(removeButton, SIGNAL(clicked()), this, |
86 | SLOT(removeAttatchment()) ); | 89 | SLOT(removeAttatchment()) ); |
87 | 90 | ||
88 | listView = new QListView(this, "AttView"); | 91 | /*listView = new QListView(this, "AttView"); |
89 | listView->addColumn("Documents"); | 92 | listView->addColumn("Documents");* |
90 | connect(listView, SIGNAL(doubleClicked(QListViewItem *)), this, | 93 | connect(listView, SIGNAL(doubleClicked(QListViewItem *)), this, |
91 | SLOT(addAttatchment()) ); | 94 | SLOT(addAttatchment()) );*/ |
95 | |||
92 | 96 | ||
93 | attView = new QListView(this, "Selected"); | 97 | attView = new QListView(this, "Selected"); |
94 | attView->addColumn("Attatched"); | 98 | attView->addColumn(tr("Attached")); |
99 | attView->addColumn(tr("File type")); | ||
95 | connect(attView, SIGNAL(doubleClicked(QListViewItem *)), this, | 100 | connect(attView, SIGNAL(doubleClicked(QListViewItem *)), this, |
96 | SLOT(removeAttatchment()) ); | 101 | SLOT(removeAttatchment()) ); |
97 | 102 | ||
98 | top->addWidget(listView, 1,0); | 103 | //top->addWidget(ofs, 0,0); |
99 | top->addWidget(attView, 1,1); | 104 | top->addWidget(attView, 0,0); |
105 | |||
106 | clear(); | ||
100 | 107 | ||
101 | clear(); | 108 | |
102 | } | 109 | } |
103 | 110 | ||
104 | void AddAtt::clear() | 111 | void AddAtt::clear() |
105 | { | 112 | { |
106 | attView->clear(); | 113 | attView->clear(); |
107 | getFiles(); | 114 | //getFiles(); |
108 | modified = FALSE; | 115 | modified = FALSE; |
109 | } | 116 | } |
110 | 117 | ||
111 | void AddAtt::fileCategorySelected(int id) | 118 | /*void AddAtt::fileCategorySelected(int id) |
112 | { | 119 | { |
113 | fileCategoryButton->setText(fileCategories->text(id)); | 120 | fileCategoryButton->setText(fileCategories->text(id)); |
114 | getFiles(); | 121 | getFiles(); |
115 | } | 122 | }*/ |
116 | 123 | ||
117 | void AddAtt::addAttatchment() | 124 | void AddAtt::addAttatchment() |
118 | { | 125 | { |
119 | QFileInfo info; | 126 | QDialog qd(this,tr("Select attachment"),true); |
120 | QString type; | 127 | |
128 | QGridLayout top(&qd,1,1); | ||
129 | |||
130 | OFileSelector ofs(&qd,1,0,"/root/Documents"); | ||
131 | |||
132 | top.addWidget(&ofs,0,0); | ||
121 | 133 | ||
122 | if (listView->selectedItem() != NULL) { | 134 | qd.showMaximized(); |
123 | item = (FileItem *) listView->selectedItem(); | 135 | |
124 | info = item->getFileInfo(); | 136 | if (qd.exec()==QDialog::Accepted) |
125 | type = item->getFileType(); | 137 | { |
126 | item = new FileItem(attView, info, type); | 138 | DocLnk* dl=new DocLnk(ofs.selectedDocument()); |
139 | FileItem* fi=new FileItem(attView,dl); | ||
140 | fi->setPixmap(0,dl->pixmap()); | ||
141 | fi->setText(1,dl->type()); | ||
142 | attView->insertItem(fi); | ||
143 | modified = TRUE; | ||
127 | } | 144 | } |
128 | modified = TRUE; | ||
129 | } | 145 | } |
130 | 146 | ||
131 | void AddAtt::removeAttatchment() | 147 | void AddAtt::removeAttatchment() |
132 | { | 148 | { |
133 | if (attView->selectedItem() != NULL) { | 149 | if (attView->selectedItem() != NULL) |
150 | { | ||
134 | attView->takeItem(attView->selectedItem()); | 151 | attView->takeItem(attView->selectedItem()); |
135 | } | 152 | } |
136 | modified = TRUE; | 153 | modified = TRUE; |
137 | } | 154 | } |
@@ -152,11 +169,10 @@ void AddAtt::accept() | |||
152 | 169 | ||
153 | void AddAtt::getFiles() | 170 | void AddAtt::getFiles() |
154 | { | 171 | { |
155 | QString path, selected; | 172 | QString path, selected; |
156 | QDir *dir; | ||
157 | 173 | ||
158 | listView->clear(); | 174 | /*listView->clear(); |
159 | 175 | ||
160 | selected = fileCategoryButton->text(); | 176 | selected = fileCategoryButton->text(); |
161 | if (selected == "Picture") { | 177 | if (selected == "Picture") { |
162 | path = "../pics/"; | 178 | path = "../pics/"; |
@@ -176,34 +192,39 @@ void AddAtt::getFiles() | |||
176 | 192 | ||
177 | QFileInfoListIterator it(*dirInfoList); // create list iterator | 193 | QFileInfoListIterator it(*dirInfoList); // create list iterator |
178 | 194 | ||
179 | while ( (fi=it.current()) ) { // for each file... | 195 | while ( (fi=it.current()) ) { // for each file... |
180 | item = new FileItem(listView, *fi, selected); | 196 | item = new FileItem(lis+ütView, *fi, selected); |
181 | ++it; // goto next list element | 197 | ++it; // goto next list element |
182 | } | 198 | }*/ |
183 | } | 199 | } |
184 | 200 | ||
185 | QStringList AddAtt::returnAttatchedFiles() | 201 | QStringList AddAtt::returnAttatchedFiles() |
186 | { | 202 | { |
187 | QFileInfo info; | 203 | QFileInfo info; |
188 | QStringList list; | 204 | QStringList list; |
189 | 205 | ||
190 | item = (FileItem *) attView->firstChild(); | 206 | item = (FileItem *) attView->firstChild(); |
207 | |||
208 | |||
191 | while (item != NULL) { | 209 | while (item != NULL) { |
192 | info = item->getFileInfo(); | 210 | DocLnk* dl=item->getDocLnk(); |
193 | list += info.filePath(); | 211 | list+=dl->file(); |
212 | /*info = item->getFileInfo(); | ||
213 | list += info.filePath();*/ | ||
194 | item = (FileItem *) item->nextSibling(); | 214 | item = (FileItem *) item->nextSibling(); |
195 | } | 215 | } |
196 | return list; | 216 | return list; |
197 | } | 217 | } |
198 | 218 | ||
199 | QStringList AddAtt::returnFileTypes() | 219 | QStringList AddAtt::returnFileTypes() |
200 | { | 220 | { |
201 | QStringList list; | 221 | QStringList list; |
202 | 222 | ||
203 | item = (FileItem *) attView->firstChild(); | 223 | item = (FileItem *) attView->firstChild(); |
224 | |||
204 | while (item != NULL) { | 225 | while (item != NULL) { |
205 | list += item->getFileType(); | 226 | list += item->getDocLnk()->type(); |
206 | item = (FileItem *) item->nextSibling(); | 227 | item = (FileItem *) item->nextSibling(); |
207 | } | 228 | } |
208 | return list; | 229 | return list; |
209 | } | 230 | } |
diff --git a/noncore/net/mailit/addatt.h b/noncore/net/mailit/addatt.h index 867c905..73062e2 100644 --- a/noncore/net/mailit/addatt.h +++ b/noncore/net/mailit/addatt.h | |||
@@ -26,19 +26,22 @@ | |||
26 | #include <qpopupmenu.h> | 26 | #include <qpopupmenu.h> |
27 | #include <qstring.h> | 27 | #include <qstring.h> |
28 | #include <qfileinfo.h> | 28 | #include <qfileinfo.h> |
29 | #include <qstringlist.h> | 29 | #include <qstringlist.h> |
30 | #include <opie/ofileselector.h> | ||
31 | #include <qpe/applnk.h> | ||
30 | 32 | ||
31 | class FileItem : public QListViewItem | 33 | class FileItem : public QListViewItem |
32 | { | 34 | { |
33 | public: | 35 | public: |
34 | FileItem(QListView *parent, QFileInfo fileInfo, QString fileType); | 36 | //FileItem(QListView *parent, QFileInfo fileInfo, QString fileType); |
35 | QFileInfo getFileInfo(); | 37 | FileItem(QListView*, DocLnk*); |
36 | QString getFileType(); | 38 | ~FileItem(); |
37 | 39 | DocLnk* getDocLnk() {return doclnk;} | |
40 | |||
41 | |||
38 | private: | 42 | private: |
39 | QFileInfo file; | 43 | DocLnk* doclnk; |
40 | QString type; | ||
41 | }; | 44 | }; |
42 | 45 | ||
43 | class AddAtt : public QDialog | 46 | class AddAtt : public QDialog |
44 | { | 47 | { |
@@ -50,21 +53,24 @@ public: | |||
50 | QStringList returnFileTypes(); | 53 | QStringList returnFileTypes(); |
51 | void getFiles(); | 54 | void getFiles(); |
52 | void clear(); | 55 | void clear(); |
53 | 56 | ||
57 | |||
54 | public slots: | 58 | public slots: |
55 | void fileCategorySelected(int); | 59 | //void fileCategorySelected(int); |
56 | void addAttatchment(); | 60 | void addAttatchment(); |
57 | void removeAttatchment(); | 61 | void removeAttatchment(); |
58 | void reject(); | 62 | void reject(); |
59 | void accept(); | 63 | void accept(); |
60 | 64 | ||
61 | private: | 65 | private: |
62 | FileItem *item; | 66 | FileItem* item; |
63 | QListView *listView, *attView; | 67 | QListView *attView; |
64 | QPushButton *fileCategoryButton, *attatchButton, *removeButton; | 68 | QPushButton *fileCategoryButton, *attatchButton, *removeButton; |
65 | QPopupMenu *fileCategories; | 69 | QPopupMenu *fileCategories; |
66 | bool modified; | 70 | bool modified; |
67 | QFileInfo *fi; | 71 | QFileInfo *fi; |
72 | |||
73 | OFileSelector* ofs; | ||
68 | }; | 74 | }; |
69 | 75 | ||
70 | #endif | 76 | #endif |
diff --git a/noncore/net/mailit/emailclient.cpp b/noncore/net/mailit/emailclient.cpp index fc4276b..9258aac 100644 --- a/noncore/net/mailit/emailclient.cpp +++ b/noncore/net/mailit/emailclient.cpp | |||
@@ -160,8 +160,9 @@ void EmailClient::init() | |||
160 | 160 | ||
161 | cancelButton = new QAction(tr("Cancel transfer"), Resource::loadPixmap("close"), QString::null, 0, this, 0); | 161 | cancelButton = new QAction(tr("Cancel transfer"), Resource::loadPixmap("close"), QString::null, 0, this, 0); |
162 | connect(cancelButton, SIGNAL(activated()), this, SLOT(cancel()) ); | 162 | connect(cancelButton, SIGNAL(activated()), this, SLOT(cancel()) ); |
163 | cancelButton->addTo(mail); | 163 | cancelButton->addTo(mail); |
164 | cancelButton->addTo(bar); | ||
164 | cancelButton->setEnabled(FALSE); | 165 | cancelButton->setEnabled(FALSE); |
165 | 166 | ||
166 | mailboxView = new OTabWidget( this, "mailboxView" ); | 167 | mailboxView = new OTabWidget( this, "mailboxView" ); |
167 | 168 | ||
@@ -213,8 +214,14 @@ AddressList* EmailClient::getAdrListRef() | |||
213 | 214 | ||
214 | //this needs to be rewritten to syncronize with outboxView | 215 | //this needs to be rewritten to syncronize with outboxView |
215 | void EmailClient::enqueMail(const Email &mail) | 216 | void EmailClient::enqueMail(const Email &mail) |
216 | { | 217 | { |
218 | if (accountList.count() == 0) { | ||
219 | QMessageBox::warning(qApp->activeWindow(), | ||
220 | tr("No account selected"), tr("You must create an account"), "OK\n"); | ||
221 | return; | ||
222 | } | ||
223 | |||
217 | if (accountList.count() > 0) { | 224 | if (accountList.count() > 0) { |
218 | currentAccount = accountList.first(); | 225 | currentAccount = accountList.first(); |
219 | qWarning("using account " + currentAccount->name); | 226 | qWarning("using account " + currentAccount->name); |
220 | } | 227 | } |
@@ -231,10 +238,9 @@ void EmailClient::sendQuedMail() | |||
231 | { | 238 | { |
232 | int count = 0; | 239 | int count = 0; |
233 | 240 | ||
234 | if (accountList.count() == 0) { | 241 | if (accountList.count() == 0) { |
235 | QMessageBox::warning(qApp->activeWindow(), | 242 | QMessageBox::warning(qApp->activeWindow(), "No account selected", "You must create an account", "OK\n"); |
236 | "No account selected", "You must create an account", "OK\n"); | ||
237 | return; | 243 | return; |
238 | } | 244 | } |
239 | //traverse listview, find messages to send | 245 | //traverse listview, find messages to send |
240 | if (! sending) { | 246 | if (! sending) { |
diff --git a/noncore/net/mailit/emailhandler.cpp b/noncore/net/mailit/emailhandler.cpp index 2144899..1be16d4 100644 --- a/noncore/net/mailit/emailhandler.cpp +++ b/noncore/net/mailit/emailhandler.cpp | |||
@@ -411,14 +411,17 @@ int EmailHandler::parse64base(char *src, char *bufOut) { | |||
411 | } | 411 | } |
412 | return processed; | 412 | return processed; |
413 | } | 413 | } |
414 | 414 | ||
415 | int EmailHandler::encodeMime(Email *mail) { | 415 | int EmailHandler::encodeMime(Email *mail) |
416 | { | ||
417 | |||
416 | QString fileName, fileType, contentType, newBody, boundary; | 418 | QString fileName, fileType, contentType, newBody, boundary; |
417 | Enclosure *ePtr; | 419 | Enclosure *ePtr; |
418 | 420 | ||
419 | QString userName = mailAccount.name; | 421 | QString userName = mailAccount.name; |
420 | userName += " <" + mailAccount.emailAddress + ">"; | 422 | if (userName.length()>0)//only embrace it if there is a user name |
423 | userName += " <" + mailAccount.emailAddress + ">"; | ||
421 | 424 | ||
422 | //add standard headers | 425 | //add standard headers |
423 | newBody = "From: " + userName + "\r\nTo: "; | 426 | newBody = "From: " + userName + "\r\nTo: "; |
424 | for (QStringList::Iterator it = mail->recipients.begin(); it != mail->recipients.end(); ++it ) { | 427 | for (QStringList::Iterator it = mail->recipients.begin(); it != mail->recipients.end(); ++it ) { |
diff --git a/noncore/net/mailit/writemail.cpp b/noncore/net/mailit/writemail.cpp index 1a7185e..70332a9 100644 --- a/noncore/net/mailit/writemail.cpp +++ b/noncore/net/mailit/writemail.cpp | |||
@@ -63,9 +63,9 @@ void WriteMail::init() | |||
63 | addMenu = new QPopupMenu(menu); | 63 | addMenu = new QPopupMenu(menu); |
64 | menu->insertItem( tr( "&Add" ), addMenu); | 64 | menu->insertItem( tr( "&Add" ), addMenu); |
65 | 65 | ||
66 | bar = new QToolBar(this); | 66 | bar = new QToolBar(this); |
67 | attatchButton = new QAction(tr("Attatchment"), Resource::loadPixmap("fileopen"), QString::null, 0, this, 0); | 67 | attatchButton = new QAction(tr("Attatchment"), Resource::loadPixmap("mailit/attach"), QString::null, 0, this, 0); |
68 | attatchButton->addTo(bar); | 68 | attatchButton->addTo(bar); |
69 | attatchButton->addTo(addMenu); | 69 | attatchButton->addTo(addMenu); |
70 | connect( attatchButton, SIGNAL( activated() ), this, SLOT( attatchFile() ) ); | 70 | connect( attatchButton, SIGNAL( activated() ), this, SLOT( attatchFile() ) ); |
71 | 71 | ||
@@ -170,11 +170,9 @@ void WriteMail::accept() | |||
170 | 170 | ||
171 | QStringList::Iterator itType = attatchmentsType.begin(); | 171 | QStringList::Iterator itType = attatchmentsType.begin(); |
172 | 172 | ||
173 | Enclosure e; | 173 | Enclosure e; |
174 | for ( QStringList::Iterator it = attatchedFiles.begin(); | 174 | for ( QStringList::Iterator it = attatchedFiles.begin(); it != attatchedFiles.end(); ++it ) { |
175 | it != attatchedFiles.end(); ++it ) { | ||
176 | |||
177 | e.id = idCount; | 175 | e.id = idCount; |
178 | e.originalName = (*it).latin1(); | 176 | e.originalName = (*it).latin1(); |
179 | e.contentType = (*itType).latin1(); | 177 | e.contentType = (*itType).latin1(); |
180 | e.contentAttribute = (*itType).latin1(); | 178 | e.contentAttribute = (*itType).latin1(); |
diff --git a/noncore/unsupported/mailit/addatt.cpp b/noncore/unsupported/mailit/addatt.cpp index c030e36..f279f52 100644 --- a/noncore/unsupported/mailit/addatt.cpp +++ b/noncore/unsupported/mailit/addatt.cpp | |||
@@ -22,17 +22,19 @@ | |||
22 | #include <qstringlist.h> | 22 | #include <qstringlist.h> |
23 | #include "resource.h" | 23 | #include "resource.h" |
24 | #include "addatt.h" | 24 | #include "addatt.h" |
25 | 25 | ||
26 | FileItem::FileItem(QListView *parent, QFileInfo fileInfo, QString fileType) | 26 | FileItem::FileItem(QListView *parent, DocLnk* dl) |
27 | : QListViewItem(parent) | 27 | : QListViewItem(parent) |
28 | { | 28 | { |
29 | file = fileInfo; | 29 | /*file = fileInfo; |
30 | type = fileType; | 30 | type = fileType;*/ |
31 | |||
32 | doclnk=dl; | ||
31 | 33 | ||
32 | setText(0, fileInfo.baseName()); | 34 | setText(0, doclnk->name()); |
33 | 35 | ||
34 | if (fileType == "Picture") { | 36 | /*if (fileType == "Picture") { |
35 | setPixmap(0, Resource::loadPixmap("pixmap")); | 37 | setPixmap(0, Resource::loadPixmap("pixmap")); |
36 | } else if (fileType == "Document") { | 38 | } else if (fileType == "Document") { |
37 | setPixmap(0, Resource::loadPixmap("txt")); | 39 | setPixmap(0, Resource::loadPixmap("txt")); |
38 | } else if (fileType == "Sound") { | 40 | } else if (fileType == "Sound") { |
@@ -40,98 +42,113 @@ FileItem::FileItem(QListView *parent, QFileInfo fileInfo, QString fileType) | |||
40 | } else if (fileType == "Movie") { | 42 | } else if (fileType == "Movie") { |
41 | setPixmap(0, Resource::loadPixmap("MPEGPlayer")); | 43 | setPixmap(0, Resource::loadPixmap("MPEGPlayer")); |
42 | } else if (fileType == "File") { | 44 | } else if (fileType == "File") { |
43 | setPixmap(0, Resource::loadPixmap("exec")); | 45 | setPixmap(0, Resource::loadPixmap("exec")); |
44 | } | 46 | }*/ |
45 | } | 47 | } |
46 | 48 | ||
47 | QFileInfo FileItem::getFileInfo() | 49 | FileItem::~FileItem() |
48 | { | 50 | { |
49 | return file; | 51 | if (doclnk!=NULL) delete doclnk; |
50 | } | 52 | doclnk=NULL; |
51 | |||
52 | QString FileItem::getFileType() | ||
53 | { | ||
54 | return type; | ||
55 | } | 53 | } |
56 | 54 | ||
57 | AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f) | 55 | AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f) |
58 | : QDialog(parent, name, f) | 56 | : QDialog(parent, name, f) |
59 | { | 57 | { |
60 | setCaption("Adding attatchments"); | 58 | setCaption("Adding attatchments"); |
61 | 59 | ||
62 | QGridLayout *top = new QGridLayout(this, 3, 2); | 60 | QGridLayout *top = new QGridLayout(this, 3,1 ); |
61 | |||
63 | 62 | ||
64 | fileCategoryButton = new QPushButton(this); | 63 | /*fileCategoryButton = new QPushButton(this);*/ |
65 | attatchButton = new QPushButton("Attatch ->", this); | 64 | attatchButton = new QPushButton("Attatch ->", this); |
66 | removeButton = new QPushButton("Remove", this); | 65 | removeButton = new QPushButton("Remove", this); |
67 | 66 | ||
68 | fileCategories = new QPopupMenu(fileCategoryButton); | 67 | /*fileCategories = new QPopupMenu(fileCategoryButton); |
69 | fileCategoryButton->setPopup(fileCategories); | 68 | fileCategoryButton->setPopup(fileCategories); |
70 | fileCategories->insertItem("Document"); | 69 | fileCategories->insertItem("Document"); |
71 | fileCategories->insertItem("Picture"); | 70 | fileCategories->insertItem("Picture"); |
72 | fileCategories->insertItem("Sound"); | 71 | fileCategories->insertItem("Sound"); |
73 | fileCategories->insertItem("Movie"); | 72 | fileCategories->insertItem("Movie"); |
74 | fileCategories->insertItem("File"); | 73 | fileCategories->insertItem("File"); |
75 | 74 | ||
76 | fileCategoryButton->setText("Document"); | 75 | fileCategoryButton->setText("Document"); |
77 | top->addWidget(fileCategoryButton, 0, 0); | 76 | top->addWidget(fileCategoryButton, 0, 0);*/ |
78 | top->addWidget(attatchButton, 2, 0); | 77 | |
79 | top->addWidget(removeButton, 2, 1); | 78 | //ofs=new OFileSelector(this,2,0,"/root/Documents"); |
79 | |||
80 | |||
81 | top->addWidget(attatchButton,1,0); | ||
82 | top->addWidget(removeButton,2,0); | ||
80 | 83 | ||
81 | connect(fileCategories, SIGNAL(activated(int)), this, | 84 | /*connect(fileCategories, SIGNAL(activated(int)), this, |
82 | SLOT(fileCategorySelected(int)) ); | 85 | SLOT(fileCategorySelected(int)) );*/ |
83 | connect(attatchButton, SIGNAL(clicked()), this, | 86 | connect(attatchButton, SIGNAL(clicked()), this, |
84 | SLOT(addAttatchment()) ); | 87 | SLOT(addAttatchment()) ); |
85 | connect(removeButton, SIGNAL(clicked()), this, | 88 | connect(removeButton, SIGNAL(clicked()), this, |
86 | SLOT(removeAttatchment()) ); | 89 | SLOT(removeAttatchment()) ); |
87 | 90 | ||
88 | listView = new QListView(this, "AttView"); | 91 | /*listView = new QListView(this, "AttView"); |
89 | listView->addColumn("Documents"); | 92 | listView->addColumn("Documents");* |
90 | connect(listView, SIGNAL(doubleClicked(QListViewItem *)), this, | 93 | connect(listView, SIGNAL(doubleClicked(QListViewItem *)), this, |
91 | SLOT(addAttatchment()) ); | 94 | SLOT(addAttatchment()) );*/ |
95 | |||
92 | 96 | ||
93 | attView = new QListView(this, "Selected"); | 97 | attView = new QListView(this, "Selected"); |
94 | attView->addColumn("Attatched"); | 98 | attView->addColumn(tr("Attached")); |
99 | attView->addColumn(tr("File type")); | ||
95 | connect(attView, SIGNAL(doubleClicked(QListViewItem *)), this, | 100 | connect(attView, SIGNAL(doubleClicked(QListViewItem *)), this, |
96 | SLOT(removeAttatchment()) ); | 101 | SLOT(removeAttatchment()) ); |
97 | 102 | ||
98 | top->addWidget(listView, 1,0); | 103 | //top->addWidget(ofs, 0,0); |
99 | top->addWidget(attView, 1,1); | 104 | top->addWidget(attView, 0,0); |
105 | |||
106 | clear(); | ||
100 | 107 | ||
101 | clear(); | 108 | |
102 | } | 109 | } |
103 | 110 | ||
104 | void AddAtt::clear() | 111 | void AddAtt::clear() |
105 | { | 112 | { |
106 | attView->clear(); | 113 | attView->clear(); |
107 | getFiles(); | 114 | //getFiles(); |
108 | modified = FALSE; | 115 | modified = FALSE; |
109 | } | 116 | } |
110 | 117 | ||
111 | void AddAtt::fileCategorySelected(int id) | 118 | /*void AddAtt::fileCategorySelected(int id) |
112 | { | 119 | { |
113 | fileCategoryButton->setText(fileCategories->text(id)); | 120 | fileCategoryButton->setText(fileCategories->text(id)); |
114 | getFiles(); | 121 | getFiles(); |
115 | } | 122 | }*/ |
116 | 123 | ||
117 | void AddAtt::addAttatchment() | 124 | void AddAtt::addAttatchment() |
118 | { | 125 | { |
119 | QFileInfo info; | 126 | QDialog qd(this,tr("Select attachment"),true); |
120 | QString type; | 127 | |
128 | QGridLayout top(&qd,1,1); | ||
129 | |||
130 | OFileSelector ofs(&qd,1,0,"/root/Documents"); | ||
131 | |||
132 | top.addWidget(&ofs,0,0); | ||
121 | 133 | ||
122 | if (listView->selectedItem() != NULL) { | 134 | qd.showMaximized(); |
123 | item = (FileItem *) listView->selectedItem(); | 135 | |
124 | info = item->getFileInfo(); | 136 | if (qd.exec()==QDialog::Accepted) |
125 | type = item->getFileType(); | 137 | { |
126 | item = new FileItem(attView, info, type); | 138 | DocLnk* dl=new DocLnk(ofs.selectedDocument()); |
139 | FileItem* fi=new FileItem(attView,dl); | ||
140 | fi->setPixmap(0,dl->pixmap()); | ||
141 | fi->setText(1,dl->type()); | ||
142 | attView->insertItem(fi); | ||
143 | modified = TRUE; | ||
127 | } | 144 | } |
128 | modified = TRUE; | ||
129 | } | 145 | } |
130 | 146 | ||
131 | void AddAtt::removeAttatchment() | 147 | void AddAtt::removeAttatchment() |
132 | { | 148 | { |
133 | if (attView->selectedItem() != NULL) { | 149 | if (attView->selectedItem() != NULL) |
150 | { | ||
134 | attView->takeItem(attView->selectedItem()); | 151 | attView->takeItem(attView->selectedItem()); |
135 | } | 152 | } |
136 | modified = TRUE; | 153 | modified = TRUE; |
137 | } | 154 | } |
@@ -152,11 +169,10 @@ void AddAtt::accept() | |||
152 | 169 | ||
153 | void AddAtt::getFiles() | 170 | void AddAtt::getFiles() |
154 | { | 171 | { |
155 | QString path, selected; | 172 | QString path, selected; |
156 | QDir *dir; | ||
157 | 173 | ||
158 | listView->clear(); | 174 | /*listView->clear(); |
159 | 175 | ||
160 | selected = fileCategoryButton->text(); | 176 | selected = fileCategoryButton->text(); |
161 | if (selected == "Picture") { | 177 | if (selected == "Picture") { |
162 | path = "../pics/"; | 178 | path = "../pics/"; |
@@ -176,34 +192,39 @@ void AddAtt::getFiles() | |||
176 | 192 | ||
177 | QFileInfoListIterator it(*dirInfoList); // create list iterator | 193 | QFileInfoListIterator it(*dirInfoList); // create list iterator |
178 | 194 | ||
179 | while ( (fi=it.current()) ) { // for each file... | 195 | while ( (fi=it.current()) ) { // for each file... |
180 | item = new FileItem(listView, *fi, selected); | 196 | item = new FileItem(lis+ütView, *fi, selected); |
181 | ++it; // goto next list element | 197 | ++it; // goto next list element |
182 | } | 198 | }*/ |
183 | } | 199 | } |
184 | 200 | ||
185 | QStringList AddAtt::returnAttatchedFiles() | 201 | QStringList AddAtt::returnAttatchedFiles() |
186 | { | 202 | { |
187 | QFileInfo info; | 203 | QFileInfo info; |
188 | QStringList list; | 204 | QStringList list; |
189 | 205 | ||
190 | item = (FileItem *) attView->firstChild(); | 206 | item = (FileItem *) attView->firstChild(); |
207 | |||
208 | |||
191 | while (item != NULL) { | 209 | while (item != NULL) { |
192 | info = item->getFileInfo(); | 210 | DocLnk* dl=item->getDocLnk(); |
193 | list += info.filePath(); | 211 | list+=dl->file(); |
212 | /*info = item->getFileInfo(); | ||
213 | list += info.filePath();*/ | ||
194 | item = (FileItem *) item->nextSibling(); | 214 | item = (FileItem *) item->nextSibling(); |
195 | } | 215 | } |
196 | return list; | 216 | return list; |
197 | } | 217 | } |
198 | 218 | ||
199 | QStringList AddAtt::returnFileTypes() | 219 | QStringList AddAtt::returnFileTypes() |
200 | { | 220 | { |
201 | QStringList list; | 221 | QStringList list; |
202 | 222 | ||
203 | item = (FileItem *) attView->firstChild(); | 223 | item = (FileItem *) attView->firstChild(); |
224 | |||
204 | while (item != NULL) { | 225 | while (item != NULL) { |
205 | list += item->getFileType(); | 226 | list += item->getDocLnk()->type(); |
206 | item = (FileItem *) item->nextSibling(); | 227 | item = (FileItem *) item->nextSibling(); |
207 | } | 228 | } |
208 | return list; | 229 | return list; |
209 | } | 230 | } |
diff --git a/noncore/unsupported/mailit/addatt.h b/noncore/unsupported/mailit/addatt.h index 867c905..73062e2 100644 --- a/noncore/unsupported/mailit/addatt.h +++ b/noncore/unsupported/mailit/addatt.h | |||
@@ -26,19 +26,22 @@ | |||
26 | #include <qpopupmenu.h> | 26 | #include <qpopupmenu.h> |
27 | #include <qstring.h> | 27 | #include <qstring.h> |
28 | #include <qfileinfo.h> | 28 | #include <qfileinfo.h> |
29 | #include <qstringlist.h> | 29 | #include <qstringlist.h> |
30 | #include <opie/ofileselector.h> | ||
31 | #include <qpe/applnk.h> | ||
30 | 32 | ||
31 | class FileItem : public QListViewItem | 33 | class FileItem : public QListViewItem |
32 | { | 34 | { |
33 | public: | 35 | public: |
34 | FileItem(QListView *parent, QFileInfo fileInfo, QString fileType); | 36 | //FileItem(QListView *parent, QFileInfo fileInfo, QString fileType); |
35 | QFileInfo getFileInfo(); | 37 | FileItem(QListView*, DocLnk*); |
36 | QString getFileType(); | 38 | ~FileItem(); |
37 | 39 | DocLnk* getDocLnk() {return doclnk;} | |
40 | |||
41 | |||
38 | private: | 42 | private: |
39 | QFileInfo file; | 43 | DocLnk* doclnk; |
40 | QString type; | ||
41 | }; | 44 | }; |
42 | 45 | ||
43 | class AddAtt : public QDialog | 46 | class AddAtt : public QDialog |
44 | { | 47 | { |
@@ -50,21 +53,24 @@ public: | |||
50 | QStringList returnFileTypes(); | 53 | QStringList returnFileTypes(); |
51 | void getFiles(); | 54 | void getFiles(); |
52 | void clear(); | 55 | void clear(); |
53 | 56 | ||
57 | |||
54 | public slots: | 58 | public slots: |
55 | void fileCategorySelected(int); | 59 | //void fileCategorySelected(int); |
56 | void addAttatchment(); | 60 | void addAttatchment(); |
57 | void removeAttatchment(); | 61 | void removeAttatchment(); |
58 | void reject(); | 62 | void reject(); |
59 | void accept(); | 63 | void accept(); |
60 | 64 | ||
61 | private: | 65 | private: |
62 | FileItem *item; | 66 | FileItem* item; |
63 | QListView *listView, *attView; | 67 | QListView *attView; |
64 | QPushButton *fileCategoryButton, *attatchButton, *removeButton; | 68 | QPushButton *fileCategoryButton, *attatchButton, *removeButton; |
65 | QPopupMenu *fileCategories; | 69 | QPopupMenu *fileCategories; |
66 | bool modified; | 70 | bool modified; |
67 | QFileInfo *fi; | 71 | QFileInfo *fi; |
72 | |||
73 | OFileSelector* ofs; | ||
68 | }; | 74 | }; |
69 | 75 | ||
70 | #endif | 76 | #endif |
diff --git a/noncore/unsupported/mailit/emailclient.cpp b/noncore/unsupported/mailit/emailclient.cpp index fc4276b..9258aac 100644 --- a/noncore/unsupported/mailit/emailclient.cpp +++ b/noncore/unsupported/mailit/emailclient.cpp | |||
@@ -160,8 +160,9 @@ void EmailClient::init() | |||
160 | 160 | ||
161 | cancelButton = new QAction(tr("Cancel transfer"), Resource::loadPixmap("close"), QString::null, 0, this, 0); | 161 | cancelButton = new QAction(tr("Cancel transfer"), Resource::loadPixmap("close"), QString::null, 0, this, 0); |
162 | connect(cancelButton, SIGNAL(activated()), this, SLOT(cancel()) ); | 162 | connect(cancelButton, SIGNAL(activated()), this, SLOT(cancel()) ); |
163 | cancelButton->addTo(mail); | 163 | cancelButton->addTo(mail); |
164 | cancelButton->addTo(bar); | ||
164 | cancelButton->setEnabled(FALSE); | 165 | cancelButton->setEnabled(FALSE); |
165 | 166 | ||
166 | mailboxView = new OTabWidget( this, "mailboxView" ); | 167 | mailboxView = new OTabWidget( this, "mailboxView" ); |
167 | 168 | ||
@@ -213,8 +214,14 @@ AddressList* EmailClient::getAdrListRef() | |||
213 | 214 | ||
214 | //this needs to be rewritten to syncronize with outboxView | 215 | //this needs to be rewritten to syncronize with outboxView |
215 | void EmailClient::enqueMail(const Email &mail) | 216 | void EmailClient::enqueMail(const Email &mail) |
216 | { | 217 | { |
218 | if (accountList.count() == 0) { | ||
219 | QMessageBox::warning(qApp->activeWindow(), | ||
220 | tr("No account selected"), tr("You must create an account"), "OK\n"); | ||
221 | return; | ||
222 | } | ||
223 | |||
217 | if (accountList.count() > 0) { | 224 | if (accountList.count() > 0) { |
218 | currentAccount = accountList.first(); | 225 | currentAccount = accountList.first(); |
219 | qWarning("using account " + currentAccount->name); | 226 | qWarning("using account " + currentAccount->name); |
220 | } | 227 | } |
@@ -231,10 +238,9 @@ void EmailClient::sendQuedMail() | |||
231 | { | 238 | { |
232 | int count = 0; | 239 | int count = 0; |
233 | 240 | ||
234 | if (accountList.count() == 0) { | 241 | if (accountList.count() == 0) { |
235 | QMessageBox::warning(qApp->activeWindow(), | 242 | QMessageBox::warning(qApp->activeWindow(), "No account selected", "You must create an account", "OK\n"); |
236 | "No account selected", "You must create an account", "OK\n"); | ||
237 | return; | 243 | return; |
238 | } | 244 | } |
239 | //traverse listview, find messages to send | 245 | //traverse listview, find messages to send |
240 | if (! sending) { | 246 | if (! sending) { |
diff --git a/noncore/unsupported/mailit/emailhandler.cpp b/noncore/unsupported/mailit/emailhandler.cpp index 2144899..1be16d4 100644 --- a/noncore/unsupported/mailit/emailhandler.cpp +++ b/noncore/unsupported/mailit/emailhandler.cpp | |||
@@ -411,14 +411,17 @@ int EmailHandler::parse64base(char *src, char *bufOut) { | |||
411 | } | 411 | } |
412 | return processed; | 412 | return processed; |
413 | } | 413 | } |
414 | 414 | ||
415 | int EmailHandler::encodeMime(Email *mail) { | 415 | int EmailHandler::encodeMime(Email *mail) |
416 | { | ||
417 | |||
416 | QString fileName, fileType, contentType, newBody, boundary; | 418 | QString fileName, fileType, contentType, newBody, boundary; |
417 | Enclosure *ePtr; | 419 | Enclosure *ePtr; |
418 | 420 | ||
419 | QString userName = mailAccount.name; | 421 | QString userName = mailAccount.name; |
420 | userName += " <" + mailAccount.emailAddress + ">"; | 422 | if (userName.length()>0)//only embrace it if there is a user name |
423 | userName += " <" + mailAccount.emailAddress + ">"; | ||
421 | 424 | ||
422 | //add standard headers | 425 | //add standard headers |
423 | newBody = "From: " + userName + "\r\nTo: "; | 426 | newBody = "From: " + userName + "\r\nTo: "; |
424 | for (QStringList::Iterator it = mail->recipients.begin(); it != mail->recipients.end(); ++it ) { | 427 | for (QStringList::Iterator it = mail->recipients.begin(); it != mail->recipients.end(); ++it ) { |
diff --git a/noncore/unsupported/mailit/writemail.cpp b/noncore/unsupported/mailit/writemail.cpp index 1a7185e..70332a9 100644 --- a/noncore/unsupported/mailit/writemail.cpp +++ b/noncore/unsupported/mailit/writemail.cpp | |||
@@ -63,9 +63,9 @@ void WriteMail::init() | |||
63 | addMenu = new QPopupMenu(menu); | 63 | addMenu = new QPopupMenu(menu); |
64 | menu->insertItem( tr( "&Add" ), addMenu); | 64 | menu->insertItem( tr( "&Add" ), addMenu); |
65 | 65 | ||
66 | bar = new QToolBar(this); | 66 | bar = new QToolBar(this); |
67 | attatchButton = new QAction(tr("Attatchment"), Resource::loadPixmap("fileopen"), QString::null, 0, this, 0); | 67 | attatchButton = new QAction(tr("Attatchment"), Resource::loadPixmap("mailit/attach"), QString::null, 0, this, 0); |
68 | attatchButton->addTo(bar); | 68 | attatchButton->addTo(bar); |
69 | attatchButton->addTo(addMenu); | 69 | attatchButton->addTo(addMenu); |
70 | connect( attatchButton, SIGNAL( activated() ), this, SLOT( attatchFile() ) ); | 70 | connect( attatchButton, SIGNAL( activated() ), this, SLOT( attatchFile() ) ); |
71 | 71 | ||
@@ -170,11 +170,9 @@ void WriteMail::accept() | |||
170 | 170 | ||
171 | QStringList::Iterator itType = attatchmentsType.begin(); | 171 | QStringList::Iterator itType = attatchmentsType.begin(); |
172 | 172 | ||
173 | Enclosure e; | 173 | Enclosure e; |
174 | for ( QStringList::Iterator it = attatchedFiles.begin(); | 174 | for ( QStringList::Iterator it = attatchedFiles.begin(); it != attatchedFiles.end(); ++it ) { |
175 | it != attatchedFiles.end(); ++it ) { | ||
176 | |||
177 | e.id = idCount; | 175 | e.id = idCount; |
178 | e.originalName = (*it).latin1(); | 176 | e.originalName = (*it).latin1(); |
179 | e.contentType = (*itType).latin1(); | 177 | e.contentType = (*itType).latin1(); |
180 | e.contentAttribute = (*itType).latin1(); | 178 | e.contentAttribute = (*itType).latin1(); |