-rw-r--r-- | kmicromail/composemail.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp index 49fd14f..976e309 100644 --- a/kmicromail/composemail.cpp +++ b/kmicromail/composemail.cpp | |||
@@ -1,140 +1,144 @@ | |||
1 | // CHANGED 2004-08-06 Lutz Rogowski | 1 | // CHANGED 2004-08-06 Lutz Rogowski |
2 | 2 | ||
3 | 3 | ||
4 | #ifdef DESKTOP_VERSION | 4 | #ifdef DESKTOP_VERSION |
5 | #include <qapplication.h> | 5 | #include <qapplication.h> |
6 | #include <kabc/addresseedialog.h> | 6 | #include <kabc/addresseedialog.h> |
7 | #include <kabc/stdaddressbook.h> | 7 | #include <kabc/stdaddressbook.h> |
8 | #include <kabc/addressee.h> | 8 | #include <kabc/addressee.h> |
9 | #else | ||
10 | #include <qpe/qpeapplication.h> | ||
9 | #endif //DESKTOP_VERSION | 11 | #endif //DESKTOP_VERSION |
10 | #include <libkdepim/externalapphandler.h> | 12 | #include <libkdepim/externalapphandler.h> |
11 | 13 | ||
12 | #include "koprefs.h" | 14 | #include "koprefs.h" |
15 | #include <klocale.h> | ||
16 | #include <kglobal.h> | ||
13 | 17 | ||
14 | #ifdef MINIKDE_KDIALOG_H | 18 | #ifdef MINIKDE_KDIALOG_H |
15 | #undef MINIKDE_KDIALOG_H | 19 | #undef MINIKDE_KDIALOG_H |
16 | #endif | 20 | #endif |
17 | 21 | ||
18 | 22 | ||
19 | #include "composemail.h" | 23 | #include "composemail.h" |
20 | 24 | ||
21 | #include <libmailwrapper/smtpwrapper.h> | 25 | #include <libmailwrapper/smtpwrapper.h> |
22 | #include <libmailwrapper/storemail.h> | 26 | #include <libmailwrapper/storemail.h> |
23 | #include <libmailwrapper/abstractmail.h> | 27 | #include <libmailwrapper/abstractmail.h> |
24 | #include <libmailwrapper/mailtypes.h> | 28 | #include <libmailwrapper/mailtypes.h> |
25 | 29 | ||
26 | /* OPIE */ | 30 | /* OPIE */ |
27 | //#include <opie2/ofiledialog.h> | 31 | //#include <opie2/ofiledialog.h> |
28 | //#include <opie2/odebug.h> | 32 | //#include <opie2/odebug.h> |
29 | #include <kfiledialog.h> | 33 | #include <kfiledialog.h> |
30 | //#include <qpe/resource.h> | 34 | //#include <qpe/resource.h> |
31 | #include <qpe/global.h> | 35 | #include <qpe/global.h> |
32 | //#include <qpe/contact.h> | 36 | //#include <qpe/contact.h> |
33 | 37 | ||
34 | 38 | ||
35 | #include <qcombobox.h> | 39 | #include <qcombobox.h> |
36 | #include <qcheckbox.h> | 40 | #include <qcheckbox.h> |
37 | #include <qiconset.h> | 41 | #include <qiconset.h> |
38 | #include <qtimer.h> | 42 | #include <qtimer.h> |
39 | #include <qmessagebox.h> | 43 | #include <qmessagebox.h> |
40 | #include <qpushbutton.h> | 44 | #include <qpushbutton.h> |
41 | #include <qmultilineedit.h> | 45 | #include <qmultilineedit.h> |
42 | #include <qlabel.h> | 46 | #include <qlabel.h> |
43 | #include <qtabwidget.h> | 47 | #include <qtabwidget.h> |
44 | #include <qlistview.h> | 48 | #include <qlistview.h> |
45 | 49 | ||
46 | //using namespace Opie::Core; | 50 | //using namespace Opie::Core; |
47 | //using namespace Opie::Ui; | 51 | //using namespace Opie::Ui; |
48 | ComposeMail::ComposeMail( Settings *sett, QWidget *parent, const char *name, bool modal ) | 52 | ComposeMail::ComposeMail( Settings *sett, QWidget *parent, const char *name, bool modal ) |
49 | : ComposeMailUI( parent, name, modal ) | 53 | : ComposeMailUI( parent, name, modal ) |
50 | { | 54 | { |
51 | 55 | ||
52 | mPickLineEdit = 0; | 56 | mPickLineEdit = 0; |
53 | mEncoding = KOPrefs::instance()->mCurrentCodeName; | 57 | mEncoding = KOPrefs::instance()->mCurrentCodeName; |
54 | connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), | 58 | connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), |
55 | this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); | 59 | this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); |
56 | settings = sett; | 60 | settings = sett; |
57 | m_replyid = ""; | 61 | m_replyid = ""; |
58 | if ( KOPrefs::instance()->mUseKapi) { | 62 | if ( KOPrefs::instance()->mUseKapi) { |
59 | KConfig config( locateLocal("config", "kabcrc") ); | 63 | KConfig config( locateLocal("config", "kabcrc") ); |
60 | config.setGroup( "General" ); | 64 | config.setGroup( "General" ); |
61 | QString whoami_uid = config.readEntry( "WhoAmI" ); | 65 | QString whoami_uid = config.readEntry( "WhoAmI" ); |
62 | 66 | ||
63 | if ( whoami_uid.isEmpty() ) { | 67 | if ( whoami_uid.isEmpty() ) { |
64 | QMessageBox::information( 0, i18n( "Hint" ), | 68 | QMessageBox::information( 0, i18n( "Hint" ), |
65 | i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), | 69 | i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), |
66 | i18n( "Ok" ) ); | 70 | i18n( "Ok" ) ); |
67 | 71 | ||
68 | 72 | ||
69 | fillSettings(); | 73 | fillSettings(); |
70 | } else | 74 | } else |
71 | ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); | 75 | ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); |
72 | 76 | ||
73 | 77 | ||
74 | #ifdef DESKTOP_VERSION | 78 | #ifdef DESKTOP_VERSION |
75 | KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); | 79 | KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); |
76 | QStringList mails = con.emails(); | 80 | QStringList mails = con.emails(); |
77 | QString defmail = con.preferredEmail(); | 81 | QString defmail = con.preferredEmail(); |
78 | if ( mails.count() == 0) | 82 | if ( mails.count() == 0) |
79 | QMessageBox::information( 0, i18n( "Hint" ), | 83 | QMessageBox::information( 0, i18n( "Hint" ), |
80 | i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), | 84 | i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), |
81 | i18n( "Ok" ) ); | 85 | i18n( "Ok" ) ); |
82 | if (defmail.length()!=0) { | 86 | if (defmail.length()!=0) { |
83 | fromBox->insertItem(defmail); | 87 | fromBox->insertItem(defmail); |
84 | } | 88 | } |
85 | QStringList::ConstIterator sit = mails.begin(); | 89 | QStringList::ConstIterator sit = mails.begin(); |
86 | for (;sit!=mails.end();++sit) { | 90 | for (;sit!=mails.end();++sit) { |
87 | if ( (*sit)==defmail) | 91 | if ( (*sit)==defmail) |
88 | continue; | 92 | continue; |
89 | fromBox->insertItem((*sit)); | 93 | fromBox->insertItem((*sit)); |
90 | } | 94 | } |
91 | senderNameEdit->setText(con.formattedName()); | 95 | senderNameEdit->setText(con.formattedName()); |
92 | #endif | 96 | #endif |
93 | 97 | ||
94 | } else { | 98 | } else { |
95 | fillSettings(); | 99 | fillSettings(); |
96 | } | 100 | } |
97 | checkBoxLater->setChecked( KOPrefs::instance()->mSendLater ); | 101 | checkBoxLater->setChecked( KOPrefs::instance()->mSendLater ); |
98 | 102 | ||
99 | attList->addColumn( i18n( "Name" ) ); | 103 | attList->addColumn( i18n( "Name" ) ); |
100 | attList->addColumn( i18n( "Size" ) ); | 104 | attList->addColumn( i18n( "Size" ) ); |
101 | QList<Account> accounts = settings->getAccounts(); | 105 | QList<Account> accounts = settings->getAccounts(); |
102 | 106 | ||
103 | if ( QApplication::desktop()->width() < 320 ) | 107 | if ( QApplication::desktop()->width() < 320 ) |
104 | smtpAccountBox->setMaximumWidth( 80 ); | 108 | smtpAccountBox->setMaximumWidth( 80 ); |
105 | Account *it; | 109 | Account *it; |
106 | for ( it = accounts.first(); it; it = accounts.next() ) { | 110 | for ( it = accounts.first(); it; it = accounts.next() ) { |
107 | if ( it->getType()==MAILLIB::A_SMTP ) { | 111 | if ( it->getType()==MAILLIB::A_SMTP ) { |
108 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); | 112 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); |
109 | smtpAccountBox->insertItem( smtp->getAccountName() ); | 113 | smtpAccountBox->insertItem( smtp->getAccountName() ); |
110 | smtpAccounts.append( smtp ); | 114 | smtpAccounts.append( smtp ); |
111 | } | 115 | } |
112 | } | 116 | } |
113 | connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); | 117 | connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); |
114 | connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); | 118 | connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); |
115 | connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); | 119 | connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); |
116 | connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); | 120 | connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); |
117 | connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); | 121 | connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); |
118 | connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); | 122 | connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); |
119 | connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); | 123 | connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); |
120 | mMail = 0; | 124 | mMail = 0; |
121 | warnAttach = true; | 125 | warnAttach = true; |
122 | QIconSet icon; | 126 | QIconSet icon; |
123 | //icon = SmallIcon("fileexport"); | 127 | //icon = SmallIcon("fileexport"); |
124 | icon = SmallIcon("filesave"); | 128 | icon = SmallIcon("filesave"); |
125 | SaveButton->setIconSet (icon ) ; | 129 | SaveButton->setIconSet (icon ) ; |
126 | if ( QApplication::desktop()->width() < 320 ) { | 130 | if ( QApplication::desktop()->width() < 320 ) { |
127 | SaveButton->setText ("") ; | 131 | SaveButton->setText ("") ; |
128 | SaveButton->setMaximumSize ( SaveButton->sizeHint().height(),SaveButton->sizeHint().height()) ; | 132 | SaveButton->setMaximumSize ( SaveButton->sizeHint().height(),SaveButton->sizeHint().height()) ; |
129 | } | 133 | } |
130 | else | 134 | else |
131 | SaveButton->setText (i18n("Save")); | 135 | SaveButton->setText (i18n("Save")); |
132 | #ifndef DESKTOP_VERSION | 136 | #ifndef DESKTOP_VERSION |
133 | QPEApplication::setStylusOperation( message, QPEApplication::RightOnHold ); | 137 | QPEApplication::setStylusOperation( message, QPEApplication::RightOnHold ); |
134 | QPEApplication::setStylusOperation( senderNameEdit, QPEApplication::RightOnHold ); | 138 | QPEApplication::setStylusOperation( senderNameEdit, QPEApplication::RightOnHold ); |
135 | QPEApplication::setStylusOperation( subjectLine, QPEApplication::RightOnHold ); | 139 | QPEApplication::setStylusOperation( subjectLine, QPEApplication::RightOnHold ); |
136 | #endif | 140 | #endif |
137 | message->setFont ( KOPrefs::instance()->mComposeFont ); | 141 | message->setFont ( KOPrefs::instance()->mComposeFont ); |
138 | message->setWordWrap (QMultiLineEdit::WidgetWidth); | 142 | message->setWordWrap (QMultiLineEdit::WidgetWidth); |
139 | if ( smtpAccounts.count() > 0 ) { | 143 | if ( smtpAccounts.count() > 0 ) { |
140 | fillValues( smtpAccountBox->currentItem() ); | 144 | fillValues( smtpAccountBox->currentItem() ); |