-rw-r--r-- | kmicromail/composemail.cpp | 21 | ||||
-rw-r--r-- | kmicromail/composemail.h | 1 | ||||
-rw-r--r-- | kmicromail/composemailui.ui | 74 | ||||
-rw-r--r-- | kmicromail/editaccounts.cpp | 19 | ||||
-rw-r--r-- | kmicromail/editaccounts.h | 1 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/settings.cpp | 46 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/settings.h | 6 | ||||
-rw-r--r-- | kmicromail/main.cpp | 2 | ||||
-rw-r--r-- | kmicromail/mainwindow.cpp | 2 | ||||
-rw-r--r-- | kmicromail/smtpconfigui.ui | 97 |
10 files changed, 178 insertions, 91 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp index 976e309..ed8a2ee 100644 --- a/kmicromail/composemail.cpp +++ b/kmicromail/composemail.cpp @@ -56,399 +56,410 @@ ComposeMail::ComposeMail( Settings *sett, QWidget *parent, const char *name, boo mPickLineEdit = 0; mEncoding = KOPrefs::instance()->mCurrentCodeName; connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); settings = sett; m_replyid = ""; if ( KOPrefs::instance()->mUseKapi) { KConfig config( locateLocal("config", "kabcrc") ); config.setGroup( "General" ); QString whoami_uid = config.readEntry( "WhoAmI" ); if ( whoami_uid.isEmpty() ) { QMessageBox::information( 0, i18n( "Hint" ), i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), i18n( "Ok" ) ); fillSettings(); } else ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); #ifdef DESKTOP_VERSION KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); QStringList mails = con.emails(); QString defmail = con.preferredEmail(); if ( mails.count() == 0) QMessageBox::information( 0, i18n( "Hint" ), i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), i18n( "Ok" ) ); if (defmail.length()!=0) { fromBox->insertItem(defmail); } QStringList::ConstIterator sit = mails.begin(); for (;sit!=mails.end();++sit) { if ( (*sit)==defmail) continue; fromBox->insertItem((*sit)); } senderNameEdit->setText(con.formattedName()); #endif } else { fillSettings(); } checkBoxLater->setChecked( KOPrefs::instance()->mSendLater ); attList->addColumn( i18n( "Name" ) ); attList->addColumn( i18n( "Size" ) ); QList<Account> accounts = settings->getAccounts(); if ( QApplication::desktop()->width() < 320 ) smtpAccountBox->setMaximumWidth( 80 ); Account *it; for ( it = accounts.first(); it; it = accounts.next() ) { if ( it->getType()==MAILLIB::A_SMTP ) { SMTPaccount *smtp = static_cast<SMTPaccount *>(it); smtpAccountBox->insertItem( smtp->getAccountName() ); smtpAccounts.append( smtp ); } } 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() ) ); connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); mMail = 0; warnAttach = true; QIconSet icon; //icon = SmallIcon("fileexport"); icon = SmallIcon("filesave"); SaveButton->setIconSet (icon ) ; if ( QApplication::desktop()->width() < 320 ) { SaveButton->setText ("") ; SaveButton->setMaximumSize ( SaveButton->sizeHint().height(),SaveButton->sizeHint().height()) ; } else SaveButton->setText (i18n("Save")); #ifndef DESKTOP_VERSION QPEApplication::setStylusOperation( message, QPEApplication::RightOnHold ); QPEApplication::setStylusOperation( senderNameEdit, QPEApplication::RightOnHold ); QPEApplication::setStylusOperation( subjectLine, QPEApplication::RightOnHold ); #endif message->setFont ( KOPrefs::instance()->mComposeFont ); message->setWordWrap (QMultiLineEdit::WidgetWidth); if ( smtpAccounts.count() > 0 ) { fillValues( smtpAccountBox->currentItem() ); } else { QMessageBox::information( 0, i18n( "Problem" ), i18n( "Please create an\nSMTP account first.\nThe SMTP is needed\nfor sending mail.\n" ), i18n( "Ok" ) ); return; } connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); - + connect( SaveSigButton, SIGNAL( clicked() ), SLOT( saveSig()) ); + if ( smtpAccountBox->count()) + fillValues(0); } void ComposeMail::fillSettings() { if ( QApplication::desktop()->width() < 320 ) fromBox->setMaximumWidth( 100 ); QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail); QStringList::ConstIterator sit = mailList.begin(); int pref = 0; for (;sit!=mailList.end();++sit) { fromBox->insertItem((*sit)); } senderNameEdit->setText(KOPrefs::instance()->mName); } - - +void ComposeMail::saveSig() +{ + if ( smtpAccountBox->count()) { + int cur = smtpAccountBox->currentItem (); + SMTPaccount *smtp = smtpAccounts.at( cur ); + if ( smtp ) + smtp->setSignature( sigMultiLine->text()); + } +} void ComposeMail::saveAsDraft() { Opie::Core::OSmartPointer<Mail> mail= new Mail(); mail->setMail(fromBox->currentText()); mail->setTo( toLine->text() ); mail->setName(senderNameEdit->text()); mail->setCC( ccLine->text() ); mail->setBCC( bccLine->text() ); mail->setReply( replyLine->text() ); mail->setSubject( subjectLine->text() ); if (!m_replyid.isEmpty()) { QStringList ids; ids.append(m_replyid); mail->setInreply(ids); } QString txt = message->text(); if ( !sigMultiLine->text().isEmpty() ) { txt.append( "\n--\n" ); txt.append( sigMultiLine->text() ); } mail->setMessage( txt ); mail->setCharset (mEncoding); /* only use the default drafts folder name! */ Storemail wrapper(AbstractMail::draftFolder()); wrapper.storeMail(mail); AttachViewItem *it = (AttachViewItem *) attList->firstChild(); /* attachments we will ignore! */ if ( it != 0 ) { if ( warnAttach ) QMessageBox::warning(0,i18n("Store message"), i18n("<center>Attachments will not be stored in \"Draft\" folder</center>")); warnAttach = false; } setStatus( i18n("Mail saved as draft!") ); } void ComposeMail::clearStatus() { topLevelWidget()->setCaption( i18n("Compose mail") ); } void ComposeMail::setStatus( QString status ) { topLevelWidget()->setCaption( status ); QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ; } void ComposeMail::pickAddress( ) { QLineEdit *line = mPickLineEdit; if ( line == 0 ) return; #ifdef DESKTOP_VERSION //qDebug(" ComposeMail::pickAddress "); QString names ;//= AddressPicker::getNames(); KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); uint i=0; for (i=0; i < list.count(); i++) { if ( !list[i].preferredEmail().isEmpty()) { if ( ! names.isEmpty() ) names+= ","; names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; } } if ( line->text().isEmpty() ) { line->setText( names ); } else if ( !names.isEmpty() ) { line->setText( line->text() + ", " + names ); } #else bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/); // the result should now arrive through method insertAttendees #endif } //the map includes name/email pairs, that comes from Ka/Pi void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) { //qDebug("ComposeMail::insertAttendees "); raise(); if ( mPickLineEdit == 0 ) { //whoami received QString defmail = uidList[0]; if ( emailList.count() == 0 ) QMessageBox::information( 0, i18n( "Hint" ), i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), i18n( "Ok" ) ); if (defmail.length()!=0) { fromBox->insertItem(defmail); } QStringList::ConstIterator sit = emailList.begin(); int pref = 0; for (;sit!=emailList.end();++sit) { if ( (*sit)==defmail) continue; fromBox->insertItem((*sit)); } senderNameEdit->setText(nameList[0]); return; } QString names ; QLineEdit *line = mPickLineEdit; if (uid == this->name()) { for ( int i = 0; i < nameList.count(); i++) { QString _name = nameList[i]; QString _email = emailList[i]; QString _uid = uidList[i]; if ( ! _email.isEmpty() ) { if ( ! names.isEmpty() ) names+= ","; names+= "\""+_name +"\"<" +_email +">"; } } } if ( line->text().isEmpty() ) { line->setText( names ); } else if ( !names.isEmpty() ) { line->setText( line->text() + ", " + names ); } } void ComposeMail::setTo( const QString & to ) { toLine->setText( to ); } void ComposeMail::setSubject( const QString & subject ) { subjectLine->setText( subject ); } void ComposeMail::setInReplyTo( const QString & messageId ) { m_replyid = messageId; } void ComposeMail::setMessage( const QString & text ) { message->setText( text ); } void ComposeMail::pickAddressTo() { mPickLineEdit = toLine; pickAddress( ); } void ComposeMail::pickAddressCC() { mPickLineEdit = ccLine; pickAddress( ); } void ComposeMail::pickAddressBCC() { mPickLineEdit = bccLine; pickAddress( ); } void ComposeMail::pickAddressReply() { mPickLineEdit = replyLine; pickAddress( ); } -void ComposeMail::fillValues( int ) +void ComposeMail::fillValues( int current ) { #if 0 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() ); #endif + SMTPaccount *smtp = smtpAccounts.at( current ); + if ( smtp ) + 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() { QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this ); if ( !lnk.isEmpty() ) { Attachment *att = new Attachment( lnk ); (void) new AttachViewItem( attList, att ); } } void ComposeMail::removeAttachment() { if ( !attList->currentItem() ) { QMessageBox::information( this, i18n( "Error" ), i18n( "<p>Please select a File.</p>" ), i18n( "Ok" ) ); } else { attList->takeItem( attList->currentItem() ); } } void ComposeMail::accept() { if ( smtpAccountBox->count() == 0 ) { reject(); return; } if (! checkBoxLater->isChecked() ) { int yesno = QMessageBox::warning(0,i18n("Stop editing message"), i18n("Send this message?"), i18n("Yes"), i18n("Cancel")); if (yesno == 1) { return; } } #if 0 odebug << "Sending Mail with " << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl; #endif Opie::Core::OSmartPointer<Mail> mail=new Mail; SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); mail->setMail(fromBox->currentText()); if ( !toLine->text().isEmpty() ) { mail->setTo( toLine->text() ); } else { QMessageBox::warning(0,i18n("Sending mail"), i18n("No Receiver spezified" ) ); return; } mail->setName(senderNameEdit->text()); mail->setCC( ccLine->text() ); mail->setBCC( bccLine->text() ); mail->setReply( replyLine->text() ); mail->setSubject( subjectLine->text() ); if (!m_replyid.isEmpty()) { QStringList ids; ids.append(m_replyid); mail->setInreply(ids); } QString txt = message->text(); if ( !sigMultiLine->text().isEmpty() ) { txt.append( "\n--\n" ); txt.append( sigMultiLine->text() ); } mail->setMessage( txt ); mail->setCharset (mEncoding); AttachViewItem *it = (AttachViewItem *) attList->firstChild(); while ( it != 0 ) { mail->addAttachment( it->getAttachment() ); it = (AttachViewItem *) it->nextSibling(); } SMTPwrapper wrapper( smtp ); if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) ) setStatus( tr ("Mail sent")); else { setStatus( tr ("Error: Something went wrong. Nothing sent")); diff --git a/kmicromail/composemail.h b/kmicromail/composemail.h index a7fa41c..966ac3e 100644 --- a/kmicromail/composemail.h +++ b/kmicromail/composemail.h @@ -1,93 +1,94 @@ #ifndef COMPOSEMAIL_H #define COMPOSEMAIL_H #include <qlineedit.h> #include <qlistview.h> #include "composemailui.h" //#include "addresspickerui.h" #include <libmailwrapper/settings.h> #include <libmailwrapper/mailwrapper.h> class RecMail; #include <opie2/osmartpointer.h> #if 0 class AddressPicker : public AddressPickerUI { //Q_OBJECT public: AddressPicker( QWidget *parent = 0, const char *name = 0, bool modal = false ); static QString getNames(); protected: QString selectedNames; void accept(); }; #endif class RecMail; class ComposeMail : public ComposeMailUI { Q_OBJECT public: ComposeMail( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = false ); virtual ~ComposeMail(); void reEditMail(const Opie::Core::OSmartPointer<RecMail>¤t); public slots: void slotAdjustColumns(); void setTo( const QString & to ); void setSubject( const QString & subject ); void setInReplyTo( const QString & messageId ); void setMessage( const QString & text ); void insertAttendees(const QString&, const QStringList& namelist, const QStringList& emaillist, const QStringList& uidlist); void setCharset(const QString&); protected slots: void accept(); void reject(); private slots: void fillValues( int current ); void fillSettings(); void pickAddress(); void pickAddressTo(); void pickAddressCC(); void pickAddressBCC(); void pickAddressReply(); void saveAsDraft(); void addAttachment(); void removeAttachment(); void clearStatus(); void setStatus( QString ); + void saveSig(); protected: QLineEdit* mPickLineEdit; Opie::Core::OSmartPointer<Mail> mMail; Settings *settings; QList<SMTPaccount> smtpAccounts; QString m_replyid; QString mEncoding; bool warnAttach; }; class AttachViewItem : public QListViewItem { public: AttachViewItem( QListView *parent, Attachment *att ); Attachment *getAttachment() { return attachment; } private: Attachment *attachment; }; #endif diff --git a/kmicromail/composemailui.ui b/kmicromail/composemailui.ui index 610907c..23f47d3 100644 --- a/kmicromail/composemailui.ui +++ b/kmicromail/composemailui.ui @@ -1,112 +1,112 @@ <!DOCTYPE UI><UI> <class>ComposeMailUI</class> <include location="local">tr.h</include> <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>579</width> - <height>476</height> + <width>275</width> + <height>382</height> </rect> </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> <hsizetype>7</hsizetype> <vsizetype>7</vsizetype> </sizepolicy> </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> </property> <property stdset="1"> <name>spacing</name> <number>0</number> </property> <widget> <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> <cstring>Layout4</cstring> </property> <property> <name>layoutSpacing</name> </property> <vbox> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>0</number> </property> <widget> <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> <cstring>Layout3</cstring> </property> <property> <name>layoutSpacing</name> </property> <hbox> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>0</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>QLabel</class> <property stdset="1"> <name>name</name> <cstring>accountLabel</cstring> </property> <property stdset="1"> <name>text</name> <string>use:</string> </property> </widget> <widget> <class>QComboBox</class> <property stdset="1"> <name>name</name> <cstring>smtpAccountBox</cstring> </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> <hsizetype>3</hsizetype> @@ -238,283 +238,273 @@ </property> <property stdset="1"> <name>maximumSize</name> <size> <width>180</width> <height>32767</height> </size> </property> </widget> </grid> </widget> <widget row="2" column="1" > <class>QLineEdit</class> <property stdset="1"> <name>name</name> <cstring>subjectLine</cstring> </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> <hsizetype>3</hsizetype> <vsizetype>0</vsizetype> </sizepolicy> </property> </widget> <widget row="1" column="1" > <class>QLineEdit</class> <property stdset="1"> <name>name</name> <cstring>toLine</cstring> </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> <hsizetype>3</hsizetype> <vsizetype>0</vsizetype> </sizepolicy> </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="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>QMultiLineEdit</class> <property stdset="1"> <name>name</name> <cstring>message</cstring> </property> </widget> </vbox> </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>3</number> + <number>2</number> </property> <property stdset="1"> <name>spacing</name> - <number>3</number> + <number>2</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" > + <widget row="1" 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" > + <widget row="0" column="1" > <class>QLineEdit</class> <property stdset="1"> <name>name</name> <cstring>ccLine</cstring> </property> </widget> - <widget row="2" column="1" > + <widget row="1" column="1" > <class>QLineEdit</class> <property stdset="1"> <name>name</name> <cstring>bccLine</cstring> </property> </widget> - <widget row="3" column="1" > + <widget row="2" 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" > + <widget row="4" 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> + <widget row="0" column="0" > + <class>QPushButton</class> <property stdset="1"> <name>name</name> - <cstring>sigLabel</cstring> + <cstring>ccButton</cstring> </property> <property stdset="1"> <name>text</name> - <string>Signature</string> + <string>CC</string> </property> </widget> - <spacer row="4" column="0" > - <property> + <widget row="3" column="1" > + <class>QPushButton</class> + <property stdset="1"> <name>name</name> - <cstring>Spacer3</cstring> + <cstring>SaveSigButton</cstring> </property> <property stdset="1"> - <name>orientation</name> - <enum>Vertical</enum> + <name>text</name> + <string>Save signature</string> </property> + </widget> + <widget row="2" column="0" > + <class>QPushButton</class> <property stdset="1"> - <name>sizeType</name> - <enum>Expanding</enum> + <name>name</name> + <cstring>replyButton</cstring> </property> - <property> - <name>sizeHint</name> - <size> - <width>20</width> - <height>20</height> - </size> + <property stdset="1"> + <name>text</name> + <string>Reply-To</string> </property> - </spacer> - <widget row="1" column="0" > - <class>QPushButton</class> + </widget> + <widget row="3" column="0" > + <class>QLabel</class> <property stdset="1"> <name>name</name> - <cstring>ccButton</cstring> + <cstring>sigLabel</cstring> </property> <property stdset="1"> <name>text</name> - <string>CC</string> + <string>Signature</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>3</number> </property> <property stdset="1"> <name>spacing</name> <number>3</number> </property> <widget row="0" column="0" rowspan="1" colspan="3" > <class>QListView</class> <property stdset="1"> <name>name</name> <cstring>attList</cstring> </property> <property stdset="1"> <name>selectionMode</name> <enum>Single</enum> </property> <property stdset="1"> <name>allColumnsShowFocus</name> <bool>true</bool> </property> <property stdset="1"> <name>showSortIndicator</name> <bool>true</bool> </property> </widget> <widget row="1" column="2" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>deleteButton</cstring> </property> <property stdset="1"> <name>text</name> <string>Delete File</string> </property> </widget> <widget row="1" column="0" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>addButton</cstring> </property> <property stdset="1"> <name>text</name> <string>Add File</string> </property> </widget> </grid> </widget> </widget> </vbox> </widget> </vbox> </widget> <tabstops> <tabstop>fromBox</tabstop> <tabstop>toButton</tabstop> <tabstop>toLine</tabstop> <tabstop>subjectLine</tabstop> <tabstop>message</tabstop> <tabstop>tabWidget</tabstop> <tabstop>ccButton</tabstop> <tabstop>ccLine</tabstop> <tabstop>bccButton</tabstop> <tabstop>bccLine</tabstop> <tabstop>replyButton</tabstop> <tabstop>replyLine</tabstop> <tabstop>sigMultiLine</tabstop> <tabstop>attList</tabstop> <tabstop>addButton</tabstop> <tabstop>deleteButton</tabstop> </tabstops> </UI> diff --git a/kmicromail/editaccounts.cpp b/kmicromail/editaccounts.cpp index 48c3963..8253c91 100644 --- a/kmicromail/editaccounts.cpp +++ b/kmicromail/editaccounts.cpp @@ -1,117 +1,118 @@ #include <qdialog.h> #include "kapplication.h" #include "defines.h" #include "editaccounts.h" /* OPIE */ #include <qpe/qpeapplication.h> /* QT */ #include <qstringlist.h> #include <qcombobox.h> #include <qcheckbox.h> #include <qmessagebox.h> #include <qpushbutton.h> #include <qlineedit.h> #include <qlabel.h> #include <qtabwidget.h> #include <qlistview.h> #include <qspinbox.h> #include <klocale.h> +#include <kfiledialog.h> #include <libmailwrapper/nntpwrapper.h> using namespace Opie::Core; AccountListItem::AccountListItem( QListView *parent, Account *a) : QListViewItem( parent ) { account = a; setText( 0, account->getAccountName() ); QString ttext = ""; switch (account->getType()) { case MAILLIB::A_NNTP: ttext="NNTP"; break; case MAILLIB::A_POP3: ttext = "POP3"; break; case MAILLIB::A_IMAP: ttext = "IMAP"; break; case MAILLIB::A_SMTP: ttext = "SMTP"; break; default: ttext = "UNKNOWN"; break; } setText( 1, ttext); } EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) : EditAccountsUI( parent, name, modal, flags ) { settings = s; mailList->addColumn( i18n( "Account" ) ); mailList->addColumn( i18n( "Type" ) ); newsList->addColumn( i18n( "Account" ) ); connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) ); slotFillLists(); } void EditAccounts::slotFillLists() { mailList->clear(); newsList->clear(); QList<Account> accounts = settings->getAccounts(); Account *it; for ( it = accounts.first(); it; it = accounts.next() ) { if ( it->getType()==MAILLIB::A_NNTP ) { (void) new AccountListItem( newsList, it ); } else { (void) new AccountListItem( mailList, it ); } } } void EditAccounts::slotNewMail() { QString *selection = new QString(); SelectMailType selType( selection, this, 0, true ); selType.show(); if ( QDialog::Accepted == selType.exec() ) { slotNewAccount( *selection ); } } void EditAccounts::slotNewAccount( const QString &type ) { if ( type.compare( i18n("IMAP") ) == 0 ) { IMAPaccount *account = new IMAPaccount(); IMAPconfig imap( account, this, 0, true ); #ifndef DESKTOP_VERSION imap.showMaximized(); #endif if ( QDialog::Accepted == imap.exec() ) { settings->addAccount( account ); account->save(); @@ -386,240 +387,254 @@ void IMAPconfig::accept() data->setConnectionType( ComboBox1->currentItem() ); data->setUser( userLine->text() ); data->setPassword( passLine->text() ); data->setPrefix(prefixLine->text()); data->setLocalFolder( localFolder->text() ); data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); QDialog::accept(); } /** * POP3config */ POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags ) : POP3configUI( parent, name, modal, flags ) { data = account; fillValues(); connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); ComboBox1->insertItem( "Only if available", 0 ); ComboBox1->insertItem( "Always, Negotiated", 1 ); ComboBox1->insertItem( "Connect on secure port", 2 ); ComboBox1->insertItem( "Run command instead", 3 ); CommandEdit->hide(); ComboBox1->setCurrentItem( data->ConnectionType() ); } void POP3config::slotConnectionToggle( int index ) { // 2 is ssl connection if ( index == 2 ) { portLine->setText( POP3_SSL_PORT ); } else if ( index == 3 ) { portLine->setText( POP3_PORT ); CommandEdit->show(); } else { portLine->setText( POP3_PORT ); } } void POP3config::fillValues() { accountLine->setText( data->getAccountName() ); serverLine->setText( data->getServer() ); portLine->setText( data->getPort() ); ComboBox1->setCurrentItem( data->ConnectionType() ); userLine->setText( data->getUser() ); passLine->setText( data->getPassword() ); localFolder->setText( data->getLocalFolder() ); int max = data->getMaxMailSize() ; if ( max ) { CheckBoxDown->setChecked( true ); SpinBoxDown->setValue ( max ); } else { CheckBoxDown->setChecked( false ); SpinBoxDown->setValue ( 5 ); } CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); } void POP3config::accept() { data->setAccountName( accountLine->text() ); data->setServer( serverLine->text() ); data->setPort( portLine->text() ); data->setConnectionType( ComboBox1->currentItem() ); data->setUser( userLine->text() ); data->setPassword( passLine->text() ); data->setLocalFolder( localFolder->text() ); data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); QDialog::accept(); } /** * SMTPconfig */ SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) : SMTPconfigUI( parent, name, modal, flags ) { data = account; connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); fillValues(); - + QIconSet icon; + //icon = SmallIcon("fileexport"); + icon = SmallIcon("fileopen"); + SignaturButton->setText(""); + SignaturButton->setIconSet (icon ) ; + SignaturButton->setMaximumSize ( SignaturButton->sizeHint().height()+4,SignaturButton->sizeHint().height()) ; + connect( SignaturButton, SIGNAL( clicked() ), this, SLOT( chooseSig() ) ); connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); ComboBox1->insertItem( "Only if available", 0 ); ComboBox1->insertItem( "Always, Negotiated", 1 ); ComboBox1->insertItem( "Connect on secure port", 2 ); ComboBox1->insertItem( "Run command instead", 3 ); CommandEdit->hide(); ComboBox1->setCurrentItem( data->ConnectionType() ); } - +void SMTPconfig::chooseSig() +{ + QString lnk = KFileDialog::getOpenFileName( "", "Choose Signatur File", this ); + if ( !lnk.isEmpty() ) { + SignaturEdit->setText( lnk ); + } +} void SMTPconfig::slotConnectionToggle( int index ) { // 2 is ssl connection if ( index == 2 ) { portLine->setText( SMTP_SSL_PORT ); } else if ( index == 3 ) { portLine->setText( SMTP_PORT ); CommandEdit->show(); } else { portLine->setText( SMTP_PORT ); } } void SMTPconfig::fillValues() { accountLine->setText( data->getAccountName() ); serverLine->setText( data->getServer() ); portLine->setText( data->getPort() ); ComboBox1->setCurrentItem( data->ConnectionType() ); loginBox->setChecked( data->getLogin() ); userLine->setText( data->getUser() ); passLine->setText( data->getPassword() ); + SignaturEdit->setText( data->getSigFile() ); } void SMTPconfig::accept() { data->setAccountName( accountLine->text() ); data->setServer( serverLine->text() ); data->setPort( portLine->text() ); data->setConnectionType( ComboBox1->currentItem() ); data->setLogin( loginBox->isChecked() ); data->setUser( userLine->text() ); data->setPassword( passLine->text() ); + data->setSigFile( SignaturEdit->text() ); QDialog::accept(); } /** * NNTPconfig */ NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) : NNTPconfigUI( parent, name, modal, flags ) { data = account; connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) ); connect( ShowSubcribed, SIGNAL( clicked() ), this, SLOT( slotShowSub() ) ); connect( FilterButton, SIGNAL( clicked() ), this, SLOT( slotShowFilter() ) ); fillValues(); connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) ); } void NNTPconfig::slotShowSub() { save(); data->save(); ListViewGroups->clear(); for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { QCheckListItem *item; item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); item->setOn( true ); } topLevelWidget()->setCaption( i18n("%1 groups subscribed").arg( subscribedGroups.count())); } void NNTPconfig::slotShowFilter() { save(); data->save(); ListViewGroups->clear(); int count = 0; for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { QCheckListItem *item; if ( GroupFilter->text().isEmpty() || (*it).find( GroupFilter->text() ) >= 0 ) { item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); ++count; if ( subscribedGroups.contains( (*it) ) >= 1 ) { item->setOn( true ); } } } topLevelWidget()->setCaption( i18n("Filter found %1 groups").arg( count)); } void NNTPconfig::slotGetNG() { save(); data->save(); topLevelWidget()->setCaption( i18n("Fetching group list...")); qApp->processEvents(); NNTPwrapper* tmp = new NNTPwrapper( data ); allGroups = tmp->listAllNewsgroups(); topLevelWidget()->setCaption( i18n("Downloaded %1 group names").arg( allGroups.count())); ListViewGroups->clear(); for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { QCheckListItem *item; item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); if ( subscribedGroups.contains( (*it) ) >= 1 ) { item->setOn( true ); } } delete tmp; } void NNTPconfig::slotSSL( bool enabled ) { if ( enabled ) { portLine->setText( NNTP_SSL_PORT ); } else { portLine->setText( NNTP_PORT ); } } void NNTPconfig::fillValues() { accountLine->setText( data->getAccountName() ); serverLine->setText( data->getServer() ); portLine->setText( data->getPort() ); sslBox->setChecked( data->getSSL() ); loginBox->setChecked( data->getLogin() ); userLine->setText( data->getUser() ); passLine->setText( data->getPassword() ); diff --git a/kmicromail/editaccounts.h b/kmicromail/editaccounts.h index 6cf842e..465780c 100644 --- a/kmicromail/editaccounts.h +++ b/kmicromail/editaccounts.h @@ -28,129 +28,130 @@ private: }; class EditAccounts : public EditAccountsUI { Q_OBJECT public: EditAccounts( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); public slots: void slotNewAccount( const QString &type ); void slotEditAccount( Account *account ); void slotDeleteAccount( Account * account ); void slotAdjustColumns(); protected slots: void slotFillLists(); void slotNewMail(); void slotEditMail(); void slotDeleteMail(); void slotNewNews(); void slotEditNews(); void slotDeleteNews(); void accept(); private: Settings *settings; }; class SelectMailType : public SelectMailTypeUI { Q_OBJECT public: SelectMailType( QString *selection = 0, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); private slots: void slotSelection( const QString &sel ); private: QString *selected; }; class IMAPconfig : public IMAPconfigUI { Q_OBJECT public: IMAPconfig( IMAPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); public slots: void fillValues(); protected slots: void slotConnectionToggle( int index ); void accept(); private: IMAPaccount *data; }; class POP3config : public POP3configUI { Q_OBJECT public: POP3config( POP3account *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); public slots: void fillValues(); protected slots: void slotConnectionToggle( int index ); void accept(); private: POP3account *data; }; class SMTPconfig : public SMTPconfigUI { Q_OBJECT public: SMTPconfig( SMTPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); public slots: void fillValues(); protected slots: void slotConnectionToggle( int index ); void accept(); + void chooseSig(); private: SMTPaccount *data; }; class NNTPconfig : public NNTPconfigUI { Q_OBJECT public: NNTPconfig( NNTPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); public slots: void fillValues(); protected slots: void slotSSL( bool enabled ); void accept(); void slotGetNG(); void slotShowSub(); void slotShowFilter(); private: QStringList subscribedGroups; QStringList allGroups; void save(); NNTPaccount *data; clist* list; }; #endif diff --git a/kmicromail/libmailwrapper/settings.cpp b/kmicromail/libmailwrapper/settings.cpp index 19093b1..8f909f9 100644 --- a/kmicromail/libmailwrapper/settings.cpp +++ b/kmicromail/libmailwrapper/settings.cpp @@ -1,99 +1,103 @@ #include <stdlib.h> #include <qdir.h> +#include <qtextcodec.h> +#include <qtextstream.h> +#include <qfile.h> + //#include <opie2/odebug.h> #include <kconfig.h> #include <kstandarddirs.h> #include "settings.h" //#include "defines.h" #define IMAP_PORT "143" #define IMAP_SSL_PORT "993" #define SMTP_PORT "25" #define SMTP_SSL_PORT "465" #define POP3_PORT "110" #define POP3_SSL_PORT "995" #define NNTP_PORT "119" #define NNTP_SSL_PORT "563" Settings::Settings() : QObject() { accounts.setAutoDelete( true ); ; updateAccounts(); //qDebug("++++++++++++++++++new settings "); } void Settings::checkDirectory() { return; locateLocal("data", "kopiemail" ); /* if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) { system( "mkdir -p $HOME/Applications/opiemail" ); qDebug("$HOME/Applications/opiemail created "); } */ } QList<Account> Settings::getAccounts() { return accounts; } void Settings::addAccount( Account *account ) { accounts.append( account ); } void Settings::delAccount( Account *account ) { account->remove(); accounts.remove( account ); } void Settings::updateAccounts() { accounts.clear(); QDir dir( locateLocal("data", "kopiemail" ) ); QStringList::Iterator it; QStringList imap = dir.entryList( "imap-*" ); for ( it = imap.begin(); it != imap.end(); it++ ) { IMAPaccount *account = new IMAPaccount( (*it).replace(0, 5, "") ); accounts.append( account ); } QStringList pop3 = dir.entryList( "pop3-*" ); for ( it = pop3.begin(); it != pop3.end(); it++ ) { POP3account *account = new POP3account( (*it).replace(0, 5, "") ); accounts.append( account ); } QStringList smtp = dir.entryList( "smtp-*" ); for ( it = smtp.begin(); it != smtp.end(); it++ ) { SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") ); accounts.append( account ); } QStringList nntp = dir.entryList( "nntp-*" ); for ( it = nntp.begin(); it != nntp.end(); it++ ) { NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") ); accounts.append( account ); } readAccounts(); } void Settings::saveAccounts() { checkDirectory(); Account *it; for ( it = accounts.first(); it; it = accounts.next() ) { it->save(); } } @@ -273,229 +277,269 @@ POP3account::POP3account( QString filename ) QString POP3account::getUniqueFileName() { int num = 0; QString unique; QDir dir( locateLocal("data", "kopiemail" ) ); QStringList imap = dir.entryList( "pop3-*" ); do { unique.setNum( num++ ); } while ( imap.contains( "pop3-" + unique ) > 0 ); return unique; } void POP3account::read() { KConfig *conf = new KConfig( getFileName()); conf->setGroup( "POP3 Account" ); accountName = conf->readEntry( "Account" ); server = conf->readEntry( "Server" ); port = conf->readEntry( "Port" ); ssl = conf->readBoolEntry( "SSL" ); connectionType = conf->readNumEntry( "ConnectionType" ); user = conf->readEntry( "User" ); //password = conf->readEntryCrypt( "Password" ); setPasswordList( conf->readListEntry( "FolderHistory")); offline = conf->readBoolEntry("Offline",false); localFolder = conf->readEntry( "LocalFolder" ); maxMailSize = conf->readNumEntry( "MaxSize",0 ); int lf = conf->readNumEntry( "LastFetch",0 ); QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) ); leaveOnServer = conf->readBoolEntry("LeaveOnServer",false); lastFetch = dt.addSecs( lf ); delete conf; } void POP3account::save() { Settings::checkDirectory(); KConfig *conf = new KConfig( getFileName() ); conf->setGroup( "POP3 Account" ); conf->writeEntry( "Account", accountName ); conf->writeEntry( "Server", server ); conf->writeEntry( "Port", port ); conf->writeEntry( "SSL", ssl ); conf->writeEntry( "ConnectionType", connectionType ); conf->writeEntry( "User", user ); //conf->writeEntryCrypt( "Password", password ); conf->writeEntry( "FolderHistory",getPasswordList() ); conf->writeEntry( "Offline",offline); conf->writeEntry( "LocalFolder", localFolder ); conf->writeEntry( "MaxSize", maxMailSize ); QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) ); int lf = dt.secsTo ( lastFetch ); conf->writeEntry( "LastFetch", lf ); conf->writeEntry( "LeaveOnServer", leaveOnServer); conf->sync(); delete conf; } QString POP3account::getFileName() { return locateLocal("data", "kopiemail" ) +"/pop3-" + file; } SMTPaccount::SMTPaccount() : Account() { file = SMTPaccount::getUniqueFileName(); accountName = "New SMTP Account"; ssl = false; connectionType = 1; login = false; useCC = false; useBCC = false; useReply = false; type = MAILLIB::A_SMTP; port = SMTP_PORT; } SMTPaccount::SMTPaccount( QString filename ) : Account() { file = filename; accountName = "New SMTP Account"; ssl = false; connectionType = 1; login = false; type = MAILLIB::A_SMTP; port = SMTP_PORT; } +QString SMTPaccount::getSignature() +{ + QFileInfo fi ( signature ); + if ( ! fi.exists() ) + return QString(); + + QFile file( signature ); + if (!file.open( IO_ReadOnly ) ) { + return QString(); + + } + QTextStream ts( &file ); + ts.setCodec( QTextCodec::codecForName("utf8") ); + QString text = ts.read(); + file.close(); + + return text; + +} +void SMTPaccount::setSignature( QString b ) +{ + + QFileInfo fi ( signature ); + if ( ! fi.exists() ) { + QString filedir( locateLocal("data", "kopiemail" ) ); + signature = filedir+ "/" + getAccountName() +".sig"; + qDebug("new sig %s ", signature.latin1()); + save(); + } + QFile fileIn( signature ); + if (!fileIn.open( IO_WriteOnly ) ) { + qDebug("OM: Cannot write signature file %s ", signature.latin1() ); + return ; + } + QTextStream tsIn( &fileIn ); + tsIn.setCodec( QTextCodec::codecForName("utf8") ); + tsIn << b ; + fileIn.close(); +} QString SMTPaccount::getUniqueFileName() { int num = 0; QString unique; QDir dir( locateLocal("data", "kopiemail" ) ); QStringList imap = dir.entryList( "smtp-*" ); do { unique.setNum( num++ ); } while ( imap.contains( "smtp-" + unique ) > 0 ); return unique; } void SMTPaccount::read() { KConfig *conf = new KConfig( getFileName() ); conf->setGroup( "SMTP Account" ); accountName = conf->readEntry( "Account" ); server = conf->readEntry( "Server" ); port = conf->readEntry( "Port" ); ssl = conf->readBoolEntry( "SSL" ); connectionType = conf->readNumEntry( "ConnectionType" ); login = conf->readBoolEntry( "Login" ); user = conf->readEntry( "User" ); - //password = conf->readEntryCrypt( "Password" ); + signature = conf->readEntry( "SigFile" ); setPasswordList( conf->readListEntry( "FolderHistory")); delete conf; } void SMTPaccount::save() { Settings::checkDirectory(); KConfig *conf = new KConfig( getFileName() ); conf->setGroup( "SMTP Account" ); conf->writeEntry( "Account", accountName ); conf->writeEntry( "Server", server ); conf->writeEntry( "Port", port ); conf->writeEntry( "SSL", ssl ); conf->writeEntry( "ConnectionType", connectionType ); conf->writeEntry( "Login", login ); conf->writeEntry( "User", user ); + conf->writeEntry( "SigFile", signature ); //conf->writeEntryCrypt( "Password", password ); conf->writeEntry( "FolderHistory",getPasswordList() ); conf->sync(); delete conf; } QString SMTPaccount::getFileName() { return locateLocal("data", "kopiemail" ) +"/smtp-" + file; } NNTPaccount::NNTPaccount() : Account() { file = NNTPaccount::getUniqueFileName(); accountName = "New NNTP Account"; ssl = false; login = false; type = MAILLIB::A_NNTP; port = NNTP_PORT; } NNTPaccount::NNTPaccount( QString filename ) : Account() { file = filename; accountName = "New NNTP Account"; ssl = false; login = false; type = MAILLIB::A_NNTP; port = NNTP_PORT; } QString NNTPaccount::getUniqueFileName() { int num = 0; QString unique; QDir dir( locateLocal("data", "kopiemail" ) ); QStringList imap = dir.entryList( "nntp-*" ); do { unique.setNum( num++ ); } while ( imap.contains( "nntp-" + unique ) > 0 ); return unique; } void NNTPaccount::read() { KConfig *conf = new KConfig( getFileName() ); conf->setGroup( "NNTP Account" ); accountName = conf->readEntry( "Account" ); server = conf->readEntry( "Server" ); port = conf->readEntry( "Port" ); ssl = conf->readBoolEntry( "SSL" ); login = conf->readBoolEntry( "Login" ); user = conf->readEntry( "User" ); //password = conf->readEntryCrypt( "Password" ); setPasswordList( conf->readListEntry( "FolderHistory")); subscribedGroups = conf->readListEntry( "Subscribed"); delete conf; } void NNTPaccount::save() { Settings::checkDirectory(); KConfig *conf = new KConfig( getFileName() ); conf->setGroup( "NNTP Account" ); conf->writeEntry( "Account", accountName ); conf->writeEntry( "Server", server ); conf->writeEntry( "Port", port ); conf->writeEntry( "SSL", ssl ); conf->writeEntry( "Login", login ); conf->writeEntry( "User", user ); //conf->writeEntryCrypt( "Password", password ); conf->writeEntry( "FolderHistory",getPasswordList() ); conf->writeEntry( "Subscribed" , subscribedGroups ); conf->sync(); delete conf; } QString NNTPaccount::getFileName() { return locateLocal("data", "kopiemail" ) +"/nntp-" + file; } diff --git a/kmicromail/libmailwrapper/settings.h b/kmicromail/libmailwrapper/settings.h index c996fe0..a6e95fe 100644 --- a/kmicromail/libmailwrapper/settings.h +++ b/kmicromail/libmailwrapper/settings.h @@ -34,149 +34,155 @@ public: void setUser(const QString&str){ user = str; } const QString&getUser()const{ return user; } void setPassword(const QString&str) { password = str; } const QString&getPassword()const { return password; } void setPasswordList(const QStringList &str); QStringList getPasswordList(); void setSSL( bool b ) { ssl = b; } bool getSSL() { return ssl; } void setConnectionType( int x ) { connectionType = x; } int ConnectionType() { return connectionType; } void setMaxMailSize( int x ) { maxMailSize = x; } int getMaxMailSize() { return maxMailSize; } void setOffline(bool b) {offline = b;} bool getOffline()const{return offline;} bool getLeaveOnServer(){ return leaveOnServer;} void setLeaveOnServer(bool b){ leaveOnServer = b;} virtual QString getFileName() { return accountName; } virtual void read() { ; } virtual void save() { ; } protected: QString accountName, server, port, user, password; bool ssl; int connectionType; bool offline; MAILLIB::ATYPE type; QString localFolder; int maxMailSize; QDateTime lastFetch; bool leaveOnServer; }; class IMAPaccount : public Account { public: IMAPaccount(); IMAPaccount( QString filename ); static QString getUniqueFileName(); virtual void read(); virtual void save(); virtual QString getFileName(); void setPrefix(const QString&str) {prefix=str;} const QString&getPrefix()const{return prefix;} private: QString file,prefix; }; class POP3account : public Account { public: POP3account(); POP3account( QString filename ); static QString getUniqueFileName(); virtual void read(); virtual void save(); virtual QString getFileName(); private: QString file; }; class SMTPaccount : public Account { public: SMTPaccount(); SMTPaccount( QString filename ); static QString getUniqueFileName(); virtual void read(); virtual void save(); virtual QString getFileName(); void setLogin( bool b ) { login = b; } bool getLogin() { return login; } + void setSigFile( QString b ) { signature = b; } + QString getSigFile() { return signature; } + + QString getSignature(); + void setSignature( QString b ); + private: QString file, name, mail, org, cc, bcc, reply, signature; bool useCC, useBCC, useReply, login; }; class NNTPaccount : public Account { public: NNTPaccount(); NNTPaccount( QString filename ); static QString getUniqueFileName(); virtual void read(); virtual void save(); virtual QString getFileName(); void setLogin( bool b ) { login = b; } bool getLogin() { return login; } void setGroups( QStringList list ) { subscribedGroups = list; } QStringList getGroups() { return subscribedGroups; } private: QString file; bool login; QStringList subscribedGroups; }; class Settings : public QObject { Q_OBJECT public: Settings(); //~Settings(){qDebug("-------------------settings "); }; QList<Account> getAccounts(); void addAccount(Account *account); void delAccount(Account *account); void saveAccounts(); void readAccounts(); static void checkDirectory(); private: void updateAccounts(); QList<Account> accounts; }; #endif diff --git a/kmicromail/main.cpp b/kmicromail/main.cpp index 006390c..1789da0 100644 --- a/kmicromail/main.cpp +++ b/kmicromail/main.cpp @@ -1,67 +1,67 @@ // CHANGED 2004-08-06 Lutz Rogowski #ifndef DESKTOP_VERSION #include <qpe/qpeapplication.h> #include <libkdepim/externalapphandler.h> #include <stdlib.h> #else #include <qapplication.h> #include <qstring.h> #include <qwindowsstyle.h> #include <qplatinumstyle.h> #include <qsgistyle.h> #endif #include "opiemail.h" #include <qdir.h> #include <kstandarddirs.h> #include <kglobal.h> #include <stdio.h> #include "mainwindow.h" #include "koprefs.h" #include <libkdepim/kpimglobalprefs.h> void dumpMissing(); //using namespace Opie::Core; int main( int argc, char **argv ) { #ifndef DESKTOP_VERSION QPEApplication a( argc, argv ); a.setKeepRunning (); #else QApplication a( argc, argv ); QApplication::setStyle( new QPlatinumStyle ()); #endif a.setFont( KOPrefs::instance()->mAppFont ); KGlobal::setAppName( "kopiemail" ); QString fileName ; #ifndef DESKTOP_VERSION fileName = getenv("QPEDIR"); if ( QApplication::desktop()->width() > 320 ) KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kopiemail/icons22/"); else KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kopiemail/"); #else - fileName = qApp->applicationDirPath () + "/kdepim/kopiemail/"; + fileName = qApp->applicationDirPath () + "/kdepim/kopiemail/icons22/"; KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); #endif KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kopiemail"))); KPimGlobalPrefs::instance()->setGlobalConfig(); OpieMail mw; #ifndef DESKTOP_VERSION //qDebug("CONNECT "); QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&mw, SLOT(message( const QCString&, const QByteArray& ))); // QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); a.showMainWidget(&mw ); #else a.setMainWidget(&mw ); mw.show(); //m.resize( 800, 600 ); QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); #endif int rv = a.exec(); dumpMissing(); KPimGlobalPrefs::instance()->writeConfig(); return rv; } diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp index 0794e00..4c58909 100644 --- a/kmicromail/mainwindow.cpp +++ b/kmicromail/mainwindow.cpp @@ -142,192 +142,194 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) griLay->addWidget( toLE = new QLineEdit( infoBox ),2,1) ; } infoBox->setMaximumHeight( infoBox->sizeHint().height() ); if ( !KOPrefs::instance()->mShowInfoStart ) { QTimer::singleShot( 1,splithor, SLOT ( toggle() ) ); } } folderView = new AccountView( split ); folderView->header()->hide(); folderView->setRootIsDecorated( false ); folderView->addColumn( i18n( "Mailbox" ) ); //layout->addWidget( folderView ); mailView = new QListView( split ); mailView->addColumn( i18n( " " ) ); mailView->addColumn( i18n( "Subject" ),QListView::Manual ); mailView->addColumn( i18n( "Sender" ),QListView::Manual ); mailView->addColumn( i18n( "Size" ),QListView::Manual); mailView->addColumn( i18n( "Date" ),QListView::Manual); if ( KOPrefs::instance()->mShowToField ) mailView->addColumn( i18n( "To" ),QListView::Manual); mailView->setAllColumnsShowFocus(true); //mailView->setSorting(-1); mailView->setRootIsDecorated( false ); statusWidget = new StatusWidget( wrapperBox ); statusWidget->hide(); //layout->addWidget( mailView ); //layout->setStretchFactor( folderView, 1 ); //layout->setStretchFactor( mailView, 2 ); slotAdjustLayout(); #ifndef DESKTOP_VERSION QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); if ( subLE ) QPEApplication::setStylusOperation( subLE ,QPEApplication::RightOnHold); if ( fromLE ) QPEApplication::setStylusOperation( fromLE ,QPEApplication::RightOnHold); if ( toLE ) QPEApplication::setStylusOperation( toLE ,QPEApplication::RightOnHold); #endif connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, SLOT( mailLeftClicked(QListViewItem*) ) ); connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, SLOT( mailLeftClicked(QListViewItem*) ) ); connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), this,SLOT(refreshMailView(const QValueList<RecMailP>&))); connect( mailView, SIGNAL( currentChanged (QListViewItem* )),this, SLOT( setInfoFields(QListViewItem*) ) ); connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); //mailView->setMultiSelection ( true ); mailView->setSelectionMode( QListView::Extended ); QValueList<int> list; int fw = 100; if ( QApplication::desktop()->width() > 320 ) fw = 50; list.append( fw ); list.append( 100 ); split->setSizes( list ); QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); mailView->setShowSortIndicator ( true ); QLabel *spacer = new QLabel( toolBar ); spacer->setBackgroundMode( QWidget::PaletteButton ); toolBar->setStretchableWidget( spacer ); QAction* closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this); connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); if ( QApplication::desktop()->width() > 320 ) closeMail->addTo(toolBar); closeMail->addTo(mailMenu); QPopupMenu* helpMenu = new QPopupMenu( menuBar ); menuBar->insertItem( i18n( "Help" ), helpMenu ); QAction* li = new QAction(i18n("About"), QPixmap(), 0, 0, this); connect( li, SIGNAL( activated() ), SLOT( showAbout()) ); li->addTo(helpMenu); li = new QAction(i18n("Licence"),QPixmap(), 0, 0, this); connect( li, SIGNAL( activated() ), SLOT( showLicence()) ); li->addTo(helpMenu); li = new QAction(i18n("LibEtPan Licence"), QPixmap(), 0, 0, this); connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) ); li->addTo(helpMenu); connect( codecMenu, SIGNAL( activated(int) ), this, SLOT( slotSetCodec( int )) ); slotSetCodec( KOPrefs::instance()->mCurrentCodec ); + menuBar->setMaximumWidth( menuBar->sizeHint().width()); + //menuBar->setMaximumSize( menuBar->sizeHint()); #ifdef DESKTOP_VERSION resize ( 640, 480 ); #endif } MainWindow::~MainWindow() { } void MainWindow::setInfoFields(QListViewItem* item ) { if ( item == 0) { if ( subLE ) subLE->setText(""); if ( fromLE ) fromLE->setText(""); if ( toLE ) toLE->setText(""); return; } RecMailP mail = ((MailListViewItem*)item)->data(); if ( subLE ) subLE->setText(mail->getSubject()); if ( fromLE ) fromLE->setText(mail->getFrom()); if ( toLE ) toLE->setText(mail->To().join(";" )); if ( subLE ) subLE->setCursorPosition(0); if ( fromLE ) fromLE->setCursorPosition(0); if ( toLE ) toLE->setCursorPosition(0); } void MainWindow::slotSetCodec( int codec ) { codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, false ); //qDebug("codec %d ", codec); KOPrefs::instance()->mCurrentCodec = codec; KOPrefs::instance()->isDirty = true; QString name; switch ( codec ) { case 0: name = "iso-8859-1"; break; case 1: name = "iso-8859-5"; break; case 2: name = "iso-8859-15"; break; case 3: name = "big-5"; break; case 4: name = "utf-8"; break; case 5: name = KOPrefs::instance()->mSendCodec.lower(); break; } KOPrefs::instance()->mCurrentCodeName = name ; codecMenu->changeItem ( 5, "Userdefined ("+KOPrefs::instance()->mSendCodec+")"); codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, true ); } void MainWindow::showLicence() { KApplication::showLicence(); } void MainWindow::showAbout() { QString version; #include <../version> QString cap = "About KOpieMail/Pi"; QString text = i18n("KOpieMail/Platform-independent\n") + "(OM/Pi) " + version + " - " #ifdef DESKTOP_VERSION "Desktop Edition\n" #else "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n" #endif "www.pi-sync.net\n\n" "Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.net>\n" "KOpieMail/Pi is based on Opie Mail\n" "Copyright (c) Rajko Albrecht and the Opie team\n" "KOpieMail/Pi is licensed under the GPL\n" "\n" "KOpieMail/Pi uses LibEtPan - a mail stuff library\n" "Copyright (C) 2001, 2002 - DINH Viet Hoa\n" "libEtPan has its own licence - see LibEtPan licence\n"; KApplication::showText( cap, text ); } void MainWindow::showEtpanLicence() { KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" ); } void MainWindow::appMessage(const QCString &, const QByteArray &) diff --git a/kmicromail/smtpconfigui.ui b/kmicromail/smtpconfigui.ui index ae0a49a..aae6f12 100644 --- a/kmicromail/smtpconfigui.ui +++ b/kmicromail/smtpconfigui.ui @@ -1,361 +1,378 @@ <!DOCTYPE UI><UI> <class>SMTPconfigUI</class> <include location="local">tr.h</include> <widget> <class>QDialog</class> <property stdset="1"> <name>name</name> <cstring>SMTPconfigUI</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>331</width> - <height>426</height> + <width>266</width> + <height>365</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>Configure SMTP</string> </property> <property> <name>layoutMargin</name> </property> <property> <name>layoutSpacing</name> </property> <vbox> <property stdset="1"> <name>margin</name> - <number>3</number> + <number>5</number> </property> <property stdset="1"> <name>spacing</name> - <number>3</number> + <number>2</number> </property> <widget> <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>accountLabel</cstring> </property> <property stdset="1"> <name>text</name> <string>Account</string> </property> </widget> <widget> <class>QLineEdit</class> <property stdset="1"> <name>name</name> <cstring>accountLine</cstring> </property> <property> <name>toolTip</name> <string>Name of the Account</string> </property> </widget> <widget> - <class>Line</class> - <property stdset="1"> - <name>name</name> - <cstring>line1</cstring> - </property> - <property stdset="1"> - <name>sizePolicy</name> - <sizepolicy> - <hsizetype>1</hsizetype> - <vsizetype>0</vsizetype> - </sizepolicy> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Horizontal</enum> - </property> - </widget> - <widget> <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> <cstring>Layout20</cstring> </property> <hbox> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget> <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> <cstring>Layout18</cstring> </property> <vbox> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget> <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>serverLabel</cstring> </property> <property stdset="1"> <name>text</name> <string>Server</string> </property> </widget> <widget> <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>portLabel</cstring> </property> <property stdset="1"> <name>text</name> <string>Port</string> </property> </widget> </vbox> </widget> <widget> <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> <cstring>Layout19</cstring> </property> <vbox> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget> <class>QLineEdit</class> <property stdset="1"> <name>name</name> <cstring>serverLine</cstring> </property> <property> <name>toolTip</name> <string>Name of the SMTP Server</string> </property> </widget> <widget> <class>QLineEdit</class> <property stdset="1"> <name>name</name> <cstring>portLine</cstring> </property> <property> <name>toolTip</name> <string>Port of the SMTP Server</string> </property> </widget> </vbox> </widget> </hbox> </widget> <widget> <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel1</cstring> </property> <property stdset="1"> <name>text</name> <string>Use secure sockets:</string> </property> </widget> <widget> <class>QComboBox</class> <property stdset="1"> <name>name</name> <cstring>ComboBox1</cstring> </property> </widget> <widget> <class>QLineEdit</class> <property stdset="1"> <name>name</name> <cstring>CommandEdit</cstring> </property> <property stdset="1"> <name>text</name> <string>ssh $SERVER exec</string> </property> </widget> <widget> - <class>Line</class> - <property stdset="1"> - <name>name</name> - <cstring>line2</cstring> - </property> - <property stdset="1"> - <name>sizePolicy</name> - <sizepolicy> - <hsizetype>1</hsizetype> - <vsizetype>0</vsizetype> - </sizepolicy> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Horizontal</enum> - </property> - </widget> - <widget> <class>QCheckBox</class> <property stdset="1"> <name>name</name> <cstring>loginBox</cstring> </property> <property stdset="1"> <name>text</name> <string>Use Login</string> </property> </widget> <widget> <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> <cstring>Layout17</cstring> </property> <hbox> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget> <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> <cstring>Layout15</cstring> </property> <vbox> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget> <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>userLabel</cstring> </property> <property stdset="1"> <name>text</name> <string>User</string> </property> </widget> <widget> <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>passLabel</cstring> </property> <property stdset="1"> <name>text</name> <string>Password</string> </property> </widget> </vbox> </widget> <widget> <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> <cstring>Layout16</cstring> </property> <vbox> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget> <class>QLineEdit</class> <property stdset="1"> <name>name</name> <cstring>userLine</cstring> </property> <property stdset="1"> <name>enabled</name> <bool>false</bool> </property> </widget> <widget> <class>QLineEdit</class> <property stdset="1"> <name>name</name> <cstring>passLine</cstring> </property> <property stdset="1"> <name>enabled</name> <bool>false</bool> </property> <property stdset="1"> <name>echoMode</name> <enum>Password</enum> </property> </widget> </vbox> </widget> </hbox> </widget> + <widget> + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Layout7</cstring> + </property> + <hbox> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>TextLabel1_2</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Signatur File</string> + </property> + </widget> + <widget> + <class>QLineEdit</class> + <property stdset="1"> + <name>name</name> + <cstring>SignaturEdit</cstring> + </property> + </widget> + <widget> + <class>QPushButton</class> + <property stdset="1"> + <name>name</name> + <cstring>SignaturButton</cstring> + </property> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + </sizepolicy> + </property> + <property stdset="1"> + <name>text</name> + <string>F</string> + </property> + </widget> + </hbox> + </widget> <spacer> <property> <name>name</name> <cstring>spacer</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> <tabstops> <tabstop>accountLine</tabstop> <tabstop>serverLine</tabstop> <tabstop>portLine</tabstop> <tabstop>loginBox</tabstop> <tabstop>userLine</tabstop> <tabstop>passLine</tabstop> </tabstops> </UI> |