author | groucho <groucho> | 2003-04-13 10:29:05 (UTC) |
---|---|---|
committer | groucho <groucho> | 2003-04-13 10:29:05 (UTC) |
commit | 8cc217bed9c122a7c7448e2cd59bfde330dfcfad (patch) (unidiff) | |
tree | f802c03bbddf54ecc541ce23bdc43da0fc8b390b | |
parent | 64d6b3e723b9b2fc3b1f3eea6da6344c5f26ce1e (diff) | |
download | opie-8cc217bed9c122a7c7448e2cd59bfde330dfcfad.zip opie-8cc217bed9c122a7c7448e2cd59bfde330dfcfad.tar.gz opie-8cc217bed9c122a7c7448e2cd59bfde330dfcfad.tar.bz2 |
- Uses mime types for attachment reading
- Addresses are read from ocontactacess
-rw-r--r-- | noncore/net/mailit/addatt.cpp | 34 | ||||
-rw-r--r-- | noncore/net/mailit/addatt.h | 8 | ||||
-rw-r--r-- | noncore/net/mailit/addresslist.cpp | 20 | ||||
-rw-r--r-- | noncore/net/mailit/emailclient.cpp | 2 | ||||
-rw-r--r-- | noncore/net/mailit/mailitwindow.cpp | 4 | ||||
-rw-r--r-- | noncore/net/mailit/viewatt.cpp | 15 | ||||
-rw-r--r-- | noncore/net/mailit/writemail.cpp | 5 | ||||
-rw-r--r-- | noncore/unsupported/mailit/addatt.cpp | 34 | ||||
-rw-r--r-- | noncore/unsupported/mailit/addatt.h | 8 | ||||
-rw-r--r-- | noncore/unsupported/mailit/addresslist.cpp | 20 | ||||
-rw-r--r-- | noncore/unsupported/mailit/emailclient.cpp | 2 | ||||
-rw-r--r-- | noncore/unsupported/mailit/mailitwindow.cpp | 4 | ||||
-rw-r--r-- | noncore/unsupported/mailit/viewatt.cpp | 15 | ||||
-rw-r--r-- | noncore/unsupported/mailit/writemail.cpp | 5 |
14 files changed, 110 insertions, 66 deletions
diff --git a/noncore/net/mailit/addatt.cpp b/noncore/net/mailit/addatt.cpp index f279f52..c8be865 100644 --- a/noncore/net/mailit/addatt.cpp +++ b/noncore/net/mailit/addatt.cpp | |||
@@ -1,160 +1,154 @@ | |||
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 <qdir.h> | 22 | #include <qdir.h> |
22 | #include <qstringlist.h> | 23 | #include <qstringlist.h> |
23 | #include "resource.h" | 24 | #include "resource.h" |
24 | #include "addatt.h" | 25 | #include "addatt.h" |
25 | 26 | ||
26 | FileItem::FileItem(QListView *parent, DocLnk* dl) | 27 | FileItem::FileItem(QListView *parent, DocLnk* dl) |
27 | : QListViewItem(parent) | 28 | : QListViewItem(parent) |
28 | { | 29 | { |
29 | /*file = fileInfo; | 30 | /*file = fileInfo; |
30 | type = fileType;*/ | 31 | type = fileType;*/ |
31 | 32 | ||
32 | doclnk=dl; | 33 | doclnk=dl; |
33 | 34 | ||
34 | setText(0, doclnk->name()); | 35 | setText(0, doclnk->name()); |
35 | 36 | ||
36 | /*if (fileType == "Picture") { | 37 | /*if (fileType == "Picture") { |
37 | setPixmap(0, Resource::loadPixmap("pixmap")); | 38 | setPixmap(0, Resource::loadPixmap("pixmap")); |
38 | } else if (fileType == "Document") { | 39 | } else if (fileType == "Document") { |
39 | setPixmap(0, Resource::loadPixmap("txt")); | 40 | setPixmap(0, Resource::loadPixmap("txt")); |
40 | } else if (fileType == "Sound") { | 41 | } else if (fileType == "Sound") { |
41 | setPixmap(0, Resource::loadPixmap("play")); | 42 | setPixmap(0, Resource::loadPixmap("play")); |
42 | } else if (fileType == "Movie") { | 43 | } else if (fileType == "Movie") { |
43 | setPixmap(0, Resource::loadPixmap("MPEGPlayer")); | 44 | setPixmap(0, Resource::loadPixmap("MPEGPlayer")); |
44 | } else if (fileType == "File") { | 45 | } else if (fileType == "File") { |
45 | setPixmap(0, Resource::loadPixmap("exec")); | 46 | setPixmap(0, Resource::loadPixmap("exec")); |
46 | }*/ | 47 | }*/ |
47 | } | 48 | } |
48 | 49 | ||
49 | FileItem::~FileItem() | 50 | FileItem::~FileItem() |
50 | { | 51 | { |
51 | if (doclnk!=NULL) delete doclnk; | 52 | if (doclnk!=NULL) delete doclnk; |
52 | doclnk=NULL; | 53 | doclnk=NULL; |
53 | } | 54 | } |
54 | 55 | ||
55 | AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f) | 56 | AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f) |
56 | : QDialog(parent, name, f) | 57 | : QDialog(parent, name, f) |
57 | { | 58 | { |
58 | setCaption("Adding attatchments"); | 59 | setCaption("Adding attatchments"); |
59 | 60 | ||
60 | QGridLayout *top = new QGridLayout(this, 3,1 ); | 61 | QGridLayout *top = new QGridLayout(this, 1,1 ); |
61 | 62 | ||
62 | 63 | QHBox *buttons=new QHBox(this); | |
63 | /*fileCategoryButton = new QPushButton(this);*/ | 64 | /*fileCategoryButton = new QPushButton(this);*/ |
64 | attatchButton = new QPushButton("Attatch ->", this); | 65 | attatchButton = new QPushButton("Attatch ->", buttons); |
65 | removeButton = new QPushButton("Remove", this); | 66 | removeButton = new QPushButton("Remove", buttons); |
66 | 67 | ||
67 | /*fileCategories = new QPopupMenu(fileCategoryButton); | 68 | /*fileCategories = new QPopupMenu(fileCategoryButton); |
68 | fileCategoryButton->setPopup(fileCategories); | 69 | fileCategoryButton->setPopup(fileCategories); |
69 | fileCategories->insertItem("Document"); | 70 | fileCategories->insertItem("Document"); |
70 | fileCategories->insertItem("Picture"); | 71 | fileCategories->insertItem("Picture"); |
71 | fileCategories->insertItem("Sound"); | 72 | fileCategories->insertItem("Sound"); |
72 | fileCategories->insertItem("Movie"); | 73 | fileCategories->insertItem("Movie"); |
73 | fileCategories->insertItem("File"); | 74 | fileCategories->insertItem("File"); |
74 | 75 | ||
75 | fileCategoryButton->setText("Document"); | 76 | fileCategoryButton->setText("Document"); |
76 | top->addWidget(fileCategoryButton, 0, 0);*/ | 77 | top->addWidget(fileCategoryButton, 0, 0);*/ |
77 | 78 | ||
78 | //ofs=new OFileSelector(this,2,0,"/root/Documents"); | ||
79 | |||
80 | |||
81 | top->addWidget(attatchButton,1,0); | ||
82 | top->addWidget(removeButton,2,0); | ||
83 | 79 | ||
84 | /*connect(fileCategories, SIGNAL(activated(int)), this, | 80 | top->addWidget(buttons,1,0); |
85 | SLOT(fileCategorySelected(int)) );*/ | 81 | //buttons->addWidget(attatchButton,0,0); |
82 | //buttons->addWidget(removeButton,0,1); | ||
83 | |||
84 | //connect(fileCategories, SIGNAL(activated(int)), this, | ||
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 | QDialog qd(this,tr("Select attachment"),true); | 126 | OFileDialog ofs("Attachments",this,0,0,"/root/Documents"); |
127 | |||
128 | QGridLayout top(&qd,1,1); | ||
129 | |||
130 | OFileSelector ofs(&qd,1,0,"/root/Documents"); | ||
131 | |||
132 | top.addWidget(&ofs,0,0); | ||
133 | 127 | ||
134 | qd.showMaximized(); | 128 | ofs.showMaximized(); |
135 | 129 | ||
136 | if (qd.exec()==QDialog::Accepted) | 130 | if (ofs.exec()==QDialog::Accepted) |
137 | { | 131 | { |
138 | DocLnk* dl=new DocLnk(ofs.selectedDocument()); | 132 | DocLnk* dl=new DocLnk(ofs.selectedDocument()); |
139 | FileItem* fi=new FileItem(attView,dl); | 133 | FileItem* fi=new FileItem(attView,dl); |
140 | fi->setPixmap(0,dl->pixmap()); | 134 | fi->setPixmap(0,dl->pixmap()); |
141 | fi->setText(1,dl->type()); | 135 | fi->setText(1,dl->type()); |
142 | attView->insertItem(fi); | 136 | attView->insertItem(fi); |
143 | modified = TRUE; | 137 | modified = TRUE; |
144 | } | 138 | } |
145 | } | 139 | } |
146 | 140 | ||
147 | void AddAtt::removeAttatchment() | 141 | void AddAtt::removeAttatchment() |
148 | { | 142 | { |
149 | if (attView->selectedItem() != NULL) | 143 | if (attView->selectedItem() != NULL) |
150 | { | 144 | { |
151 | attView->takeItem(attView->selectedItem()); | 145 | attView->takeItem(attView->selectedItem()); |
152 | } | 146 | } |
153 | modified = TRUE; | 147 | modified = TRUE; |
154 | } | 148 | } |
155 | 149 | ||
156 | void AddAtt::reject() | 150 | void AddAtt::reject() |
157 | { | 151 | { |
158 | if (modified) { | 152 | if (modified) { |
159 | attView->clear(); | 153 | attView->clear(); |
160 | modified = FALSE; | 154 | modified = FALSE; |
diff --git a/noncore/net/mailit/addatt.h b/noncore/net/mailit/addatt.h index 73062e2..fcf3279 100644 --- a/noncore/net/mailit/addatt.h +++ b/noncore/net/mailit/addatt.h | |||
@@ -6,71 +6,71 @@ | |||
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 | #ifndef ADDATT_H | 20 | #ifndef ADDATT_H |
21 | #define ADDATT_H | 21 | #define ADDATT_H |
22 | 22 | ||
23 | #include <qdialog.h> | 23 | #include <qdialog.h> |
24 | #include <qlistview.h> | 24 | #include <qlistview.h> |
25 | #include <qpushbutton.h> | 25 | #include <qpushbutton.h> |
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> | 30 | #include <opie/ofiledialog.h> |
31 | #include <qpe/applnk.h> | 31 | #include <qpe/applnk.h> |
32 | 32 | ||
33 | class FileItem : public QListViewItem | 33 | class FileItem : public QListViewItem |
34 | { | 34 | { |
35 | public: | 35 | public: |
36 | //FileItem(QListView *parent, QFileInfo fileInfo, QString fileType); | 36 | //FileItem(QListView *parent, QFileInfo fileInfo, QString fileType); |
37 | FileItem(QListView*, DocLnk*); | 37 | FileItem(QListView*, DocLnk*); |
38 | ~FileItem(); | 38 | ~FileItem(); |
39 | DocLnk* getDocLnk() {return doclnk;} | 39 | DocLnk* getDocLnk() {return doclnk;} |
40 | 40 | ||
41 | 41 | ||
42 | private: | 42 | private: |
43 | DocLnk* doclnk; | 43 | DocLnk* doclnk; |
44 | }; | 44 | }; |
45 | 45 | ||
46 | class AddAtt : public QDialog | 46 | class AddAtt : public QDialog |
47 | { | 47 | { |
48 | Q_OBJECT | 48 | Q_OBJECT |
49 | 49 | ||
50 | public: | 50 | public: |
51 | AddAtt(QWidget *parent = 0, const char *name = 0, WFlags f = 0); | 51 | AddAtt(QWidget *parent = 0, const char *name = 0, WFlags f = 0); |
52 | QStringList returnAttatchedFiles(); | 52 | QStringList returnAttatchedFiles(); |
53 | QStringList returnFileTypes(); | 53 | QStringList returnFileTypes(); |
54 | void getFiles(); | 54 | void getFiles(); |
55 | void clear(); | 55 | void clear(); |
56 | 56 | ||
57 | 57 | ||
58 | public slots: | 58 | public slots: |
59 | //void fileCategorySelected(int); | 59 | //void fileCategorySelected(int); |
60 | void addAttatchment(); | 60 | void addAttatchment(); |
61 | void removeAttatchment(); | 61 | void removeAttatchment(); |
62 | void reject(); | 62 | void reject(); |
63 | void accept(); | 63 | void accept(); |
64 | 64 | ||
65 | private: | 65 | private: |
66 | FileItem* item; | 66 | FileItem* item; |
67 | QListView *attView; | 67 | QListView *attView; |
68 | QPushButton *fileCategoryButton, *attatchButton, *removeButton; | 68 | QPushButton *attatchButton, *removeButton; |
69 | QPopupMenu *fileCategories; | 69 | QPopupMenu *fileCategories; |
70 | bool modified; | 70 | bool modified; |
71 | QFileInfo *fi; | 71 | //QFileInfo *fi; |
72 | 72 | ||
73 | OFileSelector* ofs; | 73 | OFileDialog* ofs; |
74 | }; | 74 | }; |
75 | 75 | ||
76 | #endif | 76 | #endif |
diff --git a/noncore/net/mailit/addresslist.cpp b/noncore/net/mailit/addresslist.cpp index 1cf2562..43e3830 100644 --- a/noncore/net/mailit/addresslist.cpp +++ b/noncore/net/mailit/addresslist.cpp | |||
@@ -1,45 +1,47 @@ | |||
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 <qfile.h> | 20 | #include <qfile.h> |
21 | #include <qtextstream.h> | 21 | #include <qtextstream.h> |
22 | #include <opie/ocontactaccess.h> | ||
23 | #include <opie/ocontact.h> | ||
22 | 24 | ||
23 | #include "addresslist.h" | 25 | #include "addresslist.h" |
24 | 26 | ||
25 | AddressList::AddressList(QString file) | 27 | AddressList::AddressList(QString file) |
26 | { | 28 | { |
27 | addresses.setAutoDelete(TRUE); | 29 | addresses.setAutoDelete(TRUE); |
28 | filename = file; | 30 | filename = file; |
29 | read(); | 31 | read(); |
30 | dirty = FALSE; | 32 | dirty = FALSE; |
31 | } | 33 | } |
32 | 34 | ||
33 | AddressList::~AddressList() | 35 | AddressList::~AddressList() |
34 | { | 36 | { |
35 | write(); | 37 | write(); |
36 | addresses.clear(); | 38 | addresses.clear(); |
37 | } | 39 | } |
38 | 40 | ||
39 | void AddressList::addContact(QString email, QString name) | 41 | void AddressList::addContact(QString email, QString name) |
40 | { | 42 | { |
41 | //skip if not a valid email address, | 43 | //skip if not a valid email address, |
42 | if (email.find( '@') == -1) | 44 | if (email.find( '@') == -1) |
43 | return; | 45 | return; |
44 | 46 | ||
45 | if ( ! containsEmail(email) ) { | 47 | if ( ! containsEmail(email) ) { |
@@ -95,67 +97,79 @@ int AddressList::getEmailRef(QString email) | |||
95 | } | 97 | } |
96 | return -1; | 98 | return -1; |
97 | } | 99 | } |
98 | 100 | ||
99 | int AddressList::getNameRef(QString name) | 101 | int AddressList::getNameRef(QString name) |
100 | { | 102 | { |
101 | int pos = 0; | 103 | int pos = 0; |
102 | Contact *ptr; | 104 | Contact *ptr; |
103 | 105 | ||
104 | for (ptr = addresses.first(); ptr != 0; ptr = addresses.next() ) { | 106 | for (ptr = addresses.first(); ptr != 0; ptr = addresses.next() ) { |
105 | if (ptr->name == name) | 107 | if (ptr->name == name) |
106 | return pos; | 108 | return pos; |
107 | pos++; | 109 | pos++; |
108 | } | 110 | } |
109 | return -1; | 111 | return -1; |
110 | } | 112 | } |
111 | 113 | ||
112 | QList<Contact>* AddressList::getContactList() | 114 | QList<Contact>* AddressList::getContactList() |
113 | { | 115 | { |
114 | return &addresses; | 116 | return &addresses; |
115 | } | 117 | } |
116 | 118 | ||
117 | void AddressList::read() | 119 | void AddressList::read() |
118 | { | 120 | { |
119 | QFile f(filename); | 121 | OContactAccess::List::Iterator it; |
122 | |||
123 | //QFile f(filename); | ||
120 | QString lineEmail, lineName, email, name; | 124 | QString lineEmail, lineName, email, name; |
125 | OContactAccess m_contactdb("mailit"); | ||
126 | OContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 ); | ||
127 | //OContact* oc; | ||
121 | 128 | ||
122 | if (! f.open(IO_ReadOnly) ) | 129 | for ( it = m_list.begin(); it != m_list.end(); ++it ) |
130 | { | ||
131 | //oc=(OContact*) it; | ||
132 | if ((*it).defaultEmail().length()!=0) | ||
133 | addContact((*it).defaultEmail(),(*it).fullName()); | ||
134 | } | ||
135 | |||
136 | /*if (! f.open(IO_ReadOnly) ) | ||
123 | return; | 137 | return; |
124 | 138 | ||
125 | QTextStream stream(&f); | 139 | QTextStream stream(&f); |
126 | 140 | ||
127 | while (! stream.atEnd() ) { | 141 | while (! stream.atEnd() ) { |
128 | lineEmail = stream.readLine(); | 142 | lineEmail = stream.readLine(); |
129 | if (! stream.atEnd() ) | 143 | if (! stream.atEnd() ) |
130 | lineName = stream.readLine(); | 144 | lineName = stream.readLine(); |
131 | else return; | 145 | else return; |
132 | 146 | ||
133 | email = getRightString(lineEmail); | 147 | email = getRightString(lineEmail); |
134 | name = getRightString(lineName); | 148 | name = getRightString(lineName); |
135 | addContact(email, name); | 149 | addContact(email, name); |
136 | } | 150 | } |
137 | f.close(); | 151 | f.close();*/ |
138 | } | 152 | } |
139 | 153 | ||
140 | QString AddressList::getRightString(QString in) | 154 | QString AddressList::getRightString(QString in) |
141 | { | 155 | { |
142 | QString out = ""; | 156 | QString out = ""; |
143 | 157 | ||
144 | int pos = in.find('='); | 158 | int pos = in.find('='); |
145 | if (pos != -1) { | 159 | if (pos != -1) { |
146 | out = in.mid(pos+1).stripWhiteSpace(); | 160 | out = in.mid(pos+1).stripWhiteSpace(); |
147 | } | 161 | } |
148 | return out; | 162 | return out; |
149 | } | 163 | } |
150 | 164 | ||
151 | void AddressList::write() | 165 | void AddressList::write() |
152 | { | 166 | { |
153 | if ( (addresses.count() == 0) || (!dirty) ) | 167 | if ( (addresses.count() == 0) || (!dirty) ) |
154 | return; | 168 | return; |
155 | 169 | ||
156 | QFile f(filename); | 170 | QFile f(filename); |
157 | if (! f.open(IO_WriteOnly) ) | 171 | if (! f.open(IO_WriteOnly) ) |
158 | return; | 172 | return; |
159 | 173 | ||
160 | QTextStream stream(&f); | 174 | QTextStream stream(&f); |
161 | Contact *ptr; | 175 | Contact *ptr; |
diff --git a/noncore/net/mailit/emailclient.cpp b/noncore/net/mailit/emailclient.cpp index 9258aac..2943986 100644 --- a/noncore/net/mailit/emailclient.cpp +++ b/noncore/net/mailit/emailclient.cpp | |||
@@ -127,49 +127,49 @@ void EmailClient::init() | |||
127 | 127 | ||
128 | mb = new QMenuBar( bar ); | 128 | mb = new QMenuBar( bar ); |
129 | 129 | ||
130 | QPopupMenu *mail = new QPopupMenu(mb); | 130 | QPopupMenu *mail = new QPopupMenu(mb); |
131 | mb->insertItem( tr( "&Mail" ), mail); | 131 | mb->insertItem( tr( "&Mail" ), mail); |
132 | 132 | ||
133 | QPopupMenu *configure = new QPopupMenu(mb); | 133 | QPopupMenu *configure = new QPopupMenu(mb); |
134 | mb->insertItem( tr( "Accounts" ), configure); | 134 | mb->insertItem( tr( "Accounts" ), configure); |
135 | 135 | ||
136 | selectAccountMenu = new QPopupMenu(mb); | 136 | selectAccountMenu = new QPopupMenu(mb); |
137 | editAccountMenu = new QPopupMenu(mb); | 137 | editAccountMenu = new QPopupMenu(mb); |
138 | deleteAccountMenu = new QPopupMenu(mb); | 138 | deleteAccountMenu = new QPopupMenu(mb); |
139 | 139 | ||
140 | mail->insertItem(tr("Get Mail in"), selectAccountMenu); | 140 | mail->insertItem(tr("Get Mail in"), selectAccountMenu); |
141 | configure->insertItem(tr("Edit account"), editAccountMenu); | 141 | configure->insertItem(tr("Edit account"), editAccountMenu); |
142 | configure->insertItem(tr("Delete account"), deleteAccountMenu); | 142 | configure->insertItem(tr("Delete account"), deleteAccountMenu); |
143 | 143 | ||
144 | bar = new QToolBar(this); | 144 | bar = new QToolBar(this); |
145 | 145 | ||
146 | getMailButton = new QAction(tr("Get all mail"), Resource::loadPixmap("mailit/getmail"), QString::null, 0, this, 0); | 146 | getMailButton = new QAction(tr("Get all mail"), Resource::loadPixmap("mailit/getmail"), QString::null, 0, this, 0); |
147 | connect(getMailButton, SIGNAL(activated()), this, SLOT(getAllNewMail()) ); | 147 | connect(getMailButton, SIGNAL(activated()), this, SLOT(getAllNewMail()) ); |
148 | getMailButton->addTo(bar); | 148 | getMailButton->addTo(bar); |
149 | getMailButton->addTo(mail); | 149 | getMailButton->addTo(mail); |
150 | 150 | ||
151 | sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendmail"), QString::null, 0, this, 0); | 151 | sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendqueue"), QString::null, 0, this, 0); |
152 | connect(sendMailButton, SIGNAL(activated()), this, SLOT(sendQuedMail()) ); | 152 | connect(sendMailButton, SIGNAL(activated()), this, SLOT(sendQuedMail()) ); |
153 | sendMailButton->addTo(bar); | 153 | sendMailButton->addTo(bar); |
154 | sendMailButton->addTo(mail); | 154 | sendMailButton->addTo(mail); |
155 | 155 | ||
156 | composeButton = new QAction(tr("Compose"), Resource::loadPixmap("new"), QString::null, 0, this, 0); | 156 | composeButton = new QAction(tr("Compose"), Resource::loadPixmap("new"), QString::null, 0, this, 0); |
157 | connect(composeButton, SIGNAL(activated()), this, SLOT(compose()) ); | 157 | connect(composeButton, SIGNAL(activated()), this, SLOT(compose()) ); |
158 | composeButton->addTo(bar); | 158 | composeButton->addTo(bar); |
159 | composeButton->addTo(mail); | 159 | composeButton->addTo(mail); |
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->addTo(bar); |
165 | cancelButton->setEnabled(FALSE); | 165 | cancelButton->setEnabled(FALSE); |
166 | 166 | ||
167 | mailboxView = new OTabWidget( this, "mailboxView" ); | 167 | mailboxView = new OTabWidget( this, "mailboxView" ); |
168 | 168 | ||
169 | QWidget* widget = new QWidget( mailboxView, "widget" ); | 169 | QWidget* widget = new QWidget( mailboxView, "widget" ); |
170 | grid_2 = new QGridLayout( widget ); | 170 | grid_2 = new QGridLayout( widget ); |
171 | // grid_2->setSpacing(6); | 171 | // grid_2->setSpacing(6); |
172 | // grid_2->setMargin( 11 ); | 172 | // grid_2->setMargin( 11 ); |
173 | 173 | ||
174 | inboxView = new QListView( widget, "inboxView" ); | 174 | inboxView = new QListView( widget, "inboxView" ); |
175 | inboxView->addColumn( tr( "From" ) ); | 175 | inboxView->addColumn( tr( "From" ) ); |
diff --git a/noncore/net/mailit/mailitwindow.cpp b/noncore/net/mailit/mailitwindow.cpp index f9b6de2..fd49c1f 100644 --- a/noncore/net/mailit/mailitwindow.cpp +++ b/noncore/net/mailit/mailitwindow.cpp | |||
@@ -6,78 +6,82 @@ | |||
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 "mailitwindow.h" | 20 | #include "mailitwindow.h" |
21 | 21 | ||
22 | MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl) | 22 | MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl) |
23 | : QMainWindow(parent, name, fl) | 23 | : QMainWindow(parent, name, fl) |
24 | { | 24 | { |
25 | currentCaption = "Mailit"; | 25 | currentCaption = "Mailit"; |
26 | setCaption(tr(currentCaption)); | 26 | setCaption(tr(currentCaption)); |
27 | views = new QWidgetStack(this); | 27 | views = new QWidgetStack(this); |
28 | setCentralWidget(views); | 28 | setCentralWidget(views); |
29 | 29 | ||
30 | qWarning("***Starting writeMail"); | ||
30 | emailClient = new EmailClient(views, "client"); | 31 | emailClient = new EmailClient(views, "client"); |
31 | writeMail = new WriteMail(views, "writing"); | 32 | writeMail = new WriteMail(views, "writing"); |
32 | readMail = new ReadMail(views, "reading"); | 33 | readMail = new ReadMail(views, "reading"); |
34 | qWarning("***Finished readMail"); | ||
33 | 35 | ||
34 | views->raiseWidget(emailClient); | 36 | views->raiseWidget(emailClient); |
35 | 37 | ||
36 | connect(emailClient, SIGNAL(composeRequested()), | 38 | connect(emailClient, SIGNAL(composeRequested()), |
37 | this, SLOT(compose()) ); | 39 | this, SLOT(compose()) ); |
38 | connect(emailClient, SIGNAL(viewEmail(QListView *, Email *)), this, | 40 | connect(emailClient, SIGNAL(viewEmail(QListView *, Email *)), this, |
39 | SLOT(viewMail(QListView *, Email *)) ); | 41 | SLOT(viewMail(QListView *, Email *)) ); |
40 | connect(emailClient, SIGNAL(mailUpdated(Email *)), this, | 42 | connect(emailClient, SIGNAL(mailUpdated(Email *)), this, |
41 | SLOT(updateMailView(Email *)) ); | 43 | SLOT(updateMailView(Email *)) ); |
42 | 44 | ||
43 | connect(writeMail, SIGNAL(cancelMail()), this, SLOT(showEmailClient()) ); | 45 | connect(writeMail, SIGNAL(cancelMail()), this, SLOT(showEmailClient()) ); |
44 | connect(writeMail, SIGNAL(sendMailRequested(const Email &)), this, | 46 | connect(writeMail, SIGNAL(sendMailRequested(const Email &)), this, |
45 | SLOT(showEmailClient()) ); | 47 | SLOT(showEmailClient()) ); |
46 | connect(writeMail, SIGNAL(sendMailRequested(const Email &)), emailClient, | 48 | connect(writeMail, SIGNAL(sendMailRequested(const Email &)), emailClient, |
47 | SLOT(enqueMail(const Email &)) ); | 49 | SLOT(enqueMail(const Email &)) ); |
48 | 50 | ||
49 | connect(readMail, SIGNAL(cancelView()), this, SLOT(showEmailClient()) ); | 51 | connect(readMail, SIGNAL(cancelView()), this, SLOT(showEmailClient()) ); |
50 | connect(readMail, SIGNAL(replyRequested(Email &)), this, | 52 | connect(readMail, SIGNAL(replyRequested(Email &)), this, |
51 | SLOT(composeReply(Email &)) ); | 53 | SLOT(composeReply(Email &)) ); |
52 | connect(readMail, SIGNAL(removeItem(EmailListItem *, bool &)), emailClient, | 54 | connect(readMail, SIGNAL(removeItem(EmailListItem *, bool &)), emailClient, |
53 | SLOT(deleteMail(EmailListItem *, bool &)) ); | 55 | SLOT(deleteMail(EmailListItem *, bool &)) ); |
54 | connect(readMail, SIGNAL(viewingMail(Email *)), emailClient, | 56 | connect(readMail, SIGNAL(viewingMail(Email *)), emailClient, |
55 | SLOT(moveMailFront(Email *)) ); | 57 | SLOT(moveMailFront(Email *)) ); |
56 | 58 | ||
57 | connect(emailClient, SIGNAL(newCaption(const QString &)), | 59 | connect(emailClient, SIGNAL(newCaption(const QString &)), |
58 | this, SLOT(updateCaption(const QString &)) ); | 60 | this, SLOT(updateCaption(const QString &)) ); |
59 | viewingMail = FALSE; | 61 | viewingMail = FALSE; |
62 | |||
63 | qWarning("***Finished MailitWindow"); | ||
60 | } | 64 | } |
61 | 65 | ||
62 | MailItWindow::~MailItWindow() | 66 | MailItWindow::~MailItWindow() |
63 | { | 67 | { |
64 | } | 68 | } |
65 | 69 | ||
66 | void MailItWindow::closeEvent(QCloseEvent *e) | 70 | void MailItWindow::closeEvent(QCloseEvent *e) |
67 | { | 71 | { |
68 | if (views->visibleWidget() == emailClient) { | 72 | if (views->visibleWidget() == emailClient) { |
69 | e->accept(); | 73 | e->accept(); |
70 | } else { | 74 | } else { |
71 | showEmailClient(); | 75 | showEmailClient(); |
72 | } | 76 | } |
73 | } | 77 | } |
74 | 78 | ||
75 | void MailItWindow::compose() | 79 | void MailItWindow::compose() |
76 | { | 80 | { |
77 | viewingMail = FALSE; | 81 | viewingMail = FALSE; |
78 | emailClient->hide(); | 82 | emailClient->hide(); |
79 | readMail->hide(); | 83 | readMail->hide(); |
80 | views->raiseWidget(writeMail); | 84 | views->raiseWidget(writeMail); |
81 | writeMail->setAddressList(emailClient->getAdrListRef()); | 85 | writeMail->setAddressList(emailClient->getAdrListRef()); |
82 | setCaption( tr( "Write mail" ) ); | 86 | setCaption( tr( "Write mail" ) ); |
83 | } | 87 | } |
diff --git a/noncore/net/mailit/viewatt.cpp b/noncore/net/mailit/viewatt.cpp index 86f119f..b6f5015 100644 --- a/noncore/net/mailit/viewatt.cpp +++ b/noncore/net/mailit/viewatt.cpp | |||
@@ -1,101 +1,110 @@ | |||
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 "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 | ||
24 | ViewAtt::ViewAtt(QWidget *parent, const char *name, WFlags f) | 25 | ViewAtt::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 | ||
41 | void ViewAtt::update(Email *mailIn, bool inbox) | 42 | void 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 | ||
81 | void ViewAtt::install() | 90 | void 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) { |
90 | filename = item->text(0); | 99 | filename = item->text(0); |
91 | selPtr = NULL; | 100 | selPtr = NULL; |
92 | for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) { | 101 | for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) { |
93 | if (ePtr->originalName == filename) | 102 | if (ePtr->originalName == filename) |
94 | selPtr = ePtr; | 103 | selPtr = ePtr; |
95 | } | 104 | } |
96 | 105 | ||
97 | if (selPtr == NULL) { | 106 | if (selPtr == NULL) { |
98 | qWarning("Internal error, file is not installed to documents"); | 107 | qWarning("Internal error, file is not installed to documents"); |
99 | return; | 108 | return; |
100 | } | 109 | } |
101 | 110 | ||
diff --git a/noncore/net/mailit/writemail.cpp b/noncore/net/mailit/writemail.cpp index 70332a9..a45cfd2 100644 --- a/noncore/net/mailit/writemail.cpp +++ b/noncore/net/mailit/writemail.cpp | |||
@@ -24,49 +24,49 @@ | |||
24 | WriteMail::WriteMail( QWidget* parent, const char* name, WFlags fl ) | 24 | WriteMail::WriteMail( QWidget* parent, const char* name, WFlags fl ) |
25 | : QMainWindow( parent, name, fl ) | 25 | : QMainWindow( parent, name, fl ) |
26 | { | 26 | { |
27 | showingAddressList = FALSE; | 27 | showingAddressList = FALSE; |
28 | init(); | 28 | init(); |
29 | 29 | ||
30 | addAtt = new AddAtt(0, "Add Attatchments"); | 30 | addAtt = new AddAtt(0, "Add Attatchments"); |
31 | } | 31 | } |
32 | 32 | ||
33 | WriteMail::~WriteMail() | 33 | WriteMail::~WriteMail() |
34 | { | 34 | { |
35 | delete addAtt; | 35 | delete addAtt; |
36 | } | 36 | } |
37 | 37 | ||
38 | void WriteMail::setAddressList(AddressList *list) | 38 | void WriteMail::setAddressList(AddressList *list) |
39 | { | 39 | { |
40 | Contact *cPtr; | 40 | Contact *cPtr; |
41 | 41 | ||
42 | addressList = list; | 42 | addressList = list; |
43 | 43 | ||
44 | addressView->clear(); | 44 | addressView->clear(); |
45 | QList<Contact> *cListPtr = addressList->getContactList(); | 45 | QList<Contact> *cListPtr = addressList->getContactList(); |
46 | QListViewItem *item; | 46 | QListViewItem *item; |
47 | for (cPtr = cListPtr->first(); cPtr != 0; cPtr = cListPtr->next() ) { | 47 | for (cPtr = cListPtr->first(); cPtr != 0; cPtr = cListPtr->next() ) { |
48 | item = new QListViewItem(addressView, cPtr->email, cPtr->name); | 48 | item = new QListViewItem(addressView, cPtr->name, cPtr->email); |
49 | } | 49 | } |
50 | } | 50 | } |
51 | 51 | ||
52 | void WriteMail::init() | 52 | void WriteMail::init() |
53 | { | 53 | { |
54 | setToolBarsMovable(FALSE); | 54 | setToolBarsMovable(FALSE); |
55 | 55 | ||
56 | bar = new QToolBar(this); | 56 | bar = new QToolBar(this); |
57 | bar->setHorizontalStretchable( TRUE ); | 57 | bar->setHorizontalStretchable( TRUE ); |
58 | 58 | ||
59 | menu = new QMenuBar( bar ); | 59 | menu = new QMenuBar( bar ); |
60 | 60 | ||
61 | mailMenu = new QPopupMenu(menu); | 61 | mailMenu = new QPopupMenu(menu); |
62 | menu->insertItem( tr( "&Mail" ), mailMenu); | 62 | menu->insertItem( tr( "&Mail" ), mailMenu); |
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("mailit/attach"), 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 | ||
72 | confirmButton = new QAction(tr("Enque mail"), Resource::loadPixmap("OKButton"), QString::null, 0, this, 0); | 72 | confirmButton = new QAction(tr("Enque mail"), Resource::loadPixmap("OKButton"), QString::null, 0, this, 0); |
@@ -89,52 +89,53 @@ void WriteMail::init() | |||
89 | 89 | ||
90 | subjetLabel = new QLabel( widget, "subjetLabel" ); | 90 | subjetLabel = new QLabel( widget, "subjetLabel" ); |
91 | subjetLabel->setText( tr( "Subject:" ) ); | 91 | subjetLabel->setText( tr( "Subject:" ) ); |
92 | 92 | ||
93 | grid->addWidget( subjetLabel, 1, 0 ); | 93 | grid->addWidget( subjetLabel, 1, 0 ); |
94 | 94 | ||
95 | ToolButton13_2 = new QToolButton( widget, "ToolButton13_2" ); | 95 | ToolButton13_2 = new QToolButton( widget, "ToolButton13_2" ); |
96 | ToolButton13_2->setText( tr( "..." ) ); | 96 | ToolButton13_2->setText( tr( "..." ) ); |
97 | grid->addWidget( ToolButton13_2, 1, 2 ); | 97 | grid->addWidget( ToolButton13_2, 1, 2 ); |
98 | 98 | ||
99 | subjectInput = new QLineEdit( widget, "subjectInput" ); | 99 | subjectInput = new QLineEdit( widget, "subjectInput" ); |
100 | grid->addWidget( subjectInput, 1, 1 ); | 100 | grid->addWidget( subjectInput, 1, 1 ); |
101 | 101 | ||
102 | toInput = new QLineEdit( widget, "toInput" ); | 102 | toInput = new QLineEdit( widget, "toInput" ); |
103 | grid->addWidget( toInput, 0, 1 ); | 103 | grid->addWidget( toInput, 0, 1 ); |
104 | 104 | ||
105 | addressButton = new QToolButton( widget, "addressButton" ); | 105 | addressButton = new QToolButton( widget, "addressButton" ); |
106 | addressButton->setPixmap( Resource::loadPixmap("AddressBook") ); | 106 | addressButton->setPixmap( Resource::loadPixmap("AddressBook") ); |
107 | addressButton->setToggleButton(TRUE); | 107 | addressButton->setToggleButton(TRUE); |
108 | grid->addWidget( addressButton, 0, 2 ); | 108 | grid->addWidget( addressButton, 0, 2 ); |
109 | connect(addressButton, SIGNAL(clicked()), this, SLOT(getAddress()) ); | 109 | connect(addressButton, SIGNAL(clicked()), this, SLOT(getAddress()) ); |
110 | 110 | ||
111 | emailInput = new QMultiLineEdit( widget, "emailInput" ); | 111 | emailInput = new QMultiLineEdit( widget, "emailInput" ); |
112 | grid->addMultiCellWidget( emailInput, 2, 2, 0, 2); | 112 | grid->addMultiCellWidget( emailInput, 2, 2, 0, 2); |
113 | |||
113 | 114 | ||
114 | addressView = new QListView( widget, "addressView"); | 115 | addressView = new QListView( widget, "addressView"); |
115 | addressView->addColumn("Email"); | ||
116 | addressView->addColumn("Name"); | 116 | addressView->addColumn("Name"); |
117 | addressView->addColumn("EMail"); | ||
117 | addressView->setAllColumnsShowFocus(TRUE); | 118 | addressView->setAllColumnsShowFocus(TRUE); |
118 | addressView->setMultiSelection(TRUE); | 119 | addressView->setMultiSelection(TRUE); |
119 | addressView->hide(); | 120 | addressView->hide(); |
120 | grid->addMultiCellWidget( addressView, 3, 3, 0, 2); | 121 | grid->addMultiCellWidget( addressView, 3, 3, 0, 2); |
121 | 122 | ||
122 | okButton = new QToolButton(bar, "ok"); | 123 | okButton = new QToolButton(bar, "ok"); |
123 | okButton->setPixmap( Resource::loadPixmap("enter") ); | 124 | okButton->setPixmap( Resource::loadPixmap("enter") ); |
124 | okButton->hide(); | 125 | okButton->hide(); |
125 | connect(okButton, SIGNAL(clicked()), this, SLOT(addRecipients()) ); | 126 | connect(okButton, SIGNAL(clicked()), this, SLOT(addRecipients()) ); |
126 | 127 | ||
127 | setCentralWidget(widget); | 128 | setCentralWidget(widget); |
128 | } | 129 | } |
129 | 130 | ||
130 | void WriteMail::reject() | 131 | void WriteMail::reject() |
131 | { | 132 | { |
132 | emit cancelMail(); | 133 | emit cancelMail(); |
133 | } | 134 | } |
134 | 135 | ||
135 | // need to insert date | 136 | // need to insert date |
136 | void WriteMail::accept() | 137 | void WriteMail::accept() |
137 | { | 138 | { |
138 | QStringList attatchedFiles, attatchmentsType; | 139 | QStringList attatchedFiles, attatchmentsType; |
139 | int idCount = 0; | 140 | int idCount = 0; |
140 | 141 | ||
diff --git a/noncore/unsupported/mailit/addatt.cpp b/noncore/unsupported/mailit/addatt.cpp index f279f52..c8be865 100644 --- a/noncore/unsupported/mailit/addatt.cpp +++ b/noncore/unsupported/mailit/addatt.cpp | |||
@@ -1,160 +1,154 @@ | |||
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 <qdir.h> | 22 | #include <qdir.h> |
22 | #include <qstringlist.h> | 23 | #include <qstringlist.h> |
23 | #include "resource.h" | 24 | #include "resource.h" |
24 | #include "addatt.h" | 25 | #include "addatt.h" |
25 | 26 | ||
26 | FileItem::FileItem(QListView *parent, DocLnk* dl) | 27 | FileItem::FileItem(QListView *parent, DocLnk* dl) |
27 | : QListViewItem(parent) | 28 | : QListViewItem(parent) |
28 | { | 29 | { |
29 | /*file = fileInfo; | 30 | /*file = fileInfo; |
30 | type = fileType;*/ | 31 | type = fileType;*/ |
31 | 32 | ||
32 | doclnk=dl; | 33 | doclnk=dl; |
33 | 34 | ||
34 | setText(0, doclnk->name()); | 35 | setText(0, doclnk->name()); |
35 | 36 | ||
36 | /*if (fileType == "Picture") { | 37 | /*if (fileType == "Picture") { |
37 | setPixmap(0, Resource::loadPixmap("pixmap")); | 38 | setPixmap(0, Resource::loadPixmap("pixmap")); |
38 | } else if (fileType == "Document") { | 39 | } else if (fileType == "Document") { |
39 | setPixmap(0, Resource::loadPixmap("txt")); | 40 | setPixmap(0, Resource::loadPixmap("txt")); |
40 | } else if (fileType == "Sound") { | 41 | } else if (fileType == "Sound") { |
41 | setPixmap(0, Resource::loadPixmap("play")); | 42 | setPixmap(0, Resource::loadPixmap("play")); |
42 | } else if (fileType == "Movie") { | 43 | } else if (fileType == "Movie") { |
43 | setPixmap(0, Resource::loadPixmap("MPEGPlayer")); | 44 | setPixmap(0, Resource::loadPixmap("MPEGPlayer")); |
44 | } else if (fileType == "File") { | 45 | } else if (fileType == "File") { |
45 | setPixmap(0, Resource::loadPixmap("exec")); | 46 | setPixmap(0, Resource::loadPixmap("exec")); |
46 | }*/ | 47 | }*/ |
47 | } | 48 | } |
48 | 49 | ||
49 | FileItem::~FileItem() | 50 | FileItem::~FileItem() |
50 | { | 51 | { |
51 | if (doclnk!=NULL) delete doclnk; | 52 | if (doclnk!=NULL) delete doclnk; |
52 | doclnk=NULL; | 53 | doclnk=NULL; |
53 | } | 54 | } |
54 | 55 | ||
55 | AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f) | 56 | AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f) |
56 | : QDialog(parent, name, f) | 57 | : QDialog(parent, name, f) |
57 | { | 58 | { |
58 | setCaption("Adding attatchments"); | 59 | setCaption("Adding attatchments"); |
59 | 60 | ||
60 | QGridLayout *top = new QGridLayout(this, 3,1 ); | 61 | QGridLayout *top = new QGridLayout(this, 1,1 ); |
61 | 62 | ||
62 | 63 | QHBox *buttons=new QHBox(this); | |
63 | /*fileCategoryButton = new QPushButton(this);*/ | 64 | /*fileCategoryButton = new QPushButton(this);*/ |
64 | attatchButton = new QPushButton("Attatch ->", this); | 65 | attatchButton = new QPushButton("Attatch ->", buttons); |
65 | removeButton = new QPushButton("Remove", this); | 66 | removeButton = new QPushButton("Remove", buttons); |
66 | 67 | ||
67 | /*fileCategories = new QPopupMenu(fileCategoryButton); | 68 | /*fileCategories = new QPopupMenu(fileCategoryButton); |
68 | fileCategoryButton->setPopup(fileCategories); | 69 | fileCategoryButton->setPopup(fileCategories); |
69 | fileCategories->insertItem("Document"); | 70 | fileCategories->insertItem("Document"); |
70 | fileCategories->insertItem("Picture"); | 71 | fileCategories->insertItem("Picture"); |
71 | fileCategories->insertItem("Sound"); | 72 | fileCategories->insertItem("Sound"); |
72 | fileCategories->insertItem("Movie"); | 73 | fileCategories->insertItem("Movie"); |
73 | fileCategories->insertItem("File"); | 74 | fileCategories->insertItem("File"); |
74 | 75 | ||
75 | fileCategoryButton->setText("Document"); | 76 | fileCategoryButton->setText("Document"); |
76 | top->addWidget(fileCategoryButton, 0, 0);*/ | 77 | top->addWidget(fileCategoryButton, 0, 0);*/ |
77 | 78 | ||
78 | //ofs=new OFileSelector(this,2,0,"/root/Documents"); | ||
79 | |||
80 | |||
81 | top->addWidget(attatchButton,1,0); | ||
82 | top->addWidget(removeButton,2,0); | ||
83 | 79 | ||
84 | /*connect(fileCategories, SIGNAL(activated(int)), this, | 80 | top->addWidget(buttons,1,0); |
85 | SLOT(fileCategorySelected(int)) );*/ | 81 | //buttons->addWidget(attatchButton,0,0); |
82 | //buttons->addWidget(removeButton,0,1); | ||
83 | |||
84 | //connect(fileCategories, SIGNAL(activated(int)), this, | ||
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 | QDialog qd(this,tr("Select attachment"),true); | 126 | OFileDialog ofs("Attachments",this,0,0,"/root/Documents"); |
127 | |||
128 | QGridLayout top(&qd,1,1); | ||
129 | |||
130 | OFileSelector ofs(&qd,1,0,"/root/Documents"); | ||
131 | |||
132 | top.addWidget(&ofs,0,0); | ||
133 | 127 | ||
134 | qd.showMaximized(); | 128 | ofs.showMaximized(); |
135 | 129 | ||
136 | if (qd.exec()==QDialog::Accepted) | 130 | if (ofs.exec()==QDialog::Accepted) |
137 | { | 131 | { |
138 | DocLnk* dl=new DocLnk(ofs.selectedDocument()); | 132 | DocLnk* dl=new DocLnk(ofs.selectedDocument()); |
139 | FileItem* fi=new FileItem(attView,dl); | 133 | FileItem* fi=new FileItem(attView,dl); |
140 | fi->setPixmap(0,dl->pixmap()); | 134 | fi->setPixmap(0,dl->pixmap()); |
141 | fi->setText(1,dl->type()); | 135 | fi->setText(1,dl->type()); |
142 | attView->insertItem(fi); | 136 | attView->insertItem(fi); |
143 | modified = TRUE; | 137 | modified = TRUE; |
144 | } | 138 | } |
145 | } | 139 | } |
146 | 140 | ||
147 | void AddAtt::removeAttatchment() | 141 | void AddAtt::removeAttatchment() |
148 | { | 142 | { |
149 | if (attView->selectedItem() != NULL) | 143 | if (attView->selectedItem() != NULL) |
150 | { | 144 | { |
151 | attView->takeItem(attView->selectedItem()); | 145 | attView->takeItem(attView->selectedItem()); |
152 | } | 146 | } |
153 | modified = TRUE; | 147 | modified = TRUE; |
154 | } | 148 | } |
155 | 149 | ||
156 | void AddAtt::reject() | 150 | void AddAtt::reject() |
157 | { | 151 | { |
158 | if (modified) { | 152 | if (modified) { |
159 | attView->clear(); | 153 | attView->clear(); |
160 | modified = FALSE; | 154 | modified = FALSE; |
diff --git a/noncore/unsupported/mailit/addatt.h b/noncore/unsupported/mailit/addatt.h index 73062e2..fcf3279 100644 --- a/noncore/unsupported/mailit/addatt.h +++ b/noncore/unsupported/mailit/addatt.h | |||
@@ -6,71 +6,71 @@ | |||
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 | #ifndef ADDATT_H | 20 | #ifndef ADDATT_H |
21 | #define ADDATT_H | 21 | #define ADDATT_H |
22 | 22 | ||
23 | #include <qdialog.h> | 23 | #include <qdialog.h> |
24 | #include <qlistview.h> | 24 | #include <qlistview.h> |
25 | #include <qpushbutton.h> | 25 | #include <qpushbutton.h> |
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> | 30 | #include <opie/ofiledialog.h> |
31 | #include <qpe/applnk.h> | 31 | #include <qpe/applnk.h> |
32 | 32 | ||
33 | class FileItem : public QListViewItem | 33 | class FileItem : public QListViewItem |
34 | { | 34 | { |
35 | public: | 35 | public: |
36 | //FileItem(QListView *parent, QFileInfo fileInfo, QString fileType); | 36 | //FileItem(QListView *parent, QFileInfo fileInfo, QString fileType); |
37 | FileItem(QListView*, DocLnk*); | 37 | FileItem(QListView*, DocLnk*); |
38 | ~FileItem(); | 38 | ~FileItem(); |
39 | DocLnk* getDocLnk() {return doclnk;} | 39 | DocLnk* getDocLnk() {return doclnk;} |
40 | 40 | ||
41 | 41 | ||
42 | private: | 42 | private: |
43 | DocLnk* doclnk; | 43 | DocLnk* doclnk; |
44 | }; | 44 | }; |
45 | 45 | ||
46 | class AddAtt : public QDialog | 46 | class AddAtt : public QDialog |
47 | { | 47 | { |
48 | Q_OBJECT | 48 | Q_OBJECT |
49 | 49 | ||
50 | public: | 50 | public: |
51 | AddAtt(QWidget *parent = 0, const char *name = 0, WFlags f = 0); | 51 | AddAtt(QWidget *parent = 0, const char *name = 0, WFlags f = 0); |
52 | QStringList returnAttatchedFiles(); | 52 | QStringList returnAttatchedFiles(); |
53 | QStringList returnFileTypes(); | 53 | QStringList returnFileTypes(); |
54 | void getFiles(); | 54 | void getFiles(); |
55 | void clear(); | 55 | void clear(); |
56 | 56 | ||
57 | 57 | ||
58 | public slots: | 58 | public slots: |
59 | //void fileCategorySelected(int); | 59 | //void fileCategorySelected(int); |
60 | void addAttatchment(); | 60 | void addAttatchment(); |
61 | void removeAttatchment(); | 61 | void removeAttatchment(); |
62 | void reject(); | 62 | void reject(); |
63 | void accept(); | 63 | void accept(); |
64 | 64 | ||
65 | private: | 65 | private: |
66 | FileItem* item; | 66 | FileItem* item; |
67 | QListView *attView; | 67 | QListView *attView; |
68 | QPushButton *fileCategoryButton, *attatchButton, *removeButton; | 68 | QPushButton *attatchButton, *removeButton; |
69 | QPopupMenu *fileCategories; | 69 | QPopupMenu *fileCategories; |
70 | bool modified; | 70 | bool modified; |
71 | QFileInfo *fi; | 71 | //QFileInfo *fi; |
72 | 72 | ||
73 | OFileSelector* ofs; | 73 | OFileDialog* ofs; |
74 | }; | 74 | }; |
75 | 75 | ||
76 | #endif | 76 | #endif |
diff --git a/noncore/unsupported/mailit/addresslist.cpp b/noncore/unsupported/mailit/addresslist.cpp index 1cf2562..43e3830 100644 --- a/noncore/unsupported/mailit/addresslist.cpp +++ b/noncore/unsupported/mailit/addresslist.cpp | |||
@@ -1,45 +1,47 @@ | |||
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 <qfile.h> | 20 | #include <qfile.h> |
21 | #include <qtextstream.h> | 21 | #include <qtextstream.h> |
22 | #include <opie/ocontactaccess.h> | ||
23 | #include <opie/ocontact.h> | ||
22 | 24 | ||
23 | #include "addresslist.h" | 25 | #include "addresslist.h" |
24 | 26 | ||
25 | AddressList::AddressList(QString file) | 27 | AddressList::AddressList(QString file) |
26 | { | 28 | { |
27 | addresses.setAutoDelete(TRUE); | 29 | addresses.setAutoDelete(TRUE); |
28 | filename = file; | 30 | filename = file; |
29 | read(); | 31 | read(); |
30 | dirty = FALSE; | 32 | dirty = FALSE; |
31 | } | 33 | } |
32 | 34 | ||
33 | AddressList::~AddressList() | 35 | AddressList::~AddressList() |
34 | { | 36 | { |
35 | write(); | 37 | write(); |
36 | addresses.clear(); | 38 | addresses.clear(); |
37 | } | 39 | } |
38 | 40 | ||
39 | void AddressList::addContact(QString email, QString name) | 41 | void AddressList::addContact(QString email, QString name) |
40 | { | 42 | { |
41 | //skip if not a valid email address, | 43 | //skip if not a valid email address, |
42 | if (email.find( '@') == -1) | 44 | if (email.find( '@') == -1) |
43 | return; | 45 | return; |
44 | 46 | ||
45 | if ( ! containsEmail(email) ) { | 47 | if ( ! containsEmail(email) ) { |
@@ -95,67 +97,79 @@ int AddressList::getEmailRef(QString email) | |||
95 | } | 97 | } |
96 | return -1; | 98 | return -1; |
97 | } | 99 | } |
98 | 100 | ||
99 | int AddressList::getNameRef(QString name) | 101 | int AddressList::getNameRef(QString name) |
100 | { | 102 | { |
101 | int pos = 0; | 103 | int pos = 0; |
102 | Contact *ptr; | 104 | Contact *ptr; |
103 | 105 | ||
104 | for (ptr = addresses.first(); ptr != 0; ptr = addresses.next() ) { | 106 | for (ptr = addresses.first(); ptr != 0; ptr = addresses.next() ) { |
105 | if (ptr->name == name) | 107 | if (ptr->name == name) |
106 | return pos; | 108 | return pos; |
107 | pos++; | 109 | pos++; |
108 | } | 110 | } |
109 | return -1; | 111 | return -1; |
110 | } | 112 | } |
111 | 113 | ||
112 | QList<Contact>* AddressList::getContactList() | 114 | QList<Contact>* AddressList::getContactList() |
113 | { | 115 | { |
114 | return &addresses; | 116 | return &addresses; |
115 | } | 117 | } |
116 | 118 | ||
117 | void AddressList::read() | 119 | void AddressList::read() |
118 | { | 120 | { |
119 | QFile f(filename); | 121 | OContactAccess::List::Iterator it; |
122 | |||
123 | //QFile f(filename); | ||
120 | QString lineEmail, lineName, email, name; | 124 | QString lineEmail, lineName, email, name; |
125 | OContactAccess m_contactdb("mailit"); | ||
126 | OContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 ); | ||
127 | //OContact* oc; | ||
121 | 128 | ||
122 | if (! f.open(IO_ReadOnly) ) | 129 | for ( it = m_list.begin(); it != m_list.end(); ++it ) |
130 | { | ||
131 | //oc=(OContact*) it; | ||
132 | if ((*it).defaultEmail().length()!=0) | ||
133 | addContact((*it).defaultEmail(),(*it).fullName()); | ||
134 | } | ||
135 | |||
136 | /*if (! f.open(IO_ReadOnly) ) | ||
123 | return; | 137 | return; |
124 | 138 | ||
125 | QTextStream stream(&f); | 139 | QTextStream stream(&f); |
126 | 140 | ||
127 | while (! stream.atEnd() ) { | 141 | while (! stream.atEnd() ) { |
128 | lineEmail = stream.readLine(); | 142 | lineEmail = stream.readLine(); |
129 | if (! stream.atEnd() ) | 143 | if (! stream.atEnd() ) |
130 | lineName = stream.readLine(); | 144 | lineName = stream.readLine(); |
131 | else return; | 145 | else return; |
132 | 146 | ||
133 | email = getRightString(lineEmail); | 147 | email = getRightString(lineEmail); |
134 | name = getRightString(lineName); | 148 | name = getRightString(lineName); |
135 | addContact(email, name); | 149 | addContact(email, name); |
136 | } | 150 | } |
137 | f.close(); | 151 | f.close();*/ |
138 | } | 152 | } |
139 | 153 | ||
140 | QString AddressList::getRightString(QString in) | 154 | QString AddressList::getRightString(QString in) |
141 | { | 155 | { |
142 | QString out = ""; | 156 | QString out = ""; |
143 | 157 | ||
144 | int pos = in.find('='); | 158 | int pos = in.find('='); |
145 | if (pos != -1) { | 159 | if (pos != -1) { |
146 | out = in.mid(pos+1).stripWhiteSpace(); | 160 | out = in.mid(pos+1).stripWhiteSpace(); |
147 | } | 161 | } |
148 | return out; | 162 | return out; |
149 | } | 163 | } |
150 | 164 | ||
151 | void AddressList::write() | 165 | void AddressList::write() |
152 | { | 166 | { |
153 | if ( (addresses.count() == 0) || (!dirty) ) | 167 | if ( (addresses.count() == 0) || (!dirty) ) |
154 | return; | 168 | return; |
155 | 169 | ||
156 | QFile f(filename); | 170 | QFile f(filename); |
157 | if (! f.open(IO_WriteOnly) ) | 171 | if (! f.open(IO_WriteOnly) ) |
158 | return; | 172 | return; |
159 | 173 | ||
160 | QTextStream stream(&f); | 174 | QTextStream stream(&f); |
161 | Contact *ptr; | 175 | Contact *ptr; |
diff --git a/noncore/unsupported/mailit/emailclient.cpp b/noncore/unsupported/mailit/emailclient.cpp index 9258aac..2943986 100644 --- a/noncore/unsupported/mailit/emailclient.cpp +++ b/noncore/unsupported/mailit/emailclient.cpp | |||
@@ -127,49 +127,49 @@ void EmailClient::init() | |||
127 | 127 | ||
128 | mb = new QMenuBar( bar ); | 128 | mb = new QMenuBar( bar ); |
129 | 129 | ||
130 | QPopupMenu *mail = new QPopupMenu(mb); | 130 | QPopupMenu *mail = new QPopupMenu(mb); |
131 | mb->insertItem( tr( "&Mail" ), mail); | 131 | mb->insertItem( tr( "&Mail" ), mail); |
132 | 132 | ||
133 | QPopupMenu *configure = new QPopupMenu(mb); | 133 | QPopupMenu *configure = new QPopupMenu(mb); |
134 | mb->insertItem( tr( "Accounts" ), configure); | 134 | mb->insertItem( tr( "Accounts" ), configure); |
135 | 135 | ||
136 | selectAccountMenu = new QPopupMenu(mb); | 136 | selectAccountMenu = new QPopupMenu(mb); |
137 | editAccountMenu = new QPopupMenu(mb); | 137 | editAccountMenu = new QPopupMenu(mb); |
138 | deleteAccountMenu = new QPopupMenu(mb); | 138 | deleteAccountMenu = new QPopupMenu(mb); |
139 | 139 | ||
140 | mail->insertItem(tr("Get Mail in"), selectAccountMenu); | 140 | mail->insertItem(tr("Get Mail in"), selectAccountMenu); |
141 | configure->insertItem(tr("Edit account"), editAccountMenu); | 141 | configure->insertItem(tr("Edit account"), editAccountMenu); |
142 | configure->insertItem(tr("Delete account"), deleteAccountMenu); | 142 | configure->insertItem(tr("Delete account"), deleteAccountMenu); |
143 | 143 | ||
144 | bar = new QToolBar(this); | 144 | bar = new QToolBar(this); |
145 | 145 | ||
146 | getMailButton = new QAction(tr("Get all mail"), Resource::loadPixmap("mailit/getmail"), QString::null, 0, this, 0); | 146 | getMailButton = new QAction(tr("Get all mail"), Resource::loadPixmap("mailit/getmail"), QString::null, 0, this, 0); |
147 | connect(getMailButton, SIGNAL(activated()), this, SLOT(getAllNewMail()) ); | 147 | connect(getMailButton, SIGNAL(activated()), this, SLOT(getAllNewMail()) ); |
148 | getMailButton->addTo(bar); | 148 | getMailButton->addTo(bar); |
149 | getMailButton->addTo(mail); | 149 | getMailButton->addTo(mail); |
150 | 150 | ||
151 | sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendmail"), QString::null, 0, this, 0); | 151 | sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendqueue"), QString::null, 0, this, 0); |
152 | connect(sendMailButton, SIGNAL(activated()), this, SLOT(sendQuedMail()) ); | 152 | connect(sendMailButton, SIGNAL(activated()), this, SLOT(sendQuedMail()) ); |
153 | sendMailButton->addTo(bar); | 153 | sendMailButton->addTo(bar); |
154 | sendMailButton->addTo(mail); | 154 | sendMailButton->addTo(mail); |
155 | 155 | ||
156 | composeButton = new QAction(tr("Compose"), Resource::loadPixmap("new"), QString::null, 0, this, 0); | 156 | composeButton = new QAction(tr("Compose"), Resource::loadPixmap("new"), QString::null, 0, this, 0); |
157 | connect(composeButton, SIGNAL(activated()), this, SLOT(compose()) ); | 157 | connect(composeButton, SIGNAL(activated()), this, SLOT(compose()) ); |
158 | composeButton->addTo(bar); | 158 | composeButton->addTo(bar); |
159 | composeButton->addTo(mail); | 159 | composeButton->addTo(mail); |
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->addTo(bar); |
165 | cancelButton->setEnabled(FALSE); | 165 | cancelButton->setEnabled(FALSE); |
166 | 166 | ||
167 | mailboxView = new OTabWidget( this, "mailboxView" ); | 167 | mailboxView = new OTabWidget( this, "mailboxView" ); |
168 | 168 | ||
169 | QWidget* widget = new QWidget( mailboxView, "widget" ); | 169 | QWidget* widget = new QWidget( mailboxView, "widget" ); |
170 | grid_2 = new QGridLayout( widget ); | 170 | grid_2 = new QGridLayout( widget ); |
171 | // grid_2->setSpacing(6); | 171 | // grid_2->setSpacing(6); |
172 | // grid_2->setMargin( 11 ); | 172 | // grid_2->setMargin( 11 ); |
173 | 173 | ||
174 | inboxView = new QListView( widget, "inboxView" ); | 174 | inboxView = new QListView( widget, "inboxView" ); |
175 | inboxView->addColumn( tr( "From" ) ); | 175 | inboxView->addColumn( tr( "From" ) ); |
diff --git a/noncore/unsupported/mailit/mailitwindow.cpp b/noncore/unsupported/mailit/mailitwindow.cpp index f9b6de2..fd49c1f 100644 --- a/noncore/unsupported/mailit/mailitwindow.cpp +++ b/noncore/unsupported/mailit/mailitwindow.cpp | |||
@@ -6,78 +6,82 @@ | |||
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 "mailitwindow.h" | 20 | #include "mailitwindow.h" |
21 | 21 | ||
22 | MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl) | 22 | MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl) |
23 | : QMainWindow(parent, name, fl) | 23 | : QMainWindow(parent, name, fl) |
24 | { | 24 | { |
25 | currentCaption = "Mailit"; | 25 | currentCaption = "Mailit"; |
26 | setCaption(tr(currentCaption)); | 26 | setCaption(tr(currentCaption)); |
27 | views = new QWidgetStack(this); | 27 | views = new QWidgetStack(this); |
28 | setCentralWidget(views); | 28 | setCentralWidget(views); |
29 | 29 | ||
30 | qWarning("***Starting writeMail"); | ||
30 | emailClient = new EmailClient(views, "client"); | 31 | emailClient = new EmailClient(views, "client"); |
31 | writeMail = new WriteMail(views, "writing"); | 32 | writeMail = new WriteMail(views, "writing"); |
32 | readMail = new ReadMail(views, "reading"); | 33 | readMail = new ReadMail(views, "reading"); |
34 | qWarning("***Finished readMail"); | ||
33 | 35 | ||
34 | views->raiseWidget(emailClient); | 36 | views->raiseWidget(emailClient); |
35 | 37 | ||
36 | connect(emailClient, SIGNAL(composeRequested()), | 38 | connect(emailClient, SIGNAL(composeRequested()), |
37 | this, SLOT(compose()) ); | 39 | this, SLOT(compose()) ); |
38 | connect(emailClient, SIGNAL(viewEmail(QListView *, Email *)), this, | 40 | connect(emailClient, SIGNAL(viewEmail(QListView *, Email *)), this, |
39 | SLOT(viewMail(QListView *, Email *)) ); | 41 | SLOT(viewMail(QListView *, Email *)) ); |
40 | connect(emailClient, SIGNAL(mailUpdated(Email *)), this, | 42 | connect(emailClient, SIGNAL(mailUpdated(Email *)), this, |
41 | SLOT(updateMailView(Email *)) ); | 43 | SLOT(updateMailView(Email *)) ); |
42 | 44 | ||
43 | connect(writeMail, SIGNAL(cancelMail()), this, SLOT(showEmailClient()) ); | 45 | connect(writeMail, SIGNAL(cancelMail()), this, SLOT(showEmailClient()) ); |
44 | connect(writeMail, SIGNAL(sendMailRequested(const Email &)), this, | 46 | connect(writeMail, SIGNAL(sendMailRequested(const Email &)), this, |
45 | SLOT(showEmailClient()) ); | 47 | SLOT(showEmailClient()) ); |
46 | connect(writeMail, SIGNAL(sendMailRequested(const Email &)), emailClient, | 48 | connect(writeMail, SIGNAL(sendMailRequested(const Email &)), emailClient, |
47 | SLOT(enqueMail(const Email &)) ); | 49 | SLOT(enqueMail(const Email &)) ); |
48 | 50 | ||
49 | connect(readMail, SIGNAL(cancelView()), this, SLOT(showEmailClient()) ); | 51 | connect(readMail, SIGNAL(cancelView()), this, SLOT(showEmailClient()) ); |
50 | connect(readMail, SIGNAL(replyRequested(Email &)), this, | 52 | connect(readMail, SIGNAL(replyRequested(Email &)), this, |
51 | SLOT(composeReply(Email &)) ); | 53 | SLOT(composeReply(Email &)) ); |
52 | connect(readMail, SIGNAL(removeItem(EmailListItem *, bool &)), emailClient, | 54 | connect(readMail, SIGNAL(removeItem(EmailListItem *, bool &)), emailClient, |
53 | SLOT(deleteMail(EmailListItem *, bool &)) ); | 55 | SLOT(deleteMail(EmailListItem *, bool &)) ); |
54 | connect(readMail, SIGNAL(viewingMail(Email *)), emailClient, | 56 | connect(readMail, SIGNAL(viewingMail(Email *)), emailClient, |
55 | SLOT(moveMailFront(Email *)) ); | 57 | SLOT(moveMailFront(Email *)) ); |
56 | 58 | ||
57 | connect(emailClient, SIGNAL(newCaption(const QString &)), | 59 | connect(emailClient, SIGNAL(newCaption(const QString &)), |
58 | this, SLOT(updateCaption(const QString &)) ); | 60 | this, SLOT(updateCaption(const QString &)) ); |
59 | viewingMail = FALSE; | 61 | viewingMail = FALSE; |
62 | |||
63 | qWarning("***Finished MailitWindow"); | ||
60 | } | 64 | } |
61 | 65 | ||
62 | MailItWindow::~MailItWindow() | 66 | MailItWindow::~MailItWindow() |
63 | { | 67 | { |
64 | } | 68 | } |
65 | 69 | ||
66 | void MailItWindow::closeEvent(QCloseEvent *e) | 70 | void MailItWindow::closeEvent(QCloseEvent *e) |
67 | { | 71 | { |
68 | if (views->visibleWidget() == emailClient) { | 72 | if (views->visibleWidget() == emailClient) { |
69 | e->accept(); | 73 | e->accept(); |
70 | } else { | 74 | } else { |
71 | showEmailClient(); | 75 | showEmailClient(); |
72 | } | 76 | } |
73 | } | 77 | } |
74 | 78 | ||
75 | void MailItWindow::compose() | 79 | void MailItWindow::compose() |
76 | { | 80 | { |
77 | viewingMail = FALSE; | 81 | viewingMail = FALSE; |
78 | emailClient->hide(); | 82 | emailClient->hide(); |
79 | readMail->hide(); | 83 | readMail->hide(); |
80 | views->raiseWidget(writeMail); | 84 | views->raiseWidget(writeMail); |
81 | writeMail->setAddressList(emailClient->getAdrListRef()); | 85 | writeMail->setAddressList(emailClient->getAdrListRef()); |
82 | setCaption( tr( "Write mail" ) ); | 86 | setCaption( tr( "Write mail" ) ); |
83 | } | 87 | } |
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 | |||
@@ -1,101 +1,110 @@ | |||
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 "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 | ||
24 | ViewAtt::ViewAtt(QWidget *parent, const char *name, WFlags f) | 25 | ViewAtt::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 | ||
41 | void ViewAtt::update(Email *mailIn, bool inbox) | 42 | void 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 | ||
81 | void ViewAtt::install() | 90 | void 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) { |
90 | filename = item->text(0); | 99 | filename = item->text(0); |
91 | selPtr = NULL; | 100 | selPtr = NULL; |
92 | for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) { | 101 | for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) { |
93 | if (ePtr->originalName == filename) | 102 | if (ePtr->originalName == filename) |
94 | selPtr = ePtr; | 103 | selPtr = ePtr; |
95 | } | 104 | } |
96 | 105 | ||
97 | if (selPtr == NULL) { | 106 | if (selPtr == NULL) { |
98 | qWarning("Internal error, file is not installed to documents"); | 107 | qWarning("Internal error, file is not installed to documents"); |
99 | return; | 108 | return; |
100 | } | 109 | } |
101 | 110 | ||
diff --git a/noncore/unsupported/mailit/writemail.cpp b/noncore/unsupported/mailit/writemail.cpp index 70332a9..a45cfd2 100644 --- a/noncore/unsupported/mailit/writemail.cpp +++ b/noncore/unsupported/mailit/writemail.cpp | |||
@@ -24,49 +24,49 @@ | |||
24 | WriteMail::WriteMail( QWidget* parent, const char* name, WFlags fl ) | 24 | WriteMail::WriteMail( QWidget* parent, const char* name, WFlags fl ) |
25 | : QMainWindow( parent, name, fl ) | 25 | : QMainWindow( parent, name, fl ) |
26 | { | 26 | { |
27 | showingAddressList = FALSE; | 27 | showingAddressList = FALSE; |
28 | init(); | 28 | init(); |
29 | 29 | ||
30 | addAtt = new AddAtt(0, "Add Attatchments"); | 30 | addAtt = new AddAtt(0, "Add Attatchments"); |
31 | } | 31 | } |
32 | 32 | ||
33 | WriteMail::~WriteMail() | 33 | WriteMail::~WriteMail() |
34 | { | 34 | { |
35 | delete addAtt; | 35 | delete addAtt; |
36 | } | 36 | } |
37 | 37 | ||
38 | void WriteMail::setAddressList(AddressList *list) | 38 | void WriteMail::setAddressList(AddressList *list) |
39 | { | 39 | { |
40 | Contact *cPtr; | 40 | Contact *cPtr; |
41 | 41 | ||
42 | addressList = list; | 42 | addressList = list; |
43 | 43 | ||
44 | addressView->clear(); | 44 | addressView->clear(); |
45 | QList<Contact> *cListPtr = addressList->getContactList(); | 45 | QList<Contact> *cListPtr = addressList->getContactList(); |
46 | QListViewItem *item; | 46 | QListViewItem *item; |
47 | for (cPtr = cListPtr->first(); cPtr != 0; cPtr = cListPtr->next() ) { | 47 | for (cPtr = cListPtr->first(); cPtr != 0; cPtr = cListPtr->next() ) { |
48 | item = new QListViewItem(addressView, cPtr->email, cPtr->name); | 48 | item = new QListViewItem(addressView, cPtr->name, cPtr->email); |
49 | } | 49 | } |
50 | } | 50 | } |
51 | 51 | ||
52 | void WriteMail::init() | 52 | void WriteMail::init() |
53 | { | 53 | { |
54 | setToolBarsMovable(FALSE); | 54 | setToolBarsMovable(FALSE); |
55 | 55 | ||
56 | bar = new QToolBar(this); | 56 | bar = new QToolBar(this); |
57 | bar->setHorizontalStretchable( TRUE ); | 57 | bar->setHorizontalStretchable( TRUE ); |
58 | 58 | ||
59 | menu = new QMenuBar( bar ); | 59 | menu = new QMenuBar( bar ); |
60 | 60 | ||
61 | mailMenu = new QPopupMenu(menu); | 61 | mailMenu = new QPopupMenu(menu); |
62 | menu->insertItem( tr( "&Mail" ), mailMenu); | 62 | menu->insertItem( tr( "&Mail" ), mailMenu); |
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("mailit/attach"), 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 | ||
72 | confirmButton = new QAction(tr("Enque mail"), Resource::loadPixmap("OKButton"), QString::null, 0, this, 0); | 72 | confirmButton = new QAction(tr("Enque mail"), Resource::loadPixmap("OKButton"), QString::null, 0, this, 0); |
@@ -89,52 +89,53 @@ void WriteMail::init() | |||
89 | 89 | ||
90 | subjetLabel = new QLabel( widget, "subjetLabel" ); | 90 | subjetLabel = new QLabel( widget, "subjetLabel" ); |
91 | subjetLabel->setText( tr( "Subject:" ) ); | 91 | subjetLabel->setText( tr( "Subject:" ) ); |
92 | 92 | ||
93 | grid->addWidget( subjetLabel, 1, 0 ); | 93 | grid->addWidget( subjetLabel, 1, 0 ); |
94 | 94 | ||
95 | ToolButton13_2 = new QToolButton( widget, "ToolButton13_2" ); | 95 | ToolButton13_2 = new QToolButton( widget, "ToolButton13_2" ); |
96 | ToolButton13_2->setText( tr( "..." ) ); | 96 | ToolButton13_2->setText( tr( "..." ) ); |
97 | grid->addWidget( ToolButton13_2, 1, 2 ); | 97 | grid->addWidget( ToolButton13_2, 1, 2 ); |
98 | 98 | ||
99 | subjectInput = new QLineEdit( widget, "subjectInput" ); | 99 | subjectInput = new QLineEdit( widget, "subjectInput" ); |
100 | grid->addWidget( subjectInput, 1, 1 ); | 100 | grid->addWidget( subjectInput, 1, 1 ); |
101 | 101 | ||
102 | toInput = new QLineEdit( widget, "toInput" ); | 102 | toInput = new QLineEdit( widget, "toInput" ); |
103 | grid->addWidget( toInput, 0, 1 ); | 103 | grid->addWidget( toInput, 0, 1 ); |
104 | 104 | ||
105 | addressButton = new QToolButton( widget, "addressButton" ); | 105 | addressButton = new QToolButton( widget, "addressButton" ); |
106 | addressButton->setPixmap( Resource::loadPixmap("AddressBook") ); | 106 | addressButton->setPixmap( Resource::loadPixmap("AddressBook") ); |
107 | addressButton->setToggleButton(TRUE); | 107 | addressButton->setToggleButton(TRUE); |
108 | grid->addWidget( addressButton, 0, 2 ); | 108 | grid->addWidget( addressButton, 0, 2 ); |
109 | connect(addressButton, SIGNAL(clicked()), this, SLOT(getAddress()) ); | 109 | connect(addressButton, SIGNAL(clicked()), this, SLOT(getAddress()) ); |
110 | 110 | ||
111 | emailInput = new QMultiLineEdit( widget, "emailInput" ); | 111 | emailInput = new QMultiLineEdit( widget, "emailInput" ); |
112 | grid->addMultiCellWidget( emailInput, 2, 2, 0, 2); | 112 | grid->addMultiCellWidget( emailInput, 2, 2, 0, 2); |
113 | |||
113 | 114 | ||
114 | addressView = new QListView( widget, "addressView"); | 115 | addressView = new QListView( widget, "addressView"); |
115 | addressView->addColumn("Email"); | ||
116 | addressView->addColumn("Name"); | 116 | addressView->addColumn("Name"); |
117 | addressView->addColumn("EMail"); | ||
117 | addressView->setAllColumnsShowFocus(TRUE); | 118 | addressView->setAllColumnsShowFocus(TRUE); |
118 | addressView->setMultiSelection(TRUE); | 119 | addressView->setMultiSelection(TRUE); |
119 | addressView->hide(); | 120 | addressView->hide(); |
120 | grid->addMultiCellWidget( addressView, 3, 3, 0, 2); | 121 | grid->addMultiCellWidget( addressView, 3, 3, 0, 2); |
121 | 122 | ||
122 | okButton = new QToolButton(bar, "ok"); | 123 | okButton = new QToolButton(bar, "ok"); |
123 | okButton->setPixmap( Resource::loadPixmap("enter") ); | 124 | okButton->setPixmap( Resource::loadPixmap("enter") ); |
124 | okButton->hide(); | 125 | okButton->hide(); |
125 | connect(okButton, SIGNAL(clicked()), this, SLOT(addRecipients()) ); | 126 | connect(okButton, SIGNAL(clicked()), this, SLOT(addRecipients()) ); |
126 | 127 | ||
127 | setCentralWidget(widget); | 128 | setCentralWidget(widget); |
128 | } | 129 | } |
129 | 130 | ||
130 | void WriteMail::reject() | 131 | void WriteMail::reject() |
131 | { | 132 | { |
132 | emit cancelMail(); | 133 | emit cancelMail(); |
133 | } | 134 | } |
134 | 135 | ||
135 | // need to insert date | 136 | // need to insert date |
136 | void WriteMail::accept() | 137 | void WriteMail::accept() |
137 | { | 138 | { |
138 | QStringList attatchedFiles, attatchmentsType; | 139 | QStringList attatchedFiles, attatchmentsType; |
139 | int idCount = 0; | 140 | int idCount = 0; |
140 | 141 | ||