author | harlekin <harlekin> | 2003-12-21 13:29:48 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-12-21 13:29:48 (UTC) |
commit | 1281563b998508efeaa63739fb2c7c92e8316e9c (patch) (side-by-side diff) | |
tree | ff9aa7202b0fa81e0eec727414aef69ba82b7780 | |
parent | 228ff69db6e535a872a0f397ba157f832567af80 (diff) | |
download | opie-1281563b998508efeaa63739fb2c7c92e8316e9c.zip opie-1281563b998508efeaa63739fb2c7c92e8316e9c.tar.gz opie-1281563b998508efeaa63739fb2c7c92e8316e9c.tar.bz2 |
send mail later/ enqueue gui side implementation
-rw-r--r-- | noncore/net/mail/composemail.cpp | 11 | ||||
-rw-r--r-- | noncore/net/mail/composemailui.ui | 21 | ||||
-rw-r--r-- | noncore/net/mail/settingsdialog.cpp | 6 | ||||
-rw-r--r-- | noncore/net/mail/settingsdialogui.ui | 48 |
4 files changed, 77 insertions, 9 deletions
diff --git a/noncore/net/mail/composemail.cpp b/noncore/net/mail/composemail.cpp index 048fa85..f680f5c 100644 --- a/noncore/net/mail/composemail.cpp +++ b/noncore/net/mail/composemail.cpp @@ -1,203 +1,214 @@ #include <qt.h> #include <opie/ofiledialog.h> #include <qpe/resource.h> +#include <qpe/config.h> #include "composemail.h" #include "smtpwrapper.h" ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) : ComposeMailUI( parent, name, modal, flags ) { settings = s; + Config cfg( "mail" ); + cfg.setGroup( "Compose" ); + checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); + attList->addColumn( tr( "Name" ) ); attList->addColumn( tr( "Size" ) ); QList<Account> accounts = settings->getAccounts(); Account *it; for ( it = accounts.first(); it; it = accounts.next() ) { if ( it->getType().compare( "SMTP" ) == 0 ) { SMTPaccount *smtp = static_cast<SMTPaccount *>(it); fromBox->insertItem( smtp->getMail() ); smtpAccounts.append( smtp ); } } if ( smtpAccounts.count() > 0 ) { fillValues( fromBox->currentItem() ); } else { QMessageBox::information( this, tr( "Problem" ), tr( "<p>Please create an SMTP account first.</p>" ), tr( "Ok" ) ); + return; } connect( fromBox, SIGNAL( activated( int ) ), SLOT( fillValues( int ) ) ); connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); } void ComposeMail::pickAddress( QLineEdit *line ) { QString names = AddressPicker::getNames(); if ( line->text().isEmpty() ) { line->setText( names ); } else if ( !names.isEmpty() ) { line->setText( line->text() + ", " + names ); } } void ComposeMail::setTo( const QString & to ) { /* QString toline; QStringList toEntry = to; for ( QStringList::Iterator it = toEntry.begin(); it != toEntry.end(); ++it ) { toline += (*it); } toLine->setText( toline ); */ toLine->setText( to ); } void ComposeMail::setSubject( const QString & subject ) { subjectLine->setText( subject ); } void ComposeMail::setInReplyTo( const QString & messageId ) { } void ComposeMail::setMessage( const QString & text ) { message->setText( text ); } void ComposeMail::pickAddressTo() { pickAddress( toLine ); } void ComposeMail::pickAddressCC() { pickAddress( ccLine ); } void ComposeMail::pickAddressBCC() { pickAddress( bccLine ); } void ComposeMail::pickAddressReply() { pickAddress( replyLine ); } void ComposeMail::fillValues( int current ) { SMTPaccount *smtp = smtpAccounts.at( current ); ccLine->clear(); if ( smtp->getUseCC() ) { ccLine->setText( smtp->getCC() ); } bccLine->clear(); if ( smtp->getUseBCC() ) { bccLine->setText( smtp->getBCC() ); } replyLine->clear(); if ( smtp->getUseReply() ) { replyLine->setText( smtp->getReply() ); } sigMultiLine->setText( smtp->getSignature() ); } void ComposeMail::slotAdjustColumns() { int currPage = tabWidget->currentPageIndex(); tabWidget->showPage( attachTab ); attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); attList->setColumnWidth( 1, 80 ); tabWidget->setCurrentPage( currPage ); } void ComposeMail::addAttachment() { DocLnk lnk = OFileDialog::getOpenFileName( 1, "/" ); if ( !lnk.name().isEmpty() ) { Attachment *att = new Attachment( lnk ); (void) new AttachViewItem( attList, att ); } } void ComposeMail::removeAttachment() { if ( !attList->currentItem() ) { QMessageBox::information( this, tr( "Error" ), tr( "<p>Please select a File.</p>" ), tr( "Ok" ) ); } else { attList->takeItem( attList->currentItem() ); } } void ComposeMail::accept() { + if ( checkBoxLater->isChecked() ) { + qDebug( "Send later" ); + } + + qDebug( "Sending Mail with " + smtpAccounts.at( fromBox->currentItem() )->getAccountName() ); Mail *mail = new Mail(); SMTPaccount *smtp = smtpAccounts.at( fromBox->currentItem() ); mail->setMail( smtp->getMail() ); mail->setName( smtp->getName() ); if ( !toLine->text().isEmpty() ) { mail->setTo( toLine->text() ); } else { qDebug( "No Reciever spezified -> returning" ); return; } mail->setCC( ccLine->text() ); mail->setBCC( bccLine->text() ); mail->setReply( replyLine->text() ); mail->setSubject( subjectLine->text() ); QString txt = message->text(); if ( !sigMultiLine->text().isEmpty() ) { txt.append( "\n--\n" ); txt.append( sigMultiLine->text() ); } mail->setMessage( txt ); AttachViewItem *it = (AttachViewItem *) attList->firstChild(); while ( it != NULL ) { mail->addAttachment( it->getAttachment() ); it = (AttachViewItem *) it->itemBelow(); } SMTPwrapper wrapper( settings ); wrapper.sendMail( *mail ); QDialog::accept(); } AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) : QListViewItem( parent ) { attachment = att; qDebug( att->getMimeType() ); setPixmap( 0, attachment->getDocLnk().pixmap().isNull() ? Resource::loadPixmap( "UnknownDocument-14" ) : attachment->getDocLnk().pixmap() ); setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); setText( 1, QString::number( att->getSize() ) ); } diff --git a/noncore/net/mail/composemailui.ui b/noncore/net/mail/composemailui.ui index 9f5feb9..4d225e4 100644 --- a/noncore/net/mail/composemailui.ui +++ b/noncore/net/mail/composemailui.ui @@ -1,258 +1,269 @@ <!DOCTYPE UI><UI> <class>ComposeMailUI</class> <widget> <class>QDialog</class> <property stdset="1"> <name>name</name> <cstring>ComposeMailUI</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>264</width> + <width>260</width> <height>360</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>Compose Message</string> </property> <property> <name>layoutMargin</name> </property> <property> <name>layoutSpacing</name> </property> <vbox> <property stdset="1"> <name>margin</name> - <number>0</number> + <number>3</number> </property> <property stdset="1"> <name>spacing</name> - <number>0</number> + <number>3</number> + </property> + <widget> + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>checkBoxLater</cstring> </property> + <property stdset="1"> + <name>text</name> + <string>send later</string> + </property> + </widget> <widget> <class>QTabWidget</class> <property stdset="1"> <name>name</name> <cstring>tabWidget</cstring> </property> <property> <name>layoutMargin</name> </property> <property> <name>layoutSpacing</name> </property> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>mailTab</cstring> </property> <attribute> <name>title</name> <string>Mail</string> </attribute> <grid> <property stdset="1"> <name>margin</name> - <number>4</number> + <number>-1</number> </property> <property stdset="1"> <name>spacing</name> - <number>3</number> + <number>-1</number> </property> <widget row="2" column="1" > <class>QLineEdit</class> <property stdset="1"> <name>name</name> <cstring>subjectLine</cstring> </property> </widget> <widget row="3" column="0" rowspan="1" colspan="2" > <class>QMultiLineEdit</class> <property stdset="1"> <name>name</name> <cstring>message</cstring> </property> </widget> <widget row="2" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>subjectLabel</cstring> </property> <property stdset="1"> <name>text</name> <string>Subject</string> </property> </widget> <widget row="0" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>fromLabel</cstring> </property> <property stdset="1"> <name>text</name> <string>From</string> </property> </widget> <widget row="1" column="1" > <class>QLineEdit</class> <property stdset="1"> <name>name</name> <cstring>toLine</cstring> </property> </widget> <widget row="0" column="1" > <class>QComboBox</class> <property stdset="1"> <name>name</name> <cstring>fromBox</cstring> </property> </widget> <widget row="1" column="0" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>toButton</cstring> </property> <property stdset="1"> <name>text</name> <string>To</string> </property> </widget> </grid> </widget> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>optionsTab</cstring> </property> <attribute> <name>title</name> <string>Options</string> </attribute> <grid> <property stdset="1"> <name>margin</name> <number>4</number> </property> <property stdset="1"> <name>spacing</name> <number>3</number> </property> <widget row="3" column="0" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>replyButton</cstring> </property> <property stdset="1"> <name>text</name> <string>Reply-To</string> </property> </widget> <widget row="2" column="0" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>bccButton</cstring> </property> <property stdset="1"> <name>text</name> <string>BCC</string> </property> </widget> <widget row="1" column="1" > <class>QLineEdit</class> <property stdset="1"> <name>name</name> <cstring>ccLine</cstring> </property> </widget> <widget row="2" column="1" > <class>QLineEdit</class> <property stdset="1"> <name>name</name> <cstring>bccLine</cstring> </property> </widget> <widget row="3" column="1" > <class>QLineEdit</class> <property stdset="1"> <name>name</name> <cstring>replyLine</cstring> </property> </widget> <widget row="6" column="0" rowspan="1" colspan="2" > <class>QMultiLineEdit</class> <property stdset="1"> <name>name</name> <cstring>sigMultiLine</cstring> </property> </widget> <widget row="5" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>sigLabel</cstring> </property> <property stdset="1"> <name>text</name> <string>Signature</string> </property> </widget> <spacer row="4" column="0" > <property> <name>name</name> <cstring>Spacer3</cstring> </property> <property stdset="1"> <name>orientation</name> <enum>Vertical</enum> </property> <property stdset="1"> <name>sizeType</name> <enum>Expanding</enum> </property> <property> <name>sizeHint</name> <size> <width>20</width> <height>20</height> </size> </property> </spacer> <widget row="1" column="0" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>ccButton</cstring> </property> <property stdset="1"> <name>text</name> <string>CC</string> </property> </widget> </grid> </widget> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>attachTab</cstring> </property> <attribute> <name>title</name> <string>Attachment</string> </attribute> <grid> <property stdset="1"> <name>margin</name> <number>4</number> diff --git a/noncore/net/mail/settingsdialog.cpp b/noncore/net/mail/settingsdialog.cpp index 9741e94..f9de405 100644 --- a/noncore/net/mail/settingsdialog.cpp +++ b/noncore/net/mail/settingsdialog.cpp @@ -1,34 +1,38 @@ -#include <qradiobutton.h> +#include <qcheckbox.h> #include <qpe/config.h> #include "settingsdialog.h" SettingsDialog::SettingsDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) : SettingsDialogUI( parent, name, modal, fl ) { readConfig(); } SettingsDialog::~SettingsDialog() { } void SettingsDialog::readConfig() { Config cfg("mail"); cfg.setGroup( "Settings" ); showHtmlButton->setChecked( cfg.readBoolEntry( "showHtml", false ) ); + cfg.setGroup( "Compose" ); + checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); } void SettingsDialog::writeConfig() { Config cfg( "mail" ); cfg.setGroup( "Settings" ); cfg.writeEntry( "showHtml", showHtmlButton->isChecked() ); + cfg.setGroup( "Compose" ); + cfg.writeEntry( "sendLater", checkBoxLater->isChecked() );; } void SettingsDialog::accept() { writeConfig(); QDialog::accept(); } diff --git a/noncore/net/mail/settingsdialogui.ui b/noncore/net/mail/settingsdialogui.ui index 3b03aeb..c5589dc 100644 --- a/noncore/net/mail/settingsdialogui.ui +++ b/noncore/net/mail/settingsdialogui.ui @@ -1,116 +1,158 @@ <!DOCTYPE UI><UI> <class>SettingsDialogUI</class> <widget> <class>QDialog</class> <property stdset="1"> <name>name</name> <cstring>SettingsDialogUI</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>328</width> + <width>324</width> <height>379</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>Settings Dialog</string> </property> <property> <name>layoutMargin</name> </property> <property> <name>layoutSpacing</name> </property> <vbox> <property stdset="1"> <name>margin</name> <number>3</number> </property> <property stdset="1"> <name>spacing</name> <number>3</number> </property> <widget> <class>QTabWidget</class> <property stdset="1"> <name>name</name> <cstring>TabWidget2</cstring> </property> <property> <name>layoutMargin</name> </property> <property> <name>layoutSpacing</name> </property> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>tab</cstring> </property> <attribute> <name>title</name> <string>View Mail</string> </attribute> <vbox> <property stdset="1"> <name>margin</name> <number>3</number> </property> <property stdset="1"> <name>spacing</name> <number>3</number> </property> <widget> - <class>QRadioButton</class> + <class>QCheckBox</class> <property stdset="1"> <name>name</name> <cstring>showHtmlButton</cstring> </property> <property stdset="1"> <name>text</name> <string>View mail as Html </string> </property> </widget> <spacer> <property> <name>name</name> <cstring>Spacer1</cstring> </property> <property stdset="1"> <name>orientation</name> <enum>Vertical</enum> </property> <property stdset="1"> <name>sizeType</name> <enum>Expanding</enum> </property> <property> <name>sizeHint</name> <size> <width>20</width> <height>20</height> </size> </property> </spacer> </vbox> </widget> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>tab</cstring> </property> <attribute> <name>title</name> - <string>Tab 2</string> + <string>Compose Mail</string> </attribute> + <vbox> + <property stdset="1"> + <name>margin</name> + <number>3</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>3</number> + </property> + <widget> + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>checkBoxLater</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Send mails later ( enqueue in outbox )</string> + </property> + </widget> + <spacer> + <property> + <name>name</name> + <cstring>Spacer2</cstring> + </property> + <property stdset="1"> + <name>orientation</name> + <enum>Vertical</enum> + </property> + <property stdset="1"> + <name>sizeType</name> + <enum>Expanding</enum> + </property> + <property> + <name>sizeHint</name> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </vbox> </widget> </widget> </vbox> </widget> </UI> |