author | harlekin <harlekin> | 2004-01-04 02:35:03 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2004-01-04 02:35:03 (UTC) |
commit | d93529cebc9ea9ab4adf674e93e204f5a53d8906 (patch) (unidiff) | |
tree | 727ebb146a3518a2303d515c8e3e5e093397b9dc /noncore/net | |
parent | 55df8c221c43d81f6132d033553a173276954f7c (diff) | |
download | opie-d93529cebc9ea9ab4adf674e93e204f5a53d8906.zip opie-d93529cebc9ea9ab4adf674e93e204f5a53d8906.tar.gz opie-d93529cebc9ea9ab4adf674e93e204f5a53d8906.tar.bz2 |
adapt build system to lib etc and get it build
-rw-r--r-- | noncore/net/mail/config.in | 2 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/.cvsignore | 6 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/config.in | 4 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/libmailwrapper.pro | 44 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailwrapper.cpp | 15 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/settings.cpp | 36 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/smtpwrapper.cpp | 4 | ||||
-rw-r--r-- | noncore/net/mail/mail.pro | 26 | ||||
-rw-r--r-- | noncore/net/mail/mainwindow.cpp | 7 |
9 files changed, 99 insertions, 45 deletions
diff --git a/noncore/net/mail/config.in b/noncore/net/mail/config.in index 43ecc6f..b5173ae 100644 --- a/noncore/net/mail/config.in +++ b/noncore/net/mail/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config MAIL3 | 1 | config MAIL3 |
2 | boolean "opie-mail3 (a mail client)" | 2 | boolean "opie-mail3 (a mail client)" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && LIBMAILWRAPPER |
diff --git a/noncore/net/mail/libmailwrapper/.cvsignore b/noncore/net/mail/libmailwrapper/.cvsignore new file mode 100644 index 0000000..581c299 --- a/dev/null +++ b/noncore/net/mail/libmailwrapper/.cvsignore | |||
@@ -0,0 +1,6 @@ | |||
1 | logindialogui.cpp | ||
2 | logindialogui.h | ||
3 | sendmailprogressui.cpp | ||
4 | sendmailprogressui.h | ||
5 | .moc | ||
6 | Makefile | ||
diff --git a/noncore/net/mail/libmailwrapper/config.in b/noncore/net/mail/libmailwrapper/config.in new file mode 100644 index 0000000..790891e --- a/dev/null +++ b/noncore/net/mail/libmailwrapper/config.in | |||
@@ -0,0 +1,4 @@ | |||
1 | config LIBMAILWRAPPER | ||
2 | boolean "libmailwrapper ( wrapper arround libetpan needed by mail3" | ||
3 | default "y" | ||
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE | ||
diff --git a/noncore/net/mail/libmailwrapper/libmailwrapper.pro b/noncore/net/mail/libmailwrapper/libmailwrapper.pro new file mode 100644 index 0000000..4b4a4f1 --- a/dev/null +++ b/noncore/net/mail/libmailwrapper/libmailwrapper.pro | |||
@@ -0,0 +1,44 @@ | |||
1 | TEMPLATE = lib | ||
2 | CONFIG += qt warn_on debug | ||
3 | |||
4 | HEADERS = mailwrapper.h \ | ||
5 | imapwrapper.h \ | ||
6 | mailtypes.h \ | ||
7 | pop3wrapper.h \ | ||
8 | abstractmail.h \ | ||
9 | smtpwrapper.h \ | ||
10 | genericwrapper.h \ | ||
11 | mboxwrapper.h \ | ||
12 | settings.h \ | ||
13 | logindialog.h \ | ||
14 | sendmailprogress.h | ||
15 | |||
16 | SOURCES = imapwrapper.cpp \ | ||
17 | mailwrapper.cpp \ | ||
18 | mailtypes.cpp \ | ||
19 | pop3wrapper.cpp \ | ||
20 | abstractmail.cpp \ | ||
21 | smtpwrapper.cpp \ | ||
22 | genericwrapper.cpp \ | ||
23 | mboxwrapper.cpp \ | ||
24 | settings.cpp \ | ||
25 | logindialog.cpp \ | ||
26 | sendmailprogress.cpp | ||
27 | |||
28 | INTERFACES = logindialogui.ui \ | ||
29 | sendmailprogressui.ui | ||
30 | |||
31 | |||
32 | INCLUDEPATH += $(OPIEDIR)/include | ||
33 | |||
34 | CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX ) | ||
35 | contains( CONFTEST, y ){ | ||
36 | LIBS += -lqpe -letpan -lssl -lcrypto -liconv | ||
37 | }else{ | ||
38 | LIBS += -lqpe -letpan -lssl -lcrypto | ||
39 | } | ||
40 | |||
41 | DESTDIR = $(OPIEDIR)/lib$(PROJMAK) | ||
42 | TARGET = mailwrapper | ||
43 | |||
44 | include ( $(OPIEDIR)/include.pro ) | ||
diff --git a/noncore/net/mail/libmailwrapper/mailwrapper.cpp b/noncore/net/mail/libmailwrapper/mailwrapper.cpp index 9398823..75b9343 100644 --- a/noncore/net/mail/libmailwrapper/mailwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mailwrapper.cpp | |||
@@ -1,59 +1,70 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include <sys/stat.h> | 2 | #include <sys/stat.h> |
3 | #include <sys/types.h> | 3 | #include <sys/types.h> |
4 | #include <unistd.h> | 4 | #include <unistd.h> |
5 | #include <fcntl.h> | 5 | #include <fcntl.h> |
6 | #include <string.h> | 6 | #include <string.h> |
7 | #include <qdir.h> | 7 | #include <qdir.h> |
8 | 8 | ||
9 | #include "mailwrapper.h" | 9 | #include "mailwrapper.h" |
10 | #include "logindialog.h" | 10 | //#include "logindialog.h" |
11 | #include "defines.h" | 11 | //#include "defines.h" |
12 | |||
13 | #define UNDEFINED 64 | ||
14 | #define MAXLINE 76 | ||
15 | #define UTF16MASK 0x03FFUL | ||
16 | #define UTF16SHIFT 10 | ||
17 | #define UTF16BASE 0x10000UL | ||
18 | #define UTF16HIGHSTART 0xD800UL | ||
19 | #define UTF16HIGHEND 0xDBFFUL | ||
20 | #define UTF16LOSTART 0xDC00UL | ||
21 | #define UTF16LOEND 0xDFFFUL | ||
22 | |||
12 | 23 | ||
13 | Attachment::Attachment( DocLnk lnk ) | 24 | Attachment::Attachment( DocLnk lnk ) |
14 | { | 25 | { |
15 | doc = lnk; | 26 | doc = lnk; |
16 | size = QFileInfo( doc.file() ).size(); | 27 | size = QFileInfo( doc.file() ).size(); |
17 | } | 28 | } |
18 | 29 | ||
19 | Folder::Folder(const QString&tmp_name, const QString&sep ) | 30 | Folder::Folder(const QString&tmp_name, const QString&sep ) |
20 | { | 31 | { |
21 | name = tmp_name; | 32 | name = tmp_name; |
22 | nameDisplay = name; | 33 | nameDisplay = name; |
23 | separator = sep; | 34 | separator = sep; |
24 | } | 35 | } |
25 | 36 | ||
26 | const QString& Folder::Separator()const | 37 | const QString& Folder::Separator()const |
27 | { | 38 | { |
28 | return separator; | 39 | return separator; |
29 | } | 40 | } |
30 | 41 | ||
31 | IMAPFolder::IMAPFolder(const QString&name,const QString&sep, bool select,bool no_inf, const QString&prefix ) | 42 | IMAPFolder::IMAPFolder(const QString&name,const QString&sep, bool select,bool no_inf, const QString&prefix ) |
32 | : Folder( name,sep ),m_MaySelect(select),m_NoInferior(no_inf) | 43 | : Folder( name,sep ),m_MaySelect(select),m_NoInferior(no_inf) |
33 | { | 44 | { |
34 | // Decode IMAP foldername | 45 | // Decode IMAP foldername |
35 | nameDisplay = IMAPFolder::decodeFolderName( name ); | 46 | nameDisplay = IMAPFolder::decodeFolderName( name ); |
36 | qDebug( "folder " + name + " - displayed as " + nameDisplay ); | 47 | qDebug( "folder " + name + " - displayed as " + nameDisplay ); |
37 | 48 | ||
38 | if (prefix.length()>0) { | 49 | if (prefix.length()>0) { |
39 | if (nameDisplay.startsWith(prefix) && nameDisplay.length()>prefix.length()) { | 50 | if (nameDisplay.startsWith(prefix) && nameDisplay.length()>prefix.length()) { |
40 | nameDisplay=nameDisplay.right(nameDisplay.length()-prefix.length()); | 51 | nameDisplay=nameDisplay.right(nameDisplay.length()-prefix.length()); |
41 | } | 52 | } |
42 | } | 53 | } |
43 | } | 54 | } |
44 | 55 | ||
45 | static unsigned char base64chars[] = | 56 | static unsigned char base64chars[] = |
46 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+,"; | 57 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+,"; |
47 | 58 | ||
48 | /** | 59 | /** |
49 | * Decodes base64 encoded parts of the imapfolder name | 60 | * Decodes base64 encoded parts of the imapfolder name |
50 | * Code taken from kde cvs: kdebase/kioslave/imap4/rfcdecoder.cc | 61 | * Code taken from kde cvs: kdebase/kioslave/imap4/rfcdecoder.cc |
51 | */ | 62 | */ |
52 | QString IMAPFolder::decodeFolderName( const QString &name ) | 63 | QString IMAPFolder::decodeFolderName( const QString &name ) |
53 | { | 64 | { |
54 | unsigned char c, i, bitcount; | 65 | unsigned char c, i, bitcount; |
55 | unsigned long ucs4, utf16, bitbuf; | 66 | unsigned long ucs4, utf16, bitbuf; |
56 | unsigned char base64[256], utf8[6]; | 67 | unsigned char base64[256], utf8[6]; |
57 | unsigned long srcPtr = 0; | 68 | unsigned long srcPtr = 0; |
58 | QCString dst = ""; | 69 | QCString dst = ""; |
59 | QCString src = name.ascii(); | 70 | QCString src = name.ascii(); |
diff --git a/noncore/net/mail/libmailwrapper/settings.cpp b/noncore/net/mail/libmailwrapper/settings.cpp index 17aa1b0..c5187f5 100644 --- a/noncore/net/mail/libmailwrapper/settings.cpp +++ b/noncore/net/mail/libmailwrapper/settings.cpp | |||
@@ -1,403 +1,413 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include <qdir.h> | 2 | #include <qdir.h> |
3 | 3 | ||
4 | #include <qpe/config.h> | 4 | #include <qpe/config.h> |
5 | 5 | ||
6 | #include "settings.h" | 6 | #include "settings.h" |
7 | #include "defines.h" | 7 | //#include "defines.h" |
8 | |||
9 | #define IMAP_PORT "143" | ||
10 | #define IMAP_SSL_PORT "993" | ||
11 | #define SMTP_PORT "25" | ||
12 | #define SMTP_SSL_PORT "465" | ||
13 | #define POP3_PORT "110" | ||
14 | #define POP3_SSL_PORT "995" | ||
15 | #define NNTP_PORT "119" | ||
16 | #define NNTP_SSL_PORT "563" | ||
17 | |||
8 | 18 | ||
9 | Settings::Settings() | 19 | Settings::Settings() |
10 | : QObject() | 20 | : QObject() |
11 | { | 21 | { |
12 | updateAccounts(); | 22 | updateAccounts(); |
13 | } | 23 | } |
14 | 24 | ||
15 | void Settings::checkDirectory() | 25 | void Settings::checkDirectory() |
16 | { | 26 | { |
17 | if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) { | 27 | if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) { |
18 | system( "mkdir -p $HOME/Applications/opiemail" ); | 28 | system( "mkdir -p $HOME/Applications/opiemail" ); |
19 | qDebug( "$HOME/Applications/opiemail created" ); | 29 | qDebug( "$HOME/Applications/opiemail created" ); |
20 | } | 30 | } |
21 | } | 31 | } |
22 | 32 | ||
23 | QList<Account> Settings::getAccounts() | 33 | QList<Account> Settings::getAccounts() |
24 | { | 34 | { |
25 | return accounts; | 35 | return accounts; |
26 | } | 36 | } |
27 | 37 | ||
28 | void Settings::addAccount( Account *account ) | 38 | void Settings::addAccount( Account *account ) |
29 | { | 39 | { |
30 | accounts.append( account ); | 40 | accounts.append( account ); |
31 | } | 41 | } |
32 | 42 | ||
33 | void Settings::delAccount( Account *account ) | 43 | void Settings::delAccount( Account *account ) |
34 | { | 44 | { |
35 | accounts.remove( account ); | 45 | accounts.remove( account ); |
36 | account->remove(); | 46 | account->remove(); |
37 | } | 47 | } |
38 | 48 | ||
39 | void Settings::updateAccounts() | 49 | void Settings::updateAccounts() |
40 | { | 50 | { |
41 | accounts.clear(); | 51 | accounts.clear(); |
42 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); | 52 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); |
43 | QStringList::Iterator it; | 53 | QStringList::Iterator it; |
44 | 54 | ||
45 | QStringList imap = dir.entryList( "imap-*" ); | 55 | QStringList imap = dir.entryList( "imap-*" ); |
46 | for ( it = imap.begin(); it != imap.end(); it++ ) { | 56 | for ( it = imap.begin(); it != imap.end(); it++ ) { |
47 | qDebug( "Added IMAP account" ); | 57 | qDebug( "Added IMAP account" ); |
48 | IMAPaccount *account = new IMAPaccount( (*it).replace(0, 5, "") ); | 58 | IMAPaccount *account = new IMAPaccount( (*it).replace(0, 5, "") ); |
49 | accounts.append( account ); | 59 | accounts.append( account ); |
50 | } | 60 | } |
51 | 61 | ||
52 | QStringList pop3 = dir.entryList( "pop3-*" ); | 62 | QStringList pop3 = dir.entryList( "pop3-*" ); |
53 | for ( it = pop3.begin(); it != pop3.end(); it++ ) { | 63 | for ( it = pop3.begin(); it != pop3.end(); it++ ) { |
54 | qDebug( "Added POP account" ); | 64 | qDebug( "Added POP account" ); |
55 | POP3account *account = new POP3account( (*it).replace(0, 5, "") ); | 65 | POP3account *account = new POP3account( (*it).replace(0, 5, "") ); |
56 | accounts.append( account ); | 66 | accounts.append( account ); |
57 | } | 67 | } |
58 | 68 | ||
59 | QStringList smtp = dir.entryList( "smtp-*" ); | 69 | QStringList smtp = dir.entryList( "smtp-*" ); |
60 | for ( it = smtp.begin(); it != smtp.end(); it++ ) { | 70 | for ( it = smtp.begin(); it != smtp.end(); it++ ) { |
61 | qDebug( "Added SMTP account" ); | 71 | qDebug( "Added SMTP account" ); |
62 | SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") ); | 72 | SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") ); |
63 | accounts.append( account ); | 73 | accounts.append( account ); |
64 | } | 74 | } |
65 | 75 | ||
66 | QStringList nntp = dir.entryList( "nntp-*" ); | 76 | QStringList nntp = dir.entryList( "nntp-*" ); |
67 | for ( it = nntp.begin(); it != nntp.end(); it++ ) { | 77 | for ( it = nntp.begin(); it != nntp.end(); it++ ) { |
68 | qDebug( "Added NNTP account" ); | 78 | qDebug( "Added NNTP account" ); |
69 | NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") ); | 79 | NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") ); |
70 | accounts.append( account ); | 80 | accounts.append( account ); |
71 | } | 81 | } |
72 | 82 | ||
73 | readAccounts(); | 83 | readAccounts(); |
74 | } | 84 | } |
75 | 85 | ||
76 | void Settings::saveAccounts() | 86 | void Settings::saveAccounts() |
77 | { | 87 | { |
78 | checkDirectory(); | 88 | checkDirectory(); |
79 | Account *it; | 89 | Account *it; |
80 | 90 | ||
81 | for ( it = accounts.first(); it; it = accounts.next() ) { | 91 | for ( it = accounts.first(); it; it = accounts.next() ) { |
82 | it->save(); | 92 | it->save(); |
83 | } | 93 | } |
84 | } | 94 | } |
85 | 95 | ||
86 | void Settings::readAccounts() | 96 | void Settings::readAccounts() |
87 | { | 97 | { |
88 | checkDirectory(); | 98 | checkDirectory(); |
89 | Account *it; | 99 | Account *it; |
90 | 100 | ||
91 | for ( it = accounts.first(); it; it = accounts.next() ) { | 101 | for ( it = accounts.first(); it; it = accounts.next() ) { |
92 | it->read(); | 102 | it->read(); |
93 | } | 103 | } |
94 | } | 104 | } |
95 | 105 | ||
96 | Account::Account() | 106 | Account::Account() |
97 | { | 107 | { |
98 | accountName = "changeMe"; | 108 | accountName = "changeMe"; |
99 | type = "changeMe"; | 109 | type = "changeMe"; |
100 | ssl = false; | 110 | ssl = false; |
101 | } | 111 | } |
102 | 112 | ||
103 | void Account::remove() | 113 | void Account::remove() |
104 | { | 114 | { |
105 | QFile file( getFileName() ); | 115 | QFile file( getFileName() ); |
106 | file.remove(); | 116 | file.remove(); |
107 | } | 117 | } |
108 | 118 | ||
109 | IMAPaccount::IMAPaccount() | 119 | IMAPaccount::IMAPaccount() |
110 | : Account() | 120 | : Account() |
111 | { | 121 | { |
112 | file = IMAPaccount::getUniqueFileName(); | 122 | file = IMAPaccount::getUniqueFileName(); |
113 | accountName = "New IMAP Account"; | 123 | accountName = "New IMAP Account"; |
114 | ssl = false; | 124 | ssl = false; |
115 | type = "IMAP"; | 125 | type = "IMAP"; |
116 | port = IMAP_PORT; | 126 | port = IMAP_PORT; |
117 | } | 127 | } |
118 | 128 | ||
119 | IMAPaccount::IMAPaccount( QString filename ) | 129 | IMAPaccount::IMAPaccount( QString filename ) |
120 | : Account() | 130 | : Account() |
121 | { | 131 | { |
122 | file = filename; | 132 | file = filename; |
123 | accountName = "New IMAP Account"; | 133 | accountName = "New IMAP Account"; |
124 | ssl = false; | 134 | ssl = false; |
125 | type = "IMAP"; | 135 | type = "IMAP"; |
126 | port = IMAP_PORT; | 136 | port = IMAP_PORT; |
127 | } | 137 | } |
128 | 138 | ||
129 | QString IMAPaccount::getUniqueFileName() | 139 | QString IMAPaccount::getUniqueFileName() |
130 | { | 140 | { |
131 | int num = 0; | 141 | int num = 0; |
132 | QString unique; | 142 | QString unique; |
133 | 143 | ||
134 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); | 144 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); |
135 | 145 | ||
136 | QStringList imap = dir.entryList( "imap-*" ); | 146 | QStringList imap = dir.entryList( "imap-*" ); |
137 | do { | 147 | do { |
138 | unique.setNum( num++ ); | 148 | unique.setNum( num++ ); |
139 | } while ( imap.contains( "imap-" + unique ) > 0 ); | 149 | } while ( imap.contains( "imap-" + unique ) > 0 ); |
140 | 150 | ||
141 | return unique; | 151 | return unique; |
142 | } | 152 | } |
143 | 153 | ||
144 | void IMAPaccount::read() | 154 | void IMAPaccount::read() |
145 | { | 155 | { |
146 | Config *conf = new Config( getFileName(), Config::File ); | 156 | Config *conf = new Config( getFileName(), Config::File ); |
147 | conf->setGroup( "IMAP Account" ); | 157 | conf->setGroup( "IMAP Account" ); |
148 | accountName = conf->readEntry( "Account","" ); | 158 | accountName = conf->readEntry( "Account","" ); |
149 | if (accountName.isNull()) accountName = ""; | 159 | if (accountName.isNull()) accountName = ""; |
150 | server = conf->readEntry( "Server","" ); | 160 | server = conf->readEntry( "Server","" ); |
151 | if (server.isNull()) server=""; | 161 | if (server.isNull()) server=""; |
152 | port = conf->readEntry( "Port","" ); | 162 | port = conf->readEntry( "Port","" ); |
153 | if (port.isNull()) port="143"; | 163 | if (port.isNull()) port="143"; |
154 | ssl = conf->readBoolEntry( "SSL",false ); | 164 | ssl = conf->readBoolEntry( "SSL",false ); |
155 | user = conf->readEntry( "User","" ); | 165 | user = conf->readEntry( "User","" ); |
156 | if (user.isNull()) user = ""; | 166 | if (user.isNull()) user = ""; |
157 | password = conf->readEntryCrypt( "Password","" ); | 167 | password = conf->readEntryCrypt( "Password","" ); |
158 | if (password.isNull()) password = ""; | 168 | if (password.isNull()) password = ""; |
159 | prefix = conf->readEntry("MailPrefix",""); | 169 | prefix = conf->readEntry("MailPrefix",""); |
160 | if (prefix.isNull()) prefix = ""; | 170 | if (prefix.isNull()) prefix = ""; |
161 | } | 171 | } |
162 | 172 | ||
163 | void IMAPaccount::save() | 173 | void IMAPaccount::save() |
164 | { | 174 | { |
165 | qDebug( "saving " + getFileName() ); | 175 | qDebug( "saving " + getFileName() ); |
166 | Settings::checkDirectory(); | 176 | Settings::checkDirectory(); |
167 | 177 | ||
168 | Config *conf = new Config( getFileName(), Config::File ); | 178 | Config *conf = new Config( getFileName(), Config::File ); |
169 | conf->setGroup( "IMAP Account" ); | 179 | conf->setGroup( "IMAP Account" ); |
170 | conf->writeEntry( "Account", accountName ); | 180 | conf->writeEntry( "Account", accountName ); |
171 | conf->writeEntry( "Server", server ); | 181 | conf->writeEntry( "Server", server ); |
172 | conf->writeEntry( "Port", port ); | 182 | conf->writeEntry( "Port", port ); |
173 | conf->writeEntry( "SSL", ssl ); | 183 | conf->writeEntry( "SSL", ssl ); |
174 | conf->writeEntry( "User", user ); | 184 | conf->writeEntry( "User", user ); |
175 | conf->writeEntryCrypt( "Password", password ); | 185 | conf->writeEntryCrypt( "Password", password ); |
176 | conf->writeEntry( "MailPrefix",prefix); | 186 | conf->writeEntry( "MailPrefix",prefix); |
177 | conf->write(); | 187 | conf->write(); |
178 | } | 188 | } |
179 | 189 | ||
180 | 190 | ||
181 | QString IMAPaccount::getFileName() | 191 | QString IMAPaccount::getFileName() |
182 | { | 192 | { |
183 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/imap-" + file; | 193 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/imap-" + file; |
184 | } | 194 | } |
185 | 195 | ||
186 | POP3account::POP3account() | 196 | POP3account::POP3account() |
187 | : Account() | 197 | : Account() |
188 | { | 198 | { |
189 | file = POP3account::getUniqueFileName(); | 199 | file = POP3account::getUniqueFileName(); |
190 | accountName = "New POP3 Account"; | 200 | accountName = "New POP3 Account"; |
191 | ssl = false; | 201 | ssl = false; |
192 | type = "POP3"; | 202 | type = "POP3"; |
193 | port = POP3_PORT; | 203 | port = POP3_PORT; |
194 | } | 204 | } |
195 | 205 | ||
196 | POP3account::POP3account( QString filename ) | 206 | POP3account::POP3account( QString filename ) |
197 | : Account() | 207 | : Account() |
198 | { | 208 | { |
199 | file = filename; | 209 | file = filename; |
200 | accountName = "New POP3 Account"; | 210 | accountName = "New POP3 Account"; |
201 | ssl = false; | 211 | ssl = false; |
202 | type = "POP3"; | 212 | type = "POP3"; |
203 | port = POP3_PORT; | 213 | port = POP3_PORT; |
204 | } | 214 | } |
205 | 215 | ||
206 | QString POP3account::getUniqueFileName() | 216 | QString POP3account::getUniqueFileName() |
207 | { | 217 | { |
208 | int num = 0; | 218 | int num = 0; |
209 | QString unique; | 219 | QString unique; |
210 | 220 | ||
211 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); | 221 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); |
212 | 222 | ||
213 | QStringList imap = dir.entryList( "pop3-*" ); | 223 | QStringList imap = dir.entryList( "pop3-*" ); |
214 | do { | 224 | do { |
215 | unique.setNum( num++ ); | 225 | unique.setNum( num++ ); |
216 | } while ( imap.contains( "pop3-" + unique ) > 0 ); | 226 | } while ( imap.contains( "pop3-" + unique ) > 0 ); |
217 | 227 | ||
218 | return unique; | 228 | return unique; |
219 | } | 229 | } |
220 | 230 | ||
221 | void POP3account::read() | 231 | void POP3account::read() |
222 | { | 232 | { |
223 | Config *conf = new Config( getFileName(), Config::File ); | 233 | Config *conf = new Config( getFileName(), Config::File ); |
224 | conf->setGroup( "POP3 Account" ); | 234 | conf->setGroup( "POP3 Account" ); |
225 | accountName = conf->readEntry( "Account" ); | 235 | accountName = conf->readEntry( "Account" ); |
226 | server = conf->readEntry( "Server" ); | 236 | server = conf->readEntry( "Server" ); |
227 | port = conf->readEntry( "Port" ); | 237 | port = conf->readEntry( "Port" ); |
228 | ssl = conf->readBoolEntry( "SSL" ); | 238 | ssl = conf->readBoolEntry( "SSL" ); |
229 | user = conf->readEntry( "User" ); | 239 | user = conf->readEntry( "User" ); |
230 | password = conf->readEntryCrypt( "Password" ); | 240 | password = conf->readEntryCrypt( "Password" ); |
231 | } | 241 | } |
232 | 242 | ||
233 | void POP3account::save() | 243 | void POP3account::save() |
234 | { | 244 | { |
235 | qDebug( "saving " + getFileName() ); | 245 | qDebug( "saving " + getFileName() ); |
236 | Settings::checkDirectory(); | 246 | Settings::checkDirectory(); |
237 | 247 | ||
238 | Config *conf = new Config( getFileName(), Config::File ); | 248 | Config *conf = new Config( getFileName(), Config::File ); |
239 | conf->setGroup( "POP3 Account" ); | 249 | conf->setGroup( "POP3 Account" ); |
240 | conf->writeEntry( "Account", accountName ); | 250 | conf->writeEntry( "Account", accountName ); |
241 | conf->writeEntry( "Server", server ); | 251 | conf->writeEntry( "Server", server ); |
242 | conf->writeEntry( "Port", port ); | 252 | conf->writeEntry( "Port", port ); |
243 | conf->writeEntry( "SSL", ssl ); | 253 | conf->writeEntry( "SSL", ssl ); |
244 | conf->writeEntry( "User", user ); | 254 | conf->writeEntry( "User", user ); |
245 | conf->writeEntryCrypt( "Password", password ); | 255 | conf->writeEntryCrypt( "Password", password ); |
246 | conf->write(); | 256 | conf->write(); |
247 | } | 257 | } |
248 | 258 | ||
249 | 259 | ||
250 | QString POP3account::getFileName() | 260 | QString POP3account::getFileName() |
251 | { | 261 | { |
252 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/pop3-" + file; | 262 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/pop3-" + file; |
253 | } | 263 | } |
254 | 264 | ||
255 | SMTPaccount::SMTPaccount() | 265 | SMTPaccount::SMTPaccount() |
256 | : Account() | 266 | : Account() |
257 | { | 267 | { |
258 | file = SMTPaccount::getUniqueFileName(); | 268 | file = SMTPaccount::getUniqueFileName(); |
259 | accountName = "New SMTP Account"; | 269 | accountName = "New SMTP Account"; |
260 | ssl = false; | 270 | ssl = false; |
261 | login = false; | 271 | login = false; |
262 | useCC = false; | 272 | useCC = false; |
263 | useBCC = false; | 273 | useBCC = false; |
264 | useReply = false; | 274 | useReply = false; |
265 | type = "SMTP"; | 275 | type = "SMTP"; |
266 | port = SMTP_PORT; | 276 | port = SMTP_PORT; |
267 | } | 277 | } |
268 | 278 | ||
269 | SMTPaccount::SMTPaccount( QString filename ) | 279 | SMTPaccount::SMTPaccount( QString filename ) |
270 | : Account() | 280 | : Account() |
271 | { | 281 | { |
272 | file = filename; | 282 | file = filename; |
273 | accountName = "New SMTP Account"; | 283 | accountName = "New SMTP Account"; |
274 | ssl = false; | 284 | ssl = false; |
275 | login = false; | 285 | login = false; |
276 | type = "SMTP"; | 286 | type = "SMTP"; |
277 | port = SMTP_PORT; | 287 | port = SMTP_PORT; |
278 | } | 288 | } |
279 | 289 | ||
280 | QString SMTPaccount::getUniqueFileName() | 290 | QString SMTPaccount::getUniqueFileName() |
281 | { | 291 | { |
282 | int num = 0; | 292 | int num = 0; |
283 | QString unique; | 293 | QString unique; |
284 | 294 | ||
285 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); | 295 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); |
286 | 296 | ||
287 | QStringList imap = dir.entryList( "smtp-*" ); | 297 | QStringList imap = dir.entryList( "smtp-*" ); |
288 | do { | 298 | do { |
289 | unique.setNum( num++ ); | 299 | unique.setNum( num++ ); |
290 | } while ( imap.contains( "smtp-" + unique ) > 0 ); | 300 | } while ( imap.contains( "smtp-" + unique ) > 0 ); |
291 | 301 | ||
292 | return unique; | 302 | return unique; |
293 | } | 303 | } |
294 | 304 | ||
295 | void SMTPaccount::read() | 305 | void SMTPaccount::read() |
296 | { | 306 | { |
297 | Config *conf = new Config( getFileName(), Config::File ); | 307 | Config *conf = new Config( getFileName(), Config::File ); |
298 | conf->setGroup( "SMTP Account" ); | 308 | conf->setGroup( "SMTP Account" ); |
299 | accountName = conf->readEntry( "Account" ); | 309 | accountName = conf->readEntry( "Account" ); |
300 | server = conf->readEntry( "Server" ); | 310 | server = conf->readEntry( "Server" ); |
301 | port = conf->readEntry( "Port" ); | 311 | port = conf->readEntry( "Port" ); |
302 | ssl = conf->readBoolEntry( "SSL" ); | 312 | ssl = conf->readBoolEntry( "SSL" ); |
303 | login = conf->readBoolEntry( "Login" ); | 313 | login = conf->readBoolEntry( "Login" ); |
304 | user = conf->readEntry( "User" ); | 314 | user = conf->readEntry( "User" ); |
305 | password = conf->readEntryCrypt( "Password" ); | 315 | password = conf->readEntryCrypt( "Password" ); |
306 | } | 316 | } |
307 | 317 | ||
308 | void SMTPaccount::save() | 318 | void SMTPaccount::save() |
309 | { | 319 | { |
310 | qDebug( "saving " + getFileName() ); | 320 | qDebug( "saving " + getFileName() ); |
311 | Settings::checkDirectory(); | 321 | Settings::checkDirectory(); |
312 | 322 | ||
313 | Config *conf = new Config( getFileName(), Config::File ); | 323 | Config *conf = new Config( getFileName(), Config::File ); |
314 | conf->setGroup( "SMTP Account" ); | 324 | conf->setGroup( "SMTP Account" ); |
315 | conf->writeEntry( "Account", accountName ); | 325 | conf->writeEntry( "Account", accountName ); |
316 | conf->writeEntry( "Server", server ); | 326 | conf->writeEntry( "Server", server ); |
317 | conf->writeEntry( "Port", port ); | 327 | conf->writeEntry( "Port", port ); |
318 | conf->writeEntry( "SSL", ssl ); | 328 | conf->writeEntry( "SSL", ssl ); |
319 | conf->writeEntry( "Login", login ); | 329 | conf->writeEntry( "Login", login ); |
320 | conf->writeEntry( "User", user ); | 330 | conf->writeEntry( "User", user ); |
321 | conf->writeEntryCrypt( "Password", password ); | 331 | conf->writeEntryCrypt( "Password", password ); |
322 | conf->write(); | 332 | conf->write(); |
323 | } | 333 | } |
324 | 334 | ||
325 | 335 | ||
326 | QString SMTPaccount::getFileName() | 336 | QString SMTPaccount::getFileName() |
327 | { | 337 | { |
328 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/smtp-" + file; | 338 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/smtp-" + file; |
329 | } | 339 | } |
330 | 340 | ||
331 | NNTPaccount::NNTPaccount() | 341 | NNTPaccount::NNTPaccount() |
332 | : Account() | 342 | : Account() |
333 | { | 343 | { |
334 | file = NNTPaccount::getUniqueFileName(); | 344 | file = NNTPaccount::getUniqueFileName(); |
335 | accountName = "New NNTP Account"; | 345 | accountName = "New NNTP Account"; |
336 | ssl = false; | 346 | ssl = false; |
337 | login = false; | 347 | login = false; |
338 | type = "NNTP"; | 348 | type = "NNTP"; |
339 | port = NNTP_PORT; | 349 | port = NNTP_PORT; |
340 | } | 350 | } |
341 | 351 | ||
342 | NNTPaccount::NNTPaccount( QString filename ) | 352 | NNTPaccount::NNTPaccount( QString filename ) |
343 | : Account() | 353 | : Account() |
344 | { | 354 | { |
345 | file = filename; | 355 | file = filename; |
346 | accountName = "New NNTP Account"; | 356 | accountName = "New NNTP Account"; |
347 | ssl = false; | 357 | ssl = false; |
348 | login = false; | 358 | login = false; |
349 | type = "NNTP"; | 359 | type = "NNTP"; |
350 | port = NNTP_PORT; | 360 | port = NNTP_PORT; |
351 | } | 361 | } |
352 | 362 | ||
353 | QString NNTPaccount::getUniqueFileName() | 363 | QString NNTPaccount::getUniqueFileName() |
354 | { | 364 | { |
355 | int num = 0; | 365 | int num = 0; |
356 | QString unique; | 366 | QString unique; |
357 | 367 | ||
358 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); | 368 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); |
359 | 369 | ||
360 | QStringList imap = dir.entryList( "nntp-*" ); | 370 | QStringList imap = dir.entryList( "nntp-*" ); |
361 | do { | 371 | do { |
362 | unique.setNum( num++ ); | 372 | unique.setNum( num++ ); |
363 | } while ( imap.contains( "nntp-" + unique ) > 0 ); | 373 | } while ( imap.contains( "nntp-" + unique ) > 0 ); |
364 | 374 | ||
365 | return unique; | 375 | return unique; |
366 | } | 376 | } |
367 | 377 | ||
368 | void NNTPaccount::read() | 378 | void NNTPaccount::read() |
369 | { | 379 | { |
370 | Config *conf = new Config( getFileName(), Config::File ); | 380 | Config *conf = new Config( getFileName(), Config::File ); |
371 | conf->setGroup( "NNTP Account" ); | 381 | conf->setGroup( "NNTP Account" ); |
372 | accountName = conf->readEntry( "Account" ); | 382 | accountName = conf->readEntry( "Account" ); |
373 | server = conf->readEntry( "Server" ); | 383 | server = conf->readEntry( "Server" ); |
374 | port = conf->readEntry( "Port" ); | 384 | port = conf->readEntry( "Port" ); |
375 | ssl = conf->readBoolEntry( "SSL" ); | 385 | ssl = conf->readBoolEntry( "SSL" ); |
376 | login = conf->readBoolEntry( "Login" ); | 386 | login = conf->readBoolEntry( "Login" ); |
377 | user = conf->readEntry( "User" ); | 387 | user = conf->readEntry( "User" ); |
378 | password = conf->readEntryCrypt( "Password" ); | 388 | password = conf->readEntryCrypt( "Password" ); |
379 | } | 389 | } |
380 | 390 | ||
381 | void NNTPaccount::save() | 391 | void NNTPaccount::save() |
382 | { | 392 | { |
383 | qDebug( "saving " + getFileName() ); | 393 | qDebug( "saving " + getFileName() ); |
384 | Settings::checkDirectory(); | 394 | Settings::checkDirectory(); |
385 | 395 | ||
386 | Config *conf = new Config( getFileName(), Config::File ); | 396 | Config *conf = new Config( getFileName(), Config::File ); |
387 | conf->setGroup( "NNTP Account" ); | 397 | conf->setGroup( "NNTP Account" ); |
388 | conf->writeEntry( "Account", accountName ); | 398 | conf->writeEntry( "Account", accountName ); |
389 | conf->writeEntry( "Server", server ); | 399 | conf->writeEntry( "Server", server ); |
390 | conf->writeEntry( "Port", port ); | 400 | conf->writeEntry( "Port", port ); |
391 | conf->writeEntry( "SSL", ssl ); | 401 | conf->writeEntry( "SSL", ssl ); |
392 | conf->writeEntry( "Login", login ); | 402 | conf->writeEntry( "Login", login ); |
393 | conf->writeEntry( "User", user ); | 403 | conf->writeEntry( "User", user ); |
394 | conf->writeEntryCrypt( "Password", password ); | 404 | conf->writeEntryCrypt( "Password", password ); |
395 | conf->write(); | 405 | conf->write(); |
396 | } | 406 | } |
397 | 407 | ||
398 | 408 | ||
399 | QString NNTPaccount::getFileName() | 409 | QString NNTPaccount::getFileName() |
400 | { | 410 | { |
401 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/nntp-" + file; | 411 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/nntp-" + file; |
402 | } | 412 | } |
403 | 413 | ||
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp index 7e03af9..b9c4ff2 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp | |||
@@ -1,70 +1,72 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include <sys/stat.h> | 2 | #include <sys/stat.h> |
3 | #include <sys/types.h> | 3 | #include <sys/types.h> |
4 | #include <unistd.h> | 4 | #include <unistd.h> |
5 | #include <fcntl.h> | 5 | #include <fcntl.h> |
6 | #include <string.h> | 6 | #include <string.h> |
7 | #include <qdir.h> | 7 | #include <qdir.h> |
8 | #include <qt.h> | 8 | #include <qt.h> |
9 | 9 | ||
10 | #include <qpe/config.h> | 10 | #include <qpe/config.h> |
11 | #include <qpe/qcopenvelope_qws.h> | 11 | #include <qpe/qcopenvelope_qws.h> |
12 | 12 | ||
13 | #include <libetpan/libetpan.h> | 13 | #include <libetpan/libetpan.h> |
14 | 14 | ||
15 | #include "smtpwrapper.h" | 15 | #include "smtpwrapper.h" |
16 | #include "mailwrapper.h" | 16 | #include "mailwrapper.h" |
17 | #include "mboxwrapper.h" | 17 | #include "mboxwrapper.h" |
18 | #include "logindialog.h" | 18 | #include "logindialog.h" |
19 | #include "mailtypes.h" | 19 | #include "mailtypes.h" |
20 | #include "defines.h" | 20 | //#include "defines.h" |
21 | #include "sendmailprogress.h" | 21 | #include "sendmailprogress.h" |
22 | 22 | ||
23 | #define USER_AGENT "OpieMail v0.1" | ||
24 | |||
23 | progressMailSend*SMTPwrapper::sendProgress = 0; | 25 | progressMailSend*SMTPwrapper::sendProgress = 0; |
24 | 26 | ||
25 | SMTPwrapper::SMTPwrapper( Settings *s ) | 27 | SMTPwrapper::SMTPwrapper( Settings *s ) |
26 | : QObject() | 28 | : QObject() |
27 | { | 29 | { |
28 | settings = s; | 30 | settings = s; |
29 | Config cfg( "mail" ); | 31 | Config cfg( "mail" ); |
30 | cfg.setGroup( "Status" ); | 32 | cfg.setGroup( "Status" ); |
31 | m_queuedMail = cfg.readNumEntry( "outgoing", 0 ); | 33 | m_queuedMail = cfg.readNumEntry( "outgoing", 0 ); |
32 | emit queuedMails( m_queuedMail ); | 34 | emit queuedMails( m_queuedMail ); |
33 | connect( this, SIGNAL( queuedMails( int ) ), this, SLOT( emitQCop( int ) ) ); | 35 | connect( this, SIGNAL( queuedMails( int ) ), this, SLOT( emitQCop( int ) ) ); |
34 | } | 36 | } |
35 | 37 | ||
36 | void SMTPwrapper::emitQCop( int queued ) { | 38 | void SMTPwrapper::emitQCop( int queued ) { |
37 | QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" ); | 39 | QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" ); |
38 | env << queued; | 40 | env << queued; |
39 | } | 41 | } |
40 | 42 | ||
41 | QString SMTPwrapper::mailsmtpError( int errnum ) | 43 | QString SMTPwrapper::mailsmtpError( int errnum ) |
42 | { | 44 | { |
43 | switch ( errnum ) { | 45 | switch ( errnum ) { |
44 | case MAILSMTP_NO_ERROR: | 46 | case MAILSMTP_NO_ERROR: |
45 | return tr( "No error" ); | 47 | return tr( "No error" ); |
46 | case MAILSMTP_ERROR_UNEXPECTED_CODE: | 48 | case MAILSMTP_ERROR_UNEXPECTED_CODE: |
47 | return tr( "Unexpected error code" ); | 49 | return tr( "Unexpected error code" ); |
48 | case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE: | 50 | case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE: |
49 | return tr( "Service not available" ); | 51 | return tr( "Service not available" ); |
50 | case MAILSMTP_ERROR_STREAM: | 52 | case MAILSMTP_ERROR_STREAM: |
51 | return tr( "Stream error" ); | 53 | return tr( "Stream error" ); |
52 | case MAILSMTP_ERROR_HOSTNAME: | 54 | case MAILSMTP_ERROR_HOSTNAME: |
53 | return tr( "gethostname() failed" ); | 55 | return tr( "gethostname() failed" ); |
54 | case MAILSMTP_ERROR_NOT_IMPLEMENTED: | 56 | case MAILSMTP_ERROR_NOT_IMPLEMENTED: |
55 | return tr( "Not implemented" ); | 57 | return tr( "Not implemented" ); |
56 | case MAILSMTP_ERROR_ACTION_NOT_TAKEN: | 58 | case MAILSMTP_ERROR_ACTION_NOT_TAKEN: |
57 | return tr( "Error, action not taken" ); | 59 | return tr( "Error, action not taken" ); |
58 | case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION: | 60 | case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION: |
59 | return tr( "Data exceeds storage allocation" ); | 61 | return tr( "Data exceeds storage allocation" ); |
60 | case MAILSMTP_ERROR_IN_PROCESSING: | 62 | case MAILSMTP_ERROR_IN_PROCESSING: |
61 | return tr( "Error in processing" ); | 63 | return tr( "Error in processing" ); |
62 | // case MAILSMTP_ERROR_INSUFFISANT_SYSTEM_STORAGE: | 64 | // case MAILSMTP_ERROR_INSUFFISANT_SYSTEM_STORAGE: |
63 | // return tr( "Insufficient system storage" ); | 65 | // return tr( "Insufficient system storage" ); |
64 | case MAILSMTP_ERROR_MAILBOX_UNAVAILABLE: | 66 | case MAILSMTP_ERROR_MAILBOX_UNAVAILABLE: |
65 | return tr( "Mailbox unavailable" ); | 67 | return tr( "Mailbox unavailable" ); |
66 | case MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED: | 68 | case MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED: |
67 | return tr( "Mailbox name not allowed" ); | 69 | return tr( "Mailbox name not allowed" ); |
68 | case MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND: | 70 | case MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND: |
69 | return tr( "Bad command sequence" ); | 71 | return tr( "Bad command sequence" ); |
70 | case MAILSMTP_ERROR_USER_NOT_LOCAL: | 72 | case MAILSMTP_ERROR_USER_NOT_LOCAL: |
diff --git a/noncore/net/mail/mail.pro b/noncore/net/mail/mail.pro index 2c15a7b..69e1450 100644 --- a/noncore/net/mail/mail.pro +++ b/noncore/net/mail/mail.pro | |||
@@ -1,76 +1,52 @@ | |||
1 | CONFIG += qt warn_on debug quick-app | 1 | CONFIG += qt warn_on debug quick-app |
2 | 2 | ||
3 | HEADERS = defines.h \ | 3 | HEADERS = defines.h \ |
4 | logindialog.h \ | ||
5 | settings.h \ | ||
6 | editaccounts.h \ | 4 | editaccounts.h \ |
7 | mailwrapper.h \ | ||
8 | composemail.h \ | 5 | composemail.h \ |
9 | accountview.h \ | 6 | accountview.h \ |
10 | mainwindow.h \ | 7 | mainwindow.h \ |
11 | viewmail.h \ | 8 | viewmail.h \ |
12 | viewmailbase.h \ | 9 | viewmailbase.h \ |
13 | opiemail.h \ | 10 | opiemail.h \ |
14 | imapwrapper.h \ | ||
15 | mailtypes.h \ | ||
16 | mailistviewitem.h \ | 11 | mailistviewitem.h \ |
17 | pop3wrapper.h \ | ||
18 | abstractmail.h \ | ||
19 | settingsdialog.h \ | 12 | settingsdialog.h \ |
20 | statuswidget.h \ | 13 | statuswidget.h \ |
21 | smtpwrapper.h \ | ||
22 | genericwrapper.h \ | ||
23 | mboxwrapper.h \ | ||
24 | sendmailprogress.h \ | ||
25 | newmaildir.h | 14 | newmaildir.h |
26 | 15 | ||
27 | SOURCES = main.cpp \ | 16 | SOURCES = main.cpp \ |
28 | opiemail.cpp \ | 17 | opiemail.cpp \ |
29 | mainwindow.cpp \ | 18 | mainwindow.cpp \ |
30 | accountview.cpp \ | 19 | accountview.cpp \ |
31 | composemail.cpp \ | 20 | composemail.cpp \ |
32 | mailwrapper.cpp \ | ||
33 | imapwrapper.cpp \ | ||
34 | addresspicker.cpp \ | 21 | addresspicker.cpp \ |
35 | editaccounts.cpp \ | 22 | editaccounts.cpp \ |
36 | logindialog.cpp \ | ||
37 | viewmail.cpp \ | 23 | viewmail.cpp \ |
38 | viewmailbase.cpp \ | 24 | viewmailbase.cpp \ |
39 | settings.cpp \ | ||
40 | mailtypes.cpp \ | ||
41 | pop3wrapper.cpp \ | ||
42 | abstractmail.cpp \ | ||
43 | settingsdialog.cpp \ | 25 | settingsdialog.cpp \ |
44 | statuswidget.cpp \ | 26 | statuswidget.cpp \ |
45 | smtpwrapper.cpp \ | ||
46 | genericwrapper.cpp \ | ||
47 | mboxwrapper.cpp \ | ||
48 | sendmailprogress.cpp \ | ||
49 | newmaildir.cpp | 27 | newmaildir.cpp |
50 | 28 | ||
51 | INTERFACES = editaccountsui.ui \ | 29 | INTERFACES = editaccountsui.ui \ |
52 | selectmailtypeui.ui \ | 30 | selectmailtypeui.ui \ |
53 | imapconfigui.ui \ | 31 | imapconfigui.ui \ |
54 | pop3configui.ui \ | 32 | pop3configui.ui \ |
55 | nntpconfigui.ui \ | 33 | nntpconfigui.ui \ |
56 | smtpconfigui.ui \ | 34 | smtpconfigui.ui \ |
57 | addresspickerui.ui \ | 35 | addresspickerui.ui \ |
58 | logindialogui.ui \ | ||
59 | composemailui.ui \ | 36 | composemailui.ui \ |
60 | settingsdialogui.ui \ | 37 | settingsdialogui.ui \ |
61 | statuswidgetui.ui \ | 38 | statuswidgetui.ui \ |
62 | sendmailprogressui.ui \ | ||
63 | newmaildirui.ui | 39 | newmaildirui.ui |
64 | 40 | ||
65 | INCLUDEPATH += $(OPIEDIR)/include | 41 | INCLUDEPATH += $(OPIEDIR)/include |
66 | 42 | ||
67 | CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX ) | 43 | CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX ) |
68 | contains( CONFTEST, y ){ | 44 | contains( CONFTEST, y ){ |
69 | LIBS += -lqpe -letpan -lssl -lcrypto -lopie -liconv | 45 | LIBS += -lqpe -letpan -lssl -lcrypto -lopie -liconv |
70 | }else{ | 46 | }else{ |
71 | LIBS += -lqpe -letpan -lssl -lcrypto -lopie | 47 | LIBS += -lqpe -lopie -llibmailwrapper |
72 | } | 48 | } |
73 | 49 | ||
74 | TARGET = opiemail | 50 | TARGET = opiemail |
75 | 51 | ||
76 | include ( $(OPIEDIR)/include.pro ) | 52 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp index 2a74286..6511b1f 100644 --- a/noncore/net/mail/mainwindow.cpp +++ b/noncore/net/mail/mainwindow.cpp | |||
@@ -1,69 +1,70 @@ | |||
1 | #include <qlabel.h> | 1 | #include <qlabel.h> |
2 | #include <qvbox.h> | 2 | #include <qvbox.h> |
3 | #include <qheader.h> | 3 | #include <qheader.h> |
4 | #include <qtimer.h> | 4 | #include <qtimer.h> |
5 | #include <qlayout.h> | 5 | #include <qlayout.h> |
6 | #include <qmessagebox.h> | 6 | #include <qmessagebox.h> |
7 | #include <qtextstream.h> | 7 | #include <qtextstream.h> |
8 | 8 | ||
9 | #include <qpe/qpeapplication.h> | 9 | #include <qpe/qpeapplication.h> |
10 | #include <qpe/resource.h> | 10 | #include <qpe/resource.h> |
11 | 11 | ||
12 | #include "defines.h" | 12 | #include "defines.h" |
13 | #include "mainwindow.h" | 13 | #include "mainwindow.h" |
14 | #include "viewmail.h" | 14 | #include "viewmail.h" |
15 | #include "mailtypes.h" | 15 | #include "mailtypes.h" |
16 | #include "mailistviewitem.h" | 16 | #include "mailistviewitem.h" |
17 | 17 | ||
18 | 18 | ||
19 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | 19 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) |
20 | : QMainWindow( parent, name, flags ) | 20 | : QMainWindow( parent, name, flags ) |
21 | { | 21 | { |
22 | |||
22 | setCaption( tr( "Mail" ) ); | 23 | setCaption( tr( "Mail" ) ); |
23 | setToolBarsMovable( false ); | 24 | setToolBarsMovable( false ); |
24 | 25 | ||
25 | toolBar = new QToolBar( this ); | 26 | toolBar = new QToolBar( this ); |
26 | menuBar = new QMenuBar( toolBar ); | 27 | menuBar = new QMenuBar( toolBar ); |
27 | mailMenu = new QPopupMenu( menuBar ); | 28 | mailMenu = new QPopupMenu( menuBar ); |
28 | menuBar->insertItem( tr( "Mail" ), mailMenu ); | 29 | menuBar->insertItem( tr( "Mail" ), mailMenu ); |
29 | settingsMenu = new QPopupMenu( menuBar ); | 30 | settingsMenu = new QPopupMenu( menuBar ); |
30 | menuBar->insertItem( tr( "Settings" ), settingsMenu ); | 31 | menuBar->insertItem( tr( "Settings" ), settingsMenu ); |
31 | 32 | ||
32 | addToolBar( toolBar ); | 33 | addToolBar( toolBar ); |
33 | toolBar->setHorizontalStretchable( true ); | 34 | toolBar->setHorizontalStretchable( true ); |
34 | 35 | ||
35 | QLabel *spacer = new QLabel( toolBar ); | 36 | QLabel *spacer = new QLabel( toolBar ); |
36 | spacer->setBackgroundMode( QWidget::PaletteButton ); | 37 | spacer->setBackgroundMode( QWidget::PaletteButton ); |
37 | toolBar->setStretchableWidget( spacer ); | 38 | toolBar->setStretchableWidget( spacer ); |
38 | 39 | ||
39 | composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL, | 40 | composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL, |
40 | 0, 0, this ); | 41 | 0, 0, this ); |
41 | composeMail->addTo( toolBar ); | 42 | composeMail->addTo( toolBar ); |
42 | composeMail->addTo( mailMenu ); | 43 | composeMail->addTo( mailMenu ); |
43 | 44 | ||
44 | sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED, | 45 | sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED, |
45 | 0, 0, this ); | 46 | 0, 0, this ); |
46 | sendQueued->addTo( toolBar ); | 47 | sendQueued->addTo( toolBar ); |
47 | sendQueued->addTo( mailMenu ); | 48 | sendQueued->addTo( mailMenu ); |
48 | 49 | ||
49 | /* | 50 | /* |
50 | syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, | 51 | syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, |
51 | 0, 0, this ); | 52 | 0, 0, this ); |
52 | syncFolders->addTo( toolBar ); | 53 | syncFolders->addTo( toolBar ); |
53 | syncFolders->addTo( mailMenu ); | 54 | syncFolders->addTo( mailMenu ); |
54 | */ | 55 | */ |
55 | 56 | ||
56 | showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS, | 57 | showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS, |
57 | 0, 0, this, 0, true ); | 58 | 0, 0, this, 0, true ); |
58 | showFolders->addTo( toolBar ); | 59 | showFolders->addTo( toolBar ); |
59 | showFolders->addTo( mailMenu ); | 60 | showFolders->addTo( mailMenu ); |
60 | showFolders->setOn( true ); | 61 | showFolders->setOn( true ); |
61 | connect(showFolders, SIGNAL( toggled( bool ) ), | 62 | connect(showFolders, SIGNAL( toggled( bool ) ), |
62 | SLOT( slotShowFolders( bool ) ) ); | 63 | SLOT( slotShowFolders( bool ) ) ); |
63 | 64 | ||
64 | /* | 65 | /* |
65 | searchMails = new QAction( tr( "Search mails" ), ICON_SEARCHMAILS, | 66 | searchMails = new QAction( tr( "Search mails" ), ICON_SEARCHMAILS, |
66 | 0, 0, this ); | 67 | 0, 0, this ); |
67 | searchMails->addTo( toolBar ); | 68 | searchMails->addTo( toolBar ); |
68 | searchMails->addTo( mailMenu ); | 69 | searchMails->addTo( mailMenu ); |
69 | */ | 70 | */ |
@@ -71,104 +72,104 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | |||
71 | deleteMails = new QAction(tr("Delete Mail"), QIconSet(Resource::loadPixmap("mail/delete")), 0, 0, this); | 72 | deleteMails = new QAction(tr("Delete Mail"), QIconSet(Resource::loadPixmap("mail/delete")), 0, 0, this); |
72 | deleteMails->addTo( toolBar ); | 73 | deleteMails->addTo( toolBar ); |
73 | deleteMails->addTo( mailMenu ); | 74 | deleteMails->addTo( mailMenu ); |
74 | connect( deleteMails, SIGNAL( activated() ), | 75 | connect( deleteMails, SIGNAL( activated() ), |
75 | SLOT( slotDeleteMail() ) ); | 76 | SLOT( slotDeleteMail() ) ); |
76 | 77 | ||
77 | editSettings = new QAction( tr( "Edit settings" ), ICON_EDITSETTINGS, | 78 | editSettings = new QAction( tr( "Edit settings" ), ICON_EDITSETTINGS, |
78 | 0, 0, this ); | 79 | 0, 0, this ); |
79 | editSettings->addTo( settingsMenu ); | 80 | editSettings->addTo( settingsMenu ); |
80 | connect( editSettings, SIGNAL( activated() ), | 81 | connect( editSettings, SIGNAL( activated() ), |
81 | SLOT( slotEditSettings() ) ); | 82 | SLOT( slotEditSettings() ) ); |
82 | editAccounts = new QAction( tr( "Configure accounts" ), ICON_EDITACCOUNTS, | 83 | editAccounts = new QAction( tr( "Configure accounts" ), ICON_EDITACCOUNTS, |
83 | 0, 0, this ); | 84 | 0, 0, this ); |
84 | editAccounts->addTo( settingsMenu ); | 85 | editAccounts->addTo( settingsMenu ); |
85 | 86 | ||
86 | //setCentralWidget( view ); | 87 | //setCentralWidget( view ); |
87 | 88 | ||
88 | QVBox* wrapperBox = new QVBox( this ); | 89 | QVBox* wrapperBox = new QVBox( this ); |
89 | setCentralWidget( wrapperBox ); | 90 | setCentralWidget( wrapperBox ); |
90 | 91 | ||
91 | QWidget *view = new QWidget( wrapperBox ); | 92 | QWidget *view = new QWidget( wrapperBox ); |
92 | 93 | ||
93 | layout = new QBoxLayout ( view, QBoxLayout::LeftToRight ); | 94 | layout = new QBoxLayout ( view, QBoxLayout::LeftToRight ); |
94 | 95 | ||
95 | folderView = new AccountView( view ); | 96 | folderView = new AccountView( view ); |
96 | folderView->header()->hide(); | 97 | folderView->header()->hide(); |
97 | folderView->setRootIsDecorated( true ); | 98 | folderView->setRootIsDecorated( true ); |
98 | folderView->addColumn( tr( "Mailbox" ) ); | 99 | folderView->addColumn( tr( "Mailbox" ) ); |
99 | 100 | ||
100 | layout->addWidget( folderView ); | 101 | layout->addWidget( folderView ); |
101 | 102 | ||
102 | mailView = new QListView( view ); | 103 | mailView = new QListView( view ); |
103 | mailView->addColumn( tr( "" ) ); | 104 | mailView->addColumn( tr( "" ) ); |
104 | mailView->addColumn( tr( "Subject" ),QListView::Manual ); | 105 | mailView->addColumn( tr( "Subject" ),QListView::Manual ); |
105 | mailView->addColumn( tr( "Sender" ),QListView::Manual ); | 106 | mailView->addColumn( tr( "Sender" ),QListView::Manual ); |
106 | mailView->addColumn( tr( "Size" ),QListView::Manual); | 107 | mailView->addColumn( tr( "Size" ),QListView::Manual); |
107 | mailView->addColumn( tr( "Date" )); | 108 | mailView->addColumn( tr( "Date" )); |
108 | mailView->setAllColumnsShowFocus(true); | 109 | mailView->setAllColumnsShowFocus(true); |
109 | mailView->setSorting(-1); | 110 | mailView->setSorting(-1); |
110 | 111 | ||
111 | statusWidget = new StatusWidget( wrapperBox ); | 112 | statusWidget = new StatusWidget( wrapperBox ); |
112 | statusWidget->hide(); | 113 | statusWidget->hide(); |
113 | 114 | ||
114 | layout->addWidget( mailView ); | 115 | layout->addWidget( mailView ); |
115 | layout->setStretchFactor( folderView, 1 ); | 116 | layout->setStretchFactor( folderView, 1 ); |
116 | layout->setStretchFactor( mailView, 2 ); | 117 | layout->setStretchFactor( mailView, 2 ); |
117 | 118 | ||
118 | slotAdjustLayout(); | 119 | slotAdjustLayout(); |
119 | 120 | ||
120 | QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); | 121 | QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); |
121 | QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); | 122 | QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); |
122 | 123 | ||
123 | connect( mailView, SIGNAL( mouseButtonClicked(int, QListViewItem *,const QPoint&,int ) ),this, | 124 | connect( mailView, SIGNAL( mouseButtonClicked(int, QListViewItem *,const QPoint&,int ) ),this, |
124 | SLOT( mailLeftClicked( int, QListViewItem *,const QPoint&,int ) ) ); | 125 | SLOT( mailLeftClicked( int, QListViewItem *,const QPoint&,int ) ) ); |
125 | connect( mailView, SIGNAL( mouseButtonPressed(int, QListViewItem *,const QPoint&,int ) ),this, | 126 | connect( mailView, SIGNAL( mouseButtonPressed(int, QListViewItem *,const QPoint&,int ) ),this, |
126 | SLOT( mailHold( int, QListViewItem *,const QPoint&,int ) ) ); | 127 | SLOT( mailHold( int, QListViewItem *,const QPoint&,int ) ) ); |
127 | connect(folderView, SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*))); | 128 | connect(folderView, SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*))); |
128 | 129 | ||
129 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); | 130 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); |
130 | } | 131 | } |
131 | 132 | ||
132 | 133 | ||
133 | void MainWindow::slotAdjustLayout() { | 134 | void MainWindow::slotAdjustLayout() { |
134 | 135 | ||
135 | QWidget *d = QApplication::desktop(); | 136 | QWidget *d = QApplication::desktop(); |
136 | 137 | ||
137 | if ( d->width() < d->height() ) { | 138 | if ( d->width() < d->height() ) { |
138 | layout->setDirection( QBoxLayout::TopToBottom ); | 139 | layout->setDirection( QBoxLayout::TopToBottom ); |
139 | } else { | 140 | } else { |
140 | layout->setDirection( QBoxLayout::LeftToRight ); | 141 | layout->setDirection( QBoxLayout::LeftToRight ); |
141 | } | 142 | } |
142 | } | 143 | } |
143 | 144 | ||
144 | void MainWindow::slotAdjustColumns() | 145 | void MainWindow::slotAdjustColumns() |
145 | { | 146 | { |
146 | bool hidden = folderView->isHidden(); | 147 | bool hidden = folderView->isHidden(); |
147 | if ( hidden ) folderView->show(); | 148 | if ( hidden ) folderView->show(); |
148 | folderView->setColumnWidth( 0, folderView->visibleWidth() ); | 149 | folderView->setColumnWidth( 0, folderView->visibleWidth() ); |
149 | if ( hidden ) folderView->hide(); | 150 | if ( hidden ) folderView->hide(); |
150 | 151 | ||
151 | mailView->setColumnWidth( 0, 10 ); | 152 | mailView->setColumnWidth( 0, 10 ); |
152 | mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 ); | 153 | mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 ); |
153 | mailView->setColumnWidth( 2, 80 ); | 154 | mailView->setColumnWidth( 2, 80 ); |
154 | mailView->setColumnWidth( 3, 50 ); | 155 | mailView->setColumnWidth( 3, 50 ); |
155 | mailView->setColumnWidth( 4, 50 ); | 156 | mailView->setColumnWidth( 4, 50 ); |
156 | } | 157 | } |
157 | 158 | ||
158 | void MainWindow::slotEditSettings() | 159 | void MainWindow::slotEditSettings() |
159 | { | 160 | { |
160 | } | 161 | } |
161 | 162 | ||
162 | void MainWindow::slotShowFolders( bool show ) | 163 | void MainWindow::slotShowFolders( bool show ) |
163 | { | 164 | { |
164 | qDebug( "Show Folders" ); | 165 | qDebug( "Show Folders" ); |
165 | if ( show && folderView->isHidden() ) { | 166 | if ( show && folderView->isHidden() ) { |
166 | qDebug( "-> showing" ); | 167 | qDebug( "-> showing" ); |
167 | folderView->show(); | 168 | folderView->show(); |
168 | } else if ( !show && !folderView->isHidden() ) { | 169 | } else if ( !show && !folderView->isHidden() ) { |
169 | qDebug( "-> hiding" ); | 170 | qDebug( "-> hiding" ); |
170 | folderView->hide(); | 171 | folderView->hide(); |
171 | } | 172 | } |
172 | } | 173 | } |
173 | 174 | ||
174 | void MainWindow::refreshMailView(QList<RecMail>*list) | 175 | void MainWindow::refreshMailView(QList<RecMail>*list) |