-rw-r--r-- | noncore/net/mail/mainwindow.cpp | 4 | ||||
-rw-r--r-- | noncore/net/mail/viewmail.cpp | 7 |
2 files changed, 6 insertions, 5 deletions
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp index 560715c..8ef7ddd 100644 --- a/noncore/net/mail/mainwindow.cpp +++ b/noncore/net/mail/mainwindow.cpp @@ -37,115 +37,115 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 0, 0, this ); composeMail->addTo( toolBar ); composeMail->addTo( mailMenu ); sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED, 0, 0, this ); sendQueued->addTo( toolBar ); sendQueued->addTo( mailMenu ); syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, 0, 0, this ); syncFolders->addTo( toolBar ); syncFolders->addTo( mailMenu ); showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS, 0, 0, this, 0, true ); showFolders->addTo( toolBar ); showFolders->addTo( mailMenu ); connect(showFolders, SIGNAL( toggled( bool ) ), SLOT( slotShowFolders( bool ) ) ); searchMails = new QAction( tr( "Search mails" ), ICON_SEARCHMAILS, 0, 0, this ); searchMails->addTo( toolBar ); searchMails->addTo( mailMenu ); editSettings = new QAction( tr( "Edit settings" ), ICON_EDITSETTINGS, 0, 0, this ); editSettings->addTo( settingsMenu ); editAccounts = new QAction( tr( "Configure accounts" ), ICON_EDITACCOUNTS, 0, 0, this ); editAccounts->addTo( settingsMenu ); QWidget *view = new QWidget( this ); setCentralWidget( view ); layout = new QBoxLayout ( view, QBoxLayout::LeftToRight ); folderView = new AccountView( view ); folderView->header()->hide(); folderView->addColumn( tr( "Mailbox" ) ); folderView->hide(); layout->addWidget( folderView ); mailView = new QListView( view ); - mailView->addColumn( tr( "Status" ) ); + mailView->addColumn( tr( "" ) ); mailView->addColumn( tr( "Subject" ),QListView::Manual ); mailView->addColumn( tr( "Sender" ),QListView::Manual ); mailView->addColumn( tr( "Date" )); mailView->setAllColumnsShowFocus(true); mailView->setSorting(-1); layout->addWidget( mailView ); layout->setStretchFactor( folderView, 1 ); layout->setStretchFactor( mailView, 2 ); slotAdjustLayout(); connect( mailView, SIGNAL( clicked( QListViewItem * ) ),this, SLOT( displayMail( QListViewItem * ) ) ); connect(folderView,SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*))); - QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); + QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); } void MainWindow::slotAdjustLayout() { QWidget *d = QApplication::desktop(); if ( d->width() < d->height() ) { layout->setDirection( QBoxLayout::TopToBottom ); } else { layout->setDirection( QBoxLayout::LeftToRight ); } delete d; } void MainWindow::slotAdjustColumns() { bool hidden = folderView->isHidden(); if ( hidden ) folderView->show(); folderView->setColumnWidth( 0, folderView->visibleWidth() ); if ( hidden ) folderView->hide(); mailView->setColumnWidth( 0, 10 ); mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 ); mailView->setColumnWidth( 2, 80 ); mailView->setColumnWidth( 3, 50 ); } void MainWindow::slotShowFolders( bool show ) { qDebug( "Show Folders" ); if ( show && folderView->isHidden() ) { qDebug( "-> showing" ); folderView->show(); } else if ( !show && !folderView->isHidden() ) { qDebug( "-> hiding" ); folderView->hide(); } } void MainWindow::refreshMailView(QList<RecMail>*list) { MailListViewItem*item = 0; mailView->clear(); for (unsigned int i = 0; i < list->count();++i) { item = new MailListViewItem(mailView,item); item->storeData(*(list->at(i))); item->showEntry(); diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp index a73dac5..42707e3 100644 --- a/noncore/net/mail/viewmail.cpp +++ b/noncore/net/mail/viewmail.cpp @@ -67,120 +67,121 @@ default: } curItem=new AttachItem(attachments,curItem,type,"Mailbody",desc,-1); QString filename = ""; for (unsigned int i = 0; i < body.Parts().count();++i) { type = body.Parts()[i].Type()+"/"+body.Parts()[i].Subtype(); part_plist_t::ConstIterator it = body.Parts()[i].Parameters().begin(); for (;it!=body.Parts()[i].Parameters().end();++it) { if (it.key().lower()=="name") { filename=it.data(); } } s = body.Parts()[i].Size(); w = 0; while (s>1024) { s/=1024; ++w; if (w>=2) break; } switch(w) { case 1: q="k"; break; case 2: q="M"; break; default: q=""; break; } QTextOStream o(&desc); if (w>0) o.precision(2); else o.precision(0); o.setf(QTextStream::fixed); o << s << " " << q << "Byte"; curItem=new AttachItem(attachments,curItem,type,filename,desc,i); } } void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int c ) { if (!item ) return; QPopupMenu *menu = new QPopupMenu(); int ret=0; if ( item->text( 0 ).left( 4 ) == "text" ) { menu->insertItem( tr( "Show Text" ), 1 ); } - menu->insertItem( tr( "Save Attachemt" ), 0 ); + menu->insertItem( tr( "Save Attachment" ), 0 ); menu->insertSeparator(1); ret = menu->exec( point, 0 ); switch(ret) { case 0: { MimeTypes types; types.insert( "all", "*" ); QString str = OFileDialog::getSaveFileName( 1, "/", item->text( 1 ) , types, 0 ); if( !str.isEmpty() ) { - qDebug( " first we will need a MIME wrapper" ); + qDebug( "first we will need a MIME wrapper" ); } } break ; case 1: - qDebug( QString( "Test selected" ).arg( ( ( AttachItem* )item )->Partnumber() ) ); if ( ( ( AttachItem* )item )->Partnumber() == -1 ) { setText(); } else { + if ( m_recMail.Wrapper() != 0l ) { // make sure that there is a wrapper , even after delete or simular actions browser->setText( m_recMail.Wrapper()->fetchPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); + } } break; } delete menu; } void ViewMail::setMail( RecMail mail ) { m_recMail = mail; m_mail[0] = mail.getFrom(); m_mail[1] = mail.getSubject(); m_mail[3] = mail.getDate(); m_mail[4] = mail.Msgid(); m_mail2[0] = mail.To(); m_mail2[1] = mail.CC(); m_mail2[2] = mail.Bcc(); setText(); } ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) : ViewMailBase(parent, name, fl), _inLoop(false) { m_gotBody = false; connect(reply, SIGNAL(activated()), SLOT(slotReply())); connect(forward, SIGNAL(activated()), SLOT(slotForward())); attachments->setEnabled(m_gotBody); connect( attachments, SIGNAL( clicked ( QListViewItem *, const QPoint & , int ) ), SLOT( slotItemClicked( QListViewItem *, const QPoint & , int ) ) ); } void ViewMail::setText() { QString toString; QString ccString; QString bccString; for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) { toString += (*it); } |