-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 @@ -9,13 +9,12 @@ /* 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> @@ -32,33 +31,36 @@ #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( ); @@ -76,20 +78,24 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m 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 ); @@ -110,15 +116,27 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m 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(); |