author | zautrix <zautrix> | 2004-09-15 06:15:59 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-15 06:15:59 (UTC) |
commit | 35b8948c6c203473866c74f1d13185a848454e04 (patch) (side-by-side diff) | |
tree | b6d8eca9863cbca8e24d474d8c895065faa17458 /kmicromail/composemail.cpp | |
parent | f1f43030eefa765950cb501aece6cc71fb4e9859 (diff) | |
download | kdepimpi-35b8948c6c203473866c74f1d13185a848454e04.zip kdepimpi-35b8948c6c203473866c74f1d13185a848454e04.tar.gz kdepimpi-35b8948c6c203473866c74f1d13185a848454e04.tar.bz2 |
Mail config added
-rw-r--r-- | kmicromail/composemail.cpp | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp index 9b799b3..e6f7daa 100644 --- a/kmicromail/composemail.cpp +++ b/kmicromail/composemail.cpp @@ -3,99 +3,105 @@ #include "composemail.h" #include <libmailwrapper/smtpwrapper.h> #include <libmailwrapper/storemail.h> #include <libmailwrapper/abstractmail.h> #include <libmailwrapper/mailtypes.h> /* OPIE */ //#include <opie2/ofiledialog.h> //#include <opie2/odebug.h> #include <kfiledialog.h> //#include <qpe/resource.h> -#include <qpe/config.h> #include <qpe/global.h> //#include <qpe/contact.h> #include <qcombobox.h> #include <qcheckbox.h> #include <qtimer.h> #include <qmessagebox.h> #include <qpushbutton.h> #include <qmultilineedit.h> #include <qlabel.h> #include <qtabwidget.h> #include <qlistview.h> #include <kabc/addresseedialog.h> #include <kabc/stdaddressbook.h> #include <kabc/addressee.h> #ifdef DESKTOP_VERSION #include <kabc/addresseedialog.h> #else //DESKTOP_VERSION #include <libkdepim/externalapphandler.h> #endif //DESKTOP_VERSION +#include "koprefs.h" //using namespace Opie::Core; //using namespace Opie::Ui; ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal ) : ComposeMailUI( parent, name, modal ) { - mPickLineEdit = 0; 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 = s; 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, tr( "Hint" ), tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), tr( "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, tr( "Hint" ), tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), tr( "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 - Config cfg( "mail" ); - cfg.setGroup( "Compose" ); - checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); + + } else { + fillSettings(); + } + checkBoxLater->setChecked( KOPrefs::instance()->mSendLater ); attList->addColumn( tr( "Name" ) ); attList->addColumn( tr( "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() ) ); @@ -104,27 +110,39 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); mMail = 0; warnAttach = true; if ( smtpAccounts.count() > 0 ) { fillValues( smtpAccountBox->currentItem() ); } else { QMessageBox::information( 0, tr( "Problem" ), tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ), tr( "Ok" ) ); return; } connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); - + message->setFont ( KOPrefs::instance()->mComposeFont ); } +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::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() ); |