author | groucho <groucho> | 2003-04-13 10:29:05 (UTC) |
---|---|---|
committer | groucho <groucho> | 2003-04-13 10:29:05 (UTC) |
commit | 8cc217bed9c122a7c7448e2cd59bfde330dfcfad (patch) (side-by-side diff) | |
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 | 32 | ||||
-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 | 13 | ||||
-rw-r--r-- | noncore/net/mailit/writemail.cpp | 5 | ||||
-rw-r--r-- | noncore/unsupported/mailit/addatt.cpp | 32 | ||||
-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 | 13 | ||||
-rw-r--r-- | noncore/unsupported/mailit/writemail.cpp | 5 |
14 files changed, 106 insertions, 62 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 @@ -5,32 +5,33 @@ ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include <qlayout.h> +#include <qhbox.h> #include <qdir.h> #include <qstringlist.h> #include "resource.h" #include "addatt.h" FileItem::FileItem(QListView *parent, DocLnk* dl) : QListViewItem(parent) { /*file = fileInfo; type = fileType;*/ doclnk=dl; setText(0, doclnk->name()); /* if (fileType == "Picture") { @@ -44,58 +45,57 @@ FileItem::FileItem(QListView *parent, DocLnk* dl) } else if (fileType == "File") { setPixmap(0, Resource::loadPixmap("exec")); }*/ } FileItem::~FileItem() { if (doclnk!=NULL) delete doclnk; doclnk=NULL; } AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f) : QDialog(parent, name, 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); fileCategoryButton->setPopup(fileCategories); fileCategories->insertItem("Document"); fileCategories->insertItem("Picture"); fileCategories->insertItem("Sound"); fileCategories->insertItem("Movie"); fileCategories->insertItem("File"); fileCategoryButton->setText("Document"); top->addWidget(fileCategoryButton, 0, 0);*/ - //ofs=new OFileSelector(this,2,0,"/root/Documents"); - - top->addWidget(attatchButton,1,0); - top->addWidget(removeButton,2,0); + 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(fileCategories, SIGNAL(activated(int)), this, + // SLOT(fileCategorySelected(int)) );*/ connect(attatchButton, SIGNAL(clicked()), this, SLOT(addAttatchment()) ); connect(removeButton, SIGNAL(clicked()), this, SLOT(removeAttatchment()) ); /*listView = new QListView(this, "AttView"); listView->addColumn("Documents");* connect(listView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(addAttatchment()) );*/ attView = new QListView(this, "Selected"); attView->addColumn(tr("Attached")); attView->addColumn(tr("File type")); connect(attView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(removeAttatchment()) ); @@ -110,43 +110,37 @@ AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f) void AddAtt::clear() { attView->clear(); //getFiles(); modified = FALSE; } /*void AddAtt::fileCategorySelected(int id) { fileCategoryButton->setText(fileCategories->text(id)); getFiles(); }*/ 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()); FileItem* fi=new FileItem(attView,dl); fi->setPixmap(0,dl->pixmap()); fi->setText(1,dl->type()); attView->insertItem(fi); modified = TRUE; } } void AddAtt::removeAttatchment() { if (attView->selectedItem() != NULL) { attView->takeItem(attView->selectedItem()); } 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 @@ -14,33 +14,33 @@ ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #ifndef ADDATT_H #define ADDATT_H #include <qdialog.h> #include <qlistview.h> #include <qpushbutton.h> #include <qpopupmenu.h> #include <qstring.h> #include <qfileinfo.h> #include <qstringlist.h> -#include <opie/ofileselector.h> +#include <opie/ofiledialog.h> #include <qpe/applnk.h> class FileItem : public QListViewItem { public: //FileItem(QListView *parent, QFileInfo fileInfo, QString fileType); FileItem(QListView*, DocLnk*); ~FileItem(); DocLnk* getDocLnk() {return doclnk;} private: DocLnk* doclnk; }; class AddAtt : public QDialog @@ -52,25 +52,25 @@ public: QStringList returnAttatchedFiles(); QStringList returnFileTypes(); void getFiles(); void clear(); public slots: //void fileCategorySelected(int); void addAttatchment(); void removeAttatchment(); void reject(); void accept(); private: FileItem* item; QListView *attView; - QPushButton *fileCategoryButton, *attatchButton, *removeButton; + QPushButton *attatchButton, *removeButton; QPopupMenu *fileCategories; bool modified; - QFileInfo *fi; + //QFileInfo *fi; - OFileSelector* ofs; + OFileDialog* ofs; }; #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 @@ -6,32 +6,34 @@ ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include <qfile.h> #include <qtextstream.h> +#include <opie/ocontactaccess.h> +#include <opie/ocontact.h> #include "addresslist.h" AddressList::AddressList(QString file) { addresses.setAutoDelete(TRUE); filename = file; read(); dirty = FALSE; } AddressList::~AddressList() { write(); addresses.clear(); } @@ -103,51 +105,63 @@ int AddressList::getNameRef(QString name) for (ptr = addresses.first(); ptr != 0; ptr = addresses.next() ) { if (ptr->name == name) return pos; pos++; } return -1; } QList<Contact>* AddressList::getContactList() { return &addresses; } 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; + + 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) ) + /*if (! f.open(IO_ReadOnly) ) return; QTextStream stream(&f); while (! stream.atEnd() ) { lineEmail = stream.readLine(); if (! stream.atEnd() ) lineName = stream.readLine(); else return; email = getRightString(lineEmail); name = getRightString(lineName); addContact(email, name); } - f.close(); + f.close();*/ } QString AddressList::getRightString(QString in) { QString out = ""; int pos = in.find('='); if (pos != -1) { out = in.mid(pos+1).stripWhiteSpace(); } return out; } void AddressList::write() { if ( (addresses.count() == 0) || (!dirty) ) 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 @@ -135,33 +135,33 @@ void EmailClient::init() selectAccountMenu = new QPopupMenu(mb); editAccountMenu = new QPopupMenu(mb); deleteAccountMenu = new QPopupMenu(mb); mail->insertItem(tr("Get Mail in"), selectAccountMenu); configure->insertItem(tr("Edit account"), editAccountMenu); configure->insertItem(tr("Delete account"), deleteAccountMenu); bar = new QToolBar(this); getMailButton = new QAction(tr("Get all mail"), Resource::loadPixmap("mailit/getmail"), QString::null, 0, this, 0); connect(getMailButton, SIGNAL(activated()), this, SLOT(getAllNewMail()) ); getMailButton->addTo(bar); 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); sendMailButton->addTo(mail); composeButton = new QAction(tr("Compose"), Resource::loadPixmap("new"), QString::null, 0, this, 0); connect(composeButton, SIGNAL(activated()), this, SLOT(compose()) ); composeButton->addTo(bar); composeButton->addTo(mail); cancelButton = new QAction(tr("Cancel transfer"), Resource::loadPixmap("close"), QString::null, 0, this, 0); connect(cancelButton, SIGNAL(activated()), this, SLOT(cancel()) ); cancelButton->addTo(mail); cancelButton->addTo(bar); cancelButton->setEnabled(FALSE); mailboxView = new OTabWidget( this, "mailboxView" ); 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 @@ -14,62 +14,66 @@ ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "mailitwindow.h" MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl) : QMainWindow(parent, name, fl) { currentCaption = "Mailit"; setCaption(tr(currentCaption)); views = new QWidgetStack(this); 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); connect(emailClient, SIGNAL(composeRequested()), this, SLOT(compose()) ); connect(emailClient, SIGNAL(viewEmail(QListView *, Email *)), this, SLOT(viewMail(QListView *, Email *)) ); connect(emailClient, SIGNAL(mailUpdated(Email *)), this, SLOT(updateMailView(Email *)) ); connect(writeMail, SIGNAL(cancelMail()), this, SLOT(showEmailClient()) ); connect(writeMail, SIGNAL(sendMailRequested(const Email &)), this, SLOT(showEmailClient()) ); connect(writeMail, SIGNAL(sendMailRequested(const Email &)), emailClient, SLOT(enqueMail(const Email &)) ); connect(readMail, SIGNAL(cancelView()), this, SLOT(showEmailClient()) ); connect(readMail, SIGNAL(replyRequested(Email &)), this, SLOT(composeReply(Email &)) ); connect(readMail, SIGNAL(removeItem(EmailListItem *, bool &)), emailClient, SLOT(deleteMail(EmailListItem *, bool &)) ); connect(readMail, SIGNAL(viewingMail(Email *)), emailClient, SLOT(moveMailFront(Email *)) ); connect(emailClient, SIGNAL(newCaption(const QString &)), this, SLOT(updateCaption(const QString &)) ); viewingMail = FALSE; + + qWarning("***Finished MailitWindow"); } MailItWindow::~MailItWindow() { } void MailItWindow::closeEvent(QCloseEvent *e) { if (views->visibleWidget() == emailClient) { e->accept(); } else { showEmailClient(); } } void MailItWindow::compose() 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 @@ -7,87 +7,96 @@ ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "resource.h" #include "viewatt.h" #include <qpe/applnk.h> +#include <qpe/mimetype.h> ViewAtt::ViewAtt(QWidget *parent, const char *name, WFlags f) : QMainWindow(parent, name, f) { setCaption("Exploring attatchments"); setToolBarsMovable( FALSE ); bar = new QToolBar(this); installButton = new QAction( tr( "Install" ), Resource::loadPixmap( "exec" ), QString::null, CTRL + Key_C, this, 0 ); connect(installButton, SIGNAL(activated()), this, SLOT(install()) ); listView = new QListView(this, "AttView"); listView->addColumn( "Attatchment" ); listView->addColumn( "Type" ); listView->addColumn( "Installed" ); setCentralWidget(listView); } void ViewAtt::update(Email *mailIn, bool inbox) { QListViewItem *item; Enclosure *ePtr; + + listView->clear(); if (inbox) { bar->clear(); installButton->addTo( bar ); bar->show(); } else { bar->hide(); } mail = mailIn; for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) { QString isInstalled = "No"; if (ePtr->installed) isInstalled = "Yes"; 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); actions->addTo(bar); item->setPixmap(0, Resource::loadPixmap("play")); } if (ePtr->contentType == "IMAGE") { actions = new QAction( tr("Show"), Resource::loadPixmap("pixmap"), QString::null, CTRL + Key_C, this, 0); actions->addTo(bar); item->setPixmap(0, Resource::loadPixmap("pixmap")); - } + }*/ } } void ViewAtt::install() { Enclosure *ePtr, *selPtr; QListViewItem *item; QString filename; DocLnk d; item = listView->selectedItem(); if (item != NULL) { filename = item->text(0); selPtr = NULL; for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) { if (ePtr->originalName == filename) 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 @@ -32,33 +32,33 @@ WriteMail::WriteMail( QWidget* parent, const char* name, WFlags fl ) WriteMail::~WriteMail() { delete addAtt; } void WriteMail::setAddressList(AddressList *list) { Contact *cPtr; addressList = list; addressView->clear(); QList<Contact> *cListPtr = addressList->getContactList(); 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); } } void WriteMail::init() { setToolBarsMovable(FALSE); bar = new QToolBar(this); bar->setHorizontalStretchable( TRUE ); menu = new QMenuBar( bar ); mailMenu = new QPopupMenu(menu); menu->insertItem( tr( "&Mail" ), mailMenu); addMenu = new QPopupMenu(menu); menu->insertItem( tr( "&Add" ), addMenu); @@ -98,35 +98,36 @@ void WriteMail::init() subjectInput = new QLineEdit( widget, "subjectInput" ); grid->addWidget( subjectInput, 1, 1 ); toInput = new QLineEdit( widget, "toInput" ); grid->addWidget( toInput, 0, 1 ); addressButton = new QToolButton( widget, "addressButton" ); addressButton->setPixmap( Resource::loadPixmap("AddressBook") ); addressButton->setToggleButton(TRUE); grid->addWidget( addressButton, 0, 2 ); connect(addressButton, SIGNAL(clicked()), this, SLOT(getAddress()) ); 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); addressView->hide(); grid->addMultiCellWidget( addressView, 3, 3, 0, 2); okButton = new QToolButton(bar, "ok"); okButton->setPixmap( Resource::loadPixmap("enter") ); okButton->hide(); connect(okButton, SIGNAL(clicked()), this, SLOT(addRecipients()) ); setCentralWidget(widget); } void WriteMail::reject() { emit cancelMail(); 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 @@ -5,32 +5,33 @@ ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include <qlayout.h> +#include <qhbox.h> #include <qdir.h> #include <qstringlist.h> #include "resource.h" #include "addatt.h" FileItem::FileItem(QListView *parent, DocLnk* dl) : QListViewItem(parent) { /*file = fileInfo; type = fileType;*/ doclnk=dl; setText(0, doclnk->name()); /* if (fileType == "Picture") { @@ -44,58 +45,57 @@ FileItem::FileItem(QListView *parent, DocLnk* dl) } else if (fileType == "File") { setPixmap(0, Resource::loadPixmap("exec")); }*/ } FileItem::~FileItem() { if (doclnk!=NULL) delete doclnk; doclnk=NULL; } AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f) : QDialog(parent, name, 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); fileCategoryButton->setPopup(fileCategories); fileCategories->insertItem("Document"); fileCategories->insertItem("Picture"); fileCategories->insertItem("Sound"); fileCategories->insertItem("Movie"); fileCategories->insertItem("File"); fileCategoryButton->setText("Document"); top->addWidget(fileCategoryButton, 0, 0);*/ - //ofs=new OFileSelector(this,2,0,"/root/Documents"); - - top->addWidget(attatchButton,1,0); - top->addWidget(removeButton,2,0); + 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(fileCategories, SIGNAL(activated(int)), this, + // SLOT(fileCategorySelected(int)) );*/ connect(attatchButton, SIGNAL(clicked()), this, SLOT(addAttatchment()) ); connect(removeButton, SIGNAL(clicked()), this, SLOT(removeAttatchment()) ); /*listView = new QListView(this, "AttView"); listView->addColumn("Documents");* connect(listView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(addAttatchment()) );*/ attView = new QListView(this, "Selected"); attView->addColumn(tr("Attached")); attView->addColumn(tr("File type")); connect(attView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(removeAttatchment()) ); @@ -110,43 +110,37 @@ AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f) void AddAtt::clear() { attView->clear(); //getFiles(); modified = FALSE; } /*void AddAtt::fileCategorySelected(int id) { fileCategoryButton->setText(fileCategories->text(id)); getFiles(); }*/ 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()); FileItem* fi=new FileItem(attView,dl); fi->setPixmap(0,dl->pixmap()); fi->setText(1,dl->type()); attView->insertItem(fi); modified = TRUE; } } void AddAtt::removeAttatchment() { if (attView->selectedItem() != NULL) { attView->takeItem(attView->selectedItem()); } 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 @@ -14,33 +14,33 @@ ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #ifndef ADDATT_H #define ADDATT_H #include <qdialog.h> #include <qlistview.h> #include <qpushbutton.h> #include <qpopupmenu.h> #include <qstring.h> #include <qfileinfo.h> #include <qstringlist.h> -#include <opie/ofileselector.h> +#include <opie/ofiledialog.h> #include <qpe/applnk.h> class FileItem : public QListViewItem { public: //FileItem(QListView *parent, QFileInfo fileInfo, QString fileType); FileItem(QListView*, DocLnk*); ~FileItem(); DocLnk* getDocLnk() {return doclnk;} private: DocLnk* doclnk; }; class AddAtt : public QDialog @@ -52,25 +52,25 @@ public: QStringList returnAttatchedFiles(); QStringList returnFileTypes(); void getFiles(); void clear(); public slots: //void fileCategorySelected(int); void addAttatchment(); void removeAttatchment(); void reject(); void accept(); private: FileItem* item; QListView *attView; - QPushButton *fileCategoryButton, *attatchButton, *removeButton; + QPushButton *attatchButton, *removeButton; QPopupMenu *fileCategories; bool modified; - QFileInfo *fi; + //QFileInfo *fi; - OFileSelector* ofs; + OFileDialog* ofs; }; #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 @@ -6,32 +6,34 @@ ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include <qfile.h> #include <qtextstream.h> +#include <opie/ocontactaccess.h> +#include <opie/ocontact.h> #include "addresslist.h" AddressList::AddressList(QString file) { addresses.setAutoDelete(TRUE); filename = file; read(); dirty = FALSE; } AddressList::~AddressList() { write(); addresses.clear(); } @@ -103,51 +105,63 @@ int AddressList::getNameRef(QString name) for (ptr = addresses.first(); ptr != 0; ptr = addresses.next() ) { if (ptr->name == name) return pos; pos++; } return -1; } QList<Contact>* AddressList::getContactList() { return &addresses; } 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; + + 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) ) + /*if (! f.open(IO_ReadOnly) ) return; QTextStream stream(&f); while (! stream.atEnd() ) { lineEmail = stream.readLine(); if (! stream.atEnd() ) lineName = stream.readLine(); else return; email = getRightString(lineEmail); name = getRightString(lineName); addContact(email, name); } - f.close(); + f.close();*/ } QString AddressList::getRightString(QString in) { QString out = ""; int pos = in.find('='); if (pos != -1) { out = in.mid(pos+1).stripWhiteSpace(); } return out; } void AddressList::write() { if ( (addresses.count() == 0) || (!dirty) ) 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 @@ -135,33 +135,33 @@ void EmailClient::init() selectAccountMenu = new QPopupMenu(mb); editAccountMenu = new QPopupMenu(mb); deleteAccountMenu = new QPopupMenu(mb); mail->insertItem(tr("Get Mail in"), selectAccountMenu); configure->insertItem(tr("Edit account"), editAccountMenu); configure->insertItem(tr("Delete account"), deleteAccountMenu); bar = new QToolBar(this); getMailButton = new QAction(tr("Get all mail"), Resource::loadPixmap("mailit/getmail"), QString::null, 0, this, 0); connect(getMailButton, SIGNAL(activated()), this, SLOT(getAllNewMail()) ); getMailButton->addTo(bar); 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); sendMailButton->addTo(mail); composeButton = new QAction(tr("Compose"), Resource::loadPixmap("new"), QString::null, 0, this, 0); connect(composeButton, SIGNAL(activated()), this, SLOT(compose()) ); composeButton->addTo(bar); composeButton->addTo(mail); cancelButton = new QAction(tr("Cancel transfer"), Resource::loadPixmap("close"), QString::null, 0, this, 0); connect(cancelButton, SIGNAL(activated()), this, SLOT(cancel()) ); cancelButton->addTo(mail); cancelButton->addTo(bar); cancelButton->setEnabled(FALSE); mailboxView = new OTabWidget( this, "mailboxView" ); 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 @@ -14,62 +14,66 @@ ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "mailitwindow.h" MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl) : QMainWindow(parent, name, fl) { currentCaption = "Mailit"; setCaption(tr(currentCaption)); views = new QWidgetStack(this); 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); connect(emailClient, SIGNAL(composeRequested()), this, SLOT(compose()) ); connect(emailClient, SIGNAL(viewEmail(QListView *, Email *)), this, SLOT(viewMail(QListView *, Email *)) ); connect(emailClient, SIGNAL(mailUpdated(Email *)), this, SLOT(updateMailView(Email *)) ); connect(writeMail, SIGNAL(cancelMail()), this, SLOT(showEmailClient()) ); connect(writeMail, SIGNAL(sendMailRequested(const Email &)), this, SLOT(showEmailClient()) ); connect(writeMail, SIGNAL(sendMailRequested(const Email &)), emailClient, SLOT(enqueMail(const Email &)) ); connect(readMail, SIGNAL(cancelView()), this, SLOT(showEmailClient()) ); connect(readMail, SIGNAL(replyRequested(Email &)), this, SLOT(composeReply(Email &)) ); connect(readMail, SIGNAL(removeItem(EmailListItem *, bool &)), emailClient, SLOT(deleteMail(EmailListItem *, bool &)) ); connect(readMail, SIGNAL(viewingMail(Email *)), emailClient, SLOT(moveMailFront(Email *)) ); connect(emailClient, SIGNAL(newCaption(const QString &)), this, SLOT(updateCaption(const QString &)) ); viewingMail = FALSE; + + qWarning("***Finished MailitWindow"); } MailItWindow::~MailItWindow() { } void MailItWindow::closeEvent(QCloseEvent *e) { if (views->visibleWidget() == emailClient) { e->accept(); } else { showEmailClient(); } } void MailItWindow::compose() 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 @@ -7,87 +7,96 @@ ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "resource.h" #include "viewatt.h" #include <qpe/applnk.h> +#include <qpe/mimetype.h> ViewAtt::ViewAtt(QWidget *parent, const char *name, WFlags f) : QMainWindow(parent, name, f) { setCaption("Exploring attatchments"); setToolBarsMovable( FALSE ); bar = new QToolBar(this); installButton = new QAction( tr( "Install" ), Resource::loadPixmap( "exec" ), QString::null, CTRL + Key_C, this, 0 ); connect(installButton, SIGNAL(activated()), this, SLOT(install()) ); listView = new QListView(this, "AttView"); listView->addColumn( "Attatchment" ); listView->addColumn( "Type" ); listView->addColumn( "Installed" ); setCentralWidget(listView); } void ViewAtt::update(Email *mailIn, bool inbox) { QListViewItem *item; Enclosure *ePtr; + + listView->clear(); if (inbox) { bar->clear(); installButton->addTo( bar ); bar->show(); } else { bar->hide(); } mail = mailIn; for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) { QString isInstalled = "No"; if (ePtr->installed) isInstalled = "Yes"; 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); actions->addTo(bar); item->setPixmap(0, Resource::loadPixmap("play")); } if (ePtr->contentType == "IMAGE") { actions = new QAction( tr("Show"), Resource::loadPixmap("pixmap"), QString::null, CTRL + Key_C, this, 0); actions->addTo(bar); item->setPixmap(0, Resource::loadPixmap("pixmap")); - } + }*/ } } void ViewAtt::install() { Enclosure *ePtr, *selPtr; QListViewItem *item; QString filename; DocLnk d; item = listView->selectedItem(); if (item != NULL) { filename = item->text(0); selPtr = NULL; for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) { if (ePtr->originalName == filename) 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 @@ -32,33 +32,33 @@ WriteMail::WriteMail( QWidget* parent, const char* name, WFlags fl ) WriteMail::~WriteMail() { delete addAtt; } void WriteMail::setAddressList(AddressList *list) { Contact *cPtr; addressList = list; addressView->clear(); QList<Contact> *cListPtr = addressList->getContactList(); 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); } } void WriteMail::init() { setToolBarsMovable(FALSE); bar = new QToolBar(this); bar->setHorizontalStretchable( TRUE ); menu = new QMenuBar( bar ); mailMenu = new QPopupMenu(menu); menu->insertItem( tr( "&Mail" ), mailMenu); addMenu = new QPopupMenu(menu); menu->insertItem( tr( "&Add" ), addMenu); @@ -98,35 +98,36 @@ void WriteMail::init() subjectInput = new QLineEdit( widget, "subjectInput" ); grid->addWidget( subjectInput, 1, 1 ); toInput = new QLineEdit( widget, "toInput" ); grid->addWidget( toInput, 0, 1 ); addressButton = new QToolButton( widget, "addressButton" ); addressButton->setPixmap( Resource::loadPixmap("AddressBook") ); addressButton->setToggleButton(TRUE); grid->addWidget( addressButton, 0, 2 ); connect(addressButton, SIGNAL(clicked()), this, SLOT(getAddress()) ); 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); addressView->hide(); grid->addMultiCellWidget( addressView, 3, 3, 0, 2); okButton = new QToolButton(bar, "ok"); okButton->setPixmap( Resource::loadPixmap("enter") ); okButton->hide(); connect(okButton, SIGNAL(clicked()), this, SLOT(addRecipients()) ); setCentralWidget(widget); } void WriteMail::reject() { emit cancelMail(); |