-rw-r--r-- | kmicromail/composemail.cpp | 4 | ||||
-rw-r--r-- | kmicromail/composemail.h | 4 | ||||
-rw-r--r-- | kmicromail/opiemail.cpp | 8 | ||||
-rw-r--r-- | kmicromail/opiemail.h | 4 |
4 files changed, 10 insertions, 10 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp index 14feeee..01dd406 100644 --- a/kmicromail/composemail.cpp +++ b/kmicromail/composemail.cpp | |||
@@ -1,138 +1,138 @@ | |||
1 | // CHANGED 2004-08-06 Lutz Rogowski | 1 | // CHANGED 2004-08-06 Lutz Rogowski |
2 | 2 | ||
3 | #include "composemail.h" | 3 | #include "composemail.h" |
4 | 4 | ||
5 | #include <libmailwrapper/smtpwrapper.h> | 5 | #include <libmailwrapper/smtpwrapper.h> |
6 | #include <libmailwrapper/storemail.h> | 6 | #include <libmailwrapper/storemail.h> |
7 | #include <libmailwrapper/abstractmail.h> | 7 | #include <libmailwrapper/abstractmail.h> |
8 | #include <libmailwrapper/mailtypes.h> | 8 | #include <libmailwrapper/mailtypes.h> |
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> | 15 | #include <qpe/config.h> |
16 | #include <qpe/global.h> | 16 | #include <qpe/global.h> |
17 | //#include <qpe/contact.h> | 17 | //#include <qpe/contact.h> |
18 | 18 | ||
19 | 19 | ||
20 | #include <qcombobox.h> | 20 | #include <qcombobox.h> |
21 | #include <qcheckbox.h> | 21 | #include <qcheckbox.h> |
22 | #include <qtimer.h> | 22 | #include <qtimer.h> |
23 | #include <qmessagebox.h> | 23 | #include <qmessagebox.h> |
24 | #include <qpushbutton.h> | 24 | #include <qpushbutton.h> |
25 | #include <qmultilineedit.h> | 25 | #include <qmultilineedit.h> |
26 | #include <qlabel.h> | 26 | #include <qlabel.h> |
27 | #include <qtabwidget.h> | 27 | #include <qtabwidget.h> |
28 | #include <qlistview.h> | 28 | #include <qlistview.h> |
29 | #include <kabc/addresseedialog.h> | 29 | #include <kabc/addresseedialog.h> |
30 | #include <kabc/stdaddressbook.h> | 30 | #include <kabc/stdaddressbook.h> |
31 | #include <kabc/addressee.h> | 31 | #include <kabc/addressee.h> |
32 | #ifdef DESKTOP_VERSION | 32 | #ifdef DESKTOP_VERSION |
33 | #include <kabc/addresseedialog.h> | 33 | #include <kabc/addresseedialog.h> |
34 | #else //DESKTOP_VERSION | 34 | #else //DESKTOP_VERSION |
35 | #include <libkdepim/externalapphandler.h> | 35 | #include <libkdepim/externalapphandler.h> |
36 | #endif //DESKTOP_VERSION | 36 | #endif //DESKTOP_VERSION |
37 | 37 | ||
38 | 38 | ||
39 | //using namespace Opie::Core; | 39 | //using namespace Opie::Core; |
40 | //using namespace Opie::Ui; | 40 | //using namespace Opie::Ui; |
41 | ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) | 41 | ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal ) |
42 | : ComposeMailUI( parent, name, modal, flags ) | 42 | : ComposeMailUI( parent, name, modal ) |
43 | { | 43 | { |
44 | 44 | ||
45 | mPickLineEdit = 0; | 45 | mPickLineEdit = 0; |
46 | connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), | 46 | 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&))); | 47 | this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); |
48 | settings = s; | 48 | settings = s; |
49 | m_replyid = ""; | 49 | m_replyid = ""; |
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 | if ( whoami_uid.isEmpty() ) { | 53 | if ( whoami_uid.isEmpty() ) { |
54 | QMessageBox::information( 0, tr( "Hint" ), | 54 | QMessageBox::information( 0, tr( "Hint" ), |
55 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), | 55 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), |
56 | tr( "Ok" ) ); | 56 | tr( "Ok" ) ); |
57 | 57 | ||
58 | } else | 58 | } else |
59 | bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); | 59 | bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); |
60 | #ifdef DESKTOP_VERSION | 60 | #ifdef DESKTOP_VERSION |
61 | KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); | 61 | KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); |
62 | QStringList mails = con.emails(); | 62 | QStringList mails = con.emails(); |
63 | QString defmail = con.preferredEmail(); | 63 | QString defmail = con.preferredEmail(); |
64 | if ( mails.count() == 0) | 64 | if ( mails.count() == 0) |
65 | QMessageBox::information( 0, tr( "Hint" ), | 65 | QMessageBox::information( 0, tr( "Hint" ), |
66 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), | 66 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), |
67 | tr( "Ok" ) ); | 67 | tr( "Ok" ) ); |
68 | if (defmail.length()!=0) { | 68 | if (defmail.length()!=0) { |
69 | fromBox->insertItem(defmail); | 69 | fromBox->insertItem(defmail); |
70 | } | 70 | } |
71 | QStringList::ConstIterator sit = mails.begin(); | 71 | QStringList::ConstIterator sit = mails.begin(); |
72 | for (;sit!=mails.end();++sit) { | 72 | for (;sit!=mails.end();++sit) { |
73 | if ( (*sit)==defmail) | 73 | if ( (*sit)==defmail) |
74 | continue; | 74 | continue; |
75 | fromBox->insertItem((*sit)); | 75 | fromBox->insertItem((*sit)); |
76 | } | 76 | } |
77 | senderNameEdit->setText(con.formattedName()); | 77 | senderNameEdit->setText(con.formattedName()); |
78 | #endif | 78 | #endif |
79 | Config cfg( "mail" ); | 79 | Config cfg( "mail" ); |
80 | cfg.setGroup( "Compose" ); | 80 | cfg.setGroup( "Compose" ); |
81 | checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); | 81 | checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); |
82 | 82 | ||
83 | attList->addColumn( tr( "Name" ) ); | 83 | attList->addColumn( tr( "Name" ) ); |
84 | attList->addColumn( tr( "Size" ) ); | 84 | attList->addColumn( tr( "Size" ) ); |
85 | 85 | ||
86 | QList<Account> accounts = settings->getAccounts(); | 86 | QList<Account> accounts = settings->getAccounts(); |
87 | 87 | ||
88 | Account *it; | 88 | Account *it; |
89 | for ( it = accounts.first(); it; it = accounts.next() ) { | 89 | for ( it = accounts.first(); it; it = accounts.next() ) { |
90 | if ( it->getType()==MAILLIB::A_SMTP ) { | 90 | if ( it->getType()==MAILLIB::A_SMTP ) { |
91 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); | 91 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); |
92 | smtpAccountBox->insertItem( smtp->getAccountName() ); | 92 | smtpAccountBox->insertItem( smtp->getAccountName() ); |
93 | smtpAccounts.append( smtp ); | 93 | smtpAccounts.append( smtp ); |
94 | } | 94 | } |
95 | } | 95 | } |
96 | if ( smtpAccounts.count() > 0 ) { | 96 | if ( smtpAccounts.count() > 0 ) { |
97 | fillValues( smtpAccountBox->currentItem() ); | 97 | fillValues( smtpAccountBox->currentItem() ); |
98 | } else { | 98 | } else { |
99 | QMessageBox::information( 0, tr( "Problem" ), | 99 | QMessageBox::information( 0, tr( "Problem" ), |
100 | tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ), | 100 | tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ), |
101 | tr( "Ok" ) ); | 101 | tr( "Ok" ) ); |
102 | return; | 102 | return; |
103 | } | 103 | } |
104 | connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); | 104 | connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); |
105 | connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); | 105 | connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); |
106 | connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); | 106 | connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); |
107 | connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); | 107 | connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); |
108 | connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); | 108 | connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); |
109 | connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); | 109 | connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); |
110 | connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); | 110 | connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); |
111 | connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); | 111 | connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); |
112 | mMail = 0; | 112 | mMail = 0; |
113 | warnAttach = true; | 113 | warnAttach = true; |
114 | 114 | ||
115 | } | 115 | } |
116 | 116 | ||
117 | 117 | ||
118 | 118 | ||
119 | void ComposeMail::saveAsDraft() | 119 | void ComposeMail::saveAsDraft() |
120 | { | 120 | { |
121 | 121 | ||
122 | Opie::Core::OSmartPointer<Mail> mail= new Mail(); | 122 | Opie::Core::OSmartPointer<Mail> mail= new Mail(); |
123 | mail->setMail(fromBox->currentText()); | 123 | mail->setMail(fromBox->currentText()); |
124 | mail->setTo( toLine->text() ); | 124 | mail->setTo( toLine->text() ); |
125 | mail->setName(senderNameEdit->text()); | 125 | mail->setName(senderNameEdit->text()); |
126 | mail->setCC( ccLine->text() ); | 126 | mail->setCC( ccLine->text() ); |
127 | mail->setBCC( bccLine->text() ); | 127 | mail->setBCC( bccLine->text() ); |
128 | mail->setReply( replyLine->text() ); | 128 | mail->setReply( replyLine->text() ); |
129 | mail->setSubject( subjectLine->text() ); | 129 | mail->setSubject( subjectLine->text() ); |
130 | if (!m_replyid.isEmpty()) { | 130 | if (!m_replyid.isEmpty()) { |
131 | QStringList ids; | 131 | QStringList ids; |
132 | ids.append(m_replyid); | 132 | ids.append(m_replyid); |
133 | mail->setInreply(ids); | 133 | mail->setInreply(ids); |
134 | } | 134 | } |
135 | QString txt = message->text(); | 135 | QString txt = message->text(); |
136 | if ( !sigMultiLine->text().isEmpty() ) { | 136 | if ( !sigMultiLine->text().isEmpty() ) { |
137 | txt.append( "\n--\n" ); | 137 | txt.append( "\n--\n" ); |
138 | txt.append( sigMultiLine->text() ); | 138 | txt.append( sigMultiLine->text() ); |
diff --git a/kmicromail/composemail.h b/kmicromail/composemail.h index 657f665..e20d9e1 100644 --- a/kmicromail/composemail.h +++ b/kmicromail/composemail.h | |||
@@ -1,90 +1,90 @@ | |||
1 | #ifndef COMPOSEMAIL_H | 1 | #ifndef COMPOSEMAIL_H |
2 | #define COMPOSEMAIL_H | 2 | #define COMPOSEMAIL_H |
3 | 3 | ||
4 | #include <qlineedit.h> | 4 | #include <qlineedit.h> |
5 | #include <qlistview.h> | 5 | #include <qlistview.h> |
6 | 6 | ||
7 | #include "composemailui.h" | 7 | #include "composemailui.h" |
8 | //#include "addresspickerui.h" | 8 | //#include "addresspickerui.h" |
9 | #include <libmailwrapper/settings.h> | 9 | #include <libmailwrapper/settings.h> |
10 | #include <libmailwrapper/mailwrapper.h> | 10 | #include <libmailwrapper/mailwrapper.h> |
11 | 11 | ||
12 | class RecMail; | 12 | class RecMail; |
13 | 13 | ||
14 | #include <opie2/osmartpointer.h> | 14 | #include <opie2/osmartpointer.h> |
15 | #if 0 | 15 | #if 0 |
16 | class AddressPicker : public AddressPickerUI | 16 | class AddressPicker : public AddressPickerUI |
17 | { | 17 | { |
18 | //Q_OBJECT | 18 | //Q_OBJECT |
19 | 19 | ||
20 | public: | 20 | public: |
21 | AddressPicker( QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 ); | 21 | AddressPicker( QWidget *parent = 0, const char *name = 0, bool modal = false ); |
22 | static QString getNames(); | 22 | static QString getNames(); |
23 | 23 | ||
24 | protected: | 24 | protected: |
25 | QString selectedNames; | 25 | QString selectedNames; |
26 | void accept(); | 26 | void accept(); |
27 | 27 | ||
28 | }; | 28 | }; |
29 | #endif | 29 | #endif |
30 | class RecMail; | 30 | class RecMail; |
31 | 31 | ||
32 | class ComposeMail : public ComposeMailUI | 32 | class ComposeMail : public ComposeMailUI |
33 | { | 33 | { |
34 | Q_OBJECT | 34 | Q_OBJECT |
35 | 35 | ||
36 | public: | 36 | public: |
37 | 37 | ||
38 | ComposeMail( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 ); | 38 | ComposeMail( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = false ); |
39 | virtual ~ComposeMail(); | 39 | virtual ~ComposeMail(); |
40 | 40 | ||
41 | void reEditMail(const Opie::Core::OSmartPointer<RecMail>¤t); | 41 | void reEditMail(const Opie::Core::OSmartPointer<RecMail>¤t); |
42 | 42 | ||
43 | public slots: | 43 | public slots: |
44 | void slotAdjustColumns(); | 44 | void slotAdjustColumns(); |
45 | 45 | ||
46 | void setTo( const QString & to ); | 46 | void setTo( const QString & to ); |
47 | void setSubject( const QString & subject ); | 47 | void setSubject( const QString & subject ); |
48 | void setInReplyTo( const QString & messageId ); | 48 | void setInReplyTo( const QString & messageId ); |
49 | void setMessage( const QString & text ); | 49 | void setMessage( const QString & text ); |
50 | void insertAttendees(const QString&, const QStringList& namelist, const QStringList& emaillist, const QStringList& uidlist); | 50 | void insertAttendees(const QString&, const QStringList& namelist, const QStringList& emaillist, const QStringList& uidlist); |
51 | 51 | ||
52 | 52 | ||
53 | protected slots: | 53 | protected slots: |
54 | void accept(); | 54 | void accept(); |
55 | void reject(); | 55 | void reject(); |
56 | 56 | ||
57 | private slots: | 57 | private slots: |
58 | void fillValues( int current ); | 58 | void fillValues( int current ); |
59 | void pickAddress(); | 59 | void pickAddress(); |
60 | void pickAddressTo(); | 60 | void pickAddressTo(); |
61 | void pickAddressCC(); | 61 | void pickAddressCC(); |
62 | void pickAddressBCC(); | 62 | void pickAddressBCC(); |
63 | void pickAddressReply(); | 63 | void pickAddressReply(); |
64 | void saveAsDraft(); | 64 | void saveAsDraft(); |
65 | void addAttachment(); | 65 | void addAttachment(); |
66 | void removeAttachment(); | 66 | void removeAttachment(); |
67 | void clearStatus(); | 67 | void clearStatus(); |
68 | void setStatus( QString ); | 68 | void setStatus( QString ); |
69 | 69 | ||
70 | protected: | 70 | protected: |
71 | QLineEdit* mPickLineEdit; | 71 | QLineEdit* mPickLineEdit; |
72 | Opie::Core::OSmartPointer<Mail> mMail; | 72 | Opie::Core::OSmartPointer<Mail> mMail; |
73 | Settings *settings; | 73 | Settings *settings; |
74 | QList<SMTPaccount> smtpAccounts; | 74 | QList<SMTPaccount> smtpAccounts; |
75 | QString m_replyid; | 75 | QString m_replyid; |
76 | bool warnAttach; | 76 | bool warnAttach; |
77 | }; | 77 | }; |
78 | 78 | ||
79 | class AttachViewItem : public QListViewItem | 79 | class AttachViewItem : public QListViewItem |
80 | { | 80 | { |
81 | public: | 81 | public: |
82 | AttachViewItem( QListView *parent, Attachment *att ); | 82 | AttachViewItem( QListView *parent, Attachment *att ); |
83 | Attachment *getAttachment() { return attachment; } | 83 | Attachment *getAttachment() { return attachment; } |
84 | 84 | ||
85 | private: | 85 | private: |
86 | Attachment *attachment; | 86 | Attachment *attachment; |
87 | 87 | ||
88 | }; | 88 | }; |
89 | 89 | ||
90 | #endif | 90 | #endif |
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index a1c5645..0c581c0 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp | |||
@@ -1,212 +1,212 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | // CHANGED 2004-08-06 Lutz Rogowski | 2 | // CHANGED 2004-08-06 Lutz Rogowski |
3 | 3 | ||
4 | #include "settingsdialog.h" | 4 | #include "settingsdialog.h" |
5 | #include "opiemail.h" | 5 | #include "opiemail.h" |
6 | #include "editaccounts.h" | 6 | #include "editaccounts.h" |
7 | #include "composemail.h" | 7 | #include "composemail.h" |
8 | #include "mailistviewitem.h" | 8 | #include "mailistviewitem.h" |
9 | #include "viewmail.h" | 9 | #include "viewmail.h" |
10 | #include "selectstore.h" | 10 | #include "selectstore.h" |
11 | #include "selectsmtp.h" | 11 | #include "selectsmtp.h" |
12 | 12 | ||
13 | #include <qmessagebox.h> | 13 | #include <qmessagebox.h> |
14 | #include <libkdepim/externalapphandler.h> | 14 | #include <libkdepim/externalapphandler.h> |
15 | 15 | ||
16 | #include <qpe/qpeapplication.h> | 16 | #include <qpe/qpeapplication.h> |
17 | #include <libmailwrapper/smtpwrapper.h> | 17 | #include <libmailwrapper/smtpwrapper.h> |
18 | #include <libmailwrapper/mailtypes.h> | 18 | #include <libmailwrapper/mailtypes.h> |
19 | #include <libmailwrapper/abstractmail.h> | 19 | #include <libmailwrapper/abstractmail.h> |
20 | /* OPIE */ | 20 | /* OPIE */ |
21 | //#include <qpe/resource.h> | 21 | //#include <qpe/resource.h> |
22 | //#include <qpe/qpeapplication.h> | 22 | //#include <qpe/qpeapplication.h> |
23 | 23 | ||
24 | /* QT */ | 24 | /* QT */ |
25 | 25 | ||
26 | using namespace Opie::Core; | 26 | //using namespace Opie::Core; |
27 | 27 | ||
28 | OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) | 28 | OpieMail::OpieMail( QWidget *parent, const char *name ) |
29 | : MainWindow( parent, name) //, WStyle_ContextHelp ) | 29 | : MainWindow( parent, name) //, WStyle_ContextHelp ) |
30 | { | 30 | { |
31 | settings = new Settings(); | 31 | settings = new Settings(); |
32 | 32 | ||
33 | folderView->populate( settings->getAccounts() ); | 33 | folderView->populate( settings->getAccounts() ); |
34 | 34 | ||
35 | } | 35 | } |
36 | 36 | ||
37 | OpieMail::~OpieMail() | 37 | OpieMail::~OpieMail() |
38 | { | 38 | { |
39 | if (settings) delete settings; | 39 | if (settings) delete settings; |
40 | } | 40 | } |
41 | 41 | ||
42 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) | 42 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) |
43 | { | 43 | { |
44 | 44 | ||
45 | } | 45 | } |
46 | #include <stdlib.h> | 46 | #include <stdlib.h> |
47 | void OpieMail::message(const QCString &msg, const QByteArray &data) | 47 | void OpieMail::message(const QCString &msg, const QByteArray &data) |
48 | { | 48 | { |
49 | // copied from old mail2 | 49 | // copied from old mail2 |
50 | static int ii = 0; | 50 | static int ii = 0; |
51 | qDebug("call ############################# %d ", ii); | 51 | qDebug("call ############################# %d ", ii); |
52 | // block second call | 52 | // block second call |
53 | if ( ii < 2 ) { | 53 | if ( ii < 2 ) { |
54 | //++ii; | 54 | //++ii; |
55 | if ( ii > 1 ) { | 55 | if ( ii > 1 ) { |
56 | qDebug("qcop call blocked "); | 56 | qDebug("qcop call blocked "); |
57 | //return; | 57 | //return; |
58 | } | 58 | } |
59 | } | 59 | } |
60 | ++ii; | 60 | ++ii; |
61 | //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); | 61 | //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); |
62 | if (msg == "writeMail(QString,QString)") | 62 | if (msg == "writeMail(QString,QString)") |
63 | { | 63 | { |
64 | QDataStream stream(data,IO_ReadOnly); | 64 | QDataStream stream(data,IO_ReadOnly); |
65 | QString name, email; | 65 | QString name, email; |
66 | stream >> name >> email; | 66 | stream >> name >> email; |
67 | // removing the whitespaces at beginning and end is needed! | 67 | // removing the whitespaces at beginning and end is needed! |
68 | slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); | 68 | slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); |
69 | } | 69 | } |
70 | else if (msg == "newMail()") | 70 | else if (msg == "newMail()") |
71 | { | 71 | { |
72 | slotComposeMail(); | 72 | slotComposeMail(); |
73 | } | 73 | } |
74 | else if (msg == "newMail(QString)") | 74 | else if (msg == "newMail(QString)") |
75 | { | 75 | { |
76 | QDataStream stream(data,IO_ReadOnly); | 76 | QDataStream stream(data,IO_ReadOnly); |
77 | QString nameemail; | 77 | QString nameemail; |
78 | stream >> nameemail; | 78 | stream >> nameemail; |
79 | // the format is | 79 | // the format is |
80 | // NAME <EMAIL>:SUBJECT | 80 | // NAME <EMAIL>:SUBJECT |
81 | //qDebug("message %s ", nameemail.latin1()); | 81 | //qDebug("message %s ", nameemail.latin1()); |
82 | 82 | ||
83 | slotwriteMail2( nameemail ); | 83 | slotwriteMail2( nameemail ); |
84 | } else | 84 | } else |
85 | ExternalAppHandler::instance()->appMessage ( msg, data); | 85 | ExternalAppHandler::instance()->appMessage ( msg, data); |
86 | } | 86 | } |
87 | void OpieMail::slotwriteMail2(const QString& namemail ) | 87 | void OpieMail::slotwriteMail2(const QString& namemail ) |
88 | { | 88 | { |
89 | // qDebug("OpieMail::slotwriteMail2 "); | 89 | // qDebug("OpieMail::slotwriteMail2 "); |
90 | qApp->processEvents(); | 90 | qApp->processEvents(); |
91 | ComposeMail compose( settings, this, 0, true ); | 91 | ComposeMail compose( settings, this, 0, true ); |
92 | if ( !namemail.isEmpty() ) { | 92 | if ( !namemail.isEmpty() ) { |
93 | QString to = namemail; | 93 | QString to = namemail; |
94 | if ( namemail.find( " <") > 1 ) { | 94 | if ( namemail.find( " <") > 1 ) { |
95 | to = "\"" +to.replace( QRegExp( " <"), "\" <") ; | 95 | to = "\"" +to.replace( QRegExp( " <"), "\" <") ; |
96 | } else | 96 | } else |
97 | if ( namemail.find( "<") > 1 ) { | 97 | if ( namemail.find( "<") > 1 ) { |
98 | to = "\"" +to.replace( QRegExp( "<"), "\" <") ; | 98 | to = "\"" +to.replace( QRegExp( "<"), "\" <") ; |
99 | } | 99 | } |
100 | int sub = to.find( ">:"); | 100 | int sub = to.find( ">:"); |
101 | if ( sub > 0 ) { | 101 | if ( sub > 0 ) { |
102 | compose.setTo( to.left(sub+1) ); | 102 | compose.setTo( to.left(sub+1) ); |
103 | compose.setSubject( to.mid(sub+2) ); | 103 | compose.setSubject( to.mid(sub+2) ); |
104 | } else | 104 | } else |
105 | compose.setTo( to ); | 105 | compose.setTo( to ); |
106 | } | 106 | } |
107 | compose.slotAdjustColumns(); | 107 | compose.slotAdjustColumns(); |
108 | compose.showMaximized(); | 108 | compose.showMaximized(); |
109 | compose.exec(); | 109 | compose.exec(); |
110 | raise(); | 110 | raise(); |
111 | //qDebug("retttich "); | 111 | //qDebug("retttich "); |
112 | } | 112 | } |
113 | void OpieMail::slotwriteMail(const QString&name,const QString&email) | 113 | void OpieMail::slotwriteMail(const QString&name,const QString&email) |
114 | { | 114 | { |
115 | // qDebug("OpieMail::slotwriteMail "); | 115 | // qDebug("OpieMail::slotwriteMail "); |
116 | ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); | 116 | ComposeMail compose( settings, this, 0, true ); |
117 | if (!email.isEmpty()) | 117 | if (!email.isEmpty()) |
118 | { | 118 | { |
119 | if (!name.isEmpty()) | 119 | if (!name.isEmpty()) |
120 | { | 120 | { |
121 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); | 121 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); |
122 | } | 122 | } |
123 | else | 123 | else |
124 | { | 124 | { |
125 | compose.setTo(email); | 125 | compose.setTo(email); |
126 | } | 126 | } |
127 | } | 127 | } |
128 | compose.slotAdjustColumns(); | 128 | compose.slotAdjustColumns(); |
129 | compose.showMaximized(); | 129 | compose.showMaximized(); |
130 | compose.exec(); | 130 | compose.exec(); |
131 | } | 131 | } |
132 | 132 | ||
133 | void OpieMail::slotComposeMail() | 133 | void OpieMail::slotComposeMail() |
134 | { | 134 | { |
135 | slotwriteMail2( QString () ); | 135 | slotwriteMail2( QString () ); |
136 | //slotwriteMail(0l,0l); | 136 | //slotwriteMail(0l,0l); |
137 | } | 137 | } |
138 | 138 | ||
139 | void OpieMail::slotSendQueued() | 139 | void OpieMail::slotSendQueued() |
140 | { | 140 | { |
141 | SMTPaccount *smtp = 0; | 141 | SMTPaccount *smtp = 0; |
142 | 142 | ||
143 | QList<Account> list = settings->getAccounts(); | 143 | QList<Account> list = settings->getAccounts(); |
144 | QList<SMTPaccount> smtpList; | 144 | QList<SMTPaccount> smtpList; |
145 | smtpList.setAutoDelete(false); | 145 | smtpList.setAutoDelete(false); |
146 | Account *it; | 146 | Account *it; |
147 | for ( it = list.first(); it; it = list.next() ) | 147 | for ( it = list.first(); it; it = list.next() ) |
148 | { | 148 | { |
149 | if ( it->getType() == MAILLIB::A_SMTP ) | 149 | if ( it->getType() == MAILLIB::A_SMTP ) |
150 | { | 150 | { |
151 | smtp = static_cast<SMTPaccount *>(it); | 151 | smtp = static_cast<SMTPaccount *>(it); |
152 | smtpList.append(smtp); | 152 | smtpList.append(smtp); |
153 | } | 153 | } |
154 | } | 154 | } |
155 | if (smtpList.count()==0) | 155 | if (smtpList.count()==0) |
156 | { | 156 | { |
157 | QMessageBox::information(0,tr("Info"),tr("Define a smtp account first!\n")); | 157 | QMessageBox::information(0,tr("Info"),tr("Define a smtp account first!\n")); |
158 | return; | 158 | return; |
159 | } | 159 | } |
160 | if (smtpList.count()==1) | 160 | if (smtpList.count()==1) |
161 | { | 161 | { |
162 | smtp = smtpList.at(0); | 162 | smtp = smtpList.at(0); |
163 | } | 163 | } |
164 | else | 164 | else |
165 | { | 165 | { |
166 | smtp = 0; | 166 | smtp = 0; |
167 | selectsmtp selsmtp; | 167 | selectsmtp selsmtp; |
168 | selsmtp.setSelectionlist(&smtpList); | 168 | selsmtp.setSelectionlist(&smtpList); |
169 | selsmtp.showMaximized(); | 169 | selsmtp.showMaximized(); |
170 | if ( selsmtp.exec() == QDialog::Accepted ) | 170 | if ( selsmtp.exec() == QDialog::Accepted ) |
171 | { | 171 | { |
172 | smtp = selsmtp.selected_smtp(); | 172 | smtp = selsmtp.selected_smtp(); |
173 | } | 173 | } |
174 | } | 174 | } |
175 | if (smtp) | 175 | if (smtp) |
176 | { | 176 | { |
177 | SMTPwrapper * wrap = new SMTPwrapper(smtp); | 177 | SMTPwrapper * wrap = new SMTPwrapper(smtp); |
178 | if ( wrap->flushOutbox() ) | 178 | if ( wrap->flushOutbox() ) |
179 | { | 179 | { |
180 | QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); | 180 | QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); |
181 | } | 181 | } |
182 | delete wrap; | 182 | delete wrap; |
183 | } | 183 | } |
184 | } | 184 | } |
185 | 185 | ||
186 | void OpieMail::slotSearchMails() | 186 | void OpieMail::slotSearchMails() |
187 | { | 187 | { |
188 | qDebug("OpieMail::slotSearchMails():not implemented "); | 188 | qDebug("OpieMail::slotSearchMails():not implemented "); |
189 | } | 189 | } |
190 | 190 | ||
191 | void OpieMail::slotEditSettings() | 191 | void OpieMail::slotEditSettings() |
192 | { | 192 | { |
193 | SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); | 193 | SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); |
194 | settingsDialog.showMaximized(); | 194 | settingsDialog.showMaximized(); |
195 | settingsDialog.exec(); | 195 | settingsDialog.exec(); |
196 | } | 196 | } |
197 | 197 | ||
198 | void OpieMail::slotEditAccounts() | 198 | void OpieMail::slotEditAccounts() |
199 | { | 199 | { |
200 | EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); | 200 | EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); |
201 | eaDialog.slotAdjustColumns(); | 201 | eaDialog.slotAdjustColumns(); |
202 | eaDialog.showMaximized(); | 202 | eaDialog.showMaximized(); |
203 | eaDialog.exec(); | 203 | eaDialog.exec(); |
204 | if ( settings ) delete settings; | 204 | if ( settings ) delete settings; |
205 | settings = new Settings(); | 205 | settings = new Settings(); |
206 | 206 | ||
207 | folderView->populate( settings->getAccounts() ); | 207 | folderView->populate( settings->getAccounts() ); |
208 | } | 208 | } |
209 | 209 | ||
210 | void OpieMail::displayMail() | 210 | void OpieMail::displayMail() |
211 | { | 211 | { |
212 | QListViewItem*item = mailView->currentItem(); | 212 | QListViewItem*item = mailView->currentItem(); |
@@ -324,102 +324,102 @@ void OpieMail::refreshMailView(const QValueList<RecMailP>&list) | |||
324 | item->storeData((*it)); | 324 | item->storeData((*it)); |
325 | item->showEntry(); | 325 | item->showEntry(); |
326 | } | 326 | } |
327 | } | 327 | } |
328 | 328 | ||
329 | void OpieMail::mailLeftClicked( QListViewItem *item ) | 329 | void OpieMail::mailLeftClicked( QListViewItem *item ) |
330 | { | 330 | { |
331 | mailView->clearSelection(); | 331 | mailView->clearSelection(); |
332 | /* just LEFT button - or tap with stylus on pda */ | 332 | /* just LEFT button - or tap with stylus on pda */ |
333 | //if (button!=1) return; | 333 | //if (button!=1) return; |
334 | if (!item) return; | 334 | if (!item) return; |
335 | if (folderView->currentisDraft()) { | 335 | if (folderView->currentisDraft()) { |
336 | reEditMail(); | 336 | reEditMail(); |
337 | } else { | 337 | } else { |
338 | displayMail(); | 338 | displayMail(); |
339 | } | 339 | } |
340 | } | 340 | } |
341 | 341 | ||
342 | void OpieMail::slotMoveCopyMail() | 342 | void OpieMail::slotMoveCopyMail() |
343 | { | 343 | { |
344 | if (!mailView->currentItem()) return; | 344 | if (!mailView->currentItem()) return; |
345 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 345 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
346 | AbstractMail*targetMail = 0; | 346 | AbstractMail*targetMail = 0; |
347 | QString targetFolder = ""; | 347 | QString targetFolder = ""; |
348 | Selectstore sels; | 348 | Selectstore sels; |
349 | folderView->setupFolderselect(&sels); | 349 | folderView->setupFolderselect(&sels); |
350 | if (!sels.exec()) return; | 350 | if (!sels.exec()) return; |
351 | targetMail = sels.currentMail(); | 351 | targetMail = sels.currentMail(); |
352 | targetFolder = sels.currentFolder(); | 352 | targetFolder = sels.currentFolder(); |
353 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || | 353 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || |
354 | targetFolder.isEmpty()) | 354 | targetFolder.isEmpty()) |
355 | { | 355 | { |
356 | return; | 356 | return; |
357 | } | 357 | } |
358 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 358 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
359 | { | 359 | { |
360 | QMessageBox::critical(0,tr("Error creating new Folder"), | 360 | QMessageBox::critical(0,tr("Error creating new Folder"), |
361 | tr("<center>Error while creating<br>new folder - breaking.</center>")); | 361 | tr("<center>Error while creating<br>new folder - breaking.</center>")); |
362 | return; | 362 | return; |
363 | } | 363 | } |
364 | sels.hide(); | 364 | sels.hide(); |
365 | qApp->processEvents(); | 365 | qApp->processEvents(); |
366 | // qDebug("hiding sels "); | 366 | // qDebug("hiding sels "); |
367 | mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); | 367 | mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); |
368 | folderView->refreshCurrent(); | 368 | folderView->refreshCurrent(); |
369 | } | 369 | } |
370 | 370 | ||
371 | void OpieMail::slotMoveCopyAllMail() | 371 | void OpieMail::slotMoveCopyAllMail() |
372 | { | 372 | { |
373 | 373 | ||
374 | if (!mailView->currentItem()) return; | 374 | if (!mailView->currentItem()) return; |
375 | QValueList<RecMailP> t; | 375 | QValueList<RecMailP> t; |
376 | // if ( QMessageBox::warning(this, tr("Move/Copy all selected mails"), tr("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 376 | // if ( QMessageBox::warning(this, tr("Move/Copy all selected mails"), tr("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
377 | { | 377 | { |
378 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); | 378 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); |
379 | while ( item ) { | 379 | while ( item ) { |
380 | if ( item->isSelected() ) { | 380 | if ( item->isSelected() ) { |
381 | t.append( item->data() ); | 381 | t.append( item->data() ); |
382 | } | 382 | } |
383 | item = (MailListViewItem*)item->nextSibling(); | 383 | item = (MailListViewItem*)item->nextSibling(); |
384 | } | 384 | } |
385 | } | 385 | } |
386 | // else | 386 | // else |
387 | // return; | 387 | // return; |
388 | if ( t.count() == 0 ) | 388 | if ( t.count() == 0 ) |
389 | return; | 389 | return; |
390 | RecMailP mail = t.first(); | 390 | RecMailP mail = t.first(); |
391 | AbstractMail*targetMail = 0; | 391 | AbstractMail*targetMail = 0; |
392 | QString targetFolder = ""; | 392 | QString targetFolder = ""; |
393 | Selectstore sels; | 393 | Selectstore sels; |
394 | folderView->setupFolderselect(&sels); | 394 | folderView->setupFolderselect(&sels); |
395 | if (!sels.exec()) return; | 395 | if (!sels.exec()) return; |
396 | targetMail = sels.currentMail(); | 396 | targetMail = sels.currentMail(); |
397 | targetFolder = sels.currentFolder(); | 397 | targetFolder = sels.currentFolder(); |
398 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || | 398 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || |
399 | targetFolder.isEmpty()) | 399 | targetFolder.isEmpty()) |
400 | { | 400 | { |
401 | return; | 401 | return; |
402 | } | 402 | } |
403 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 403 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
404 | { | 404 | { |
405 | QMessageBox::critical(0,tr("Error creating new Folder"), | 405 | QMessageBox::critical(0,tr("Error creating new Folder"), |
406 | tr("<center>Error while creating<br>new folder - breaking.</center>")); | 406 | tr("<center>Error while creating<br>new folder - breaking.</center>")); |
407 | return; | 407 | return; |
408 | } | 408 | } |
409 | sels.hide(); | 409 | sels.hide(); |
410 | qApp->processEvents(); | 410 | qApp->processEvents(); |
411 | //qDebug("hiding sels "); | 411 | //qDebug("hiding sels "); |
412 | mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails()); | 412 | mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails()); |
413 | folderView->refreshCurrent(); | 413 | folderView->refreshCurrent(); |
414 | } | 414 | } |
415 | 415 | ||
416 | void OpieMail::reEditMail() | 416 | void OpieMail::reEditMail() |
417 | { | 417 | { |
418 | if (!mailView->currentItem()) return; | 418 | if (!mailView->currentItem()) return; |
419 | 419 | ||
420 | ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); | 420 | ComposeMail compose( settings, this, 0, true ); |
421 | compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); | 421 | compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); |
422 | compose.slotAdjustColumns(); | 422 | compose.slotAdjustColumns(); |
423 | compose.showMaximized(); | 423 | compose.showMaximized(); |
424 | compose.exec(); | 424 | compose.exec(); |
425 | } | 425 | } |
diff --git a/kmicromail/opiemail.h b/kmicromail/opiemail.h index 934f232..7434e59 100644 --- a/kmicromail/opiemail.h +++ b/kmicromail/opiemail.h | |||
@@ -1,48 +1,48 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | #ifndef OPIEMAIL_H | 2 | #ifndef OPIEMAIL_H |
3 | #define OPIEMAIL_H | 3 | #define OPIEMAIL_H |
4 | 4 | ||
5 | #include "mainwindow.h" | 5 | #include "mainwindow.h" |
6 | #include <libmailwrapper/settings.h> | 6 | #include <libmailwrapper/settings.h> |
7 | 7 | ||
8 | #include <opie2/osmartpointer.h> | 8 | #include <opie2/osmartpointer.h> |
9 | #include <libmailwrapper/mailtypes.h> | 9 | #include <libmailwrapper/mailtypes.h> |
10 | 10 | ||
11 | class OpieMail : public MainWindow | 11 | class OpieMail : public MainWindow |
12 | { | 12 | { |
13 | Q_OBJECT | 13 | Q_OBJECT |
14 | 14 | ||
15 | public: | 15 | public: |
16 | OpieMail( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); | 16 | OpieMail( QWidget *parent = 0, const char *name = 0 ); |
17 | virtual ~OpieMail(); | 17 | virtual ~OpieMail(); |
18 | static QString appName() { return QString::fromLatin1("opiemail"); } | 18 | static QString appName() { return QString::fromLatin1("kopiemail"); } |
19 | 19 | ||
20 | public slots: | 20 | public slots: |
21 | virtual void slotwriteMail(const QString&name,const QString&email); | 21 | virtual void slotwriteMail(const QString&name,const QString&email); |
22 | virtual void slotwriteMail2(const QString&nameemail); | 22 | virtual void slotwriteMail2(const QString&nameemail); |
23 | virtual void slotComposeMail(); | 23 | virtual void slotComposeMail(); |
24 | virtual void appMessage(const QCString &msg, const QByteArray &data); | 24 | virtual void appMessage(const QCString &msg, const QByteArray &data); |
25 | virtual void message(const QCString &msg, const QByteArray &data); | 25 | virtual void message(const QCString &msg, const QByteArray &data); |
26 | protected slots: | 26 | protected slots: |
27 | virtual void slotSendQueued(); | 27 | virtual void slotSendQueued(); |
28 | virtual void slotSearchMails(); | 28 | virtual void slotSearchMails(); |
29 | virtual void slotEditSettings(); | 29 | virtual void slotEditSettings(); |
30 | virtual void slotEditAccounts(); | 30 | virtual void slotEditAccounts(); |
31 | virtual void displayMail(); | 31 | virtual void displayMail(); |
32 | virtual void slotDeleteMail(); | 32 | virtual void slotDeleteMail(); |
33 | virtual void slotDeleteAllMail(); | 33 | virtual void slotDeleteAllMail(); |
34 | virtual void mailHold(int, QListViewItem *,const QPoint&,int); | 34 | virtual void mailHold(int, QListViewItem *,const QPoint&,int); |
35 | virtual void slotShowFolders( bool show ); | 35 | virtual void slotShowFolders( bool show ); |
36 | virtual void refreshMailView(const QValueList<RecMailP>&); | 36 | virtual void refreshMailView(const QValueList<RecMailP>&); |
37 | virtual void mailLeftClicked( QListViewItem * ); | 37 | virtual void mailLeftClicked( QListViewItem * ); |
38 | virtual void slotMoveCopyMail(); | 38 | virtual void slotMoveCopyMail(); |
39 | virtual void slotMoveCopyAllMail(); | 39 | virtual void slotMoveCopyAllMail(); |
40 | virtual void reEditMail(); | 40 | virtual void reEditMail(); |
41 | void clearSelection(); | 41 | void clearSelection(); |
42 | 42 | ||
43 | private: | 43 | private: |
44 | Settings *settings; | 44 | Settings *settings; |
45 | 45 | ||
46 | }; | 46 | }; |
47 | 47 | ||
48 | #endif | 48 | #endif |