summaryrefslogtreecommitdiff
authorgroucho <groucho>2003-04-13 10:29:05 (UTC)
committer groucho <groucho>2003-04-13 10:29:05 (UTC)
commit8cc217bed9c122a7c7448e2cd59bfde330dfcfad (patch) (side-by-side diff)
treef802c03bbddf54ecc541ce23bdc43da0fc8b390b
parent64d6b3e723b9b2fc3b1f3eea6da6344c5f26ce1e (diff)
downloadopie-8cc217bed9c122a7c7448e2cd59bfde330dfcfad.zip
opie-8cc217bed9c122a7c7448e2cd59bfde330dfcfad.tar.gz
opie-8cc217bed9c122a7c7448e2cd59bfde330dfcfad.tar.bz2
- Uses mime types for attachment reading
- Addresses are read from ocontactacess
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mailit/addatt.cpp34
-rw-r--r--noncore/net/mailit/addatt.h8
-rw-r--r--noncore/net/mailit/addresslist.cpp20
-rw-r--r--noncore/net/mailit/emailclient.cpp2
-rw-r--r--noncore/net/mailit/mailitwindow.cpp4
-rw-r--r--noncore/net/mailit/viewatt.cpp15
-rw-r--r--noncore/net/mailit/writemail.cpp5
-rw-r--r--noncore/unsupported/mailit/addatt.cpp34
-rw-r--r--noncore/unsupported/mailit/addatt.h8
-rw-r--r--noncore/unsupported/mailit/addresslist.cpp20
-rw-r--r--noncore/unsupported/mailit/emailclient.cpp2
-rw-r--r--noncore/unsupported/mailit/mailitwindow.cpp4
-rw-r--r--noncore/unsupported/mailit/viewatt.cpp15
-rw-r--r--noncore/unsupported/mailit/writemail.cpp5
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
@@ -19,4 +19,5 @@
**********************************************************************/
#include <qlayout.h>
+#include <qhbox.h>
#include <qdir.h>
#include <qstringlist.h>
@@ -58,10 +59,10 @@ AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f)
setCaption("Adding attatchments");
- QGridLayout *top = new QGridLayout(this, 3,1 );
+ QGridLayout *top = new QGridLayout(this, 1,1 );
-
+ QHBox *buttons=new QHBox(this);
/*fileCategoryButton = new QPushButton(this);*/
- attatchButton = new QPushButton("Attatch ->", this);
- removeButton = new QPushButton("Remove", this);
+ attatchButton = new QPushButton("Attatch ->", buttons);
+ removeButton = new QPushButton("Remove", buttons);
/*fileCategories = new QPopupMenu(fileCategoryButton);
@@ -76,12 +77,11 @@ AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f)
top->addWidget(fileCategoryButton, 0, 0);*/
- //ofs=new OFileSelector(this,2,0,"/root/Documents");
-
-
- top->addWidget(attatchButton,1,0);
- top->addWidget(removeButton,2,0);
- /*connect(fileCategories, SIGNAL(activated(int)), this,
- SLOT(fileCategorySelected(int)) );*/
+ top->addWidget(buttons,1,0);
+ //buttons->addWidget(attatchButton,0,0);
+ //buttons->addWidget(removeButton,0,1);
+
+ //connect(fileCategories, SIGNAL(activated(int)), this,
+ // SLOT(fileCategorySelected(int)) );*/
connect(attatchButton, SIGNAL(clicked()), this,
SLOT(addAttatchment()) );
@@ -124,15 +124,9 @@ void AddAtt::clear()
void AddAtt::addAttatchment()
{
- QDialog qd(this,tr("Select attachment"),true);
-
- QGridLayout top(&qd,1,1);
-
- OFileSelector ofs(&qd,1,0,"/root/Documents");
-
- top.addWidget(&ofs,0,0);
+ OFileDialog ofs("Attachments",this,0,0,"/root/Documents");
- qd.showMaximized();
+ ofs.showMaximized();
- if (qd.exec()==QDialog::Accepted)
+ if (ofs.exec()==QDialog::Accepted)
{
DocLnk* dl=new DocLnk(ofs.selectedDocument());
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
@@ -28,5 +28,5 @@
#include <qfileinfo.h>
#include <qstringlist.h>
-#include <opie/ofileselector.h>
+#include <opie/ofiledialog.h>
#include <qpe/applnk.h>
@@ -66,10 +66,10 @@ private:
FileItem* item;
QListView *attView;
- QPushButton *fileCategoryButton, *attatchButton, *removeButton;
+ QPushButton *attatchButton, *removeButton;
QPopupMenu *fileCategories;
bool modified;
- QFileInfo *fi;
+ //QFileInfo *fi;
- OFileSelector* ofs;
+ OFileDialog* ofs;
};
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
@@ -20,4 +20,6 @@
#include <qfile.h>
#include <qtextstream.h>
+#include <opie/ocontactaccess.h>
+#include <opie/ocontact.h>
#include "addresslist.h"
@@ -117,8 +119,20 @@ QList<Contact>* AddressList::getContactList()
void AddressList::read()
{
- QFile f(filename);
+ OContactAccess::List::Iterator it;
+
+ //QFile f(filename);
QString lineEmail, lineName, email, name;
+ OContactAccess m_contactdb("mailit");
+ OContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 );
+ //OContact* oc;
- if (! f.open(IO_ReadOnly) )
+ for ( it = m_list.begin(); it != m_list.end(); ++it )
+ {
+ //oc=(OContact*) it;
+ if ((*it).defaultEmail().length()!=0)
+ addContact((*it).defaultEmail(),(*it).fullName());
+ }
+
+ /*if (! f.open(IO_ReadOnly) )
return;
@@ -135,5 +149,5 @@ void AddressList::read()
addContact(email, name);
}
- f.close();
+ f.close();*/
}
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
@@ -149,5 +149,5 @@ void EmailClient::init()
getMailButton->addTo(mail);
- sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendmail"), QString::null, 0, this, 0);
+ sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendqueue"), QString::null, 0, this, 0);
connect(sendMailButton, SIGNAL(activated()), this, SLOT(sendQuedMail()) );
sendMailButton->addTo(bar);
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
@@ -28,7 +28,9 @@ MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl)
setCentralWidget(views);
+ qWarning("***Starting writeMail");
emailClient = new EmailClient(views, "client");
writeMail = new WriteMail(views, "writing");
readMail = new ReadMail(views, "reading");
+ qWarning("***Finished readMail");
views->raiseWidget(emailClient);
@@ -58,4 +60,6 @@ MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl)
this, SLOT(updateCaption(const QString &)) );
viewingMail = FALSE;
+
+ qWarning("***Finished MailitWindow");
}
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
@@ -21,4 +21,5 @@
#include "viewatt.h"
#include <qpe/applnk.h>
+#include <qpe/mimetype.h>
ViewAtt::ViewAtt(QWidget *parent, const char *name, WFlags f)
@@ -44,4 +45,6 @@ void ViewAtt::update(Email *mailIn, bool inbox)
Enclosure *ePtr;
+
+
listView->clear();
if (inbox) {
@@ -61,9 +64,15 @@ void ViewAtt::update(Email *mailIn, bool inbox)
item = new QListViewItem(listView, ePtr->originalName, ePtr->contentType, isInstalled);
+ const QString& mtypeDef=(const QString&) ePtr->contentType+"/"+ePtr->contentAttribute;
+
+ MimeType mt(mtypeDef);
+
+ item->setPixmap(0, mt.pixmap());
+
+ /*
if (ePtr->contentType == "TEXT") {
actions = new QAction( tr("View"), Resource::loadPixmap("TextEditor"), QString::null, CTRL + Key_C, this, 0);
actions->addTo(bar);
- item->setPixmap(0, Resource::loadPixmap("txt"));
- }
+ }
if (ePtr->contentType == "AUDIO") {
actions = new QAction( tr("Play"), Resource::loadPixmap("SoundPlayer"), QString::null, CTRL + Key_C, this, 0);
@@ -75,5 +84,5 @@ void ViewAtt::update(Email *mailIn, bool inbox)
actions->addTo(bar);
item->setPixmap(0, Resource::loadPixmap("pixmap"));
- }
+ }*/
}
}
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
@@ -46,5 +46,5 @@ void WriteMail::setAddressList(AddressList *list)
QListViewItem *item;
for (cPtr = cListPtr->first(); cPtr != 0; cPtr = cListPtr->next() ) {
- item = new QListViewItem(addressView, cPtr->email, cPtr->name);
+ item = new QListViewItem(addressView, cPtr->name, cPtr->email);
}
}
@@ -111,8 +111,9 @@ void WriteMail::init()
emailInput = new QMultiLineEdit( widget, "emailInput" );
grid->addMultiCellWidget( emailInput, 2, 2, 0, 2);
+
addressView = new QListView( widget, "addressView");
- addressView->addColumn("Email");
addressView->addColumn("Name");
+ addressView->addColumn("EMail");
addressView->setAllColumnsShowFocus(TRUE);
addressView->setMultiSelection(TRUE);
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
@@ -19,4 +19,5 @@
**********************************************************************/
#include <qlayout.h>
+#include <qhbox.h>
#include <qdir.h>
#include <qstringlist.h>
@@ -58,10 +59,10 @@ AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f)
setCaption("Adding attatchments");
- QGridLayout *top = new QGridLayout(this, 3,1 );
+ QGridLayout *top = new QGridLayout(this, 1,1 );
-
+ QHBox *buttons=new QHBox(this);
/*fileCategoryButton = new QPushButton(this);*/
- attatchButton = new QPushButton("Attatch ->", this);
- removeButton = new QPushButton("Remove", this);
+ attatchButton = new QPushButton("Attatch ->", buttons);
+ removeButton = new QPushButton("Remove", buttons);
/*fileCategories = new QPopupMenu(fileCategoryButton);
@@ -76,12 +77,11 @@ AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f)
top->addWidget(fileCategoryButton, 0, 0);*/
- //ofs=new OFileSelector(this,2,0,"/root/Documents");
-
-
- top->addWidget(attatchButton,1,0);
- top->addWidget(removeButton,2,0);
- /*connect(fileCategories, SIGNAL(activated(int)), this,
- SLOT(fileCategorySelected(int)) );*/
+ top->addWidget(buttons,1,0);
+ //buttons->addWidget(attatchButton,0,0);
+ //buttons->addWidget(removeButton,0,1);
+
+ //connect(fileCategories, SIGNAL(activated(int)), this,
+ // SLOT(fileCategorySelected(int)) );*/
connect(attatchButton, SIGNAL(clicked()), this,
SLOT(addAttatchment()) );
@@ -124,15 +124,9 @@ void AddAtt::clear()
void AddAtt::addAttatchment()
{
- QDialog qd(this,tr("Select attachment"),true);
-
- QGridLayout top(&qd,1,1);
-
- OFileSelector ofs(&qd,1,0,"/root/Documents");
-
- top.addWidget(&ofs,0,0);
+ OFileDialog ofs("Attachments",this,0,0,"/root/Documents");
- qd.showMaximized();
+ ofs.showMaximized();
- if (qd.exec()==QDialog::Accepted)
+ if (ofs.exec()==QDialog::Accepted)
{
DocLnk* dl=new DocLnk(ofs.selectedDocument());
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
@@ -28,5 +28,5 @@
#include <qfileinfo.h>
#include <qstringlist.h>
-#include <opie/ofileselector.h>
+#include <opie/ofiledialog.h>
#include <qpe/applnk.h>
@@ -66,10 +66,10 @@ private:
FileItem* item;
QListView *attView;
- QPushButton *fileCategoryButton, *attatchButton, *removeButton;
+ QPushButton *attatchButton, *removeButton;
QPopupMenu *fileCategories;
bool modified;
- QFileInfo *fi;
+ //QFileInfo *fi;
- OFileSelector* ofs;
+ OFileDialog* ofs;
};
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
@@ -20,4 +20,6 @@
#include <qfile.h>
#include <qtextstream.h>
+#include <opie/ocontactaccess.h>
+#include <opie/ocontact.h>
#include "addresslist.h"
@@ -117,8 +119,20 @@ QList<Contact>* AddressList::getContactList()
void AddressList::read()
{
- QFile f(filename);
+ OContactAccess::List::Iterator it;
+
+ //QFile f(filename);
QString lineEmail, lineName, email, name;
+ OContactAccess m_contactdb("mailit");
+ OContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 );
+ //OContact* oc;
- if (! f.open(IO_ReadOnly) )
+ for ( it = m_list.begin(); it != m_list.end(); ++it )
+ {
+ //oc=(OContact*) it;
+ if ((*it).defaultEmail().length()!=0)
+ addContact((*it).defaultEmail(),(*it).fullName());
+ }
+
+ /*if (! f.open(IO_ReadOnly) )
return;
@@ -135,5 +149,5 @@ void AddressList::read()
addContact(email, name);
}
- f.close();
+ f.close();*/
}
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
@@ -149,5 +149,5 @@ void EmailClient::init()
getMailButton->addTo(mail);
- sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendmail"), QString::null, 0, this, 0);
+ sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendqueue"), QString::null, 0, this, 0);
connect(sendMailButton, SIGNAL(activated()), this, SLOT(sendQuedMail()) );
sendMailButton->addTo(bar);
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
@@ -28,7 +28,9 @@ MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl)
setCentralWidget(views);
+ qWarning("***Starting writeMail");
emailClient = new EmailClient(views, "client");
writeMail = new WriteMail(views, "writing");
readMail = new ReadMail(views, "reading");
+ qWarning("***Finished readMail");
views->raiseWidget(emailClient);
@@ -58,4 +60,6 @@ MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl)
this, SLOT(updateCaption(const QString &)) );
viewingMail = FALSE;
+
+ qWarning("***Finished MailitWindow");
}
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
@@ -21,4 +21,5 @@
#include "viewatt.h"
#include <qpe/applnk.h>
+#include <qpe/mimetype.h>
ViewAtt::ViewAtt(QWidget *parent, const char *name, WFlags f)
@@ -44,4 +45,6 @@ void ViewAtt::update(Email *mailIn, bool inbox)
Enclosure *ePtr;
+
+
listView->clear();
if (inbox) {
@@ -61,9 +64,15 @@ void ViewAtt::update(Email *mailIn, bool inbox)
item = new QListViewItem(listView, ePtr->originalName, ePtr->contentType, isInstalled);
+ const QString& mtypeDef=(const QString&) ePtr->contentType+"/"+ePtr->contentAttribute;
+
+ MimeType mt(mtypeDef);
+
+ item->setPixmap(0, mt.pixmap());
+
+ /*
if (ePtr->contentType == "TEXT") {
actions = new QAction( tr("View"), Resource::loadPixmap("TextEditor"), QString::null, CTRL + Key_C, this, 0);
actions->addTo(bar);
- item->setPixmap(0, Resource::loadPixmap("txt"));
- }
+ }
if (ePtr->contentType == "AUDIO") {
actions = new QAction( tr("Play"), Resource::loadPixmap("SoundPlayer"), QString::null, CTRL + Key_C, this, 0);
@@ -75,5 +84,5 @@ void ViewAtt::update(Email *mailIn, bool inbox)
actions->addTo(bar);
item->setPixmap(0, Resource::loadPixmap("pixmap"));
- }
+ }*/
}
}
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
@@ -46,5 +46,5 @@ void WriteMail::setAddressList(AddressList *list)
QListViewItem *item;
for (cPtr = cListPtr->first(); cPtr != 0; cPtr = cListPtr->next() ) {
- item = new QListViewItem(addressView, cPtr->email, cPtr->name);
+ item = new QListViewItem(addressView, cPtr->name, cPtr->email);
}
}
@@ -111,8 +111,9 @@ void WriteMail::init()
emailInput = new QMultiLineEdit( widget, "emailInput" );
grid->addMultiCellWidget( emailInput, 2, 2, 0, 2);
+
addressView = new QListView( widget, "addressView");
- addressView->addColumn("Email");
addressView->addColumn("Name");
+ addressView->addColumn("EMail");
addressView->setAllColumnsShowFocus(TRUE);
addressView->setMultiSelection(TRUE);