summaryrefslogtreecommitdiffabout
path: root/kmicromail/composemail.cpp
Unidiff
Diffstat (limited to 'kmicromail/composemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/composemail.cpp30
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 @@
9 9
10/* OPIE */ 10/* OPIE */
11//#include <opie2/ofiledialog.h> 11//#include <opie2/ofiledialog.h>
12//#include <opie2/odebug.h> 12//#include <opie2/odebug.h>
13#include <kfiledialog.h> 13#include <kfiledialog.h>
14//#include <qpe/resource.h> 14//#include <qpe/resource.h>
15#include <qpe/config.h>
16#include <qpe/global.h> 15#include <qpe/global.h>
17//#include <qpe/contact.h> 16//#include <qpe/contact.h>
18 17
19 18
20#include <qcombobox.h> 19#include <qcombobox.h>
21#include <qcheckbox.h> 20#include <qcheckbox.h>
@@ -32,33 +31,36 @@
32#ifdef DESKTOP_VERSION 31#ifdef DESKTOP_VERSION
33#include <kabc/addresseedialog.h> 32#include <kabc/addresseedialog.h>
34#else //DESKTOP_VERSION 33#else //DESKTOP_VERSION
35#include <libkdepim/externalapphandler.h> 34#include <libkdepim/externalapphandler.h>
36#endif //DESKTOP_VERSION 35#endif //DESKTOP_VERSION
37 36
37#include "koprefs.h"
38 38
39//using namespace Opie::Core; 39//using namespace Opie::Core;
40//using namespace Opie::Ui; 40//using namespace Opie::Ui;
41ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal ) 41ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal )
42 : ComposeMailUI( parent, name, modal ) 42 : ComposeMailUI( parent, name, modal )
43{ 43{
44
45 mPickLineEdit = 0; 44 mPickLineEdit = 0;
46 connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), 45 connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)),
47 this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); 46 this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&)));
48 settings = s; 47 settings = s;
49 m_replyid = ""; 48 m_replyid = "";
49 if ( KOPrefs::instance()->mUseKapi) {
50 KConfig config( locateLocal("config", "kabcrc") ); 50 KConfig config( locateLocal("config", "kabcrc") );
51 config.setGroup( "General" ); 51 config.setGroup( "General" );
52 QString whoami_uid = config.readEntry( "WhoAmI" ); 52 QString whoami_uid = config.readEntry( "WhoAmI" );
53 53
54 if ( whoami_uid.isEmpty() ) { 54 if ( whoami_uid.isEmpty() ) {
55 QMessageBox::information( 0, tr( "Hint" ), 55 QMessageBox::information( 0, tr( "Hint" ),
56 tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), 56 tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
57 tr( "Ok" ) ); 57 tr( "Ok" ) );
58 58
59
60 fillSettings();
59 } else 61 } else
60 ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); 62 ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid);
61 63
62 64
63#ifdef DESKTOP_VERSION 65#ifdef DESKTOP_VERSION
64 KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); 66 KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( );
@@ -76,20 +78,24 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m
76 if ( (*sit)==defmail) 78 if ( (*sit)==defmail)
77 continue; 79 continue;
78 fromBox->insertItem((*sit)); 80 fromBox->insertItem((*sit));
79 } 81 }
80 senderNameEdit->setText(con.formattedName()); 82 senderNameEdit->setText(con.formattedName());
81#endif 83#endif
82 Config cfg( "mail" ); 84
83 cfg.setGroup( "Compose" ); 85 } else {
84 checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); 86 fillSettings();
87 }
88 checkBoxLater->setChecked( KOPrefs::instance()->mSendLater );
85 89
86 attList->addColumn( tr( "Name" ) ); 90 attList->addColumn( tr( "Name" ) );
87 attList->addColumn( tr( "Size" ) ); 91 attList->addColumn( tr( "Size" ) );
88 QList<Account> accounts = settings->getAccounts(); 92 QList<Account> accounts = settings->getAccounts();
89 93
94 if ( QApplication::desktop()->width() < 320 )
95 smtpAccountBox->setMaximumWidth( 80 );
90 Account *it; 96 Account *it;
91 for ( it = accounts.first(); it; it = accounts.next() ) { 97 for ( it = accounts.first(); it; it = accounts.next() ) {
92 if ( it->getType()==MAILLIB::A_SMTP ) { 98 if ( it->getType()==MAILLIB::A_SMTP ) {
93 SMTPaccount *smtp = static_cast<SMTPaccount *>(it); 99 SMTPaccount *smtp = static_cast<SMTPaccount *>(it);
94 smtpAccountBox->insertItem( smtp->getAccountName() ); 100 smtpAccountBox->insertItem( smtp->getAccountName() );
95 smtpAccounts.append( smtp ); 101 smtpAccounts.append( smtp );
@@ -110,15 +116,27 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m
110 QMessageBox::information( 0, tr( "Problem" ), 116 QMessageBox::information( 0, tr( "Problem" ),
111 tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ), 117 tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ),
112 tr( "Ok" ) ); 118 tr( "Ok" ) );
113 return; 119 return;
114 } 120 }
115 connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); 121 connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) );
116 122 message->setFont ( KOPrefs::instance()->mComposeFont );
117} 123}
118 124
125void ComposeMail::fillSettings()
126{
127 if ( QApplication::desktop()->width() < 320 )
128 fromBox->setMaximumWidth( 100 );
129 QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail);
130 QStringList::ConstIterator sit = mailList.begin();
131 int pref = 0;
132 for (;sit!=mailList.end();++sit) {
133 fromBox->insertItem((*sit));
134 }
135 senderNameEdit->setText(KOPrefs::instance()->mName);
136}
119 137
120 138
121void ComposeMail::saveAsDraft() 139void ComposeMail::saveAsDraft()
122{ 140{
123 141
124 Opie::Core::OSmartPointer<Mail> mail= new Mail(); 142 Opie::Core::OSmartPointer<Mail> mail= new Mail();