author | groucho <groucho> | 2003-04-24 11:19:11 (UTC) |
---|---|---|
committer | groucho <groucho> | 2003-04-24 11:19:11 (UTC) |
commit | 9671975e21266e3bfa6f3c793a3278b67cea34b7 (patch) (unidiff) | |
tree | 876c77939cfd0e00fc844b1b5af09b2978564a6d | |
parent | 51e782b9658de61dc02579e115a9c62f396609a3 (diff) | |
download | opie-9671975e21266e3bfa6f3c793a3278b67cea34b7.zip opie-9671975e21266e3bfa6f3c793a3278b67cea34b7.tar.gz opie-9671975e21266e3bfa6f3c793a3278b67cea34b7.tar.bz2 |
- reworked size filtering
- started reworking offline download
- better tab focus switching
- Hello "Whats this" capability
- Fixed parsing of To: header files (no more Delivered-To: and Reply-To: matches)
- Good bye Settings.txt, hello Config Objects and encrypted passwords
- Translation improvements (added trs)
- Parser optimizations
30 files changed, 488 insertions, 512 deletions
diff --git a/noncore/net/mailit/addatt.cpp b/noncore/net/mailit/addatt.cpp index d268f1f..daefac6 100644 --- a/noncore/net/mailit/addatt.cpp +++ b/noncore/net/mailit/addatt.cpp | |||
@@ -51,59 +51,59 @@ FileItem::~FileItem() | |||
51 | { | 51 | { |
52 | if (doclnk!=NULL) delete doclnk; | 52 | if (doclnk!=NULL) delete doclnk; |
53 | doclnk=NULL; | 53 | doclnk=NULL; |
54 | } | 54 | } |
55 | 55 | ||
56 | AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f) | 56 | AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f) |
57 | : QDialog(parent, name, f) | 57 | : QDialog(parent, name, f) |
58 | { | 58 | { |
59 | setCaption("Adding attatchments"); | 59 | setCaption("Adding attachments"); |
60 | 60 | ||
61 | QGridLayout *top = new QGridLayout(this, 1,1 ); | 61 | QGridLayout *top = new QGridLayout(this, 1,1 ); |
62 | 62 | ||
63 | QHBox *buttons=new QHBox(this); | 63 | QHBox *buttons=new QHBox(this); |
64 | /*fileCategoryButton = new QPushButton(this);*/ | 64 | /*fileCategoryButton = new QPushButton(this);*/ |
65 | attatchButton = new QPushButton(tr("Attatch..."), buttons); | 65 | attachButton = new QPushButton(tr("attach..."), buttons); |
66 | removeButton = new QPushButton(tr("Remove"), buttons); | 66 | removeButton = new QPushButton(tr("Remove"), buttons); |
67 | 67 | ||
68 | /*fileCategories = new QPopupMenu(fileCategoryButton); | 68 | /*fileCategories = new QPopupMenu(fileCategoryButton); |
69 | fileCategoryButton->setPopup(fileCategories); | 69 | fileCategoryButton->setPopup(fileCategories); |
70 | fileCategories->insertItem("Document"); | 70 | fileCategories->insertItem("Document"); |
71 | fileCategories->insertItem("Picture"); | 71 | fileCategories->insertItem("Picture"); |
72 | fileCategories->insertItem("Sound"); | 72 | fileCategories->insertItem("Sound"); |
73 | fileCategories->insertItem("Movie"); | 73 | fileCategories->insertItem("Movie"); |
74 | fileCategories->insertItem("File"); | 74 | fileCategories->insertItem("File"); |
75 | 75 | ||
76 | fileCategoryButton->setText("Document"); | 76 | fileCategoryButton->setText("Document"); |
77 | top->addWidget(fileCategoryButton, 0, 0);*/ | 77 | top->addWidget(fileCategoryButton, 0, 0);*/ |
78 | 78 | ||
79 | 79 | ||
80 | top->addWidget(buttons,1,0); | 80 | top->addWidget(buttons,1,0); |
81 | //buttons->addWidget(attatchButton,0,0); | 81 | //buttons->addWidget(attachButton,0,0); |
82 | //buttons->addWidget(removeButton,0,1); | 82 | //buttons->addWidget(removeButton,0,1); |
83 | 83 | ||
84 | //connect(fileCategories, SIGNAL(activated(int)), this, | 84 | //connect(fileCategories, SIGNAL(activated(int)), this, |
85 | //SLOT(fileCategorySelected(int)) );*/ | 85 | //SLOT(fileCategorySelected(int)) );*/ |
86 | connect(attatchButton, SIGNAL(clicked()), this, | 86 | connect(attachButton, SIGNAL(clicked()), this, |
87 | SLOT(addAttatchment()) ); | 87 | SLOT(addattachment()) ); |
88 | connect(removeButton, SIGNAL(clicked()), this, | 88 | connect(removeButton, SIGNAL(clicked()), this, |
89 | SLOT(removeAttatchment()) ); | 89 | SLOT(removeattachment()) ); |
90 | 90 | ||
91 | /*listView = new QListView(this, "AttView"); | 91 | /*listView = new QListView(this, "AttView"); |
92 | listView->addColumn("Documents");* | 92 | listView->addColumn("Documents");* |
93 | connect(listView, SIGNAL(doubleClicked(QListViewItem *)), this, | 93 | connect(listView, SIGNAL(doubleClicked(QListViewItem *)), this, |
94 | SLOT(addAttatchment()) );*/ | 94 | SLOT(addattachment()) );*/ |
95 | 95 | ||
96 | 96 | ||
97 | attView = new QListView(this, "Selected"); | 97 | attView = new QListView(this, "Selected"); |
98 | attView->addColumn(tr("Attached")); | 98 | attView->addColumn(tr("Attached")); |
99 | attView->addColumn(tr("File type")); | 99 | attView->addColumn(tr("File type")); |
100 | connect(attView, SIGNAL(doubleClicked(QListViewItem *)), this, | 100 | connect(attView, SIGNAL(doubleClicked(QListViewItem *)), this, |
101 | SLOT(removeAttatchment()) ); | 101 | SLOT(removeattachment()) ); |
102 | 102 | ||
103 | //top->addWidget(ofs, 0,0); | 103 | //top->addWidget(ofs, 0,0); |
104 | top->addWidget(attView, 0,0); | 104 | top->addWidget(attView, 0,0); |
105 | 105 | ||
106 | clear(); | 106 | clear(); |
107 | 107 | ||
108 | 108 | ||
109 | } | 109 | } |
@@ -116,34 +116,34 @@ void AddAtt::clear() | |||
116 | } | 116 | } |
117 | 117 | ||
118 | /*void AddAtt::fileCategorySelected(int id) | 118 | /*void AddAtt::fileCategorySelected(int id) |
119 | { | 119 | { |
120 | fileCategoryButton->setText(fileCategories->text(id)); | 120 | fileCategoryButton->setText(fileCategories->text(id)); |
121 | getFiles(); | 121 | getFiles(); |
122 | }*/ | 122 | }*/ |
123 | 123 | ||
124 | void AddAtt::addAttatchment() | 124 | void AddAtt::addattachment() |
125 | { | 125 | { |
126 | OFileDialog ofs("Attachments",this,0,0,"/root/Documents"); | 126 | OFileDialog ofs("Attachments",this,0,0,"/root/Documents"); |
127 | 127 | ||
128 | ofs.showMaximized(); | 128 | ofs.showMaximized(); |
129 | 129 | ||
130 | if (ofs.exec()==QDialog::Accepted) | 130 | if (ofs.exec()==QDialog::Accepted) |
131 | { | 131 | { |
132 | DocLnk* dl=new DocLnk(ofs.selectedDocument()); | 132 | DocLnk* dl=new DocLnk(ofs.selectedDocument()); |
133 | FileItem* fi=new FileItem(attView,dl); | 133 | FileItem* fi=new FileItem(attView,dl); |
134 | fi->setPixmap(0,dl->pixmap()); | 134 | fi->setPixmap(0,dl->pixmap()); |
135 | fi->setText(1,dl->type()); | 135 | fi->setText(1,dl->type()); |
136 | attView->insertItem(fi); | 136 | attView->insertItem(fi); |
137 | modified = TRUE; | 137 | modified = TRUE; |
138 | } | 138 | } |
139 | } | 139 | } |
140 | 140 | ||
141 | void AddAtt::removeAttatchment() | 141 | void AddAtt::removeattachment() |
142 | { | 142 | { |
143 | if (attView->selectedItem() != NULL) | 143 | if (attView->selectedItem() != NULL) |
144 | { | 144 | { |
145 | attView->takeItem(attView->selectedItem()); | 145 | attView->takeItem(attView->selectedItem()); |
146 | } | 146 | } |
147 | modified = TRUE; | 147 | modified = TRUE; |
148 | } | 148 | } |
149 | 149 | ||
@@ -187,17 +187,17 @@ void AddAtt::getFiles() | |||
187 | QFileInfoListIterator it(*dirInfoList); // create list iterator | 187 | QFileInfoListIterator it(*dirInfoList); // create list iterator |
188 | 188 | ||
189 | while ( (fi=it.current()) ) { // for each file... | 189 | while ( (fi=it.current()) ) { // for each file... |
190 | item = new FileItem(lis+ütView, *fi, selected); | 190 | item = new FileItem(lis+ütView, *fi, selected); |
191 | ++it; // goto next list element | 191 | ++it; // goto next list element |
192 | }*/ | 192 | }*/ |
193 | } | 193 | } |
194 | 194 | ||
195 | QStringList AddAtt::returnAttatchedFiles() | 195 | QStringList AddAtt::returnattachedFiles() |
196 | { | 196 | { |
197 | QFileInfo info; | 197 | QFileInfo info; |
198 | QStringList list; | 198 | QStringList list; |
199 | 199 | ||
200 | item = (FileItem *) attView->firstChild(); | 200 | item = (FileItem *) attView->firstChild(); |
201 | 201 | ||
202 | 202 | ||
203 | while (item != NULL) { | 203 | while (item != NULL) { |
diff --git a/noncore/net/mailit/addatt.h b/noncore/net/mailit/addatt.h index fcf3279..a365947 100644 --- a/noncore/net/mailit/addatt.h +++ b/noncore/net/mailit/addatt.h | |||
@@ -44,33 +44,33 @@ private: | |||
44 | }; | 44 | }; |
45 | 45 | ||
46 | class AddAtt : public QDialog | 46 | class AddAtt : public QDialog |
47 | { | 47 | { |
48 | Q_OBJECT | 48 | Q_OBJECT |
49 | 49 | ||
50 | public: | 50 | public: |
51 | AddAtt(QWidget *parent = 0, const char *name = 0, WFlags f = 0); | 51 | AddAtt(QWidget *parent = 0, const char *name = 0, WFlags f = 0); |
52 | QStringList returnAttatchedFiles(); | 52 | QStringList returnattachedFiles(); |
53 | QStringList returnFileTypes(); | 53 | QStringList returnFileTypes(); |
54 | void getFiles(); | 54 | void getFiles(); |
55 | void clear(); | 55 | void clear(); |
56 | 56 | ||
57 | 57 | ||
58 | public slots: | 58 | public slots: |
59 | //void fileCategorySelected(int); | 59 | //void fileCategorySelected(int); |
60 | void addAttatchment(); | 60 | void addattachment(); |
61 | void removeAttatchment(); | 61 | void removeattachment(); |
62 | void reject(); | 62 | void reject(); |
63 | void accept(); | 63 | void accept(); |
64 | 64 | ||
65 | private: | 65 | private: |
66 | FileItem* item; | 66 | FileItem* item; |
67 | QListView *attView; | 67 | QListView *attView; |
68 | QPushButton *attatchButton, *removeButton; | 68 | QPushButton *attachButton, *removeButton; |
69 | QPopupMenu *fileCategories; | 69 | QPopupMenu *fileCategories; |
70 | bool modified; | 70 | bool modified; |
71 | //QFileInfo *fi; | 71 | //QFileInfo *fi; |
72 | 72 | ||
73 | OFileDialog* ofs; | 73 | OFileDialog* ofs; |
74 | }; | 74 | }; |
75 | 75 | ||
76 | #endif | 76 | #endif |
diff --git a/noncore/net/mailit/addresslist.cpp b/noncore/net/mailit/addresslist.cpp index 8d9ab91..7d60ebf 100644 --- a/noncore/net/mailit/addresslist.cpp +++ b/noncore/net/mailit/addresslist.cpp | |||
@@ -116,17 +116,17 @@ QList<Contact>* AddressList::getContactList() | |||
116 | 116 | ||
117 | void AddressList::read() | 117 | void AddressList::read() |
118 | { | 118 | { |
119 | OContactAccess::List::Iterator it; | 119 | OContactAccess::List::Iterator it; |
120 | 120 | ||
121 | QString lineEmail, lineName, email, name; | 121 | QString lineEmail, lineName, email, name; |
122 | OContactAccess m_contactdb("mailit"); | 122 | OContactAccess m_contactdb("mailit"); |
123 | OContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 ); | 123 | OContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 ); |
124 | //OContact* oc; | 124 | //OContact* oc;(*it).defaultEmail() |
125 | 125 | ||
126 | for ( it = m_list.begin(); it != m_list.end(); ++it ) | 126 | for ( it = m_list.begin(); it != m_list.end(); ++it ) |
127 | { | 127 | { |
128 | //oc=(OContact*) it; | 128 | //oc=(OContact*) it; |
129 | if ((*it).defaultEmail().length()!=0) | 129 | if ((*it).defaultEmail().length()!=0) |
130 | addContact((*it).defaultEmail(),(*it).fileAs()); | 130 | addContact((*it).defaultEmail(),(*it).fileAs()); |
131 | } | 131 | } |
132 | 132 | ||
diff --git a/noncore/net/mailit/emailclient.cpp b/noncore/net/mailit/emailclient.cpp index ad1e0b4..23059cf 100644 --- a/noncore/net/mailit/emailclient.cpp +++ b/noncore/net/mailit/emailclient.cpp | |||
@@ -18,16 +18,17 @@ | |||
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qapplication.h> | 20 | #include <qapplication.h> |
21 | #include <qmessagebox.h> | 21 | #include <qmessagebox.h> |
22 | #include <qfile.h> | 22 | #include <qfile.h> |
23 | #include <qcheckbox.h> | 23 | #include <qcheckbox.h> |
24 | #include <qmenubar.h> | 24 | #include <qmenubar.h> |
25 | #include <qaction.h> | 25 | #include <qaction.h> |
26 | #include <qwhatsthis.h> | ||
26 | #include <qpe/resource.h> | 27 | #include <qpe/resource.h> |
27 | #include "emailclient.h" | 28 | #include "emailclient.h" |
28 | 29 | ||
29 | QCollection::Item AccountList::newItem(QCollection::Item d) | 30 | QCollection::Item AccountList::newItem(QCollection::Item d) |
30 | { | 31 | { |
31 | return dupl( (MailAccount *) d); | 32 | return dupl( (MailAccount *) d); |
32 | } | 33 | } |
33 | 34 | ||
@@ -77,16 +78,17 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) | |||
77 | readSettings(); | 78 | readSettings(); |
78 | 79 | ||
79 | updateAccounts(); | 80 | updateAccounts(); |
80 | 81 | ||
81 | lineShift = "\n"; | 82 | lineShift = "\n"; |
82 | readMail(); | 83 | readMail(); |
83 | lineShift = "\r\n"; | 84 | lineShift = "\r\n"; |
84 | 85 | ||
86 | mailboxView->setCurrentTab(0); //ensure that inbox has focus | ||
85 | } | 87 | } |
86 | 88 | ||
87 | 89 | ||
88 | EmailClient::~EmailClient() | 90 | EmailClient::~EmailClient() |
89 | { | 91 | { |
90 | //needs to be moved from destructor to closewindow event | 92 | //needs to be moved from destructor to closewindow event |
91 | saveMail(getPath(FALSE) + "inbox.txt", inboxView); | 93 | saveMail(getPath(FALSE) + "inbox.txt", inboxView); |
92 | //does not currently work. Defining outbox in the same | 94 | //does not currently work. Defining outbox in the same |
@@ -108,30 +110,32 @@ void EmailClient::init() | |||
108 | status1Label = new QLabel( tr("Idle"), statusBar); | 110 | status1Label = new QLabel( tr("Idle"), statusBar); |
109 | status2Label = new QLabel("", statusBar); | 111 | status2Label = new QLabel("", statusBar); |
110 | connect(emailHandler, SIGNAL(updatePopStatus(const QString &)), | 112 | connect(emailHandler, SIGNAL(updatePopStatus(const QString &)), |
111 | status2Label, SLOT(setText(const QString &)) ); | 113 | status2Label, SLOT(setText(const QString &)) ); |
112 | connect(emailHandler, SIGNAL(updateSmtpStatus(const QString &)), | 114 | connect(emailHandler, SIGNAL(updateSmtpStatus(const QString &)), |
113 | status2Label, SLOT(setText(const QString &)) ); | 115 | status2Label, SLOT(setText(const QString &)) ); |
114 | 116 | ||
115 | progressBar = new QProgressBar(statusBar); | 117 | progressBar = new QProgressBar(statusBar); |
118 | |||
116 | connect(emailHandler, SIGNAL(mailboxSize(int)), | 119 | connect(emailHandler, SIGNAL(mailboxSize(int)), |
117 | this, SLOT(setTotalSize(int)) ); | 120 | this, SLOT(setTotalSize(int)) ); |
118 | connect(emailHandler, SIGNAL(currentMailSize(int)), | 121 | connect(emailHandler, SIGNAL(currentMailSize(int)), |
119 | this, SLOT(setMailSize(int)) ); | 122 | this, SLOT(setMailSize(int)) ); |
120 | connect(emailHandler, SIGNAL(downloadedSize(int)), | 123 | connect(emailHandler, SIGNAL(downloadedSize(int)), |
121 | this, SLOT(setDownloadedSize(int)) ); | 124 | this, SLOT(setDownloadedSize(int)) ); |
122 | 125 | ||
123 | statusBar->addWidget(status1Label); | 126 | statusBar->addWidget(status1Label); |
124 | statusBar->addWidget(progressBar); | 127 | statusBar->addWidget(progressBar); |
125 | statusBar->addWidget(status2Label); | 128 | statusBar->addWidget(status2Label); |
126 | 129 | ||
127 | setToolBarsMovable(FALSE); | 130 | setToolBarsMovable(FALSE); |
128 | 131 | ||
129 | bar = new QToolBar(this); | 132 | bar = new QToolBar(this); |
133 | QWhatsThis::add(bar,tr("Main operation toolbar")); | ||
130 | bar->setHorizontalStretchable( TRUE ); | 134 | bar->setHorizontalStretchable( TRUE ); |
131 | 135 | ||
132 | mb = new QMenuBar( bar ); | 136 | mb = new QMenuBar( bar ); |
133 | 137 | ||
134 | QPopupMenu *mail = new QPopupMenu(mb); | 138 | QPopupMenu *mail = new QPopupMenu(mb); |
135 | mb->insertItem( tr( "&Mail" ), mail); | 139 | mb->insertItem( tr( "&Mail" ), mail); |
136 | 140 | ||
137 | QPopupMenu *configure = new QPopupMenu(mb); | 141 | QPopupMenu *configure = new QPopupMenu(mb); |
@@ -143,89 +147,80 @@ void EmailClient::init() | |||
143 | 147 | ||
144 | mail->insertItem(tr("Get Mail in"), selectAccountMenu); | 148 | mail->insertItem(tr("Get Mail in"), selectAccountMenu); |
145 | configure->insertItem(tr("Edit account"), editAccountMenu); | 149 | configure->insertItem(tr("Edit account"), editAccountMenu); |
146 | configure->insertItem(tr("Delete account"), deleteAccountMenu); | 150 | configure->insertItem(tr("Delete account"), deleteAccountMenu); |
147 | 151 | ||
148 | bar = new QToolBar(this); | 152 | bar = new QToolBar(this); |
149 | 153 | ||
150 | getMailButton = new QToolButton(Resource::loadPixmap("mailit/getmail"),tr("getMail"),tr("select account"), this,SLOT(getAllNewMail()),bar); | 154 | getMailButton = new QToolButton(Resource::loadPixmap("mailit/getmail"),tr("getMail"),tr("select account"), this,SLOT(getAllNewMail()),bar); |
151 | //connect(setAccountlButton, SIGNAL(activated()), this, SLOT(setCurrentAccount()) ); | 155 | QWhatsThis::add(getMailButton,tr("Click to download mail via all available accounts.\n Press and hold to select the desired account.")); |
152 | // setAccountButton->addTo(bar); | 156 | |
153 | //setAccountButton->addTo(mail); | ||
154 | |||
155 | /*idCount = 0; | ||
156 | |||
157 | for (MailAccount* accountPtr = accountList.first(); accountPtr != 0; | ||
158 | accountPtr = accountList.next()) { | ||
159 | |||
160 | selectAccountMenu->insertItem(accountPtr->accountName,this, SLOT(selectAccount(int)), 0, idCount); | ||
161 | idCount++; | ||
162 | }*/ | ||
163 | getMailButton->setPopup(selectAccountMenu); | 157 | getMailButton->setPopup(selectAccountMenu); |
164 | 158 | ||
165 | |||
166 | /*getMailButton = new QAction(tr("Get all mail"), Resource::loadPixmap("mailit/getmail"), QString::null, 0, this, 0); | ||
167 | connect(getMailButton, SIGNAL(activated()), this, SLOT(getAllNewMail()) ); | ||
168 | getMailButton->addTo(bar);*/ | ||
169 | //getMailButton->addTo(mail); | ||
170 | |||
171 | sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendqueue"), QString::null, 0, this, 0); | 159 | sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendqueue"), QString::null, 0, this, 0); |
172 | connect(sendMailButton, SIGNAL(activated()), this, SLOT(sendQuedMail()) ); | 160 | connect(sendMailButton, SIGNAL(activated()), this, SLOT(sendQuedMail()) ); |
173 | sendMailButton->addTo(bar); | 161 | sendMailButton->addTo(bar); |
174 | sendMailButton->addTo(mail); | 162 | sendMailButton->addTo(mail); |
163 | sendMailButton->setWhatsThis("Send mail queued in the outbox"); | ||
175 | 164 | ||
176 | composeButton = new QAction(tr("Compose"), Resource::loadPixmap("new"), QString::null, 0, this, 0); | 165 | composeButton = new QAction(tr("Compose"), Resource::loadPixmap("new"), QString::null, 0, this, 0); |
177 | connect(composeButton, SIGNAL(activated()), this, SLOT(compose()) ); | 166 | connect(composeButton, SIGNAL(activated()), this, SLOT(compose()) ); |
178 | composeButton->addTo(bar); | 167 | composeButton->addTo(bar); |
179 | composeButton->addTo(mail); | 168 | composeButton->addTo(mail); |
169 | composeButton->setWhatsThis("Compose a new mail"); | ||
180 | 170 | ||
181 | cancelButton = new QAction(tr("Cancel transfer"), Resource::loadPixmap("close"), QString::null, 0, this, 0); | 171 | cancelButton = new QAction(tr("Cancel transfer"), Resource::loadPixmap("close"), QString::null, 0, this, 0); |
182 | connect(cancelButton, SIGNAL(activated()), this, SLOT(cancel()) ); | 172 | connect(cancelButton, SIGNAL(activated()), this, SLOT(cancel()) ); |
183 | cancelButton->addTo(mail); | 173 | cancelButton->addTo(mail); |
184 | cancelButton->addTo(bar); | 174 | cancelButton->addTo(bar); |
185 | cancelButton->setEnabled(FALSE); | 175 | cancelButton->setEnabled(FALSE); |
176 | cancelButton->setWhatsThis("Stop the currently active mail transfer"); | ||
177 | |||
186 | 178 | ||
187 | deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); | 179 | deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); |
188 | connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) ); | 180 | connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) ); |
189 | deleteButton->addTo(bar); | 181 | deleteButton->addTo(bar); |
182 | deleteButton->setWhatsThis("Remove the currently selected eMail(s)"); | ||
190 | 183 | ||
191 | mailboxView = new OTabWidget( this, "mailboxView" ); | 184 | mailboxView = new OTabWidget( this, "mailboxView" ); |
192 | 185 | ||
193 | QWidget* widget = new QWidget( mailboxView, "widget" ); | 186 | QWidget* widget = new QWidget( mailboxView, "widget" ); |
194 | grid_2 = new QGridLayout( widget ); | 187 | grid_2 = new QGridLayout( widget ); |
195 | // grid_2->setSpacing(6); | 188 | // grid_2->setSpacing(6); |
196 | // grid_2->setMargin( 11 ); | 189 | // grid_2->setMargin( 11 ); |
197 | 190 | ||
198 | inboxView = new QListView( widget, "inboxView" ); | 191 | inboxView = new QListView( widget, "inboxView" ); |
199 | inboxView->addColumn( tr( "From" ) ); | 192 | inboxView->addColumn( tr( "From" ) ); |
200 | inboxView->addColumn( tr( "Subject" ) ); | 193 | inboxView->addColumn( tr( "Subject" ) ); |
201 | inboxView->addColumn( tr( "Date" ) ); | 194 | inboxView->addColumn( tr( "Date" ) ); |
202 | inboxView->setMinimumSize( QSize( 0, 0 ) ); | 195 | inboxView->setMinimumSize( QSize( 0, 0 ) ); |
203 | inboxView->setAllColumnsShowFocus(TRUE); | 196 | inboxView->setAllColumnsShowFocus(TRUE); |
197 | QWhatsThis::add(inboxView,QWidget::tr("This is the inbox view.\n It keeps the fetched mail which can be viewed by double clicking the entry.\n" | ||
198 | " A blue attachment icon shows whether this mail has attachments.")); | ||
204 | 199 | ||
205 | grid_2->addWidget( inboxView, 2, 0 ); | 200 | grid_2->addWidget( inboxView, 2, 0 ); |
206 | mailboxView->addTab( widget, "mailit/inbox", tr( "Inbox" ) ); | 201 | mailboxView->addTab( widget, "mailit/inbox", tr( "Inbox" ) ); |
207 | 202 | ||
208 | QWidget* widget_2 = new QWidget( mailboxView, "widget_2" ); | 203 | QWidget* widget_2 = new QWidget( mailboxView, "widget_2" ); |
209 | grid_3 = new QGridLayout( widget_2 ); | 204 | grid_3 = new QGridLayout( widget_2 ); |
210 | // grid_3->setSpacing(6); | 205 | // grid_3->setSpacing(6); |
211 | // grid_3->setMargin( 11 ); | 206 | // grid_3->setMargin( 11 ); |
212 | 207 | ||
213 | outboxView = new QListView( widget_2, "outboxView" ); | 208 | outboxView = new QListView( widget_2, "outboxView" ); |
214 | outboxView->addColumn( tr( "To" ) ); | 209 | outboxView->addColumn( tr( "To" ) ); |
215 | outboxView->addColumn( tr( "Subject" ) ); | 210 | outboxView->addColumn( tr( "Subject" ) ); |
216 | outboxView->setAllColumnsShowFocus(TRUE); | 211 | outboxView->setAllColumnsShowFocus(TRUE); |
217 | 212 | ||
213 | QWhatsThis::add(outboxView,QWidget::tr("This is the oubox view.\n It keeps the queued mails to send which can be reviewed by double clicking the entry.")); | ||
218 | grid_3->addWidget( outboxView, 0, 0 ); | 214 | grid_3->addWidget( outboxView, 0, 0 ); |
219 | mailboxView->addTab( widget_2,"mailit/outbox", tr( "Outbox" ) ); | 215 | mailboxView->addTab( widget_2,"mailit/outbox", tr( "Outbox" ) ); |
220 | 216 | ||
221 | setCentralWidget(mailboxView); | 217 | setCentralWidget(mailboxView); |
222 | 218 | ||
223 | mailboxView->setCurrentTab(0); | ||
224 | } | 219 | } |
225 | 220 | ||
226 | void EmailClient::compose() | 221 | void EmailClient::compose() |
227 | { | 222 | { |
228 | emit composeRequested(); | 223 | emit composeRequested(); |
229 | } | 224 | } |
230 | 225 | ||
231 | void EmailClient::cancel() | 226 | void EmailClient::cancel() |
@@ -319,52 +314,55 @@ void EmailClient::getNewMail() { | |||
319 | getMailButton->setEnabled(FALSE); | 314 | getMailButton->setEnabled(FALSE); |
320 | cancelButton->setEnabled(TRUE); | 315 | cancelButton->setEnabled(TRUE); |
321 | selectAccountMenu->setEnabled(FALSE); | 316 | selectAccountMenu->setEnabled(FALSE); |
322 | 317 | ||
323 | status1Label->setText(currentAccount->accountName + " headers"); | 318 | status1Label->setText(currentAccount->accountName + " headers"); |
324 | progressBar->reset(); | 319 | progressBar->reset(); |
325 | 320 | ||
326 | //get any previous mails not downloaded and add to queue | 321 | //get any previous mails not downloaded and add to queue |
327 | /* mailDownloadList.clear(); | 322 | mailDownloadList.clear(); |
328 | Email *mailPtr; | 323 | Email *mailPtr; |
329 | item = (EmailListItem *) inboxView->firstChild(); | 324 | item = (EmailListItem *) inboxView->firstChild(); |
330 | while (item != NULL) { | 325 | while (item != NULL) { |
331 | mailPtr = item->getMail(); | 326 | mailPtr = item->getMail(); |
332 | if ( (!mailPtr->downloaded) && (mailPtr->fromAccountId == currentAccount->id) ) { | 327 | if ( (!mailPtr->downloaded) && (mailPtr->fromAccountId == currentAccount->id) ) { |
333 | mailDownloadList.sizeInsert(mailPtr->serverId, mailPtr->size); | 328 | mailDownloadList.sizeInsert(mailPtr->serverId, mailPtr->size); |
334 | } | 329 | } |
335 | item = (EmailListItem *) item->nextSibling(); | 330 | item = (EmailListItem *) item->nextSibling(); |
336 | }*/ | 331 | } |
337 | 332 | ||
338 | emailHandler->getMailHeaders(); | 333 | emailHandler->getMailHeaders(); |
334 | |||
339 | } | 335 | } |
340 | 336 | ||
341 | void EmailClient::getAllNewMail() | 337 | void EmailClient::getAllNewMail() |
342 | { | 338 | { |
343 | allAccounts = TRUE; | 339 | allAccounts = TRUE; |
344 | currentAccount = accountList.first(); | 340 | currentAccount = accountList.first(); |
345 | getNewMail(); | 341 | getNewMail(); |
346 | } | 342 | } |
347 | 343 | ||
348 | void EmailClient::mailArrived(const Email &mail, bool fromDisk) | 344 | void EmailClient::mailArrived(const Email &mail, bool fromDisk) |
349 | { | 345 | { |
350 | Enclosure *ePtr; | 346 | Enclosure *ePtr; |
351 | Email newMail; | 347 | Email newMail; |
352 | int thisMailId; | 348 | int thisMailId; |
353 | emailHandler->parse(mail.rawMail, lineShift, &newMail); | 349 | emailHandler->parse(mail.rawMail, lineShift, &newMail); |
354 | |||
355 | mailconf->setGroup(newMail.id); | 350 | mailconf->setGroup(newMail.id); |
356 | 351 | ||
357 | if (fromDisk) { | 352 | if (fromDisk) |
353 | { | ||
358 | newMail.downloaded = mailconf->readBoolEntry("downloaded"); | 354 | newMail.downloaded = mailconf->readBoolEntry("downloaded"); |
359 | newMail.size = mailconf->readNumEntry("size"); | 355 | newMail.size = mailconf->readNumEntry("size"); |
360 | newMail.serverId = mailconf->readNumEntry("serverid"); | 356 | newMail.serverId = mailconf->readNumEntry("serverid"); |
361 | newMail.fromAccountId = mailconf->readNumEntry("fromaccountid"); | 357 | newMail.fromAccountId = mailconf->readNumEntry("fromaccountid"); |
362 | } else { //mail arrived from server | 358 | } |
359 | else | ||
360 | { //mail arrived from server | ||
363 | newMail.serverId = mail.serverId; | 361 | newMail.serverId = mail.serverId; |
364 | newMail.size = mail.size; | 362 | newMail.size = mail.size; |
365 | newMail.downloaded = mail.downloaded; | 363 | newMail.downloaded = mail.downloaded; |
366 | 364 | ||
367 | newMail.fromAccountId = currentAccount->id; | 365 | newMail.fromAccountId = currentAccount->id; |
368 | mailconf->writeEntry("fromaccountid", newMail.fromAccountId); | 366 | mailconf->writeEntry("fromaccountid", newMail.fromAccountId); |
369 | } | 367 | } |
370 | 368 | ||
@@ -373,31 +371,33 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) | |||
373 | 371 | ||
374 | //check if new mail | 372 | //check if new mail |
375 | if ( (thisMailId = mailconf->readNumEntry("internalmailid", -1)) == -1) { | 373 | if ( (thisMailId = mailconf->readNumEntry("internalmailid", -1)) == -1) { |
376 | thisMailId = mailIdCount; | 374 | thisMailId = mailIdCount; |
377 | mailIdCount++; | 375 | mailIdCount++; |
378 | 376 | ||
379 | //set server count, so that if the user aborts, the new | 377 | //set server count, so that if the user aborts, the new |
380 | //header is not reloaded | 378 | //header is not reloaded |
381 | if (currentAccount->synchronize) | 379 | if ((currentAccount)&&(currentAccount->synchronize)) |
382 | currentAccount->lastServerMailCount++; | 380 | currentAccount->lastServerMailCount++; |
383 | 381 | ||
384 | mailconf->writeEntry("internalmailid", thisMailId); | 382 | mailconf->writeEntry("internalmailid", thisMailId); |
385 | mailconf->writeEntry("downloaded", newMail.downloaded); | 383 | mailconf->writeEntry("downloaded", newMail.downloaded); |
386 | mailconf->writeEntry("size", (int) newMail.size); | 384 | mailconf->writeEntry("size", (int) newMail.size); |
387 | mailconf->writeEntry("serverid", newMail.serverId); | 385 | mailconf->writeEntry("serverid", newMail.serverId); |
388 | 386 | ||
389 | addressList->addContact(newMail.fromMail, newMail.from); | 387 | //addressList->addContact(newMail.fromMail, newMail.from); |
390 | } else if (!fromDisk) { //body to header arrived | ||
391 | mailconf->writeEntry("downloaded", TRUE); | ||
392 | } | 388 | } |
389 | |||
390 | mailconf->writeEntry("downloaded", newMail.downloaded); | ||
391 | |||
393 | QString stringMailId; | 392 | QString stringMailId; |
394 | stringMailId.setNum(thisMailId); | 393 | stringMailId.setNum(thisMailId); |
395 | //se if any attatchments needs to be stored | 394 | //see if any attatchments needs to be stored |
395 | |||
396 | for ( ePtr=newMail.files.first(); ePtr != 0; ePtr=newMail.files.next() ) { | 396 | for ( ePtr=newMail.files.first(); ePtr != 0; ePtr=newMail.files.next() ) { |
397 | QString stringId; | 397 | QString stringId; |
398 | stringId.setNum(ePtr->id); | 398 | stringId.setNum(ePtr->id); |
399 | 399 | ||
400 | int id = mailconf->readNumEntry("enclosureid_" + stringId); | 400 | int id = mailconf->readNumEntry("enclosureid_" + stringId); |
401 | if (id != ePtr->id) { //new entry | 401 | if (id != ePtr->id) { //new entry |
402 | mailconf->writeEntry("enclosureid_" + stringId, ePtr->id); | 402 | mailconf->writeEntry("enclosureid_" + stringId, ePtr->id); |
403 | mailconf->writeEntry("name_" + stringId, ePtr->originalName); | 403 | mailconf->writeEntry("name_" + stringId, ePtr->originalName); |
@@ -421,64 +421,71 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) | |||
421 | ePtr->saved = mailconf->readBoolEntry("saved_" + stringId); | 421 | ePtr->saved = mailconf->readBoolEntry("saved_" + stringId); |
422 | ePtr->installed = mailconf->readBoolEntry("installed_" + stringId); | 422 | ePtr->installed = mailconf->readBoolEntry("installed_" + stringId); |
423 | if (ePtr->saved) { | 423 | if (ePtr->saved) { |
424 | ePtr->name = mailconf->readEntry("filename_" + stringId); | 424 | ePtr->name = mailconf->readEntry("filename_" + stringId); |
425 | ePtr->path = mailconf->readEntry("path_" + stringId); | 425 | ePtr->path = mailconf->readEntry("path_" + stringId); |
426 | } | 426 | } |
427 | } | 427 | } |
428 | } | 428 | } |
429 | if (!previewingMail && !fromDisk) { | 429 | |
430 | bool found=false; | ||
431 | |||
432 | if (!fromDisk) | ||
433 | { | ||
434 | |||
430 | Email *mailPtr; | 435 | Email *mailPtr; |
431 | item = (EmailListItem *) inboxView->firstChild(); | 436 | item = (EmailListItem *) inboxView->firstChild(); |
432 | while (item != NULL) { | 437 | while ((item != NULL)&&(!found)) |
438 | { | ||
433 | mailPtr = item->getMail(); | 439 | mailPtr = item->getMail(); |
434 | if (mailPtr->id == newMail.id) { | 440 | if (mailPtr->id == newMail.id) { |
435 | item->setMail(newMail); | 441 | item->setMail(newMail); |
436 | emit mailUpdated(item->getMail()); | 442 | emit mailUpdated(item->getMail()); |
443 | found = true; | ||
437 | } | 444 | } |
438 | item = (EmailListItem *) item->nextSibling(); | 445 | item = (EmailListItem *) item->nextSibling(); |
439 | } | 446 | } |
440 | } else { | ||
441 | item = new EmailListItem(inboxView, newMail, TRUE); | ||
442 | if (!newMail.downloaded) | ||
443 | mailDownloadList.sizeInsert(newMail.serverId, newMail.size); | ||
444 | } | 447 | } |
448 | if ((!found)||(fromDisk)) item = new EmailListItem(inboxView, newMail, TRUE); | ||
449 | |||
450 | /*if (!newMail.downloaded) | ||
451 | mailDownloadList.sizeInsert(newMail.serverId, newMail.size);*/ | ||
445 | 452 | ||
446 | mailboxView->setCurrentTab(0); | 453 | mailboxView->setCurrentTab(0); |
447 | 454 | ||
448 | } | 455 | } |
449 | 456 | ||
450 | void EmailClient::allMailArrived(int count) | 457 | void EmailClient::allMailArrived(int count) |
451 | { | 458 | { |
452 | // not previewing means all mailtransfer has been done | 459 | // not previewing means all mailtransfer has been done |
453 | if (!previewingMail) { | 460 | /*if (!previewingMail) {*/ |
454 | if ( (allAccounts) && ( (currentAccount = accountList.next()) !=0 ) ) { | 461 | if ( (allAccounts) && ( (currentAccount = accountList.next()) !=0 ) ) { |
455 | emit newCaption("Mailit - " + currentAccount->accountName); | 462 | emit newCaption("Mailit - " + currentAccount->accountName); |
456 | getNewMail(); | 463 | getNewMail(); |
457 | return; | 464 | return; |
458 | } else { | 465 | } else { |
459 | allAccounts = FALSE; | 466 | allAccounts = FALSE; |
460 | receiving = FALSE; | 467 | receiving = FALSE; |
461 | getMailButton->setEnabled(TRUE); | 468 | getMailButton->setEnabled(TRUE); |
462 | cancelButton->setEnabled(FALSE); | 469 | cancelButton->setEnabled(FALSE); |
463 | selectAccountMenu->setEnabled(TRUE); | 470 | selectAccountMenu->setEnabled(TRUE); |
464 | status1Label->setText("Idle"); | 471 | status1Label->setText("Idle"); |
465 | 472 | ||
466 | progressBar->reset(); | 473 | progressBar->reset(); |
467 | return; | 474 | return; |
468 | } | 475 | } |
469 | } | 476 | //} |
470 | 477 | ||
471 | // all headers downloaded from server, start downloading remaining mails | 478 | // all headers downloaded from server, start downloading remaining mails |
472 | previewingMail = FALSE; | 479 | previewingMail = FALSE; |
473 | status1Label->setText(currentAccount->accountName); | 480 | status1Label->setText(currentAccount->accountName); |
474 | progressBar->reset(); | 481 | progressBar->reset(); |
475 | 482 | ||
476 | emailHandler->getMailByList(&mailDownloadList); | 483 | //emailHandler->getMailByList(&mailDownloadList); |
477 | 484 | ||
478 | mailboxView->setCurrentTab(0); | 485 | mailboxView->setCurrentTab(0); |
479 | } | 486 | } |
480 | 487 | ||
481 | void EmailClient::moveMailFront(Email *mailPtr) | 488 | void EmailClient::moveMailFront(Email *mailPtr) |
482 | { | 489 | { |
483 | if ( (receiving) && (mailPtr->fromAccountId == currentAccount->id) ) { | 490 | if ( (receiving) && (mailPtr->fromAccountId == currentAccount->id) ) { |
484 | mailDownloadList.moveFront(mailPtr->serverId, mailPtr->size); | 491 | mailDownloadList.moveFront(mailPtr->serverId, mailPtr->size); |
@@ -536,45 +543,43 @@ void EmailClient::popError(int code) | |||
536 | receiving = FALSE; | 543 | receiving = FALSE; |
537 | getMailButton->setEnabled(TRUE); | 544 | getMailButton->setEnabled(TRUE); |
538 | cancelButton->setEnabled(FALSE); | 545 | cancelButton->setEnabled(FALSE); |
539 | selectAccountMenu->setEnabled(TRUE); | 546 | selectAccountMenu->setEnabled(TRUE); |
540 | } | 547 | } |
541 | 548 | ||
542 | void EmailClient::inboxItemSelected() | 549 | void EmailClient::inboxItemSelected() |
543 | { | 550 | { |
544 | killTimer(timerID); | 551 | //killTimer(timerID); |
545 | 552 | ||
546 | item = (EmailListItem*) inboxView->selectedItem(); | 553 | item = (EmailListItem*) inboxView->selectedItem(); |
547 | if (item != NULL) { | 554 | if (item != NULL) { |
548 | emit viewEmail(inboxView, item->getMail()); | 555 | emit viewEmail(inboxView, item->getMail()); |
549 | } | 556 | } |
550 | } | 557 | } |
551 | 558 | ||
552 | void EmailClient::outboxItemSelected() | 559 | void EmailClient::outboxItemSelected() |
553 | { | 560 | { |
554 | killTimer(timerID); | 561 | //killTimer(timerID); |
555 | 562 | ||
556 | item = (EmailListItem*) outboxView->selectedItem(); | 563 | item = (EmailListItem*) outboxView->selectedItem(); |
557 | if (item != NULL) { | 564 | if (item != NULL) { |
558 | emit viewEmail(outboxView, item->getMail()); | 565 | emit viewEmail(outboxView, item->getMail()); |
559 | } | 566 | } |
560 | 567 | ||
561 | } | 568 | } |
562 | 569 | ||
563 | void EmailClient::readMail() | 570 | void EmailClient::readMail() |
564 | { | 571 | { |
565 | Email mail; | 572 | Email mail; |
566 | int start, stop; | 573 | int start, stop; |
567 | QString s, del; | 574 | QString s, del; |
568 | 575 | ||
569 | QFile f(getPath(FALSE) + "inbox.txt"); | 576 | QFile f(getPath(FALSE) + "inbox.txt"); |
570 | // QFileInfo fi(f); | 577 | |
571 | //qDebug( f.name()); | ||
572 | |||
573 | if ( f.open(IO_ReadOnly) ) { // file opened successfully | 578 | if ( f.open(IO_ReadOnly) ) { // file opened successfully |
574 | QTextStream t( &f ); // use a text stream | 579 | QTextStream t( &f ); // use a text stream |
575 | s = t.read(); | 580 | s = t.read(); |
576 | f.close(); | 581 | f.close(); |
577 | 582 | ||
578 | start = 0; | 583 | start = 0; |
579 | del = "\n.\n"; | 584 | del = "\n.\n"; |
580 | while ((uint) start < s.length()) { | 585 | while ((uint) start < s.length()) { |
@@ -617,22 +622,19 @@ void EmailClient::saveMail(QString fileName, QListView *view) | |||
617 | QFile f(fileName); | 622 | QFile f(fileName); |
618 | Email *mail; | 623 | Email *mail; |
619 | 624 | ||
620 | if (! f.open(IO_WriteOnly) ) { | 625 | if (! f.open(IO_WriteOnly) ) { |
621 | qWarning("could not open file"); | 626 | qWarning("could not open file"); |
622 | return; | 627 | return; |
623 | } | 628 | } |
624 | item = (EmailListItem *) view->firstChild(); | 629 | item = (EmailListItem *) view->firstChild(); |
625 | //qDebug (QString("Write : ") ); | ||
626 | QTextStream t(&f); | 630 | QTextStream t(&f); |
627 | while (item != NULL) { | 631 | while (item != NULL) { |
628 | mail = item->getMail(); | 632 | mail = item->getMail(); |
629 | //qDebug(mail->rawMail); | ||
630 | //qDebug(mail->recipients.first()); | ||
631 | t << mail->rawMail; | 633 | t << mail->rawMail; |
632 | 634 | ||
633 | mailconf->setGroup(mail->id); | 635 | mailconf->setGroup(mail->id); |
634 | mailconf->writeEntry("mailread", mail->read); | 636 | mailconf->writeEntry("mailread", mail->read); |
635 | 637 | ||
636 | item = (EmailListItem *) item->nextSibling(); | 638 | item = (EmailListItem *) item->nextSibling(); |
637 | } | 639 | } |
638 | f.close(); | 640 | f.close(); |
@@ -657,120 +659,95 @@ QString EmailClient::getPath(bool enclosurePath) | |||
657 | return (dir.path() + "/"); | 659 | return (dir.path() + "/"); |
658 | 660 | ||
659 | } | 661 | } |
660 | return (dir.path() + "/"); | 662 | return (dir.path() + "/"); |
661 | } | 663 | } |
662 | 664 | ||
663 | void EmailClient::readSettings() | 665 | void EmailClient::readSettings() |
664 | { | 666 | { |
665 | TextParser *p; | 667 | int y,acc_count, accountPos=0; |
666 | QString s; | ||
667 | int pos, accountPos, y; | ||
668 | QFile f( getPath(FALSE) + "settings.txt"); | ||
669 | |||
670 | if ( f.open(IO_ReadOnly) ) { // file opened successfully | ||
671 | QTextStream t( &f ); // use a text stream | ||
672 | s = t.read(); | ||
673 | f.close(); | ||
674 | 668 | ||
675 | p = new TextParser(s, "\n"); | 669 | mailconf->setGroup("mailitglobal"); |
676 | 670 | acc_count=mailconf->readNumEntry("Accounts",0); | |
677 | accountPos = 0; | ||
678 | while ( (accountPos = p->find("ACCOUNTSTART",';', accountPos, TRUE)) != -1 ) { | ||
679 | accountPos++; | ||
680 | if ( (pos = p->find("ACCOUNTNAME",':', accountPos, TRUE)) != -1 ) | ||
681 | account.accountName = p->getString(& ++pos, 'z', TRUE); | ||
682 | if ( (pos = p->find("NAME",':', accountPos, TRUE)) != -1) | ||
683 | account.name = p->getString(& ++pos, 'z', TRUE); | ||
684 | if ( (pos = p->find("EMAIL",':', accountPos, TRUE)) != -1) | ||
685 | account.emailAddress = p->getString(& ++pos, 'z', TRUE); | ||
686 | if ( (pos = p->find("POPUSER",':', accountPos, TRUE)) != -1) | ||
687 | account.popUserName = p->getString(& ++pos, 'z', TRUE); | ||
688 | if ( (pos = p->find("POPPASSWORD",':', accountPos, TRUE)) != -1) | ||
689 | account.popPasswd = p->getString(& ++pos, 'z', TRUE); | ||
690 | if ( (pos = p->find("POPSERVER",':', accountPos, TRUE)) != -1) | ||
691 | account.popServer = p->getString(& ++pos, 'z', TRUE); | ||
692 | if ( (pos = p->find("SMTPSERVER",':', accountPos, TRUE)) != -1) | ||
693 | account.smtpServer = p->getString(& ++pos, 'z', TRUE); | ||
694 | if ( (pos = p->find("ACCOUNTID",':', accountPos, TRUE)) != -1) { | ||
695 | s = p->getString(& ++pos, 'z', TRUE); | ||
696 | account.id = s.toInt(); | ||
697 | } | ||
698 | 671 | ||
672 | for (int accountPos = 0;accountPos<acc_count ; accountPos++) | ||
673 | { | ||
674 | mailconf->setGroup("Account_"+QString::number(accountPos+1)); //Account numbers start at 1 ... | ||
675 | account.accountName = mailconf->readEntry("AccName",""); | ||
676 | account.name = mailconf->readEntry("UserName",""); | ||
677 | account.emailAddress = mailconf->readEntry("Email",""); | ||
678 | account.popUserName = mailconf->readEntry("POPUser",""); | ||
679 | account.popPasswd = mailconf->readEntryCrypt("POPPassword",""); | ||
680 | account.popServer = mailconf->readEntry("POPServer",""); | ||
681 | account.smtpServer = mailconf->readEntry("SMTPServer",""); | ||
682 | account.id = mailconf->readNumEntry("AccountId",0); | ||
683 | account.syncLimit = mailconf->readNumEntry("HeaderLimit",0); | ||
699 | account.lastServerMailCount = 0; | 684 | account.lastServerMailCount = 0; |
700 | account.synchronize = FALSE; | 685 | account.synchronize = FALSE; |
701 | if ( (pos = p->find("SYNCHRONIZE",':', accountPos, TRUE)) != -1) { | 686 | |
702 | if (p->getString(& ++pos, 'z', TRUE).upper() == "YES") { | 687 | account.synchronize = (mailconf->readEntry("Synchronize","No")=="Yes"); |
703 | account.synchronize = TRUE; | 688 | if (account.synchronize) |
704 | if ( (pos = p->find("LASTSERVERMAILCOUNT",':', accountPos, TRUE)) != -1) { | 689 | { |
705 | s = p->getString(& ++pos, 'z', TRUE); | 690 | mailconf->readNumEntry("LASTSERVERMAILCOUNT",0); |
706 | account.lastServerMailCount = s.toInt(); | ||
707 | } | ||
708 | } | ||
709 | } | ||
710 | |||
711 | if ( (pos = p->find("SYNCLIMIT",':', accountPos, TRUE)) != -1) { | ||
712 | account.syncLimit = p->getString(& ++pos, 'z', TRUE).toInt(); | ||
713 | } | 691 | } |
714 | |||
715 | 692 | ||
716 | accountList.append(&account); | 693 | accountList.append(&account); |
717 | } | 694 | } |
718 | delete p; | 695 | |
719 | } | ||
720 | mailconf->setGroup("mailitglobal"); | 696 | mailconf->setGroup("mailitglobal"); |
721 | if ( (y = mailconf->readNumEntry("mailidcount", -1)) != -1) { | 697 | |
698 | if ( (y = mailconf->readNumEntry("mailidcount", -1)) != -1) | ||
699 | { | ||
722 | mailIdCount = y; | 700 | mailIdCount = y; |
723 | } | 701 | } |
724 | if ( (y = mailconf->readNumEntry("accountidcount", -1)) != -1) { | 702 | if ( (y = mailconf->readNumEntry("accountidcount", -1)) != -1) |
703 | { | ||
725 | accountIdCount = y; | 704 | accountIdCount = y; |
726 | } | 705 | } |
727 | } | 706 | } |
728 | 707 | ||
729 | void EmailClient::saveSettings() | 708 | void EmailClient::saveSettings() |
730 | { | 709 | { |
731 | 710 | int acc_count=0; | |
732 | QString temp; | ||
733 | QFile f( getPath(FALSE) + "settings.txt"); | ||
734 | MailAccount *accountPtr; | 711 | MailAccount *accountPtr; |
735 | 712 | ||
736 | if (! f.open(IO_WriteOnly) ) { | 713 | |
737 | qWarning("could not save settings file"); | 714 | if (!mailconf) |
715 | { | ||
716 | qWarning("could not save settings"); | ||
738 | return; | 717 | return; |
739 | } | 718 | } |
740 | QTextStream t(&f); | ||
741 | t << "#Settings for OPIE Mailit program\n"; | ||
742 | 719 | ||
743 | for (accountPtr = accountList.first(); accountPtr != 0; | 720 | for (accountPtr = accountList.first(); accountPtr != 0; |
744 | accountPtr = accountList.next()) { | 721 | accountPtr = accountList.next()) |
745 | 722 | { | |
746 | t << "accountStart;\n"; | 723 | mailconf->setGroup("Account_"+QString::number(++acc_count)); |
747 | t << "AccountName: " + accountPtr->accountName + "\n"; | 724 | mailconf->writeEntry("AccName",accountPtr->accountName ); |
748 | t << "Name: " + accountPtr->name + "\n"; | 725 | mailconf->writeEntry("UserName",accountPtr->name); |
749 | t << "Email: " + accountPtr->emailAddress + "\n"; | 726 | mailconf->writeEntry("Email",accountPtr->emailAddress); |
750 | t << "POPUser: " + accountPtr->popUserName + "\n"; | 727 | mailconf->writeEntry("POPUser",accountPtr->popUserName); |
751 | t << "POPPAssword: " + accountPtr->popPasswd + "\n"; | 728 | mailconf->writeEntryCrypt("POPPassword",accountPtr->popPasswd); |
752 | t << "POPServer: " + accountPtr->popServer + "\n"; | 729 | mailconf->writeEntry("POPServer",accountPtr->popServer); |
753 | t << "SMTPServer: " + accountPtr->smtpServer + "\n"; | 730 | mailconf->writeEntry("SMTPServer",accountPtr->smtpServer); |
754 | t << "AccountId: " << accountPtr->id << "\n"; | 731 | mailconf->writeEntry("AccountId",accountPtr->id); |
755 | if (accountPtr->synchronize) { | 732 | if (accountPtr->synchronize) |
756 | t << "Synchronize: Yes\n"; | 733 | { |
757 | t << "LastServerMailCount: "; | 734 | mailconf->writeEntry("Synchronize","Yes"); |
758 | t << accountPtr->lastServerMailCount << "\n"; | 735 | mailconf->writeEntry("HeaderLimit",accountPtr->syncLimit); |
759 | } else { | 736 | mailconf->writeEntry("LastServerMailCount",accountPtr->lastServerMailCount); |
760 | t << "Synchronize: No\n"; | 737 | } |
738 | else | ||
739 | { | ||
740 | mailconf->writeEntry("Synchronize", "No"); | ||
761 | } | 741 | } |
762 | t << "SyncLimit: "; | ||
763 | t << accountPtr->syncLimit << "\n"; | ||
764 | t << "accountEnd;\n"; | ||
765 | } | 742 | } |
766 | f.close(); | ||
767 | 743 | ||
768 | mailconf->setGroup("mailitglobal"); | 744 | mailconf->setGroup("mailitglobal"); |
745 | mailconf->writeEntry("Accounts",acc_count); | ||
769 | mailconf->writeEntry("mailidcount", mailIdCount); | 746 | mailconf->writeEntry("mailidcount", mailIdCount); |
770 | mailconf->writeEntry("accountidcount", accountIdCount); | 747 | mailconf->writeEntry("accountidcount", accountIdCount); |
771 | } | 748 | } |
772 | 749 | ||
773 | void EmailClient::selectAccount(int id) | 750 | void EmailClient::selectAccount(int id) |
774 | { | 751 | { |
775 | if (accountList.count() > 0) { | 752 | if (accountList.count() > 0) { |
776 | currentAccount = accountList.at(id); | 753 | currentAccount = accountList.at(id); |
@@ -996,9 +973,9 @@ void EmailClient::forward() | |||
996 | void EmailClient::remove() | 973 | void EmailClient::remove() |
997 | { | 974 | { |
998 | Email* mail=getCurrentMail(); | 975 | Email* mail=getCurrentMail(); |
999 | 976 | ||
1000 | if (mail!=NULL) | 977 | if (mail!=NULL) |
1001 | { | 978 | { |
1002 | emit remove(*mail); | 979 | emit remove(*mail); |
1003 | } | 980 | } |
1004 | }*/ \ No newline at end of file | 981 | }*/ |
diff --git a/noncore/net/mailit/emailhandler.cpp b/noncore/net/mailit/emailhandler.cpp index f6c6d60..b180051 100644 --- a/noncore/net/mailit/emailhandler.cpp +++ b/noncore/net/mailit/emailhandler.cpp | |||
@@ -99,28 +99,24 @@ void EmailHandler::getMail() | |||
99 | popClient->setAccount(mailAccount.popUserName, mailAccount.popPasswd); | 99 | popClient->setAccount(mailAccount.popUserName, mailAccount.popPasswd); |
100 | if (mailAccount.synchronize) { | 100 | if (mailAccount.synchronize) { |
101 | popClient->setSynchronize(mailAccount.lastServerMailCount); | 101 | popClient->setSynchronize(mailAccount.lastServerMailCount); |
102 | } else { | 102 | } else { |
103 | popClient->removeSynchronize(); | 103 | popClient->removeSynchronize(); |
104 | } | 104 | } |
105 | 105 | ||
106 | headers = FALSE; | 106 | headers = FALSE; |
107 | popClient->headersOnly(headers, 0); | 107 | //popClient->headersOnly(headers, 0); |
108 | popClient->newConnection(mailAccount.popServer, 110); | 108 | popClient->newConnection(mailAccount.popServer, 110); |
109 | } | 109 | } |
110 | 110 | ||
111 | void EmailHandler::getMailHeaders() | 111 | void EmailHandler::getMailHeaders() |
112 | { | 112 | { |
113 | popClient->setAccount(mailAccount.popUserName, mailAccount.popPasswd); | 113 | popClient->setAccount(mailAccount.popUserName, mailAccount.popPasswd); |
114 | if (mailAccount.synchronize) { | 114 | mailAccount.synchronize ? popClient->setSynchronize(mailAccount.lastServerMailCount): popClient->removeSynchronize(); |
115 | popClient->setSynchronize(mailAccount.lastServerMailCount); | ||
116 | } else { | ||
117 | popClient->removeSynchronize(); | ||
118 | } | ||
119 | 115 | ||
120 | headers = TRUE; | 116 | headers = TRUE; |
121 | popClient->headersOnly(headers, mailAccount.syncLimit); //less than requested syncLimit, download all | 117 | popClient->headersOnly(headers, mailAccount.syncLimit); //less than requested syncLimit, download all |
122 | popClient->newConnection(mailAccount.popServer, 110); | 118 | popClient->newConnection(mailAccount.popServer, 110); |
123 | } | 119 | } |
124 | 120 | ||
125 | void EmailHandler::getMailByList(MailList *mailList) | 121 | void EmailHandler::getMailByList(MailList *mailList) |
126 | { | 122 | { |
@@ -130,24 +126,24 @@ void EmailHandler::getMailByList(MailList *mailList) | |||
130 | } | 126 | } |
131 | 127 | ||
132 | headers = FALSE; | 128 | headers = FALSE; |
133 | popClient->headersOnly(FALSE, 0); | 129 | popClient->headersOnly(FALSE, 0); |
134 | popClient->newConnection(mailAccount.popServer, 110); | 130 | popClient->newConnection(mailAccount.popServer, 110); |
135 | popClient->setSelectedMails(mailList); | 131 | popClient->setSelectedMails(mailList); |
136 | } | 132 | } |
137 | 133 | ||
138 | void EmailHandler::messageArrived(const QString &message, int id, uint size, bool complete) | 134 | void EmailHandler::messageArrived(const QString &message, int id, uint size, bool incomplete) |
139 | { | 135 | { |
140 | Email mail; | 136 | Email mail; |
141 | 137 | ||
142 | mail.rawMail = message; | 138 | mail.rawMail = message; |
143 | mail.serverId = id; | 139 | mail.serverId = id; |
144 | mail.size = size; | 140 | mail.size = size; |
145 | mail.downloaded = complete; | 141 | mail.downloaded = incomplete; |
146 | 142 | ||
147 | emit mailArrived(mail, FALSE); | 143 | emit mailArrived(mail, FALSE); |
148 | } | 144 | } |
149 | 145 | ||
150 | bool EmailHandler::parse(QString in, QString lineShift, Email *mail) | 146 | bool EmailHandler::parse(QString in, QString lineShift, Email *mail) |
151 | { | 147 | { |
152 | QString temp, boundary; | 148 | QString temp, boundary; |
153 | int pos; | 149 | int pos; |
@@ -180,52 +176,72 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail) | |||
180 | pos++; | 176 | pos++; |
181 | if (p.separatorAt(pos) == ' ') { | 177 | if (p.separatorAt(pos) == ' ') { |
182 | mail->from = p.getString(&pos, '<', false); | 178 | mail->from = p.getString(&pos, '<', false); |
183 | mail->from = mail->from.stripWhiteSpace(); | 179 | mail->from = mail->from.stripWhiteSpace(); |
184 | if ( (mail->from.length() > 2) && (mail->from[0] == '"') ) { | 180 | if ( (mail->from.length() > 2) && (mail->from[0] == '"') ) { |
185 | mail->from = mail->from.left(mail->from.length() - 1); | 181 | mail->from = mail->from.left(mail->from.length() - 1); |
186 | mail->from = mail->from.right(mail->from.length() - 1); | 182 | mail->from = mail->from.right(mail->from.length() - 1); |
187 | } | 183 | } |
188 | pos++; | 184 | pos++; |
185 | |||
189 | mail->fromMail = p.getString(&pos, '>', false); | 186 | mail->fromMail = p.getString(&pos, '>', false); |
190 | } else { | 187 | } else { |
191 | if ((p.separatorAt(pos) == '<') | 188 | if ((p.separatorAt(pos) == '<') |
192 | || (p.separatorAt(pos) == ' ')) //No name.. nasty | 189 | || (p.separatorAt(pos) == ' ')) //No name.. nasty |
193 | pos++; | 190 | pos++; |
194 | pos++; | 191 | pos++; |
195 | mail->fromMail = p.getString(&pos, 'z', TRUE); | 192 | mail->fromMail = p.getString(&pos, 'z', TRUE); |
196 | if (mail->fromMail.at(mail->fromMail.length()-1) == '>') | 193 | if (mail->fromMail.at(mail->fromMail.length()-1) == '>') |
197 | mail->fromMail.truncate(mail->fromMail.length() - 1); | 194 | mail->fromMail.truncate(mail->fromMail.length() - 1); |
198 | mail->from=mail->fromMail; | 195 | mail->from=mail->fromMail; |
199 | } | 196 | } |
200 | } | 197 | } |
201 | 198 | ||
202 | //@@@ToDo: Rewrite the parser as To: stops at the first occurence- which is Delivered-To: | 199 | pos=0; |
203 | if ((pos = p.find("TO",':', 0, TRUE)) != -1) | 200 | |
201 | //Search for To: after the FROM: attribute to prevent hitting the Delivered-To: | ||
202 | while((pos = p.find("TO",':', pos+1, TRUE))!=-1) | ||
204 | { | 203 | { |
205 | pos++; | 204 | QString rec; |
206 | mail->recipients.append (p.getString(&pos, 'z', TRUE) ); | 205 | |
206 | if (p.separatorAt(pos-1)!='-') | ||
207 | { | ||
208 | pos++; | ||
209 | mail->recipients.append(p.getString(&pos, '\r', TRUE)); | ||
210 | } | ||
211 | /*else { | ||
212 | if ((p.separatorAt(pos) == '<')|| (p.separatorAt(pos) == ' ')) //No name.. nasty | ||
213 | pos++; | ||
214 | pos++; | ||
215 | mail->fromMail = p.getString(&pos, 'z', TRUE); | ||
216 | if (mail->fromMail.at(mail->fromMail.length()-1) == '>') | ||
217 | mail->fromMail.truncate(mail->fromMail.length() - 1); | ||
218 | mail->from=mail->fromMail; | ||
219 | } | ||
220 | mail->recipients.append (p.getString(&pos, 'z', TRUE) ); | ||
221 | }*/ | ||
207 | } | 222 | } |
208 | 223 | // | |
209 | //@@@ToDo: Rewrite the parser as To: stops at the first occurence- which is Delivered-To: | 224 | //if (pos==-1) mail->recipients.append (tr("undisclosed recipients") ); |
225 | |||
210 | if ((pos = p.find("CC",':', 0, TRUE)) != -1) | 226 | if ((pos = p.find("CC",':', 0, TRUE)) != -1) |
211 | { | 227 | { |
212 | pos++; | 228 | pos++; |
213 | mail->carbonCopies.append (p.getString(&pos, 'z', TRUE) ); | 229 | mail->carbonCopies.append (p.getString(&pos, 'z', TRUE) ); |
214 | } | 230 | } |
215 | 231 | ||
216 | |||
217 | if ((pos = p.find("SUBJECT",':', 0, TRUE)) != -1) { | 232 | if ((pos = p.find("SUBJECT",':', 0, TRUE)) != -1) { |
218 | pos++; | 233 | pos++; |
219 | mail->subject = p.getString(&pos, 'z', TRUE); | 234 | mail->subject = p.getString(&pos, 'z', TRUE); |
220 | } | 235 | } |
236 | |||
221 | if ((pos = p.find("DATE",':', 0, TRUE)) != -1) { | 237 | if ((pos = p.find("DATE",':', 0, TRUE)) != -1) { |
222 | pos++; | 238 | pos++; |
223 | mail->date = p.getString(&pos, 'z', true); | 239 | mail->date = p.getString(&pos, 'z', TRUE); |
224 | } | 240 | } |
225 | 241 | ||
226 | 242 | ||
227 | 243 | ||
228 | if ((pos = p.find("MESSAGE",'-', 0, TRUE)) != -1) { | 244 | if ((pos = p.find("MESSAGE",'-', 0, TRUE)) != -1) { |
229 | pos++; | 245 | pos++; |
230 | if ( (p.wordAt(pos).upper() == "ID") && | 246 | if ( (p.wordAt(pos).upper() == "ID") && |
231 | (p.separatorAt(pos) == ':') ) { | 247 | (p.separatorAt(pos) == ':') ) { |
diff --git a/noncore/net/mailit/emaillistitem.cpp b/noncore/net/mailit/emaillistitem.cpp index a325766..b925a1c 100644 --- a/noncore/net/mailit/emaillistitem.cpp +++ b/noncore/net/mailit/emaillistitem.cpp | |||
@@ -33,21 +33,23 @@ EmailListItem::EmailListItem(QListView *parent, Email mailIn, bool inbox) | |||
33 | } else { | 33 | } else { |
34 | QStringList::Iterator it = mail.recipients.begin(); | 34 | QStringList::Iterator it = mail.recipients.begin(); |
35 | temp = *it; | 35 | temp = *it; |
36 | if (mail.recipients.count() > 1) | 36 | if (mail.recipients.count() > 1) |
37 | temp += "..."; | 37 | temp += "..."; |
38 | setText(0, temp); | 38 | setText(0, temp); |
39 | } | 39 | } |
40 | setText(1, mail.subject); | 40 | setText(1, mail.subject); |
41 | setText(2,mail.date); | ||
41 | 42 | ||
42 | if (mailIn.files.count()>0) | 43 | if (mailIn.files.count()>0) |
43 | { | 44 | { |
44 | setPixmap(0, Resource::loadPixmap("mailit/attach")); | 45 | setPixmap(0, Resource::loadPixmap("mailit/attach")); |
45 | } | 46 | } |
47 | |||
46 | selected = FALSE; | 48 | selected = FALSE; |
47 | } | 49 | } |
48 | 50 | ||
49 | Email* EmailListItem::getMail() | 51 | Email* EmailListItem::getMail() |
50 | { | 52 | { |
51 | return &mail; | 53 | return &mail; |
52 | } | 54 | } |
53 | 55 | ||
diff --git a/noncore/net/mailit/mailitwindow.cpp b/noncore/net/mailit/mailitwindow.cpp index ef5fc09..7181adf 100644 --- a/noncore/net/mailit/mailitwindow.cpp +++ b/noncore/net/mailit/mailitwindow.cpp | |||
@@ -12,27 +12,28 @@ | |||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qwhatsthis.h> | ||
20 | #include "mailitwindow.h" | 21 | #include "mailitwindow.h" |
21 | 22 | ||
22 | MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl) | 23 | MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl) |
23 | : QMainWindow(parent, name, fl) | 24 | : QMainWindow(parent, name, WStyle_ContextHelp) |
24 | { | 25 | { |
25 | currentCaption = "Mailit"; | 26 | currentCaption = "Mailit"; |
26 | setCaption(tr(currentCaption)); | 27 | setCaption(tr(currentCaption)); |
27 | views = new QWidgetStack(this); | 28 | views = new QWidgetStack(this); |
28 | setCentralWidget(views); | 29 | setCentralWidget(views); |
29 | 30 | QWhatsThis::add(views,tr("Central view area")); | |
30 | emailClient = new EmailClient(views, "client"); | 31 | emailClient = new EmailClient(views, "client"); |
31 | writeMail = new WriteMail(views, "writing"); | 32 | writeMail = new WriteMail(views, "writing"); |
32 | readMail = new ReadMail(views, "reading"); | 33 | readMail = new ReadMail(views, "reading"); |
33 | 34 | ||
34 | views->raiseWidget(emailClient); | 35 | views->raiseWidget(emailClient); |
35 | 36 | ||
36 | connect(emailClient, SIGNAL(composeRequested()), | 37 | connect(emailClient, SIGNAL(composeRequested()), |
37 | this, SLOT(compose()) ); | 38 | this, SLOT(compose()) ); |
38 | connect(emailClient, SIGNAL(viewEmail(QListView *, Email *)), this, | 39 | connect(emailClient, SIGNAL(viewEmail(QListView *, Email *)), this, |
@@ -135,31 +136,8 @@ void MailItWindow::setDocument(const QString &_address) | |||
135 | // strip leading 'mailto:' | 136 | // strip leading 'mailto:' |
136 | QString address = _address; | 137 | QString address = _address; |
137 | if (address.startsWith("mailto:")) | 138 | if (address.startsWith("mailto:")) |
138 | address = address.mid(6); | 139 | address = address.mid(6); |
139 | 140 | ||
140 | compose(); | 141 | compose(); |
141 | writeMail->setRecipient(address); | 142 | writeMail->setRecipient(address); |
142 | } | 143 | } |
143 | |||
144 | /*void MailItWindow::reply(Email& mail) | ||
145 | { | ||
146 | qDebug("####EmailClient: 0 reached"); | ||
147 | composeReply(mail,(bool&)FALSE); | ||
148 | } | ||
149 | |||
150 | void MailItWindow::replyAll(Email& mail) | ||
151 | { | ||
152 | qDebug("####EmailClient: 1 reached"); | ||
153 | composeReply(mail,(bool&)TRUE); | ||
154 | } | ||
155 | |||
156 | void MailItWindow::forward(Email& mail) | ||
157 | { | ||
158 | qDebug("####EmailClient: 2 reached"); | ||
159 | } | ||
160 | |||
161 | void MailItWindow::remove(Email&) | ||
162 | { | ||
163 | qDebug("####EmailClient: 3 reached"); | ||
164 | //emit removeItem(eli,(bool&)TRUE); | ||
165 | } */ \ No newline at end of file | ||
diff --git a/noncore/net/mailit/popclient.cpp b/noncore/net/mailit/popclient.cpp index f9cc337..67306be 100644 --- a/noncore/net/mailit/popclient.cpp +++ b/noncore/net/mailit/popclient.cpp | |||
@@ -114,40 +114,29 @@ void PopClient::incomingData() | |||
114 | QString md5Source; | 114 | QString md5Source; |
115 | int start, end; | 115 | int start, end; |
116 | // char *md5Digest; | 116 | // char *md5Digest; |
117 | char md5Digest[16]; | 117 | char md5Digest[16]; |
118 | // if ( !socket->canReadLine() ) | 118 | // if ( !socket->canReadLine() ) |
119 | // return; | 119 | // return; |
120 | 120 | ||
121 | response = socket->readLine(); | 121 | response = socket->readLine(); |
122 | //qDebug(response +" %d", status); | ||
123 | 122 | ||
124 | switch(status) { | 123 | switch(status) { |
125 | //logging in | 124 | //logging in |
126 | case Init: { | 125 | case Init: { |
127 | #ifdef APOP_TEST | 126 | #ifdef APOP_TEST |
128 | start = response.find('<',0); | 127 | start = response.find('<',0); |
129 | end = response.find('>', start); | 128 | end = response.find('>', start); |
130 | if( start >= 0 && end > start ) | 129 | if( start >= 0 && end > start ) |
131 | { | 130 | { |
132 | timeStamp = response.mid( start , end - start + 1); | 131 | timeStamp = response.mid( start , end - start + 1); |
133 | md5Source = timeStamp + popPassword; | 132 | md5Source = timeStamp + popPassword; |
134 | //qDebug( md5Source); | ||
135 | // for( int i = 0; i < md5Source.length(); i++) { | ||
136 | // buff[i] = (QChar)md5Source[i]; | ||
137 | // } | ||
138 | 133 | ||
139 | md5_buffer( (char const *)md5Source, md5Source.length(),&md5Digest[0]); | 134 | md5_buffer( (char const *)md5Source, md5Source.length(),&md5Digest[0]); |
140 | // md5_buffer(char const *buffer, unsigned int len, char *digest); | ||
141 | |||
142 | // MD5_Init( &ctx); | ||
143 | // MD5_Update( &ctx, buff, sizeof( buff) ); | ||
144 | // MD5_Final( md5Digest, &ctx); | ||
145 | // MD5( buff, md5Source.length(), md5Digest); | ||
146 | 135 | ||
147 | for(int j =0;j < MD5_DIGEST_LENGTH ;j++) | 136 | for(int j =0;j < MD5_DIGEST_LENGTH ;j++) |
148 | { | 137 | { |
149 | printf("%x", md5Digest[j]); | 138 | printf("%x", md5Digest[j]); |
150 | } | 139 | } |
151 | printf("\n"); | 140 | printf("\n"); |
152 | // qDebug(md5Digest); | 141 | // qDebug(md5Digest); |
153 | *stream << "APOP " << popUserName << " " << md5Digest << "\r\n"; | 142 | *stream << "APOP " << popUserName << " " << md5Digest << "\r\n"; |
@@ -159,17 +148,17 @@ void PopClient::incomingData() | |||
159 | { | 148 | { |
160 | timeStamp = ""; | 149 | timeStamp = ""; |
161 | *stream << "USER " << popUserName << "\r\n"; | 150 | *stream << "USER " << popUserName << "\r\n"; |
162 | status = Pass; | 151 | status = Pass; |
163 | } | 152 | } |
164 | 153 | ||
165 | break; | 154 | break; |
166 | } | 155 | } |
167 | //password shhh. don't tell anyone (implement APOP...) | 156 | |
168 | case Pass: { | 157 | case Pass: { |
169 | *stream << "PASS " << popPassword << "\r\n"; | 158 | *stream << "PASS " << popPassword << "\r\n"; |
170 | status = Stat; | 159 | status = Stat; |
171 | break; | 160 | break; |
172 | } | 161 | } |
173 | //ask for number of messages | 162 | //ask for number of messages |
174 | case Stat: { | 163 | case Stat: { |
175 | if (response[0] == '+') { | 164 | if (response[0] == '+') { |
@@ -243,20 +232,21 @@ void PopClient::incomingData() | |||
243 | //qWarning(response); | 232 | //qWarning(response); |
244 | errorHandling(ErrUnknownResponse); | 233 | errorHandling(ErrUnknownResponse); |
245 | } | 234 | } |
246 | } | 235 | } |
247 | } | 236 | } |
248 | //Read message number x, count upwards to messageCount | 237 | //Read message number x, count upwards to messageCount |
249 | case Retr: { | 238 | case Retr: { |
250 | if (status != Quit) { | 239 | if (status != Quit) { |
251 | if (!preview || mailSize <= headerLimit) { | 240 | if (mailSize <= headerLimit) |
241 | { | ||
252 | *stream << "RETR " << messageCount << "\r\n"; | 242 | *stream << "RETR " << messageCount << "\r\n"; |
253 | } else { //only header | 243 | } else { //only header |
254 | *stream << "TOP " << messageCount << " 0\r\n"; | 244 | *stream << "TOP " << messageCount << " 0\r\n"; |
255 | } | 245 | } |
256 | messageCount++; | 246 | messageCount++; |
257 | status = Ignore; | 247 | status = Ignore; |
258 | break; | 248 | break; |
259 | } } | 249 | } } |
260 | case Ignore: { | 250 | case Ignore: { |
261 | if (status != Quit) { //because of idiotic switch | 251 | if (status != Quit) { //because of idiotic switch |
262 | if (response[0] == '+') { | 252 | if (response[0] == '+') { |
@@ -278,18 +268,20 @@ void PopClient::incomingData() | |||
278 | message += response; | 268 | message += response; |
279 | } | 269 | } |
280 | emit downloadedSize(message.length()); | 270 | emit downloadedSize(message.length()); |
281 | int x = message.find("\r\n.\r\n",-5); | 271 | int x = message.find("\r\n.\r\n",-5); |
282 | if (x == -1) { | 272 | if (x == -1) { |
283 | break; | 273 | break; |
284 | } else { //message reach entire size | 274 | } else { //message reach entire size |
285 | //complete mail downloaded | 275 | //complete mail downloaded |
286 | if ( (!preview ) || ((preview) && (mailSize <= headerLimit)) ){ | 276 | //if ( (!preview ) || ((preview) && (mailSize <= headerLimit)) ){ |
287 | emit newMessage(message, messageCount-1, mailSize, TRUE); | 277 | if ( mailSize <= headerLimit) |
278 | { | ||
279 | emit newMessage(message, messageCount-1, mailSize, TRUE); | ||
288 | } else { //incomplete mail downloaded | 280 | } else { //incomplete mail downloaded |
289 | emit newMessage(message, messageCount-1, mailSize, FALSE); | 281 | emit newMessage(message, messageCount-1, mailSize, FALSE); |
290 | } | 282 | } |
291 | if (messageCount > newMessages) //that was the last message | 283 | if (messageCount > newMessages) //that was the last message |
292 | status = Quit; | 284 | status = Quit; |
293 | else { //ask for new message | 285 | else { //ask for new message |
294 | if (selected) { //grab next from queue | 286 | if (selected) { //grab next from queue |
295 | int *ptr = mailList->next(); | 287 | int *ptr = mailList->next(); |
diff --git a/noncore/net/mailit/readmail.cpp b/noncore/net/mailit/readmail.cpp index dc98a6f..4eae7f6 100644 --- a/noncore/net/mailit/readmail.cpp +++ b/noncore/net/mailit/readmail.cpp | |||
@@ -54,46 +54,56 @@ void ReadMail::init() | |||
54 | menu->insertItem( tr( "&Mail" ), mailMenu); | 54 | menu->insertItem( tr( "&Mail" ), mailMenu); |
55 | 55 | ||
56 | bar = new QToolBar(this); | 56 | bar = new QToolBar(this); |
57 | 57 | ||
58 | //reply dependant on viewing inbox | 58 | //reply dependant on viewing inbox |
59 | replyButton = new QAction( tr( "Reply" ), Resource::loadPixmap( "mailit/reply" ), | 59 | replyButton = new QAction( tr( "Reply" ), Resource::loadPixmap( "mailit/reply" ), |
60 | QString::null, 0, this, 0 ); | 60 | QString::null, 0, this, 0 ); |
61 | connect(replyButton, SIGNAL(activated()), this, SLOT(reply()) ); | 61 | connect(replyButton, SIGNAL(activated()), this, SLOT(reply()) ); |
62 | 62 | replyButton->setWhatsThis(tr("Click here to reply to the selected mail")); | |
63 | |||
63 | forwardButton = new QAction( tr( "Forward" ), Resource::loadPixmap( "mailit/forward" ), | 64 | forwardButton = new QAction( tr( "Forward" ), Resource::loadPixmap( "mailit/forward" ), |
64 | QString::null, 0, this, 0 ); | 65 | QString::null, 0, this, 0 ); |
65 | connect(forwardButton, SIGNAL(activated()), this, SLOT(forward()) ); | 66 | connect(forwardButton, SIGNAL(activated()), this, SLOT(forward()) ); |
67 | forwardButton->setWhatsThis(tr("Click here to forward the selected mail")); | ||
66 | 68 | ||
67 | previousButton = new QAction( tr( "Previous" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); | 69 | previousButton = new QAction( tr( "Previous" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); |
68 | connect( previousButton, SIGNAL( activated() ), this, SLOT( previous() ) ); | 70 | connect( previousButton, SIGNAL( activated() ), this, SLOT( previous() ) ); |
69 | previousButton->addTo(bar); | 71 | previousButton->addTo(bar); |
70 | previousButton->addTo(viewMenu); | 72 | previousButton->addTo(viewMenu); |
73 | previousButton->setWhatsThis(tr("Read the previous mail in the list")); | ||
71 | 74 | ||
72 | nextButton = new QAction( tr( "Next" ), Resource::loadPixmap( "forward" ), QString::null, 0, this, 0 ); | 75 | nextButton = new QAction( tr( "Next" ), Resource::loadPixmap( "forward" ), QString::null, 0, this, 0 ); |
73 | connect( nextButton, SIGNAL( activated() ), this, SLOT( next() ) ); | 76 | connect( nextButton, SIGNAL( activated() ), this, SLOT( next() ) ); |
74 | nextButton->addTo(bar); | 77 | nextButton->addTo(bar); |
75 | nextButton->addTo(viewMenu); | 78 | nextButton->addTo(viewMenu); |
79 | previousButton->setWhatsThis(tr("Read the next mail in the list")); | ||
76 | 80 | ||
77 | attatchmentsButton = new QAction( tr( "Attatchments" ), Resource::loadPixmap( "mailit/attach" ), QString::null, 0, this, 0 ); | 81 | attachmentButton = new QAction( tr( "Attatchments" ), Resource::loadPixmap( "mailit/attach" ), QString::null, 0, this, 0 ); |
78 | connect( attatchmentsButton, SIGNAL( activated() ), this, | 82 | connect( attachmentButton, SIGNAL( activated() ), this, |
79 | SLOT( viewAttatchments() ) ); | 83 | SLOT( viewAttachments() ) ); |
80 | attatchmentsButton->addTo(bar); | 84 | attachmentButton->addTo(bar); |
81 | attatchmentsButton->addTo(viewMenu); | 85 | attachmentButton->addTo(viewMenu); |
86 | attachmentButton->setWhatsThis(tr("Click here to add attachments to your mail")); | ||
82 | 87 | ||
83 | plainTextButton = new QAction( tr( "Text Format" ), Resource::loadPixmap( "DocsIcon" ), QString::null, 0, this, 0, TRUE); | 88 | plainTextButton = new QAction( tr( "Text Format" ), Resource::loadPixmap( "DocsIcon" ), QString::null, 0, this, 0, TRUE); |
84 | connect( plainTextButton, SIGNAL( activated() ), this, SLOT( shiftText() ) ); | 89 | connect( plainTextButton, SIGNAL( activated() ), this, SLOT( shiftText() ) ); |
85 | plainTextButton->addTo(bar); | 90 | plainTextButton->addTo(bar); |
86 | plainTextButton->addTo(viewMenu); | 91 | plainTextButton->addTo(viewMenu); |
92 | plainTextButton->setWhatsThis(tr("The mail view has 2 modes:\n" | ||
93 | "<LI><B>RichText</B> shows the mail as HTML with reach features (no standard line breaks)</LI>" | ||
94 | "<LI><B>Plain</B> shows the mail as standard plain text</LI>" | ||
95 | "Click here to switch between those view modes" )); | ||
87 | 96 | ||
88 | deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); | 97 | deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); |
89 | connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) ); | 98 | connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) ); |
90 | deleteButton->addTo(bar); | 99 | deleteButton->addTo(bar); |
91 | deleteButton->addTo(mailMenu); | 100 | deleteButton->addTo(mailMenu); |
101 | deleteButton->setWhatsThis(tr("Click here to remove the selected mail")); | ||
92 | 102 | ||
93 | viewMenu->insertItem(Resource::loadPixmap("close"), "Close", this, SLOT(close())); | 103 | viewMenu->insertItem(Resource::loadPixmap("close"), "Close", this, SLOT(close())); |
94 | 104 | ||
95 | emailView = new QTextView( this, "emailView" ); | 105 | emailView = new QTextView( this, "emailView" ); |
96 | 106 | ||
97 | setCentralWidget(emailView); | 107 | setCentralWidget(emailView); |
98 | 108 | ||
99 | mime = new QMimeSourceFactory(); | 109 | mime = new QMimeSourceFactory(); |
@@ -243,18 +253,18 @@ void ReadMail::updateView() | |||
243 | text += "\nAwaiting download\n"; | 253 | text += "\nAwaiting download\n"; |
244 | text += "Size of mail: " + mailStringSize; | 254 | text += "Size of mail: " + mailStringSize; |
245 | } | 255 | } |
246 | 256 | ||
247 | emailView->setText(text); | 257 | emailView->setText(text); |
248 | } | 258 | } |
249 | 259 | ||
250 | if (mail->files.count() == 0) | 260 | if (mail->files.count() == 0) |
251 | attatchmentsButton->setEnabled(FALSE); | 261 | attachmentButton->setEnabled(FALSE); |
252 | else attatchmentsButton->setEnabled(TRUE); | 262 | else attachmentButton->setEnabled(TRUE); |
253 | 263 | ||
254 | setCaption("Examining mail: " + mail->subject); | 264 | setCaption("Examining mail: " + mail->subject); |
255 | } | 265 | } |
256 | 266 | ||
257 | //update view with current EmailListItem (item) | 267 | //update view with current EmailListItem (item) |
258 | void ReadMail::update(QListView *thisView, Email *mailIn) | 268 | void ReadMail::update(QListView *thisView, Email *mailIn) |
259 | { | 269 | { |
260 | view = thisView; | 270 | view = thisView; |
@@ -334,17 +344,17 @@ void ReadMail::updateButtons() | |||
334 | } | 344 | } |
335 | 345 | ||
336 | void ReadMail::shiftText() | 346 | void ReadMail::shiftText() |
337 | { | 347 | { |
338 | plainTxt = ! plainTxt; | 348 | plainTxt = ! plainTxt; |
339 | updateView(); | 349 | updateView(); |
340 | } | 350 | } |
341 | 351 | ||
342 | void ReadMail::viewAttatchments() | 352 | void ReadMail::viewAttachments() |
343 | { | 353 | { |
344 | viewAtt->update(mail, inbox); | 354 | viewAtt->update(mail, inbox); |
345 | viewAtt->showMaximized(); | 355 | viewAtt->showMaximized(); |
346 | } | 356 | } |
347 | 357 | ||
348 | void ReadMail::reply() | 358 | void ReadMail::reply() |
349 | { | 359 | { |
350 | emit replyRequested(*mail, (bool&)TRUE); | 360 | emit replyRequested(*mail, (bool&)TRUE); |
diff --git a/noncore/net/mailit/readmail.h b/noncore/net/mailit/readmail.h index 0fe0646..df32c34 100644 --- a/noncore/net/mailit/readmail.h +++ b/noncore/net/mailit/readmail.h | |||
@@ -52,17 +52,17 @@ signals: | |||
52 | void viewingMail(Email *); | 52 | void viewingMail(Email *); |
53 | 53 | ||
54 | public slots: | 54 | public slots: |
55 | void close(); | 55 | void close(); |
56 | void next(); | 56 | void next(); |
57 | void previous(); | 57 | void previous(); |
58 | void deleteItem(); | 58 | void deleteItem(); |
59 | void shiftText(); | 59 | void shiftText(); |
60 | void viewAttatchments(); | 60 | void viewAttachments(); |
61 | void reply(); | 61 | void reply(); |
62 | void forward(); | 62 | void forward(); |
63 | 63 | ||
64 | private: | 64 | private: |
65 | void init(); | 65 | void init(); |
66 | void updateButtons(); | 66 | void updateButtons(); |
67 | 67 | ||
68 | private: | 68 | private: |
@@ -75,15 +75,15 @@ private: | |||
75 | QToolBar *bar; | 75 | QToolBar *bar; |
76 | QMenuBar *menu; | 76 | QMenuBar *menu; |
77 | QPopupMenu *viewMenu, *mailMenu; | 77 | QPopupMenu *viewMenu, *mailMenu; |
78 | QAction *deleteButton; | 78 | QAction *deleteButton; |
79 | QMimeSourceFactory *mime; | 79 | QMimeSourceFactory *mime; |
80 | QAction *plainTextButton; | 80 | QAction *plainTextButton; |
81 | QAction *nextButton; | 81 | QAction *nextButton; |
82 | QTextView *emailView; | 82 | QTextView *emailView; |
83 | QAction *attatchmentsButton; | 83 | QAction *attachmentButton; |
84 | QAction *previousButton; | 84 | QAction *previousButton; |
85 | QAction *replyButton; | 85 | QAction *replyButton; |
86 | QAction *forwardButton; | 86 | QAction *forwardButton; |
87 | }; | 87 | }; |
88 | 88 | ||
89 | #endif // READMAIL_H | 89 | #endif // READMAIL_H |
diff --git a/noncore/net/mailit/smtpclient.cpp b/noncore/net/mailit/smtpclient.cpp index b2e38e5..8a51a5b 100644 --- a/noncore/net/mailit/smtpclient.cpp +++ b/noncore/net/mailit/smtpclient.cpp | |||
@@ -82,90 +82,82 @@ void SmtpClient::errorHandling(int status) | |||
82 | void SmtpClient::incomingData() | 82 | void SmtpClient::incomingData() |
83 | { | 83 | { |
84 | QString response; | 84 | QString response; |
85 | 85 | ||
86 | if (!socket->canReadLine()) | 86 | if (!socket->canReadLine()) |
87 | return; | 87 | return; |
88 | 88 | ||
89 | response = socket->readLine(); | 89 | response = socket->readLine(); |
90 | //qDebug(response); | ||
91 | 90 | ||
92 | switch(status) { | 91 | switch(status) { |
93 | case Init: { | 92 | case Init: { |
94 | if (response[0] == '2') { | 93 | if (response[0] == '2') { |
95 | status = From; | 94 | status = From; |
96 | mailPtr = mailList.first(); | 95 | mailPtr = mailList.first(); |
97 | *stream << "HELO there\r\n"; | 96 | *stream << "HELO there\r\n"; |
98 | //qDebug("HELO"); | ||
99 | } else errorHandling(ErrUnknownResponse); | 97 | } else errorHandling(ErrUnknownResponse); |
100 | break; | 98 | break; |
101 | } | 99 | } |
102 | case From: { | 100 | case From: { |
103 | if (response[0] == '2') { | 101 | if (response[0] == '2') { |
104 | *stream << "MAIL FROM: " << mailPtr->from << "\r\n"; | 102 | *stream << "MAIL FROM: " << mailPtr->from << "\r\n"; |
105 | status = Recv; | 103 | status = Recv; |
106 | //qDebug("MAIL FROM: "+mailPtr->from); | ||
107 | } else errorHandling(ErrUnknownResponse); | 104 | } else errorHandling(ErrUnknownResponse); |
108 | break; | 105 | break; |
109 | } | 106 | } |
110 | case Recv: { | 107 | case Recv: { |
111 | if (response[0] == '2') { | 108 | if (response[0] == '2') { |
112 | it = mailPtr->to.begin(); | 109 | it = mailPtr->to.begin(); |
113 | if (it == NULL) | 110 | if (it == NULL) |
114 | errorHandling(ErrUnknownResponse); | 111 | errorHandling(ErrUnknownResponse); |
115 | *stream << "RCPT TO: " << *it << ">\r\n"; | 112 | *stream << "RCPT TO: " << *it << ">\r\n"; |
116 | //qDebug("RCPT TO: "+ *it); | ||
117 | status = MRcv; | 113 | status = MRcv; |
118 | } else errorHandling(ErrUnknownResponse); | 114 | } else errorHandling(ErrUnknownResponse); |
119 | break; | 115 | break; |
120 | } | 116 | } |
121 | case MRcv: { | 117 | case MRcv: { |
122 | if (response[0] == '2') { | 118 | if (response[0] == '2') { |
123 | it++; | 119 | it++; |
124 | if ( it != mailPtr->to.end() ) { | 120 | if ( it != mailPtr->to.end() ) { |
125 | *stream << "RCPT TO: <" << *it << ">\r\n"; | 121 | *stream << "RCPT TO: <" << *it << ">\r\n"; |
126 | //qDebug("RCPT TO: "+ *it); | ||
127 | break; | 122 | break; |
128 | } else { | 123 | } else { |
129 | status = Data; | 124 | status = Data; |
130 | } | 125 | } |
131 | } else errorHandling(ErrUnknownResponse); | 126 | } else errorHandling(ErrUnknownResponse); |
132 | } | 127 | } |
133 | case Data: { | 128 | case Data: { |
134 | if (response[0] == '2') { | 129 | if (response[0] == '2') { |
135 | *stream << "DATA\r\n"; | 130 | *stream << "DATA\r\n"; |
136 | status = Body; | 131 | status = Body; |
137 | //qDebug("DATA"); | ||
138 | emit updateStatus(tr("Sending: ") + mailPtr->subject); | 132 | emit updateStatus(tr("Sending: ") + mailPtr->subject); |
139 | } else errorHandling(ErrUnknownResponse); | 133 | } else errorHandling(ErrUnknownResponse); |
140 | break; | 134 | break; |
141 | } | 135 | } |
142 | case Body: { | 136 | case Body: { |
143 | if (response[0] == '3') { | 137 | if (response[0] == '3') { |
144 | *stream << mailPtr->body << "\r\n.\r\n"; | 138 | *stream << mailPtr->body << "\r\n.\r\n"; |
145 | mailPtr = mailList.next(); | 139 | mailPtr = mailList.next(); |
146 | if (mailPtr != NULL) { | 140 | if (mailPtr != NULL) { |
147 | status = From; | 141 | status = From; |
148 | } else { | 142 | } else { |
149 | status = Quit; | 143 | status = Quit; |
150 | } | 144 | } |
151 | //qDebug("BODY"); | ||
152 | } else errorHandling(ErrUnknownResponse); | 145 | } else errorHandling(ErrUnknownResponse); |
153 | break; | 146 | break; |
154 | } | 147 | } |
155 | case Quit: { | 148 | case Quit: { |
156 | if (response[0] == '2') { | 149 | if (response[0] == '2') { |
157 | *stream << "QUIT\r\n"; | 150 | *stream << "QUIT\r\n"; |
158 | status = Done; | 151 | status = Done; |
159 | QString temp; | 152 | QString temp; |
160 | temp.setNum(mailList.count()); | 153 | temp.setNum(mailList.count()); |
161 | emit updateStatus(tr("Sent ") + temp + tr(" messages")); | 154 | emit updateStatus(tr("Sent ") + temp + tr(" messages")); |
162 | emit mailSent(); | 155 | emit mailSent(); |
163 | mailList.clear(); | 156 | mailList.clear(); |
164 | sending = FALSE; | 157 | sending = FALSE; |
165 | socket->close(); | 158 | socket->close(); |
166 | //qDebug("QUIT"); | ||
167 | } else errorHandling(ErrUnknownResponse); | 159 | } else errorHandling(ErrUnknownResponse); |
168 | break; | 160 | break; |
169 | } | 161 | } |
170 | } | 162 | } |
171 | } | 163 | } |
diff --git a/noncore/net/mailit/textparser.cpp b/noncore/net/mailit/textparser.cpp index f082417..3fa5f6e 100644 --- a/noncore/net/mailit/textparser.cpp +++ b/noncore/net/mailit/textparser.cpp | |||
@@ -57,37 +57,47 @@ void TextParser::init() | |||
57 | void TextParser::createSeparators() | 57 | void TextParser::createSeparators() |
58 | { | 58 | { |
59 | separators = " @#,.:;<>*/(){}|'?-+=_"; | 59 | separators = " @#,.:;<>*/(){}|'?-+=_"; |
60 | } | 60 | } |
61 | 61 | ||
62 | /*Returns pos of given search criteria, -1 if not found */ | 62 | /*Returns pos of given search criteria, -1 if not found */ |
63 | int TextParser::find(QString target, QChar sep, int pos, bool upperCase) | 63 | int TextParser::find(QString target, QChar sep, int pos, bool upperCase) |
64 | { | 64 | { |
65 | |||
66 | t_splitElm parsstr; | ||
67 | QString pString; | ||
68 | |||
65 | int atLine = 0, atPosElm = 0; | 69 | int atLine = 0, atPosElm = 0; |
66 | 70 | ||
67 | for (int x = 0; x < totalElmCount; x++) { | 71 | getLineReference(pos,&atLine,&atPosElm); |
68 | if (x >= pos) { | 72 | |
69 | if (upperCase) { | 73 | for (int x = pos; x < totalElmCount; x++) |
70 | if ((splitDone[atLine].elm[atPosElm].str.upper() == target) && | 74 | { |
71 | (splitDone[atLine].elm[atPosElm].separator == sep)) | 75 | parsstr=splitDone[atLine].elm[atPosElm++]; |
72 | return x; | 76 | |
73 | } else { | 77 | if (upperCase) |
74 | if ((splitDone[atLine].elm[atPosElm].str == target) && | 78 | { |
75 | (splitDone[atLine].elm[atPosElm].separator == sep)) | 79 | pString=parsstr.str.upper(); |
76 | return x; | 80 | target=target.upper(); |
77 | } | 81 | } |
78 | } | 82 | else |
79 | atPosElm++; | 83 | { |
80 | if (atPosElm >= splitDone[atLine].elmCount) { //new Line | 84 | pString=parsstr.str; |
85 | } | ||
86 | if ((pString == target) && (parsstr.separator == sep)) | ||
87 | { | ||
88 | return x; | ||
89 | } | ||
90 | if (atPosElm >= splitDone[atLine].elmCount) | ||
91 | { //new Line | ||
81 | atLine++; | 92 | atLine++; |
82 | atPosElm = 0; | 93 | atPosElm = 0; |
83 | } | 94 | } |
84 | } | 95 | } |
85 | |||
86 | return -1; | 96 | return -1; |
87 | } | 97 | } |
88 | 98 | ||
89 | int TextParser::elmCount() | 99 | int TextParser::elmCount() |
90 | { | 100 | { |
91 | return totalElmCount; | 101 | return totalElmCount; |
92 | } | 102 | } |
93 | 103 | ||
diff --git a/noncore/net/mailit/viewatt.cpp b/noncore/net/mailit/viewatt.cpp index b6f5015..21885c2 100644 --- a/noncore/net/mailit/viewatt.cpp +++ b/noncore/net/mailit/viewatt.cpp | |||
@@ -14,34 +14,37 @@ | |||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include "resource.h" | 20 | #include "resource.h" |
21 | #include "viewatt.h" | 21 | #include "viewatt.h" |
22 | #include <qwhatsthis.h> | ||
22 | #include <qpe/applnk.h> | 23 | #include <qpe/applnk.h> |
23 | #include <qpe/mimetype.h> | 24 | #include <qpe/mimetype.h> |
24 | 25 | ||
25 | ViewAtt::ViewAtt(QWidget *parent, const char *name, WFlags f) | 26 | ViewAtt::ViewAtt(QWidget *parent, const char *name, WFlags f) |
26 | : QMainWindow(parent, name, f) | 27 | : QMainWindow(parent, name, f) |
27 | { | 28 | { |
28 | setCaption("Exploring attatchments"); | 29 | setCaption("Exploring attatchments"); |
29 | 30 | ||
30 | setToolBarsMovable( FALSE ); | 31 | setToolBarsMovable( FALSE ); |
31 | bar = new QToolBar(this); | 32 | bar = new QToolBar(this); |
32 | installButton = new QAction( tr( "Install" ), Resource::loadPixmap( "exec" ), QString::null, CTRL + Key_C, this, 0 ); | 33 | installButton = new QAction( tr( "Install" ), Resource::loadPixmap( "exec" ), QString::null, CTRL + Key_C, this, 0 ); |
33 | connect(installButton, SIGNAL(activated()), this, SLOT(install()) ); | 34 | connect(installButton, SIGNAL(activated()), this, SLOT(install()) ); |
35 | installButton->setWhatsThis(tr("Click here to install the attachment to your Documents")); | ||
34 | 36 | ||
35 | listView = new QListView(this, "AttView"); | 37 | listView = new QListView(this, "AttView"); |
36 | listView->addColumn( "Attatchment" ); | 38 | listView->addColumn( "Attatchment" ); |
37 | listView->addColumn( "Type" ); | 39 | listView->addColumn( "Type" ); |
38 | listView->addColumn( "Installed" ); | 40 | listView->addColumn( "Installed" ); |
39 | setCentralWidget(listView); | 41 | setCentralWidget(listView); |
42 | QWhatsThis::add(listView,QWidget::tr("This is an overview about all attachments in the mail")); | ||
40 | } | 43 | } |
41 | 44 | ||
42 | void ViewAtt::update(Email *mailIn, bool inbox) | 45 | void ViewAtt::update(Email *mailIn, bool inbox) |
43 | { | 46 | { |
44 | QListViewItem *item; | 47 | QListViewItem *item; |
45 | Enclosure *ePtr; | 48 | Enclosure *ePtr; |
46 | 49 | ||
47 | 50 | ||
diff --git a/noncore/net/mailit/writemail.cpp b/noncore/net/mailit/writemail.cpp index a9dcb02..0336c83 100644 --- a/noncore/net/mailit/writemail.cpp +++ b/noncore/net/mailit/writemail.cpp | |||
@@ -13,26 +13,27 @@ | |||
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qmessagebox.h> | 20 | #include <qmessagebox.h> |
21 | #include <qwhatsthis.h> | ||
21 | #include "writemail.h" | 22 | #include "writemail.h" |
22 | #include <qpe/resource.h> | 23 | #include <qpe/resource.h> |
23 | 24 | ||
24 | WriteMail::WriteMail( QWidget* parent, const char* name, WFlags fl ) | 25 | WriteMail::WriteMail( QWidget* parent, const char* name, WFlags fl ) |
25 | : QMainWindow( parent, name, fl ) | 26 | : QMainWindow( parent, name, fl ) |
26 | { | 27 | { |
27 | showingAddressList = FALSE; | 28 | showingAddressList = FALSE; |
28 | init(); | 29 | init(); |
29 | 30 | ||
30 | addAtt = new AddAtt(0, "Add Attatchments"); | 31 | addAtt = new AddAtt(0, "Add Attachments"); |
31 | } | 32 | } |
32 | 33 | ||
33 | WriteMail::~WriteMail() | 34 | WriteMail::~WriteMail() |
34 | { | 35 | { |
35 | delete addAtt; | 36 | delete addAtt; |
36 | } | 37 | } |
37 | 38 | ||
38 | void WriteMail::setAddressList(AddressList *list) | 39 | void WriteMail::setAddressList(AddressList *list) |
@@ -59,96 +60,103 @@ void WriteMail::init() | |||
59 | menu = new QMenuBar( bar ); | 60 | menu = new QMenuBar( bar ); |
60 | 61 | ||
61 | mailMenu = new QPopupMenu(menu); | 62 | mailMenu = new QPopupMenu(menu); |
62 | menu->insertItem( tr( "&Mail" ), mailMenu); | 63 | menu->insertItem( tr( "&Mail" ), mailMenu); |
63 | addMenu = new QPopupMenu(menu); | 64 | addMenu = new QPopupMenu(menu); |
64 | menu->insertItem( tr( "&Add" ), addMenu); | 65 | menu->insertItem( tr( "&Add" ), addMenu); |
65 | 66 | ||
66 | bar = new QToolBar(this); | 67 | bar = new QToolBar(this); |
67 | attatchButton = new QAction(tr("Attatchment"), Resource::loadPixmap("mailit/attach"), QString::null, 0, this, 0); | 68 | attachButton = new QAction(tr("Attachment"), Resource::loadPixmap("mailit/attach"), QString::null, 0, this, 0); |
68 | attatchButton->addTo(bar); | 69 | attachButton->addTo(bar); |
69 | attatchButton->addTo(addMenu); | 70 | attachButton->addTo(addMenu); |
70 | connect( attatchButton, SIGNAL( activated() ), this, SLOT( attatchFile() ) ); | 71 | connect( attachButton, SIGNAL( activated() ), this, SLOT( attachFile() ) ); |
71 | 72 | attachButton->setWhatsThis(tr("Click here to attach files to your mail")); | |
73 | |||
72 | confirmButton = new QAction(tr("Enque mail"), Resource::loadPixmap("OKButton"), QString::null, 0, this, 0); | 74 | confirmButton = new QAction(tr("Enque mail"), Resource::loadPixmap("OKButton"), QString::null, 0, this, 0); |
73 | confirmButton->addTo(bar); | 75 | confirmButton->addTo(bar); |
74 | confirmButton->addTo(mailMenu); | 76 | confirmButton->addTo(mailMenu); |
75 | connect( confirmButton, SIGNAL( activated() ), this, SLOT( accept() ) ); | 77 | connect( confirmButton, SIGNAL( activated() ), this, SLOT( accept() ) ); |
78 | confirmButton->setWhatsThis(tr("This button puts your mail in the send queue")); | ||
76 | 79 | ||
77 | newButton = new QAction(tr("New mail"), Resource::loadPixmap("new"), QString::null, 0, this, 0); | 80 | newButton = new QAction(tr("New mail"), Resource::loadPixmap("new"), QString::null, 0, this, 0); |
78 | newButton->addTo(mailMenu); | 81 | newButton->addTo(mailMenu); |
79 | connect( newButton, SIGNAL( activated() ), this, SLOT( newMail() ) ); | 82 | connect( newButton, SIGNAL( activated() ), this, SLOT( newMail() ) ); |
80 | 83 | newButton->setWhatsThis(tr("Click here to create a new mail")); | |
84 | |||
81 | widget = new QWidget(this, "widget"); | 85 | widget = new QWidget(this, "widget"); |
82 | grid = new QGridLayout( widget ); | 86 | grid = new QGridLayout( widget ); |
83 | 87 | ||
84 | recipientsBox = new QComboBox( FALSE, widget, "toLabel" ); | 88 | recipientsBox = new QComboBox( FALSE, widget, "toLabel" ); |
85 | recipientsBox->insertItem( tr( "To:" ) ); | 89 | recipientsBox->insertItem( tr( "To:" ) ); |
86 | recipientsBox->insertItem( tr( "CC:" ) ); | 90 | recipientsBox->insertItem( tr( "CC:" ) ); |
87 | recipientsBox->setCurrentItem(0); | 91 | recipientsBox->setCurrentItem(0); |
88 | grid->addWidget( recipientsBox, 0, 0 ); | 92 | grid->addWidget( recipientsBox, 0, 0 ); |
89 | connect(recipientsBox,SIGNAL(activated(int)),this, SLOT(changeRecipients(int))); | 93 | connect(recipientsBox,SIGNAL(activated(int)),this, SLOT(changeRecipients(int))); |
90 | 94 | ||
91 | |||
92 | subjetLabel = new QLabel( widget, "subjetLabel" ); | 95 | subjetLabel = new QLabel( widget, "subjetLabel" ); |
93 | subjetLabel->setText( tr( "Subject:" ) ); | 96 | subjetLabel->setText( tr( "Subject:" ) ); |
94 | 97 | ||
95 | grid->addWidget( subjetLabel, 1, 0 ); | 98 | grid->addWidget( subjetLabel, 1, 0 ); |
96 | 99 | ||
97 | ToolButton13_2 = new QToolButton( widget, "ToolButton13_2" ); | 100 | ToolButton13_2 = new QToolButton( widget, "ToolButton13_2" ); |
98 | ToolButton13_2->setText( tr( "..." ) ); | 101 | ToolButton13_2->setText( tr( "..." ) ); |
99 | grid->addWidget( ToolButton13_2, 1, 2 ); | 102 | grid->addWidget( ToolButton13_2, 1, 2 ); |
100 | 103 | ||
101 | subjectInput = new QLineEdit( widget, "subjectInput" ); | 104 | subjectInput = new QLineEdit( widget, "subjectInput" ); |
102 | grid->addWidget( subjectInput, 1, 1 ); | 105 | grid->addWidget( subjectInput, 1, 1 ); |
106 | QWhatsThis::add(subjectInput,QWidget::tr("The mail subject should be entered here")); | ||
103 | 107 | ||
104 | toInput = new QLineEdit( widget, "toInput" ); | 108 | toInput = new QLineEdit( widget, "toInput" ); |
105 | grid->addWidget( toInput, 0, 1 ); | 109 | grid->addWidget( toInput, 0, 1 ); |
110 | QWhatsThis::add(recipientsBox,QWidget::tr("Recipients can be entered here")); | ||
106 | 111 | ||
107 | ccInput = new QLineEdit( widget, "ccInput" ); | 112 | ccInput = new QLineEdit( widget, "ccInput" ); |
108 | ccInput->hide(); | 113 | ccInput->hide(); |
109 | grid->addWidget( ccInput, 0, 1 ); | 114 | grid->addWidget( ccInput, 0, 1 ); |
115 | QWhatsThis::add(ccInput,QWidget::tr("If you would like to send copies of your mail they can be entered here")); | ||
110 | 116 | ||
111 | |||
112 | addressButton = new QToolButton( widget, "addressButton" ); | 117 | addressButton = new QToolButton( widget, "addressButton" ); |
113 | addressButton->setPixmap( Resource::loadPixmap("AddressBook") ); | 118 | addressButton->setPixmap( Resource::loadPixmap("AddressBook") ); |
114 | addressButton->setToggleButton(TRUE); | 119 | addressButton->setToggleButton(TRUE); |
115 | grid->addWidget( addressButton, 0, 2 ); | 120 | grid->addWidget( addressButton, 0, 2 ); |
116 | connect(addressButton, SIGNAL(clicked()), this, SLOT(getAddress()) ); | 121 | connect(addressButton, SIGNAL(clicked()), this, SLOT(getAddress()) ); |
122 | QWhatsThis::add(addressButton,QWidget::tr("This button opens the address selector with all mail adresses from your OPIE addressbook")); | ||
117 | 123 | ||
118 | emailInput = new QMultiLineEdit( widget, "emailInput" ); | 124 | emailInput = new QMultiLineEdit( widget, "emailInput" ); |
119 | grid->addMultiCellWidget( emailInput, 2, 2, 0, 2); | 125 | grid->addMultiCellWidget( emailInput, 2, 2, 0, 2); |
126 | QWhatsThis::add(recipientsBox,QWidget::tr("Enter your mail text here")); | ||
120 | 127 | ||
121 | |||
122 | addressView = new QListView( widget, "addressView"); | 128 | addressView = new QListView( widget, "addressView"); |
123 | addressView->addColumn("Name"); | 129 | addressView->addColumn("Name"); |
124 | addressView->addColumn("EMail"); | 130 | addressView->addColumn("EMail"); |
125 | addressView->setAllColumnsShowFocus(TRUE); | 131 | addressView->setAllColumnsShowFocus(TRUE); |
126 | addressView->setMultiSelection(TRUE); | 132 | addressView->setMultiSelection(TRUE); |
127 | addressView->hide(); | 133 | addressView->hide(); |
128 | grid->addMultiCellWidget( addressView, 3, 3, 0, 2); | 134 | grid->addMultiCellWidget( addressView, 3, 3, 0, 2); |
129 | 135 | QWhatsThis::add(recipientsBox,QWidget::tr("Chose the recipients from this list")); | |
136 | |||
130 | okButton = new QToolButton(bar, "ok"); | 137 | okButton = new QToolButton(bar, "ok"); |
131 | okButton->setPixmap( Resource::loadPixmap("enter") ); | 138 | okButton->setPixmap( Resource::loadPixmap("enter") ); |
132 | okButton->hide(); | 139 | okButton->hide(); |
133 | connect(okButton, SIGNAL(clicked()), this, SLOT(addRecipients()) ); | 140 | connect(okButton, SIGNAL(clicked()), this, SLOT(addRecipients()) ); |
141 | QWhatsThis::add(okButton,QWidget::tr("Queue your mail by clicking here")); | ||
134 | 142 | ||
135 | setCentralWidget(widget); | 143 | setCentralWidget(widget); |
136 | } | 144 | } |
137 | 145 | ||
138 | void WriteMail::reject() | 146 | void WriteMail::reject() |
139 | { | 147 | { |
140 | emit cancelMail(); | 148 | emit cancelMail(); |
141 | } | 149 | } |
142 | 150 | ||
143 | // need to insert date | 151 | // need to insert date |
144 | void WriteMail::accept() | 152 | void WriteMail::accept() |
145 | { | 153 | { |
146 | QStringList attatchedFiles, attatchmentsType; | 154 | QStringList attachedFiles, attachmentsType; |
147 | int idCount = 0; | 155 | int idCount = 0; |
148 | 156 | ||
149 | if (toInput->text() == "") | 157 | if (toInput->text() == "") |
150 | { | 158 | { |
151 | QMessageBox::warning(this,tr("No recipient"), tr("Send mail to whom?"), tr("OK\n")); | 159 | QMessageBox::warning(this,tr("No recipient"), tr("Send mail to whom?"), tr("OK\n")); |
152 | return; | 160 | return; |
153 | } | 161 | } |
154 | 162 | ||
@@ -191,23 +199,23 @@ void WriteMail::accept() | |||
191 | mail.rawMail += ",\n"; | 199 | mail.rawMail += ",\n"; |
192 | } | 200 | } |
193 | 201 | ||
194 | mail.rawMail += mail.from; | 202 | mail.rawMail += mail.from; |
195 | mail.rawMail += "\nSubject: "; | 203 | mail.rawMail += "\nSubject: "; |
196 | mail.rawMail += mail.subject; | 204 | mail.rawMail += mail.subject; |
197 | mail.rawMail += "\n\n"; | 205 | mail.rawMail += "\n\n"; |
198 | 206 | ||
199 | attatchedFiles = addAtt->returnAttatchedFiles(); | 207 | attachedFiles = addAtt->returnattachedFiles(); |
200 | attatchmentsType = addAtt->returnFileTypes(); | 208 | attachmentsType = addAtt->returnFileTypes(); |
201 | 209 | ||
202 | QStringList::Iterator itType = attatchmentsType.begin(); | 210 | QStringList::Iterator itType = attachmentsType.begin(); |
203 | 211 | ||
204 | Enclosure e; | 212 | Enclosure e; |
205 | for ( QStringList::Iterator it = attatchedFiles.begin(); it != attatchedFiles.end(); ++it ) { | 213 | for ( QStringList::Iterator it = attachedFiles.begin(); it != attachedFiles.end(); ++it ) { |
206 | e.id = idCount; | 214 | e.id = idCount; |
207 | e.originalName = (*it).latin1(); | 215 | e.originalName = (*it).latin1(); |
208 | e.contentType = (*itType).latin1(); | 216 | e.contentType = (*itType).latin1(); |
209 | e.contentAttribute = (*itType).latin1(); | 217 | e.contentAttribute = (*itType).latin1(); |
210 | e.saved = TRUE; | 218 | e.saved = TRUE; |
211 | mail.addEnclosure(&e); | 219 | mail.addEnclosure(&e); |
212 | 220 | ||
213 | itType++; | 221 | itType++; |
@@ -231,17 +239,17 @@ void WriteMail::getAddress() | |||
231 | 239 | ||
232 | } else { | 240 | } else { |
233 | addressView->hide(); | 241 | addressView->hide(); |
234 | okButton->hide(); | 242 | okButton->hide(); |
235 | emailInput->show(); | 243 | emailInput->show(); |
236 | } | 244 | } |
237 | } | 245 | } |
238 | 246 | ||
239 | void WriteMail::attatchFile() | 247 | void WriteMail::attachFile() |
240 | { | 248 | { |
241 | addAtt->showMaximized(); | 249 | addAtt->showMaximized(); |
242 | } | 250 | } |
243 | 251 | ||
244 | void WriteMail::reply(Email replyMail, bool replyAll) | 252 | void WriteMail::reply(Email replyMail, bool replyAll) |
245 | { | 253 | { |
246 | int pos; | 254 | int pos; |
247 | 255 | ||
@@ -251,17 +259,17 @@ void WriteMail::reply(Email replyMail, bool replyAll) | |||
251 | toInput->setText(mail.fromMail); | 259 | toInput->setText(mail.fromMail); |
252 | //replyAll ? ccInput->setText(mail.c) | 260 | //replyAll ? ccInput->setText(mail.c) |
253 | 261 | ||
254 | addRecipients(replyAll); | 262 | addRecipients(replyAll); |
255 | 263 | ||
256 | subjectInput->setText(tr("Re: ") + mail.subject); | 264 | subjectInput->setText(tr("Re: ") + mail.subject); |
257 | 265 | ||
258 | pos = 0; | 266 | pos = 0; |
259 | mail.body.insert(pos, ">>"); | 267 | mail.body.insert(pos, ">"); |
260 | while (pos != -1) { | 268 | while (pos != -1) { |
261 | pos = mail.body.find('\n', pos); | 269 | pos = mail.body.find('\n', pos); |
262 | if (pos != -1) | 270 | if (pos != -1) |
263 | mail.body.insert(++pos, ">>"); | 271 | mail.body.insert(++pos, ">>"); |
264 | } | 272 | } |
265 | 273 | ||
266 | emailInput->setText(mail.body); | 274 | emailInput->setText(mail.body); |
267 | } | 275 | } |
diff --git a/noncore/net/mailit/writemail.h b/noncore/net/mailit/writemail.h index f193b13..921f27e 100644 --- a/noncore/net/mailit/writemail.h +++ b/noncore/net/mailit/writemail.h | |||
@@ -50,17 +50,17 @@ public: | |||
50 | 50 | ||
51 | signals: | 51 | signals: |
52 | void sendMailRequested(const Email &mail); | 52 | void sendMailRequested(const Email &mail); |
53 | void cancelMail(); | 53 | void cancelMail(); |
54 | 54 | ||
55 | 55 | ||
56 | public slots: | 56 | public slots: |
57 | void getAddress(); | 57 | void getAddress(); |
58 | void attatchFile(); | 58 | void attachFile(); |
59 | void addRecipients(); | 59 | void addRecipients(); |
60 | void newMail(); | 60 | void newMail(); |
61 | void accept(); | 61 | void accept(); |
62 | void reject(); | 62 | void reject(); |
63 | void changeRecipients(int); | 63 | void changeRecipients(int); |
64 | 64 | ||
65 | private: | 65 | private: |
66 | bool getRecipients(bool); | 66 | bool getRecipients(bool); |
@@ -74,17 +74,17 @@ private: | |||
74 | 74 | ||
75 | QToolBar *bar; | 75 | QToolBar *bar; |
76 | QMenuBar *menu; | 76 | QMenuBar *menu; |
77 | QPopupMenu *addMenu, *mailMenu; | 77 | QPopupMenu *addMenu, *mailMenu; |
78 | QListView *addressView; | 78 | QListView *addressView; |
79 | 79 | ||
80 | QToolButton *okButton; | 80 | QToolButton *okButton; |
81 | QWidget *widget; | 81 | QWidget *widget; |
82 | QAction *attatchButton; | 82 | QAction *attachButton; |
83 | QAction *confirmButton; | 83 | QAction *confirmButton; |
84 | QAction *newButton; | 84 | QAction *newButton; |
85 | QLabel* subjetLabel; | 85 | QLabel* subjetLabel; |
86 | QToolButton* ToolButton13_2; | 86 | QToolButton* ToolButton13_2; |
87 | QComboBox* recipientsBox; | 87 | QComboBox* recipientsBox; |
88 | QLineEdit *subjectInput; | 88 | QLineEdit *subjectInput; |
89 | QLineEdit *toInput; | 89 | QLineEdit *toInput; |
90 | QLineEdit *ccInput; | 90 | QLineEdit *ccInput; |
diff --git a/noncore/unsupported/mailit/addatt.cpp b/noncore/unsupported/mailit/addatt.cpp index d268f1f..daefac6 100644 --- a/noncore/unsupported/mailit/addatt.cpp +++ b/noncore/unsupported/mailit/addatt.cpp | |||
@@ -51,59 +51,59 @@ FileItem::~FileItem() | |||
51 | { | 51 | { |
52 | if (doclnk!=NULL) delete doclnk; | 52 | if (doclnk!=NULL) delete doclnk; |
53 | doclnk=NULL; | 53 | doclnk=NULL; |
54 | } | 54 | } |
55 | 55 | ||
56 | AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f) | 56 | AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f) |
57 | : QDialog(parent, name, f) | 57 | : QDialog(parent, name, f) |
58 | { | 58 | { |
59 | setCaption("Adding attatchments"); | 59 | setCaption("Adding attachments"); |
60 | 60 | ||
61 | QGridLayout *top = new QGridLayout(this, 1,1 ); | 61 | QGridLayout *top = new QGridLayout(this, 1,1 ); |
62 | 62 | ||
63 | QHBox *buttons=new QHBox(this); | 63 | QHBox *buttons=new QHBox(this); |
64 | /*fileCategoryButton = new QPushButton(this);*/ | 64 | /*fileCategoryButton = new QPushButton(this);*/ |
65 | attatchButton = new QPushButton(tr("Attatch..."), buttons); | 65 | attachButton = new QPushButton(tr("attach..."), buttons); |
66 | removeButton = new QPushButton(tr("Remove"), buttons); | 66 | removeButton = new QPushButton(tr("Remove"), buttons); |
67 | 67 | ||
68 | /*fileCategories = new QPopupMenu(fileCategoryButton); | 68 | /*fileCategories = new QPopupMenu(fileCategoryButton); |
69 | fileCategoryButton->setPopup(fileCategories); | 69 | fileCategoryButton->setPopup(fileCategories); |
70 | fileCategories->insertItem("Document"); | 70 | fileCategories->insertItem("Document"); |
71 | fileCategories->insertItem("Picture"); | 71 | fileCategories->insertItem("Picture"); |
72 | fileCategories->insertItem("Sound"); | 72 | fileCategories->insertItem("Sound"); |
73 | fileCategories->insertItem("Movie"); | 73 | fileCategories->insertItem("Movie"); |
74 | fileCategories->insertItem("File"); | 74 | fileCategories->insertItem("File"); |
75 | 75 | ||
76 | fileCategoryButton->setText("Document"); | 76 | fileCategoryButton->setText("Document"); |
77 | top->addWidget(fileCategoryButton, 0, 0);*/ | 77 | top->addWidget(fileCategoryButton, 0, 0);*/ |
78 | 78 | ||
79 | 79 | ||
80 | top->addWidget(buttons,1,0); | 80 | top->addWidget(buttons,1,0); |
81 | //buttons->addWidget(attatchButton,0,0); | 81 | //buttons->addWidget(attachButton,0,0); |
82 | //buttons->addWidget(removeButton,0,1); | 82 | //buttons->addWidget(removeButton,0,1); |
83 | 83 | ||
84 | //connect(fileCategories, SIGNAL(activated(int)), this, | 84 | //connect(fileCategories, SIGNAL(activated(int)), this, |
85 | //SLOT(fileCategorySelected(int)) );*/ | 85 | //SLOT(fileCategorySelected(int)) );*/ |
86 | connect(attatchButton, SIGNAL(clicked()), this, | 86 | connect(attachButton, SIGNAL(clicked()), this, |
87 | SLOT(addAttatchment()) ); | 87 | SLOT(addattachment()) ); |
88 | connect(removeButton, SIGNAL(clicked()), this, | 88 | connect(removeButton, SIGNAL(clicked()), this, |
89 | SLOT(removeAttatchment()) ); | 89 | SLOT(removeattachment()) ); |
90 | 90 | ||
91 | /*listView = new QListView(this, "AttView"); | 91 | /*listView = new QListView(this, "AttView"); |
92 | listView->addColumn("Documents");* | 92 | listView->addColumn("Documents");* |
93 | connect(listView, SIGNAL(doubleClicked(QListViewItem *)), this, | 93 | connect(listView, SIGNAL(doubleClicked(QListViewItem *)), this, |
94 | SLOT(addAttatchment()) );*/ | 94 | SLOT(addattachment()) );*/ |
95 | 95 | ||
96 | 96 | ||
97 | attView = new QListView(this, "Selected"); | 97 | attView = new QListView(this, "Selected"); |
98 | attView->addColumn(tr("Attached")); | 98 | attView->addColumn(tr("Attached")); |
99 | attView->addColumn(tr("File type")); | 99 | attView->addColumn(tr("File type")); |
100 | connect(attView, SIGNAL(doubleClicked(QListViewItem *)), this, | 100 | connect(attView, SIGNAL(doubleClicked(QListViewItem *)), this, |
101 | SLOT(removeAttatchment()) ); | 101 | SLOT(removeattachment()) ); |
102 | 102 | ||
103 | //top->addWidget(ofs, 0,0); | 103 | //top->addWidget(ofs, 0,0); |
104 | top->addWidget(attView, 0,0); | 104 | top->addWidget(attView, 0,0); |
105 | 105 | ||
106 | clear(); | 106 | clear(); |
107 | 107 | ||
108 | 108 | ||
109 | } | 109 | } |
@@ -116,34 +116,34 @@ void AddAtt::clear() | |||
116 | } | 116 | } |
117 | 117 | ||
118 | /*void AddAtt::fileCategorySelected(int id) | 118 | /*void AddAtt::fileCategorySelected(int id) |
119 | { | 119 | { |
120 | fileCategoryButton->setText(fileCategories->text(id)); | 120 | fileCategoryButton->setText(fileCategories->text(id)); |
121 | getFiles(); | 121 | getFiles(); |
122 | }*/ | 122 | }*/ |
123 | 123 | ||
124 | void AddAtt::addAttatchment() | 124 | void AddAtt::addattachment() |
125 | { | 125 | { |
126 | OFileDialog ofs("Attachments",this,0,0,"/root/Documents"); | 126 | OFileDialog ofs("Attachments",this,0,0,"/root/Documents"); |
127 | 127 | ||
128 | ofs.showMaximized(); | 128 | ofs.showMaximized(); |
129 | 129 | ||
130 | if (ofs.exec()==QDialog::Accepted) | 130 | if (ofs.exec()==QDialog::Accepted) |
131 | { | 131 | { |
132 | DocLnk* dl=new DocLnk(ofs.selectedDocument()); | 132 | DocLnk* dl=new DocLnk(ofs.selectedDocument()); |
133 | FileItem* fi=new FileItem(attView,dl); | 133 | FileItem* fi=new FileItem(attView,dl); |
134 | fi->setPixmap(0,dl->pixmap()); | 134 | fi->setPixmap(0,dl->pixmap()); |
135 | fi->setText(1,dl->type()); | 135 | fi->setText(1,dl->type()); |
136 | attView->insertItem(fi); | 136 | attView->insertItem(fi); |
137 | modified = TRUE; | 137 | modified = TRUE; |
138 | } | 138 | } |
139 | } | 139 | } |
140 | 140 | ||
141 | void AddAtt::removeAttatchment() | 141 | void AddAtt::removeattachment() |
142 | { | 142 | { |
143 | if (attView->selectedItem() != NULL) | 143 | if (attView->selectedItem() != NULL) |
144 | { | 144 | { |
145 | attView->takeItem(attView->selectedItem()); | 145 | attView->takeItem(attView->selectedItem()); |
146 | } | 146 | } |
147 | modified = TRUE; | 147 | modified = TRUE; |
148 | } | 148 | } |
149 | 149 | ||
@@ -187,17 +187,17 @@ void AddAtt::getFiles() | |||
187 | QFileInfoListIterator it(*dirInfoList); // create list iterator | 187 | QFileInfoListIterator it(*dirInfoList); // create list iterator |
188 | 188 | ||
189 | while ( (fi=it.current()) ) { // for each file... | 189 | while ( (fi=it.current()) ) { // for each file... |
190 | item = new FileItem(lis+ütView, *fi, selected); | 190 | item = new FileItem(lis+ütView, *fi, selected); |
191 | ++it; // goto next list element | 191 | ++it; // goto next list element |
192 | }*/ | 192 | }*/ |
193 | } | 193 | } |
194 | 194 | ||
195 | QStringList AddAtt::returnAttatchedFiles() | 195 | QStringList AddAtt::returnattachedFiles() |
196 | { | 196 | { |
197 | QFileInfo info; | 197 | QFileInfo info; |
198 | QStringList list; | 198 | QStringList list; |
199 | 199 | ||
200 | item = (FileItem *) attView->firstChild(); | 200 | item = (FileItem *) attView->firstChild(); |
201 | 201 | ||
202 | 202 | ||
203 | while (item != NULL) { | 203 | while (item != NULL) { |
diff --git a/noncore/unsupported/mailit/addatt.h b/noncore/unsupported/mailit/addatt.h index fcf3279..a365947 100644 --- a/noncore/unsupported/mailit/addatt.h +++ b/noncore/unsupported/mailit/addatt.h | |||
@@ -44,33 +44,33 @@ private: | |||
44 | }; | 44 | }; |
45 | 45 | ||
46 | class AddAtt : public QDialog | 46 | class AddAtt : public QDialog |
47 | { | 47 | { |
48 | Q_OBJECT | 48 | Q_OBJECT |
49 | 49 | ||
50 | public: | 50 | public: |
51 | AddAtt(QWidget *parent = 0, const char *name = 0, WFlags f = 0); | 51 | AddAtt(QWidget *parent = 0, const char *name = 0, WFlags f = 0); |
52 | QStringList returnAttatchedFiles(); | 52 | QStringList returnattachedFiles(); |
53 | QStringList returnFileTypes(); | 53 | QStringList returnFileTypes(); |
54 | void getFiles(); | 54 | void getFiles(); |
55 | void clear(); | 55 | void clear(); |
56 | 56 | ||
57 | 57 | ||
58 | public slots: | 58 | public slots: |
59 | //void fileCategorySelected(int); | 59 | //void fileCategorySelected(int); |
60 | void addAttatchment(); | 60 | void addattachment(); |
61 | void removeAttatchment(); | 61 | void removeattachment(); |
62 | void reject(); | 62 | void reject(); |
63 | void accept(); | 63 | void accept(); |
64 | 64 | ||
65 | private: | 65 | private: |
66 | FileItem* item; | 66 | FileItem* item; |
67 | QListView *attView; | 67 | QListView *attView; |
68 | QPushButton *attatchButton, *removeButton; | 68 | QPushButton *attachButton, *removeButton; |
69 | QPopupMenu *fileCategories; | 69 | QPopupMenu *fileCategories; |
70 | bool modified; | 70 | bool modified; |
71 | //QFileInfo *fi; | 71 | //QFileInfo *fi; |
72 | 72 | ||
73 | OFileDialog* ofs; | 73 | OFileDialog* ofs; |
74 | }; | 74 | }; |
75 | 75 | ||
76 | #endif | 76 | #endif |
diff --git a/noncore/unsupported/mailit/addresslist.cpp b/noncore/unsupported/mailit/addresslist.cpp index 8d9ab91..7d60ebf 100644 --- a/noncore/unsupported/mailit/addresslist.cpp +++ b/noncore/unsupported/mailit/addresslist.cpp | |||
@@ -116,17 +116,17 @@ QList<Contact>* AddressList::getContactList() | |||
116 | 116 | ||
117 | void AddressList::read() | 117 | void AddressList::read() |
118 | { | 118 | { |
119 | OContactAccess::List::Iterator it; | 119 | OContactAccess::List::Iterator it; |
120 | 120 | ||
121 | QString lineEmail, lineName, email, name; | 121 | QString lineEmail, lineName, email, name; |
122 | OContactAccess m_contactdb("mailit"); | 122 | OContactAccess m_contactdb("mailit"); |
123 | OContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 ); | 123 | OContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 ); |
124 | //OContact* oc; | 124 | //OContact* oc;(*it).defaultEmail() |
125 | 125 | ||
126 | for ( it = m_list.begin(); it != m_list.end(); ++it ) | 126 | for ( it = m_list.begin(); it != m_list.end(); ++it ) |
127 | { | 127 | { |
128 | //oc=(OContact*) it; | 128 | //oc=(OContact*) it; |
129 | if ((*it).defaultEmail().length()!=0) | 129 | if ((*it).defaultEmail().length()!=0) |
130 | addContact((*it).defaultEmail(),(*it).fileAs()); | 130 | addContact((*it).defaultEmail(),(*it).fileAs()); |
131 | } | 131 | } |
132 | 132 | ||
diff --git a/noncore/unsupported/mailit/emailclient.cpp b/noncore/unsupported/mailit/emailclient.cpp index ad1e0b4..23059cf 100644 --- a/noncore/unsupported/mailit/emailclient.cpp +++ b/noncore/unsupported/mailit/emailclient.cpp | |||
@@ -18,16 +18,17 @@ | |||
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qapplication.h> | 20 | #include <qapplication.h> |
21 | #include <qmessagebox.h> | 21 | #include <qmessagebox.h> |
22 | #include <qfile.h> | 22 | #include <qfile.h> |
23 | #include <qcheckbox.h> | 23 | #include <qcheckbox.h> |
24 | #include <qmenubar.h> | 24 | #include <qmenubar.h> |
25 | #include <qaction.h> | 25 | #include <qaction.h> |
26 | #include <qwhatsthis.h> | ||
26 | #include <qpe/resource.h> | 27 | #include <qpe/resource.h> |
27 | #include "emailclient.h" | 28 | #include "emailclient.h" |
28 | 29 | ||
29 | QCollection::Item AccountList::newItem(QCollection::Item d) | 30 | QCollection::Item AccountList::newItem(QCollection::Item d) |
30 | { | 31 | { |
31 | return dupl( (MailAccount *) d); | 32 | return dupl( (MailAccount *) d); |
32 | } | 33 | } |
33 | 34 | ||
@@ -77,16 +78,17 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) | |||
77 | readSettings(); | 78 | readSettings(); |
78 | 79 | ||
79 | updateAccounts(); | 80 | updateAccounts(); |
80 | 81 | ||
81 | lineShift = "\n"; | 82 | lineShift = "\n"; |
82 | readMail(); | 83 | readMail(); |
83 | lineShift = "\r\n"; | 84 | lineShift = "\r\n"; |
84 | 85 | ||
86 | mailboxView->setCurrentTab(0); //ensure that inbox has focus | ||
85 | } | 87 | } |
86 | 88 | ||
87 | 89 | ||
88 | EmailClient::~EmailClient() | 90 | EmailClient::~EmailClient() |
89 | { | 91 | { |
90 | //needs to be moved from destructor to closewindow event | 92 | //needs to be moved from destructor to closewindow event |
91 | saveMail(getPath(FALSE) + "inbox.txt", inboxView); | 93 | saveMail(getPath(FALSE) + "inbox.txt", inboxView); |
92 | //does not currently work. Defining outbox in the same | 94 | //does not currently work. Defining outbox in the same |
@@ -108,30 +110,32 @@ void EmailClient::init() | |||
108 | status1Label = new QLabel( tr("Idle"), statusBar); | 110 | status1Label = new QLabel( tr("Idle"), statusBar); |
109 | status2Label = new QLabel("", statusBar); | 111 | status2Label = new QLabel("", statusBar); |
110 | connect(emailHandler, SIGNAL(updatePopStatus(const QString &)), | 112 | connect(emailHandler, SIGNAL(updatePopStatus(const QString &)), |
111 | status2Label, SLOT(setText(const QString &)) ); | 113 | status2Label, SLOT(setText(const QString &)) ); |
112 | connect(emailHandler, SIGNAL(updateSmtpStatus(const QString &)), | 114 | connect(emailHandler, SIGNAL(updateSmtpStatus(const QString &)), |
113 | status2Label, SLOT(setText(const QString &)) ); | 115 | status2Label, SLOT(setText(const QString &)) ); |
114 | 116 | ||
115 | progressBar = new QProgressBar(statusBar); | 117 | progressBar = new QProgressBar(statusBar); |
118 | |||
116 | connect(emailHandler, SIGNAL(mailboxSize(int)), | 119 | connect(emailHandler, SIGNAL(mailboxSize(int)), |
117 | this, SLOT(setTotalSize(int)) ); | 120 | this, SLOT(setTotalSize(int)) ); |
118 | connect(emailHandler, SIGNAL(currentMailSize(int)), | 121 | connect(emailHandler, SIGNAL(currentMailSize(int)), |
119 | this, SLOT(setMailSize(int)) ); | 122 | this, SLOT(setMailSize(int)) ); |
120 | connect(emailHandler, SIGNAL(downloadedSize(int)), | 123 | connect(emailHandler, SIGNAL(downloadedSize(int)), |
121 | this, SLOT(setDownloadedSize(int)) ); | 124 | this, SLOT(setDownloadedSize(int)) ); |
122 | 125 | ||
123 | statusBar->addWidget(status1Label); | 126 | statusBar->addWidget(status1Label); |
124 | statusBar->addWidget(progressBar); | 127 | statusBar->addWidget(progressBar); |
125 | statusBar->addWidget(status2Label); | 128 | statusBar->addWidget(status2Label); |
126 | 129 | ||
127 | setToolBarsMovable(FALSE); | 130 | setToolBarsMovable(FALSE); |
128 | 131 | ||
129 | bar = new QToolBar(this); | 132 | bar = new QToolBar(this); |
133 | QWhatsThis::add(bar,tr("Main operation toolbar")); | ||
130 | bar->setHorizontalStretchable( TRUE ); | 134 | bar->setHorizontalStretchable( TRUE ); |
131 | 135 | ||
132 | mb = new QMenuBar( bar ); | 136 | mb = new QMenuBar( bar ); |
133 | 137 | ||
134 | QPopupMenu *mail = new QPopupMenu(mb); | 138 | QPopupMenu *mail = new QPopupMenu(mb); |
135 | mb->insertItem( tr( "&Mail" ), mail); | 139 | mb->insertItem( tr( "&Mail" ), mail); |
136 | 140 | ||
137 | QPopupMenu *configure = new QPopupMenu(mb); | 141 | QPopupMenu *configure = new QPopupMenu(mb); |
@@ -143,89 +147,80 @@ void EmailClient::init() | |||
143 | 147 | ||
144 | mail->insertItem(tr("Get Mail in"), selectAccountMenu); | 148 | mail->insertItem(tr("Get Mail in"), selectAccountMenu); |
145 | configure->insertItem(tr("Edit account"), editAccountMenu); | 149 | configure->insertItem(tr("Edit account"), editAccountMenu); |
146 | configure->insertItem(tr("Delete account"), deleteAccountMenu); | 150 | configure->insertItem(tr("Delete account"), deleteAccountMenu); |
147 | 151 | ||
148 | bar = new QToolBar(this); | 152 | bar = new QToolBar(this); |
149 | 153 | ||
150 | getMailButton = new QToolButton(Resource::loadPixmap("mailit/getmail"),tr("getMail"),tr("select account"), this,SLOT(getAllNewMail()),bar); | 154 | getMailButton = new QToolButton(Resource::loadPixmap("mailit/getmail"),tr("getMail"),tr("select account"), this,SLOT(getAllNewMail()),bar); |
151 | //connect(setAccountlButton, SIGNAL(activated()), this, SLOT(setCurrentAccount()) ); | 155 | QWhatsThis::add(getMailButton,tr("Click to download mail via all available accounts.\n Press and hold to select the desired account.")); |
152 | // setAccountButton->addTo(bar); | 156 | |
153 | //setAccountButton->addTo(mail); | ||
154 | |||
155 | /*idCount = 0; | ||
156 | |||
157 | for (MailAccount* accountPtr = accountList.first(); accountPtr != 0; | ||
158 | accountPtr = accountList.next()) { | ||
159 | |||
160 | selectAccountMenu->insertItem(accountPtr->accountName,this, SLOT(selectAccount(int)), 0, idCount); | ||
161 | idCount++; | ||
162 | }*/ | ||
163 | getMailButton->setPopup(selectAccountMenu); | 157 | getMailButton->setPopup(selectAccountMenu); |
164 | 158 | ||
165 | |||
166 | /*getMailButton = new QAction(tr("Get all mail"), Resource::loadPixmap("mailit/getmail"), QString::null, 0, this, 0); | ||
167 | connect(getMailButton, SIGNAL(activated()), this, SLOT(getAllNewMail()) ); | ||
168 | getMailButton->addTo(bar);*/ | ||
169 | //getMailButton->addTo(mail); | ||
170 | |||
171 | sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendqueue"), QString::null, 0, this, 0); | 159 | sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendqueue"), QString::null, 0, this, 0); |
172 | connect(sendMailButton, SIGNAL(activated()), this, SLOT(sendQuedMail()) ); | 160 | connect(sendMailButton, SIGNAL(activated()), this, SLOT(sendQuedMail()) ); |
173 | sendMailButton->addTo(bar); | 161 | sendMailButton->addTo(bar); |
174 | sendMailButton->addTo(mail); | 162 | sendMailButton->addTo(mail); |
163 | sendMailButton->setWhatsThis("Send mail queued in the outbox"); | ||
175 | 164 | ||
176 | composeButton = new QAction(tr("Compose"), Resource::loadPixmap("new"), QString::null, 0, this, 0); | 165 | composeButton = new QAction(tr("Compose"), Resource::loadPixmap("new"), QString::null, 0, this, 0); |
177 | connect(composeButton, SIGNAL(activated()), this, SLOT(compose()) ); | 166 | connect(composeButton, SIGNAL(activated()), this, SLOT(compose()) ); |
178 | composeButton->addTo(bar); | 167 | composeButton->addTo(bar); |
179 | composeButton->addTo(mail); | 168 | composeButton->addTo(mail); |
169 | composeButton->setWhatsThis("Compose a new mail"); | ||
180 | 170 | ||
181 | cancelButton = new QAction(tr("Cancel transfer"), Resource::loadPixmap("close"), QString::null, 0, this, 0); | 171 | cancelButton = new QAction(tr("Cancel transfer"), Resource::loadPixmap("close"), QString::null, 0, this, 0); |
182 | connect(cancelButton, SIGNAL(activated()), this, SLOT(cancel()) ); | 172 | connect(cancelButton, SIGNAL(activated()), this, SLOT(cancel()) ); |
183 | cancelButton->addTo(mail); | 173 | cancelButton->addTo(mail); |
184 | cancelButton->addTo(bar); | 174 | cancelButton->addTo(bar); |
185 | cancelButton->setEnabled(FALSE); | 175 | cancelButton->setEnabled(FALSE); |
176 | cancelButton->setWhatsThis("Stop the currently active mail transfer"); | ||
177 | |||
186 | 178 | ||
187 | deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); | 179 | deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); |
188 | connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) ); | 180 | connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) ); |
189 | deleteButton->addTo(bar); | 181 | deleteButton->addTo(bar); |
182 | deleteButton->setWhatsThis("Remove the currently selected eMail(s)"); | ||
190 | 183 | ||
191 | mailboxView = new OTabWidget( this, "mailboxView" ); | 184 | mailboxView = new OTabWidget( this, "mailboxView" ); |
192 | 185 | ||
193 | QWidget* widget = new QWidget( mailboxView, "widget" ); | 186 | QWidget* widget = new QWidget( mailboxView, "widget" ); |
194 | grid_2 = new QGridLayout( widget ); | 187 | grid_2 = new QGridLayout( widget ); |
195 | // grid_2->setSpacing(6); | 188 | // grid_2->setSpacing(6); |
196 | // grid_2->setMargin( 11 ); | 189 | // grid_2->setMargin( 11 ); |
197 | 190 | ||
198 | inboxView = new QListView( widget, "inboxView" ); | 191 | inboxView = new QListView( widget, "inboxView" ); |
199 | inboxView->addColumn( tr( "From" ) ); | 192 | inboxView->addColumn( tr( "From" ) ); |
200 | inboxView->addColumn( tr( "Subject" ) ); | 193 | inboxView->addColumn( tr( "Subject" ) ); |
201 | inboxView->addColumn( tr( "Date" ) ); | 194 | inboxView->addColumn( tr( "Date" ) ); |
202 | inboxView->setMinimumSize( QSize( 0, 0 ) ); | 195 | inboxView->setMinimumSize( QSize( 0, 0 ) ); |
203 | inboxView->setAllColumnsShowFocus(TRUE); | 196 | inboxView->setAllColumnsShowFocus(TRUE); |
197 | QWhatsThis::add(inboxView,QWidget::tr("This is the inbox view.\n It keeps the fetched mail which can be viewed by double clicking the entry.\n" | ||
198 | " A blue attachment icon shows whether this mail has attachments.")); | ||
204 | 199 | ||
205 | grid_2->addWidget( inboxView, 2, 0 ); | 200 | grid_2->addWidget( inboxView, 2, 0 ); |
206 | mailboxView->addTab( widget, "mailit/inbox", tr( "Inbox" ) ); | 201 | mailboxView->addTab( widget, "mailit/inbox", tr( "Inbox" ) ); |
207 | 202 | ||
208 | QWidget* widget_2 = new QWidget( mailboxView, "widget_2" ); | 203 | QWidget* widget_2 = new QWidget( mailboxView, "widget_2" ); |
209 | grid_3 = new QGridLayout( widget_2 ); | 204 | grid_3 = new QGridLayout( widget_2 ); |
210 | // grid_3->setSpacing(6); | 205 | // grid_3->setSpacing(6); |
211 | // grid_3->setMargin( 11 ); | 206 | // grid_3->setMargin( 11 ); |
212 | 207 | ||
213 | outboxView = new QListView( widget_2, "outboxView" ); | 208 | outboxView = new QListView( widget_2, "outboxView" ); |
214 | outboxView->addColumn( tr( "To" ) ); | 209 | outboxView->addColumn( tr( "To" ) ); |
215 | outboxView->addColumn( tr( "Subject" ) ); | 210 | outboxView->addColumn( tr( "Subject" ) ); |
216 | outboxView->setAllColumnsShowFocus(TRUE); | 211 | outboxView->setAllColumnsShowFocus(TRUE); |
217 | 212 | ||
213 | QWhatsThis::add(outboxView,QWidget::tr("This is the oubox view.\n It keeps the queued mails to send which can be reviewed by double clicking the entry.")); | ||
218 | grid_3->addWidget( outboxView, 0, 0 ); | 214 | grid_3->addWidget( outboxView, 0, 0 ); |
219 | mailboxView->addTab( widget_2,"mailit/outbox", tr( "Outbox" ) ); | 215 | mailboxView->addTab( widget_2,"mailit/outbox", tr( "Outbox" ) ); |
220 | 216 | ||
221 | setCentralWidget(mailboxView); | 217 | setCentralWidget(mailboxView); |
222 | 218 | ||
223 | mailboxView->setCurrentTab(0); | ||
224 | } | 219 | } |
225 | 220 | ||
226 | void EmailClient::compose() | 221 | void EmailClient::compose() |
227 | { | 222 | { |
228 | emit composeRequested(); | 223 | emit composeRequested(); |
229 | } | 224 | } |
230 | 225 | ||
231 | void EmailClient::cancel() | 226 | void EmailClient::cancel() |
@@ -319,52 +314,55 @@ void EmailClient::getNewMail() { | |||
319 | getMailButton->setEnabled(FALSE); | 314 | getMailButton->setEnabled(FALSE); |
320 | cancelButton->setEnabled(TRUE); | 315 | cancelButton->setEnabled(TRUE); |
321 | selectAccountMenu->setEnabled(FALSE); | 316 | selectAccountMenu->setEnabled(FALSE); |
322 | 317 | ||
323 | status1Label->setText(currentAccount->accountName + " headers"); | 318 | status1Label->setText(currentAccount->accountName + " headers"); |
324 | progressBar->reset(); | 319 | progressBar->reset(); |
325 | 320 | ||
326 | //get any previous mails not downloaded and add to queue | 321 | //get any previous mails not downloaded and add to queue |
327 | /* mailDownloadList.clear(); | 322 | mailDownloadList.clear(); |
328 | Email *mailPtr; | 323 | Email *mailPtr; |
329 | item = (EmailListItem *) inboxView->firstChild(); | 324 | item = (EmailListItem *) inboxView->firstChild(); |
330 | while (item != NULL) { | 325 | while (item != NULL) { |
331 | mailPtr = item->getMail(); | 326 | mailPtr = item->getMail(); |
332 | if ( (!mailPtr->downloaded) && (mailPtr->fromAccountId == currentAccount->id) ) { | 327 | if ( (!mailPtr->downloaded) && (mailPtr->fromAccountId == currentAccount->id) ) { |
333 | mailDownloadList.sizeInsert(mailPtr->serverId, mailPtr->size); | 328 | mailDownloadList.sizeInsert(mailPtr->serverId, mailPtr->size); |
334 | } | 329 | } |
335 | item = (EmailListItem *) item->nextSibling(); | 330 | item = (EmailListItem *) item->nextSibling(); |
336 | }*/ | 331 | } |
337 | 332 | ||
338 | emailHandler->getMailHeaders(); | 333 | emailHandler->getMailHeaders(); |
334 | |||
339 | } | 335 | } |
340 | 336 | ||
341 | void EmailClient::getAllNewMail() | 337 | void EmailClient::getAllNewMail() |
342 | { | 338 | { |
343 | allAccounts = TRUE; | 339 | allAccounts = TRUE; |
344 | currentAccount = accountList.first(); | 340 | currentAccount = accountList.first(); |
345 | getNewMail(); | 341 | getNewMail(); |
346 | } | 342 | } |
347 | 343 | ||
348 | void EmailClient::mailArrived(const Email &mail, bool fromDisk) | 344 | void EmailClient::mailArrived(const Email &mail, bool fromDisk) |
349 | { | 345 | { |
350 | Enclosure *ePtr; | 346 | Enclosure *ePtr; |
351 | Email newMail; | 347 | Email newMail; |
352 | int thisMailId; | 348 | int thisMailId; |
353 | emailHandler->parse(mail.rawMail, lineShift, &newMail); | 349 | emailHandler->parse(mail.rawMail, lineShift, &newMail); |
354 | |||
355 | mailconf->setGroup(newMail.id); | 350 | mailconf->setGroup(newMail.id); |
356 | 351 | ||
357 | if (fromDisk) { | 352 | if (fromDisk) |
353 | { | ||
358 | newMail.downloaded = mailconf->readBoolEntry("downloaded"); | 354 | newMail.downloaded = mailconf->readBoolEntry("downloaded"); |
359 | newMail.size = mailconf->readNumEntry("size"); | 355 | newMail.size = mailconf->readNumEntry("size"); |
360 | newMail.serverId = mailconf->readNumEntry("serverid"); | 356 | newMail.serverId = mailconf->readNumEntry("serverid"); |
361 | newMail.fromAccountId = mailconf->readNumEntry("fromaccountid"); | 357 | newMail.fromAccountId = mailconf->readNumEntry("fromaccountid"); |
362 | } else { //mail arrived from server | 358 | } |
359 | else | ||
360 | { //mail arrived from server | ||
363 | newMail.serverId = mail.serverId; | 361 | newMail.serverId = mail.serverId; |
364 | newMail.size = mail.size; | 362 | newMail.size = mail.size; |
365 | newMail.downloaded = mail.downloaded; | 363 | newMail.downloaded = mail.downloaded; |
366 | 364 | ||
367 | newMail.fromAccountId = currentAccount->id; | 365 | newMail.fromAccountId = currentAccount->id; |
368 | mailconf->writeEntry("fromaccountid", newMail.fromAccountId); | 366 | mailconf->writeEntry("fromaccountid", newMail.fromAccountId); |
369 | } | 367 | } |
370 | 368 | ||
@@ -373,31 +371,33 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) | |||
373 | 371 | ||
374 | //check if new mail | 372 | //check if new mail |
375 | if ( (thisMailId = mailconf->readNumEntry("internalmailid", -1)) == -1) { | 373 | if ( (thisMailId = mailconf->readNumEntry("internalmailid", -1)) == -1) { |
376 | thisMailId = mailIdCount; | 374 | thisMailId = mailIdCount; |
377 | mailIdCount++; | 375 | mailIdCount++; |
378 | 376 | ||
379 | //set server count, so that if the user aborts, the new | 377 | //set server count, so that if the user aborts, the new |
380 | //header is not reloaded | 378 | //header is not reloaded |
381 | if (currentAccount->synchronize) | 379 | if ((currentAccount)&&(currentAccount->synchronize)) |
382 | currentAccount->lastServerMailCount++; | 380 | currentAccount->lastServerMailCount++; |
383 | 381 | ||
384 | mailconf->writeEntry("internalmailid", thisMailId); | 382 | mailconf->writeEntry("internalmailid", thisMailId); |
385 | mailconf->writeEntry("downloaded", newMail.downloaded); | 383 | mailconf->writeEntry("downloaded", newMail.downloaded); |
386 | mailconf->writeEntry("size", (int) newMail.size); | 384 | mailconf->writeEntry("size", (int) newMail.size); |
387 | mailconf->writeEntry("serverid", newMail.serverId); | 385 | mailconf->writeEntry("serverid", newMail.serverId); |
388 | 386 | ||
389 | addressList->addContact(newMail.fromMail, newMail.from); | 387 | //addressList->addContact(newMail.fromMail, newMail.from); |
390 | } else if (!fromDisk) { //body to header arrived | ||
391 | mailconf->writeEntry("downloaded", TRUE); | ||
392 | } | 388 | } |
389 | |||
390 | mailconf->writeEntry("downloaded", newMail.downloaded); | ||
391 | |||
393 | QString stringMailId; | 392 | QString stringMailId; |
394 | stringMailId.setNum(thisMailId); | 393 | stringMailId.setNum(thisMailId); |
395 | //se if any attatchments needs to be stored | 394 | //see if any attatchments needs to be stored |
395 | |||
396 | for ( ePtr=newMail.files.first(); ePtr != 0; ePtr=newMail.files.next() ) { | 396 | for ( ePtr=newMail.files.first(); ePtr != 0; ePtr=newMail.files.next() ) { |
397 | QString stringId; | 397 | QString stringId; |
398 | stringId.setNum(ePtr->id); | 398 | stringId.setNum(ePtr->id); |
399 | 399 | ||
400 | int id = mailconf->readNumEntry("enclosureid_" + stringId); | 400 | int id = mailconf->readNumEntry("enclosureid_" + stringId); |
401 | if (id != ePtr->id) { //new entry | 401 | if (id != ePtr->id) { //new entry |
402 | mailconf->writeEntry("enclosureid_" + stringId, ePtr->id); | 402 | mailconf->writeEntry("enclosureid_" + stringId, ePtr->id); |
403 | mailconf->writeEntry("name_" + stringId, ePtr->originalName); | 403 | mailconf->writeEntry("name_" + stringId, ePtr->originalName); |
@@ -421,64 +421,71 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) | |||
421 | ePtr->saved = mailconf->readBoolEntry("saved_" + stringId); | 421 | ePtr->saved = mailconf->readBoolEntry("saved_" + stringId); |
422 | ePtr->installed = mailconf->readBoolEntry("installed_" + stringId); | 422 | ePtr->installed = mailconf->readBoolEntry("installed_" + stringId); |
423 | if (ePtr->saved) { | 423 | if (ePtr->saved) { |
424 | ePtr->name = mailconf->readEntry("filename_" + stringId); | 424 | ePtr->name = mailconf->readEntry("filename_" + stringId); |
425 | ePtr->path = mailconf->readEntry("path_" + stringId); | 425 | ePtr->path = mailconf->readEntry("path_" + stringId); |
426 | } | 426 | } |
427 | } | 427 | } |
428 | } | 428 | } |
429 | if (!previewingMail && !fromDisk) { | 429 | |
430 | bool found=false; | ||
431 | |||
432 | if (!fromDisk) | ||
433 | { | ||
434 | |||
430 | Email *mailPtr; | 435 | Email *mailPtr; |
431 | item = (EmailListItem *) inboxView->firstChild(); | 436 | item = (EmailListItem *) inboxView->firstChild(); |
432 | while (item != NULL) { | 437 | while ((item != NULL)&&(!found)) |
438 | { | ||
433 | mailPtr = item->getMail(); | 439 | mailPtr = item->getMail(); |
434 | if (mailPtr->id == newMail.id) { | 440 | if (mailPtr->id == newMail.id) { |
435 | item->setMail(newMail); | 441 | item->setMail(newMail); |
436 | emit mailUpdated(item->getMail()); | 442 | emit mailUpdated(item->getMail()); |
443 | found = true; | ||
437 | } | 444 | } |
438 | item = (EmailListItem *) item->nextSibling(); | 445 | item = (EmailListItem *) item->nextSibling(); |
439 | } | 446 | } |
440 | } else { | ||
441 | item = new EmailListItem(inboxView, newMail, TRUE); | ||
442 | if (!newMail.downloaded) | ||
443 | mailDownloadList.sizeInsert(newMail.serverId, newMail.size); | ||
444 | } | 447 | } |
448 | if ((!found)||(fromDisk)) item = new EmailListItem(inboxView, newMail, TRUE); | ||
449 | |||
450 | /*if (!newMail.downloaded) | ||
451 | mailDownloadList.sizeInsert(newMail.serverId, newMail.size);*/ | ||
445 | 452 | ||
446 | mailboxView->setCurrentTab(0); | 453 | mailboxView->setCurrentTab(0); |
447 | 454 | ||
448 | } | 455 | } |
449 | 456 | ||
450 | void EmailClient::allMailArrived(int count) | 457 | void EmailClient::allMailArrived(int count) |
451 | { | 458 | { |
452 | // not previewing means all mailtransfer has been done | 459 | // not previewing means all mailtransfer has been done |
453 | if (!previewingMail) { | 460 | /*if (!previewingMail) {*/ |
454 | if ( (allAccounts) && ( (currentAccount = accountList.next()) !=0 ) ) { | 461 | if ( (allAccounts) && ( (currentAccount = accountList.next()) !=0 ) ) { |
455 | emit newCaption("Mailit - " + currentAccount->accountName); | 462 | emit newCaption("Mailit - " + currentAccount->accountName); |
456 | getNewMail(); | 463 | getNewMail(); |
457 | return; | 464 | return; |
458 | } else { | 465 | } else { |
459 | allAccounts = FALSE; | 466 | allAccounts = FALSE; |
460 | receiving = FALSE; | 467 | receiving = FALSE; |
461 | getMailButton->setEnabled(TRUE); | 468 | getMailButton->setEnabled(TRUE); |
462 | cancelButton->setEnabled(FALSE); | 469 | cancelButton->setEnabled(FALSE); |
463 | selectAccountMenu->setEnabled(TRUE); | 470 | selectAccountMenu->setEnabled(TRUE); |
464 | status1Label->setText("Idle"); | 471 | status1Label->setText("Idle"); |
465 | 472 | ||
466 | progressBar->reset(); | 473 | progressBar->reset(); |
467 | return; | 474 | return; |
468 | } | 475 | } |
469 | } | 476 | //} |
470 | 477 | ||
471 | // all headers downloaded from server, start downloading remaining mails | 478 | // all headers downloaded from server, start downloading remaining mails |
472 | previewingMail = FALSE; | 479 | previewingMail = FALSE; |
473 | status1Label->setText(currentAccount->accountName); | 480 | status1Label->setText(currentAccount->accountName); |
474 | progressBar->reset(); | 481 | progressBar->reset(); |
475 | 482 | ||
476 | emailHandler->getMailByList(&mailDownloadList); | 483 | //emailHandler->getMailByList(&mailDownloadList); |
477 | 484 | ||
478 | mailboxView->setCurrentTab(0); | 485 | mailboxView->setCurrentTab(0); |
479 | } | 486 | } |
480 | 487 | ||
481 | void EmailClient::moveMailFront(Email *mailPtr) | 488 | void EmailClient::moveMailFront(Email *mailPtr) |
482 | { | 489 | { |
483 | if ( (receiving) && (mailPtr->fromAccountId == currentAccount->id) ) { | 490 | if ( (receiving) && (mailPtr->fromAccountId == currentAccount->id) ) { |
484 | mailDownloadList.moveFront(mailPtr->serverId, mailPtr->size); | 491 | mailDownloadList.moveFront(mailPtr->serverId, mailPtr->size); |
@@ -536,45 +543,43 @@ void EmailClient::popError(int code) | |||
536 | receiving = FALSE; | 543 | receiving = FALSE; |
537 | getMailButton->setEnabled(TRUE); | 544 | getMailButton->setEnabled(TRUE); |
538 | cancelButton->setEnabled(FALSE); | 545 | cancelButton->setEnabled(FALSE); |
539 | selectAccountMenu->setEnabled(TRUE); | 546 | selectAccountMenu->setEnabled(TRUE); |
540 | } | 547 | } |
541 | 548 | ||
542 | void EmailClient::inboxItemSelected() | 549 | void EmailClient::inboxItemSelected() |
543 | { | 550 | { |
544 | killTimer(timerID); | 551 | //killTimer(timerID); |
545 | 552 | ||
546 | item = (EmailListItem*) inboxView->selectedItem(); | 553 | item = (EmailListItem*) inboxView->selectedItem(); |
547 | if (item != NULL) { | 554 | if (item != NULL) { |
548 | emit viewEmail(inboxView, item->getMail()); | 555 | emit viewEmail(inboxView, item->getMail()); |
549 | } | 556 | } |
550 | } | 557 | } |
551 | 558 | ||
552 | void EmailClient::outboxItemSelected() | 559 | void EmailClient::outboxItemSelected() |
553 | { | 560 | { |
554 | killTimer(timerID); | 561 | //killTimer(timerID); |
555 | 562 | ||
556 | item = (EmailListItem*) outboxView->selectedItem(); | 563 | item = (EmailListItem*) outboxView->selectedItem(); |
557 | if (item != NULL) { | 564 | if (item != NULL) { |
558 | emit viewEmail(outboxView, item->getMail()); | 565 | emit viewEmail(outboxView, item->getMail()); |
559 | } | 566 | } |
560 | 567 | ||
561 | } | 568 | } |
562 | 569 | ||
563 | void EmailClient::readMail() | 570 | void EmailClient::readMail() |
564 | { | 571 | { |
565 | Email mail; | 572 | Email mail; |
566 | int start, stop; | 573 | int start, stop; |
567 | QString s, del; | 574 | QString s, del; |
568 | 575 | ||
569 | QFile f(getPath(FALSE) + "inbox.txt"); | 576 | QFile f(getPath(FALSE) + "inbox.txt"); |
570 | // QFileInfo fi(f); | 577 | |
571 | //qDebug( f.name()); | ||
572 | |||
573 | if ( f.open(IO_ReadOnly) ) { // file opened successfully | 578 | if ( f.open(IO_ReadOnly) ) { // file opened successfully |
574 | QTextStream t( &f ); // use a text stream | 579 | QTextStream t( &f ); // use a text stream |
575 | s = t.read(); | 580 | s = t.read(); |
576 | f.close(); | 581 | f.close(); |
577 | 582 | ||
578 | start = 0; | 583 | start = 0; |
579 | del = "\n.\n"; | 584 | del = "\n.\n"; |
580 | while ((uint) start < s.length()) { | 585 | while ((uint) start < s.length()) { |
@@ -617,22 +622,19 @@ void EmailClient::saveMail(QString fileName, QListView *view) | |||
617 | QFile f(fileName); | 622 | QFile f(fileName); |
618 | Email *mail; | 623 | Email *mail; |
619 | 624 | ||
620 | if (! f.open(IO_WriteOnly) ) { | 625 | if (! f.open(IO_WriteOnly) ) { |
621 | qWarning("could not open file"); | 626 | qWarning("could not open file"); |
622 | return; | 627 | return; |
623 | } | 628 | } |
624 | item = (EmailListItem *) view->firstChild(); | 629 | item = (EmailListItem *) view->firstChild(); |
625 | //qDebug (QString("Write : ") ); | ||
626 | QTextStream t(&f); | 630 | QTextStream t(&f); |
627 | while (item != NULL) { | 631 | while (item != NULL) { |
628 | mail = item->getMail(); | 632 | mail = item->getMail(); |
629 | //qDebug(mail->rawMail); | ||
630 | //qDebug(mail->recipients.first()); | ||
631 | t << mail->rawMail; | 633 | t << mail->rawMail; |
632 | 634 | ||
633 | mailconf->setGroup(mail->id); | 635 | mailconf->setGroup(mail->id); |
634 | mailconf->writeEntry("mailread", mail->read); | 636 | mailconf->writeEntry("mailread", mail->read); |
635 | 637 | ||
636 | item = (EmailListItem *) item->nextSibling(); | 638 | item = (EmailListItem *) item->nextSibling(); |
637 | } | 639 | } |
638 | f.close(); | 640 | f.close(); |
@@ -657,120 +659,95 @@ QString EmailClient::getPath(bool enclosurePath) | |||
657 | return (dir.path() + "/"); | 659 | return (dir.path() + "/"); |
658 | 660 | ||
659 | } | 661 | } |
660 | return (dir.path() + "/"); | 662 | return (dir.path() + "/"); |
661 | } | 663 | } |
662 | 664 | ||
663 | void EmailClient::readSettings() | 665 | void EmailClient::readSettings() |
664 | { | 666 | { |
665 | TextParser *p; | 667 | int y,acc_count, accountPos=0; |
666 | QString s; | ||
667 | int pos, accountPos, y; | ||
668 | QFile f( getPath(FALSE) + "settings.txt"); | ||
669 | |||
670 | if ( f.open(IO_ReadOnly) ) { // file opened successfully | ||
671 | QTextStream t( &f ); // use a text stream | ||
672 | s = t.read(); | ||
673 | f.close(); | ||
674 | 668 | ||
675 | p = new TextParser(s, "\n"); | 669 | mailconf->setGroup("mailitglobal"); |
676 | 670 | acc_count=mailconf->readNumEntry("Accounts",0); | |
677 | accountPos = 0; | ||
678 | while ( (accountPos = p->find("ACCOUNTSTART",';', accountPos, TRUE)) != -1 ) { | ||
679 | accountPos++; | ||
680 | if ( (pos = p->find("ACCOUNTNAME",':', accountPos, TRUE)) != -1 ) | ||
681 | account.accountName = p->getString(& ++pos, 'z', TRUE); | ||
682 | if ( (pos = p->find("NAME",':', accountPos, TRUE)) != -1) | ||
683 | account.name = p->getString(& ++pos, 'z', TRUE); | ||
684 | if ( (pos = p->find("EMAIL",':', accountPos, TRUE)) != -1) | ||
685 | account.emailAddress = p->getString(& ++pos, 'z', TRUE); | ||
686 | if ( (pos = p->find("POPUSER",':', accountPos, TRUE)) != -1) | ||
687 | account.popUserName = p->getString(& ++pos, 'z', TRUE); | ||
688 | if ( (pos = p->find("POPPASSWORD",':', accountPos, TRUE)) != -1) | ||
689 | account.popPasswd = p->getString(& ++pos, 'z', TRUE); | ||
690 | if ( (pos = p->find("POPSERVER",':', accountPos, TRUE)) != -1) | ||
691 | account.popServer = p->getString(& ++pos, 'z', TRUE); | ||
692 | if ( (pos = p->find("SMTPSERVER",':', accountPos, TRUE)) != -1) | ||
693 | account.smtpServer = p->getString(& ++pos, 'z', TRUE); | ||
694 | if ( (pos = p->find("ACCOUNTID",':', accountPos, TRUE)) != -1) { | ||
695 | s = p->getString(& ++pos, 'z', TRUE); | ||
696 | account.id = s.toInt(); | ||
697 | } | ||
698 | 671 | ||
672 | for (int accountPos = 0;accountPos<acc_count ; accountPos++) | ||
673 | { | ||
674 | mailconf->setGroup("Account_"+QString::number(accountPos+1)); //Account numbers start at 1 ... | ||
675 | account.accountName = mailconf->readEntry("AccName",""); | ||
676 | account.name = mailconf->readEntry("UserName",""); | ||
677 | account.emailAddress = mailconf->readEntry("Email",""); | ||
678 | account.popUserName = mailconf->readEntry("POPUser",""); | ||
679 | account.popPasswd = mailconf->readEntryCrypt("POPPassword",""); | ||
680 | account.popServer = mailconf->readEntry("POPServer",""); | ||
681 | account.smtpServer = mailconf->readEntry("SMTPServer",""); | ||
682 | account.id = mailconf->readNumEntry("AccountId",0); | ||
683 | account.syncLimit = mailconf->readNumEntry("HeaderLimit",0); | ||
699 | account.lastServerMailCount = 0; | 684 | account.lastServerMailCount = 0; |
700 | account.synchronize = FALSE; | 685 | account.synchronize = FALSE; |
701 | if ( (pos = p->find("SYNCHRONIZE",':', accountPos, TRUE)) != -1) { | 686 | |
702 | if (p->getString(& ++pos, 'z', TRUE).upper() == "YES") { | 687 | account.synchronize = (mailconf->readEntry("Synchronize","No")=="Yes"); |
703 | account.synchronize = TRUE; | 688 | if (account.synchronize) |
704 | if ( (pos = p->find("LASTSERVERMAILCOUNT",':', accountPos, TRUE)) != -1) { | 689 | { |
705 | s = p->getString(& ++pos, 'z', TRUE); | 690 | mailconf->readNumEntry("LASTSERVERMAILCOUNT",0); |
706 | account.lastServerMailCount = s.toInt(); | ||
707 | } | ||
708 | } | ||
709 | } | ||
710 | |||
711 | if ( (pos = p->find("SYNCLIMIT",':', accountPos, TRUE)) != -1) { | ||
712 | account.syncLimit = p->getString(& ++pos, 'z', TRUE).toInt(); | ||
713 | } | 691 | } |
714 | |||
715 | 692 | ||
716 | accountList.append(&account); | 693 | accountList.append(&account); |
717 | } | 694 | } |
718 | delete p; | 695 | |
719 | } | ||
720 | mailconf->setGroup("mailitglobal"); | 696 | mailconf->setGroup("mailitglobal"); |
721 | if ( (y = mailconf->readNumEntry("mailidcount", -1)) != -1) { | 697 | |
698 | if ( (y = mailconf->readNumEntry("mailidcount", -1)) != -1) | ||
699 | { | ||
722 | mailIdCount = y; | 700 | mailIdCount = y; |
723 | } | 701 | } |
724 | if ( (y = mailconf->readNumEntry("accountidcount", -1)) != -1) { | 702 | if ( (y = mailconf->readNumEntry("accountidcount", -1)) != -1) |
703 | { | ||
725 | accountIdCount = y; | 704 | accountIdCount = y; |
726 | } | 705 | } |
727 | } | 706 | } |
728 | 707 | ||
729 | void EmailClient::saveSettings() | 708 | void EmailClient::saveSettings() |
730 | { | 709 | { |
731 | 710 | int acc_count=0; | |
732 | QString temp; | ||
733 | QFile f( getPath(FALSE) + "settings.txt"); | ||
734 | MailAccount *accountPtr; | 711 | MailAccount *accountPtr; |
735 | 712 | ||
736 | if (! f.open(IO_WriteOnly) ) { | 713 | |
737 | qWarning("could not save settings file"); | 714 | if (!mailconf) |
715 | { | ||
716 | qWarning("could not save settings"); | ||
738 | return; | 717 | return; |
739 | } | 718 | } |
740 | QTextStream t(&f); | ||
741 | t << "#Settings for OPIE Mailit program\n"; | ||
742 | 719 | ||
743 | for (accountPtr = accountList.first(); accountPtr != 0; | 720 | for (accountPtr = accountList.first(); accountPtr != 0; |
744 | accountPtr = accountList.next()) { | 721 | accountPtr = accountList.next()) |
745 | 722 | { | |
746 | t << "accountStart;\n"; | 723 | mailconf->setGroup("Account_"+QString::number(++acc_count)); |
747 | t << "AccountName: " + accountPtr->accountName + "\n"; | 724 | mailconf->writeEntry("AccName",accountPtr->accountName ); |
748 | t << "Name: " + accountPtr->name + "\n"; | 725 | mailconf->writeEntry("UserName",accountPtr->name); |
749 | t << "Email: " + accountPtr->emailAddress + "\n"; | 726 | mailconf->writeEntry("Email",accountPtr->emailAddress); |
750 | t << "POPUser: " + accountPtr->popUserName + "\n"; | 727 | mailconf->writeEntry("POPUser",accountPtr->popUserName); |
751 | t << "POPPAssword: " + accountPtr->popPasswd + "\n"; | 728 | mailconf->writeEntryCrypt("POPPassword",accountPtr->popPasswd); |
752 | t << "POPServer: " + accountPtr->popServer + "\n"; | 729 | mailconf->writeEntry("POPServer",accountPtr->popServer); |
753 | t << "SMTPServer: " + accountPtr->smtpServer + "\n"; | 730 | mailconf->writeEntry("SMTPServer",accountPtr->smtpServer); |
754 | t << "AccountId: " << accountPtr->id << "\n"; | 731 | mailconf->writeEntry("AccountId",accountPtr->id); |
755 | if (accountPtr->synchronize) { | 732 | if (accountPtr->synchronize) |
756 | t << "Synchronize: Yes\n"; | 733 | { |
757 | t << "LastServerMailCount: "; | 734 | mailconf->writeEntry("Synchronize","Yes"); |
758 | t << accountPtr->lastServerMailCount << "\n"; | 735 | mailconf->writeEntry("HeaderLimit",accountPtr->syncLimit); |
759 | } else { | 736 | mailconf->writeEntry("LastServerMailCount",accountPtr->lastServerMailCount); |
760 | t << "Synchronize: No\n"; | 737 | } |
738 | else | ||
739 | { | ||
740 | mailconf->writeEntry("Synchronize", "No"); | ||
761 | } | 741 | } |
762 | t << "SyncLimit: "; | ||
763 | t << accountPtr->syncLimit << "\n"; | ||
764 | t << "accountEnd;\n"; | ||
765 | } | 742 | } |
766 | f.close(); | ||
767 | 743 | ||
768 | mailconf->setGroup("mailitglobal"); | 744 | mailconf->setGroup("mailitglobal"); |
745 | mailconf->writeEntry("Accounts",acc_count); | ||
769 | mailconf->writeEntry("mailidcount", mailIdCount); | 746 | mailconf->writeEntry("mailidcount", mailIdCount); |
770 | mailconf->writeEntry("accountidcount", accountIdCount); | 747 | mailconf->writeEntry("accountidcount", accountIdCount); |
771 | } | 748 | } |
772 | 749 | ||
773 | void EmailClient::selectAccount(int id) | 750 | void EmailClient::selectAccount(int id) |
774 | { | 751 | { |
775 | if (accountList.count() > 0) { | 752 | if (accountList.count() > 0) { |
776 | currentAccount = accountList.at(id); | 753 | currentAccount = accountList.at(id); |
@@ -996,9 +973,9 @@ void EmailClient::forward() | |||
996 | void EmailClient::remove() | 973 | void EmailClient::remove() |
997 | { | 974 | { |
998 | Email* mail=getCurrentMail(); | 975 | Email* mail=getCurrentMail(); |
999 | 976 | ||
1000 | if (mail!=NULL) | 977 | if (mail!=NULL) |
1001 | { | 978 | { |
1002 | emit remove(*mail); | 979 | emit remove(*mail); |
1003 | } | 980 | } |
1004 | }*/ \ No newline at end of file | 981 | }*/ |
diff --git a/noncore/unsupported/mailit/emailhandler.cpp b/noncore/unsupported/mailit/emailhandler.cpp index f6c6d60..b180051 100644 --- a/noncore/unsupported/mailit/emailhandler.cpp +++ b/noncore/unsupported/mailit/emailhandler.cpp | |||
@@ -99,28 +99,24 @@ void EmailHandler::getMail() | |||
99 | popClient->setAccount(mailAccount.popUserName, mailAccount.popPasswd); | 99 | popClient->setAccount(mailAccount.popUserName, mailAccount.popPasswd); |
100 | if (mailAccount.synchronize) { | 100 | if (mailAccount.synchronize) { |
101 | popClient->setSynchronize(mailAccount.lastServerMailCount); | 101 | popClient->setSynchronize(mailAccount.lastServerMailCount); |
102 | } else { | 102 | } else { |
103 | popClient->removeSynchronize(); | 103 | popClient->removeSynchronize(); |
104 | } | 104 | } |
105 | 105 | ||
106 | headers = FALSE; | 106 | headers = FALSE; |
107 | popClient->headersOnly(headers, 0); | 107 | //popClient->headersOnly(headers, 0); |
108 | popClient->newConnection(mailAccount.popServer, 110); | 108 | popClient->newConnection(mailAccount.popServer, 110); |
109 | } | 109 | } |
110 | 110 | ||
111 | void EmailHandler::getMailHeaders() | 111 | void EmailHandler::getMailHeaders() |
112 | { | 112 | { |
113 | popClient->setAccount(mailAccount.popUserName, mailAccount.popPasswd); | 113 | popClient->setAccount(mailAccount.popUserName, mailAccount.popPasswd); |
114 | if (mailAccount.synchronize) { | 114 | mailAccount.synchronize ? popClient->setSynchronize(mailAccount.lastServerMailCount): popClient->removeSynchronize(); |
115 | popClient->setSynchronize(mailAccount.lastServerMailCount); | ||
116 | } else { | ||
117 | popClient->removeSynchronize(); | ||
118 | } | ||
119 | 115 | ||
120 | headers = TRUE; | 116 | headers = TRUE; |
121 | popClient->headersOnly(headers, mailAccount.syncLimit); //less than requested syncLimit, download all | 117 | popClient->headersOnly(headers, mailAccount.syncLimit); //less than requested syncLimit, download all |
122 | popClient->newConnection(mailAccount.popServer, 110); | 118 | popClient->newConnection(mailAccount.popServer, 110); |
123 | } | 119 | } |
124 | 120 | ||
125 | void EmailHandler::getMailByList(MailList *mailList) | 121 | void EmailHandler::getMailByList(MailList *mailList) |
126 | { | 122 | { |
@@ -130,24 +126,24 @@ void EmailHandler::getMailByList(MailList *mailList) | |||
130 | } | 126 | } |
131 | 127 | ||
132 | headers = FALSE; | 128 | headers = FALSE; |
133 | popClient->headersOnly(FALSE, 0); | 129 | popClient->headersOnly(FALSE, 0); |
134 | popClient->newConnection(mailAccount.popServer, 110); | 130 | popClient->newConnection(mailAccount.popServer, 110); |
135 | popClient->setSelectedMails(mailList); | 131 | popClient->setSelectedMails(mailList); |
136 | } | 132 | } |
137 | 133 | ||
138 | void EmailHandler::messageArrived(const QString &message, int id, uint size, bool complete) | 134 | void EmailHandler::messageArrived(const QString &message, int id, uint size, bool incomplete) |
139 | { | 135 | { |
140 | Email mail; | 136 | Email mail; |
141 | 137 | ||
142 | mail.rawMail = message; | 138 | mail.rawMail = message; |
143 | mail.serverId = id; | 139 | mail.serverId = id; |
144 | mail.size = size; | 140 | mail.size = size; |
145 | mail.downloaded = complete; | 141 | mail.downloaded = incomplete; |
146 | 142 | ||
147 | emit mailArrived(mail, FALSE); | 143 | emit mailArrived(mail, FALSE); |
148 | } | 144 | } |
149 | 145 | ||
150 | bool EmailHandler::parse(QString in, QString lineShift, Email *mail) | 146 | bool EmailHandler::parse(QString in, QString lineShift, Email *mail) |
151 | { | 147 | { |
152 | QString temp, boundary; | 148 | QString temp, boundary; |
153 | int pos; | 149 | int pos; |
@@ -180,52 +176,72 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail) | |||
180 | pos++; | 176 | pos++; |
181 | if (p.separatorAt(pos) == ' ') { | 177 | if (p.separatorAt(pos) == ' ') { |
182 | mail->from = p.getString(&pos, '<', false); | 178 | mail->from = p.getString(&pos, '<', false); |
183 | mail->from = mail->from.stripWhiteSpace(); | 179 | mail->from = mail->from.stripWhiteSpace(); |
184 | if ( (mail->from.length() > 2) && (mail->from[0] == '"') ) { | 180 | if ( (mail->from.length() > 2) && (mail->from[0] == '"') ) { |
185 | mail->from = mail->from.left(mail->from.length() - 1); | 181 | mail->from = mail->from.left(mail->from.length() - 1); |
186 | mail->from = mail->from.right(mail->from.length() - 1); | 182 | mail->from = mail->from.right(mail->from.length() - 1); |
187 | } | 183 | } |
188 | pos++; | 184 | pos++; |
185 | |||
189 | mail->fromMail = p.getString(&pos, '>', false); | 186 | mail->fromMail = p.getString(&pos, '>', false); |
190 | } else { | 187 | } else { |
191 | if ((p.separatorAt(pos) == '<') | 188 | if ((p.separatorAt(pos) == '<') |
192 | || (p.separatorAt(pos) == ' ')) //No name.. nasty | 189 | || (p.separatorAt(pos) == ' ')) //No name.. nasty |
193 | pos++; | 190 | pos++; |
194 | pos++; | 191 | pos++; |
195 | mail->fromMail = p.getString(&pos, 'z', TRUE); | 192 | mail->fromMail = p.getString(&pos, 'z', TRUE); |
196 | if (mail->fromMail.at(mail->fromMail.length()-1) == '>') | 193 | if (mail->fromMail.at(mail->fromMail.length()-1) == '>') |
197 | mail->fromMail.truncate(mail->fromMail.length() - 1); | 194 | mail->fromMail.truncate(mail->fromMail.length() - 1); |
198 | mail->from=mail->fromMail; | 195 | mail->from=mail->fromMail; |
199 | } | 196 | } |
200 | } | 197 | } |
201 | 198 | ||
202 | //@@@ToDo: Rewrite the parser as To: stops at the first occurence- which is Delivered-To: | 199 | pos=0; |
203 | if ((pos = p.find("TO",':', 0, TRUE)) != -1) | 200 | |
201 | //Search for To: after the FROM: attribute to prevent hitting the Delivered-To: | ||
202 | while((pos = p.find("TO",':', pos+1, TRUE))!=-1) | ||
204 | { | 203 | { |
205 | pos++; | 204 | QString rec; |
206 | mail->recipients.append (p.getString(&pos, 'z', TRUE) ); | 205 | |
206 | if (p.separatorAt(pos-1)!='-') | ||
207 | { | ||
208 | pos++; | ||
209 | mail->recipients.append(p.getString(&pos, '\r', TRUE)); | ||
210 | } | ||
211 | /*else { | ||
212 | if ((p.separatorAt(pos) == '<')|| (p.separatorAt(pos) == ' ')) //No name.. nasty | ||
213 | pos++; | ||
214 | pos++; | ||
215 | mail->fromMail = p.getString(&pos, 'z', TRUE); | ||
216 | if (mail->fromMail.at(mail->fromMail.length()-1) == '>') | ||
217 | mail->fromMail.truncate(mail->fromMail.length() - 1); | ||
218 | mail->from=mail->fromMail; | ||
219 | } | ||
220 | mail->recipients.append (p.getString(&pos, 'z', TRUE) ); | ||
221 | }*/ | ||
207 | } | 222 | } |
208 | 223 | // | |
209 | //@@@ToDo: Rewrite the parser as To: stops at the first occurence- which is Delivered-To: | 224 | //if (pos==-1) mail->recipients.append (tr("undisclosed recipients") ); |
225 | |||
210 | if ((pos = p.find("CC",':', 0, TRUE)) != -1) | 226 | if ((pos = p.find("CC",':', 0, TRUE)) != -1) |
211 | { | 227 | { |
212 | pos++; | 228 | pos++; |
213 | mail->carbonCopies.append (p.getString(&pos, 'z', TRUE) ); | 229 | mail->carbonCopies.append (p.getString(&pos, 'z', TRUE) ); |
214 | } | 230 | } |
215 | 231 | ||
216 | |||
217 | if ((pos = p.find("SUBJECT",':', 0, TRUE)) != -1) { | 232 | if ((pos = p.find("SUBJECT",':', 0, TRUE)) != -1) { |
218 | pos++; | 233 | pos++; |
219 | mail->subject = p.getString(&pos, 'z', TRUE); | 234 | mail->subject = p.getString(&pos, 'z', TRUE); |
220 | } | 235 | } |
236 | |||
221 | if ((pos = p.find("DATE",':', 0, TRUE)) != -1) { | 237 | if ((pos = p.find("DATE",':', 0, TRUE)) != -1) { |
222 | pos++; | 238 | pos++; |
223 | mail->date = p.getString(&pos, 'z', true); | 239 | mail->date = p.getString(&pos, 'z', TRUE); |
224 | } | 240 | } |
225 | 241 | ||
226 | 242 | ||
227 | 243 | ||
228 | if ((pos = p.find("MESSAGE",'-', 0, TRUE)) != -1) { | 244 | if ((pos = p.find("MESSAGE",'-', 0, TRUE)) != -1) { |
229 | pos++; | 245 | pos++; |
230 | if ( (p.wordAt(pos).upper() == "ID") && | 246 | if ( (p.wordAt(pos).upper() == "ID") && |
231 | (p.separatorAt(pos) == ':') ) { | 247 | (p.separatorAt(pos) == ':') ) { |
diff --git a/noncore/unsupported/mailit/emaillistitem.cpp b/noncore/unsupported/mailit/emaillistitem.cpp index a325766..b925a1c 100644 --- a/noncore/unsupported/mailit/emaillistitem.cpp +++ b/noncore/unsupported/mailit/emaillistitem.cpp | |||
@@ -33,21 +33,23 @@ EmailListItem::EmailListItem(QListView *parent, Email mailIn, bool inbox) | |||
33 | } else { | 33 | } else { |
34 | QStringList::Iterator it = mail.recipients.begin(); | 34 | QStringList::Iterator it = mail.recipients.begin(); |
35 | temp = *it; | 35 | temp = *it; |
36 | if (mail.recipients.count() > 1) | 36 | if (mail.recipients.count() > 1) |
37 | temp += "..."; | 37 | temp += "..."; |
38 | setText(0, temp); | 38 | setText(0, temp); |
39 | } | 39 | } |
40 | setText(1, mail.subject); | 40 | setText(1, mail.subject); |
41 | setText(2,mail.date); | ||
41 | 42 | ||
42 | if (mailIn.files.count()>0) | 43 | if (mailIn.files.count()>0) |
43 | { | 44 | { |
44 | setPixmap(0, Resource::loadPixmap("mailit/attach")); | 45 | setPixmap(0, Resource::loadPixmap("mailit/attach")); |
45 | } | 46 | } |
47 | |||
46 | selected = FALSE; | 48 | selected = FALSE; |
47 | } | 49 | } |
48 | 50 | ||
49 | Email* EmailListItem::getMail() | 51 | Email* EmailListItem::getMail() |
50 | { | 52 | { |
51 | return &mail; | 53 | return &mail; |
52 | } | 54 | } |
53 | 55 | ||
diff --git a/noncore/unsupported/mailit/mailitwindow.cpp b/noncore/unsupported/mailit/mailitwindow.cpp index ef5fc09..7181adf 100644 --- a/noncore/unsupported/mailit/mailitwindow.cpp +++ b/noncore/unsupported/mailit/mailitwindow.cpp | |||
@@ -12,27 +12,28 @@ | |||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qwhatsthis.h> | ||
20 | #include "mailitwindow.h" | 21 | #include "mailitwindow.h" |
21 | 22 | ||
22 | MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl) | 23 | MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl) |
23 | : QMainWindow(parent, name, fl) | 24 | : QMainWindow(parent, name, WStyle_ContextHelp) |
24 | { | 25 | { |
25 | currentCaption = "Mailit"; | 26 | currentCaption = "Mailit"; |
26 | setCaption(tr(currentCaption)); | 27 | setCaption(tr(currentCaption)); |
27 | views = new QWidgetStack(this); | 28 | views = new QWidgetStack(this); |
28 | setCentralWidget(views); | 29 | setCentralWidget(views); |
29 | 30 | QWhatsThis::add(views,tr("Central view area")); | |
30 | emailClient = new EmailClient(views, "client"); | 31 | emailClient = new EmailClient(views, "client"); |
31 | writeMail = new WriteMail(views, "writing"); | 32 | writeMail = new WriteMail(views, "writing"); |
32 | readMail = new ReadMail(views, "reading"); | 33 | readMail = new ReadMail(views, "reading"); |
33 | 34 | ||
34 | views->raiseWidget(emailClient); | 35 | views->raiseWidget(emailClient); |
35 | 36 | ||
36 | connect(emailClient, SIGNAL(composeRequested()), | 37 | connect(emailClient, SIGNAL(composeRequested()), |
37 | this, SLOT(compose()) ); | 38 | this, SLOT(compose()) ); |
38 | connect(emailClient, SIGNAL(viewEmail(QListView *, Email *)), this, | 39 | connect(emailClient, SIGNAL(viewEmail(QListView *, Email *)), this, |
@@ -135,31 +136,8 @@ void MailItWindow::setDocument(const QString &_address) | |||
135 | // strip leading 'mailto:' | 136 | // strip leading 'mailto:' |
136 | QString address = _address; | 137 | QString address = _address; |
137 | if (address.startsWith("mailto:")) | 138 | if (address.startsWith("mailto:")) |
138 | address = address.mid(6); | 139 | address = address.mid(6); |
139 | 140 | ||
140 | compose(); | 141 | compose(); |
141 | writeMail->setRecipient(address); | 142 | writeMail->setRecipient(address); |
142 | } | 143 | } |
143 | |||
144 | /*void MailItWindow::reply(Email& mail) | ||
145 | { | ||
146 | qDebug("####EmailClient: 0 reached"); | ||
147 | composeReply(mail,(bool&)FALSE); | ||
148 | } | ||
149 | |||
150 | void MailItWindow::replyAll(Email& mail) | ||
151 | { | ||
152 | qDebug("####EmailClient: 1 reached"); | ||
153 | composeReply(mail,(bool&)TRUE); | ||
154 | } | ||
155 | |||
156 | void MailItWindow::forward(Email& mail) | ||
157 | { | ||
158 | qDebug("####EmailClient: 2 reached"); | ||
159 | } | ||
160 | |||
161 | void MailItWindow::remove(Email&) | ||
162 | { | ||
163 | qDebug("####EmailClient: 3 reached"); | ||
164 | //emit removeItem(eli,(bool&)TRUE); | ||
165 | } */ \ No newline at end of file | ||
diff --git a/noncore/unsupported/mailit/popclient.cpp b/noncore/unsupported/mailit/popclient.cpp index f9cc337..67306be 100644 --- a/noncore/unsupported/mailit/popclient.cpp +++ b/noncore/unsupported/mailit/popclient.cpp | |||
@@ -114,40 +114,29 @@ void PopClient::incomingData() | |||
114 | QString md5Source; | 114 | QString md5Source; |
115 | int start, end; | 115 | int start, end; |
116 | // char *md5Digest; | 116 | // char *md5Digest; |
117 | char md5Digest[16]; | 117 | char md5Digest[16]; |
118 | // if ( !socket->canReadLine() ) | 118 | // if ( !socket->canReadLine() ) |
119 | // return; | 119 | // return; |
120 | 120 | ||
121 | response = socket->readLine(); | 121 | response = socket->readLine(); |
122 | //qDebug(response +" %d", status); | ||
123 | 122 | ||
124 | switch(status) { | 123 | switch(status) { |
125 | //logging in | 124 | //logging in |
126 | case Init: { | 125 | case Init: { |
127 | #ifdef APOP_TEST | 126 | #ifdef APOP_TEST |
128 | start = response.find('<',0); | 127 | start = response.find('<',0); |
129 | end = response.find('>', start); | 128 | end = response.find('>', start); |
130 | if( start >= 0 && end > start ) | 129 | if( start >= 0 && end > start ) |
131 | { | 130 | { |
132 | timeStamp = response.mid( start , end - start + 1); | 131 | timeStamp = response.mid( start , end - start + 1); |
133 | md5Source = timeStamp + popPassword; | 132 | md5Source = timeStamp + popPassword; |
134 | //qDebug( md5Source); | ||
135 | // for( int i = 0; i < md5Source.length(); i++) { | ||
136 | // buff[i] = (QChar)md5Source[i]; | ||
137 | // } | ||
138 | 133 | ||
139 | md5_buffer( (char const *)md5Source, md5Source.length(),&md5Digest[0]); | 134 | md5_buffer( (char const *)md5Source, md5Source.length(),&md5Digest[0]); |
140 | // md5_buffer(char const *buffer, unsigned int len, char *digest); | ||
141 | |||
142 | // MD5_Init( &ctx); | ||
143 | // MD5_Update( &ctx, buff, sizeof( buff) ); | ||
144 | // MD5_Final( md5Digest, &ctx); | ||
145 | // MD5( buff, md5Source.length(), md5Digest); | ||
146 | 135 | ||
147 | for(int j =0;j < MD5_DIGEST_LENGTH ;j++) | 136 | for(int j =0;j < MD5_DIGEST_LENGTH ;j++) |
148 | { | 137 | { |
149 | printf("%x", md5Digest[j]); | 138 | printf("%x", md5Digest[j]); |
150 | } | 139 | } |
151 | printf("\n"); | 140 | printf("\n"); |
152 | // qDebug(md5Digest); | 141 | // qDebug(md5Digest); |
153 | *stream << "APOP " << popUserName << " " << md5Digest << "\r\n"; | 142 | *stream << "APOP " << popUserName << " " << md5Digest << "\r\n"; |
@@ -159,17 +148,17 @@ void PopClient::incomingData() | |||
159 | { | 148 | { |
160 | timeStamp = ""; | 149 | timeStamp = ""; |
161 | *stream << "USER " << popUserName << "\r\n"; | 150 | *stream << "USER " << popUserName << "\r\n"; |
162 | status = Pass; | 151 | status = Pass; |
163 | } | 152 | } |
164 | 153 | ||
165 | break; | 154 | break; |
166 | } | 155 | } |
167 | //password shhh. don't tell anyone (implement APOP...) | 156 | |
168 | case Pass: { | 157 | case Pass: { |
169 | *stream << "PASS " << popPassword << "\r\n"; | 158 | *stream << "PASS " << popPassword << "\r\n"; |
170 | status = Stat; | 159 | status = Stat; |
171 | break; | 160 | break; |
172 | } | 161 | } |
173 | //ask for number of messages | 162 | //ask for number of messages |
174 | case Stat: { | 163 | case Stat: { |
175 | if (response[0] == '+') { | 164 | if (response[0] == '+') { |
@@ -243,20 +232,21 @@ void PopClient::incomingData() | |||
243 | //qWarning(response); | 232 | //qWarning(response); |
244 | errorHandling(ErrUnknownResponse); | 233 | errorHandling(ErrUnknownResponse); |
245 | } | 234 | } |
246 | } | 235 | } |
247 | } | 236 | } |
248 | //Read message number x, count upwards to messageCount | 237 | //Read message number x, count upwards to messageCount |
249 | case Retr: { | 238 | case Retr: { |
250 | if (status != Quit) { | 239 | if (status != Quit) { |
251 | if (!preview || mailSize <= headerLimit) { | 240 | if (mailSize <= headerLimit) |
241 | { | ||
252 | *stream << "RETR " << messageCount << "\r\n"; | 242 | *stream << "RETR " << messageCount << "\r\n"; |
253 | } else { //only header | 243 | } else { //only header |
254 | *stream << "TOP " << messageCount << " 0\r\n"; | 244 | *stream << "TOP " << messageCount << " 0\r\n"; |
255 | } | 245 | } |
256 | messageCount++; | 246 | messageCount++; |
257 | status = Ignore; | 247 | status = Ignore; |
258 | break; | 248 | break; |
259 | } } | 249 | } } |
260 | case Ignore: { | 250 | case Ignore: { |
261 | if (status != Quit) { //because of idiotic switch | 251 | if (status != Quit) { //because of idiotic switch |
262 | if (response[0] == '+') { | 252 | if (response[0] == '+') { |
@@ -278,18 +268,20 @@ void PopClient::incomingData() | |||
278 | message += response; | 268 | message += response; |
279 | } | 269 | } |
280 | emit downloadedSize(message.length()); | 270 | emit downloadedSize(message.length()); |
281 | int x = message.find("\r\n.\r\n",-5); | 271 | int x = message.find("\r\n.\r\n",-5); |
282 | if (x == -1) { | 272 | if (x == -1) { |
283 | break; | 273 | break; |
284 | } else { //message reach entire size | 274 | } else { //message reach entire size |
285 | //complete mail downloaded | 275 | //complete mail downloaded |
286 | if ( (!preview ) || ((preview) && (mailSize <= headerLimit)) ){ | 276 | //if ( (!preview ) || ((preview) && (mailSize <= headerLimit)) ){ |
287 | emit newMessage(message, messageCount-1, mailSize, TRUE); | 277 | if ( mailSize <= headerLimit) |
278 | { | ||
279 | emit newMessage(message, messageCount-1, mailSize, TRUE); | ||
288 | } else { //incomplete mail downloaded | 280 | } else { //incomplete mail downloaded |
289 | emit newMessage(message, messageCount-1, mailSize, FALSE); | 281 | emit newMessage(message, messageCount-1, mailSize, FALSE); |
290 | } | 282 | } |
291 | if (messageCount > newMessages) //that was the last message | 283 | if (messageCount > newMessages) //that was the last message |
292 | status = Quit; | 284 | status = Quit; |
293 | else { //ask for new message | 285 | else { //ask for new message |
294 | if (selected) { //grab next from queue | 286 | if (selected) { //grab next from queue |
295 | int *ptr = mailList->next(); | 287 | int *ptr = mailList->next(); |
diff --git a/noncore/unsupported/mailit/readmail.cpp b/noncore/unsupported/mailit/readmail.cpp index dc98a6f..4eae7f6 100644 --- a/noncore/unsupported/mailit/readmail.cpp +++ b/noncore/unsupported/mailit/readmail.cpp | |||
@@ -54,46 +54,56 @@ void ReadMail::init() | |||
54 | menu->insertItem( tr( "&Mail" ), mailMenu); | 54 | menu->insertItem( tr( "&Mail" ), mailMenu); |
55 | 55 | ||
56 | bar = new QToolBar(this); | 56 | bar = new QToolBar(this); |
57 | 57 | ||
58 | //reply dependant on viewing inbox | 58 | //reply dependant on viewing inbox |
59 | replyButton = new QAction( tr( "Reply" ), Resource::loadPixmap( "mailit/reply" ), | 59 | replyButton = new QAction( tr( "Reply" ), Resource::loadPixmap( "mailit/reply" ), |
60 | QString::null, 0, this, 0 ); | 60 | QString::null, 0, this, 0 ); |
61 | connect(replyButton, SIGNAL(activated()), this, SLOT(reply()) ); | 61 | connect(replyButton, SIGNAL(activated()), this, SLOT(reply()) ); |
62 | 62 | replyButton->setWhatsThis(tr("Click here to reply to the selected mail")); | |
63 | |||
63 | forwardButton = new QAction( tr( "Forward" ), Resource::loadPixmap( "mailit/forward" ), | 64 | forwardButton = new QAction( tr( "Forward" ), Resource::loadPixmap( "mailit/forward" ), |
64 | QString::null, 0, this, 0 ); | 65 | QString::null, 0, this, 0 ); |
65 | connect(forwardButton, SIGNAL(activated()), this, SLOT(forward()) ); | 66 | connect(forwardButton, SIGNAL(activated()), this, SLOT(forward()) ); |
67 | forwardButton->setWhatsThis(tr("Click here to forward the selected mail")); | ||
66 | 68 | ||
67 | previousButton = new QAction( tr( "Previous" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); | 69 | previousButton = new QAction( tr( "Previous" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); |
68 | connect( previousButton, SIGNAL( activated() ), this, SLOT( previous() ) ); | 70 | connect( previousButton, SIGNAL( activated() ), this, SLOT( previous() ) ); |
69 | previousButton->addTo(bar); | 71 | previousButton->addTo(bar); |
70 | previousButton->addTo(viewMenu); | 72 | previousButton->addTo(viewMenu); |
73 | previousButton->setWhatsThis(tr("Read the previous mail in the list")); | ||
71 | 74 | ||
72 | nextButton = new QAction( tr( "Next" ), Resource::loadPixmap( "forward" ), QString::null, 0, this, 0 ); | 75 | nextButton = new QAction( tr( "Next" ), Resource::loadPixmap( "forward" ), QString::null, 0, this, 0 ); |
73 | connect( nextButton, SIGNAL( activated() ), this, SLOT( next() ) ); | 76 | connect( nextButton, SIGNAL( activated() ), this, SLOT( next() ) ); |
74 | nextButton->addTo(bar); | 77 | nextButton->addTo(bar); |
75 | nextButton->addTo(viewMenu); | 78 | nextButton->addTo(viewMenu); |
79 | previousButton->setWhatsThis(tr("Read the next mail in the list")); | ||
76 | 80 | ||
77 | attatchmentsButton = new QAction( tr( "Attatchments" ), Resource::loadPixmap( "mailit/attach" ), QString::null, 0, this, 0 ); | 81 | attachmentButton = new QAction( tr( "Attatchments" ), Resource::loadPixmap( "mailit/attach" ), QString::null, 0, this, 0 ); |
78 | connect( attatchmentsButton, SIGNAL( activated() ), this, | 82 | connect( attachmentButton, SIGNAL( activated() ), this, |
79 | SLOT( viewAttatchments() ) ); | 83 | SLOT( viewAttachments() ) ); |
80 | attatchmentsButton->addTo(bar); | 84 | attachmentButton->addTo(bar); |
81 | attatchmentsButton->addTo(viewMenu); | 85 | attachmentButton->addTo(viewMenu); |
86 | attachmentButton->setWhatsThis(tr("Click here to add attachments to your mail")); | ||
82 | 87 | ||
83 | plainTextButton = new QAction( tr( "Text Format" ), Resource::loadPixmap( "DocsIcon" ), QString::null, 0, this, 0, TRUE); | 88 | plainTextButton = new QAction( tr( "Text Format" ), Resource::loadPixmap( "DocsIcon" ), QString::null, 0, this, 0, TRUE); |
84 | connect( plainTextButton, SIGNAL( activated() ), this, SLOT( shiftText() ) ); | 89 | connect( plainTextButton, SIGNAL( activated() ), this, SLOT( shiftText() ) ); |
85 | plainTextButton->addTo(bar); | 90 | plainTextButton->addTo(bar); |
86 | plainTextButton->addTo(viewMenu); | 91 | plainTextButton->addTo(viewMenu); |
92 | plainTextButton->setWhatsThis(tr("The mail view has 2 modes:\n" | ||
93 | "<LI><B>RichText</B> shows the mail as HTML with reach features (no standard line breaks)</LI>" | ||
94 | "<LI><B>Plain</B> shows the mail as standard plain text</LI>" | ||
95 | "Click here to switch between those view modes" )); | ||
87 | 96 | ||
88 | deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); | 97 | deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); |
89 | connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) ); | 98 | connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) ); |
90 | deleteButton->addTo(bar); | 99 | deleteButton->addTo(bar); |
91 | deleteButton->addTo(mailMenu); | 100 | deleteButton->addTo(mailMenu); |
101 | deleteButton->setWhatsThis(tr("Click here to remove the selected mail")); | ||
92 | 102 | ||
93 | viewMenu->insertItem(Resource::loadPixmap("close"), "Close", this, SLOT(close())); | 103 | viewMenu->insertItem(Resource::loadPixmap("close"), "Close", this, SLOT(close())); |
94 | 104 | ||
95 | emailView = new QTextView( this, "emailView" ); | 105 | emailView = new QTextView( this, "emailView" ); |
96 | 106 | ||
97 | setCentralWidget(emailView); | 107 | setCentralWidget(emailView); |
98 | 108 | ||
99 | mime = new QMimeSourceFactory(); | 109 | mime = new QMimeSourceFactory(); |
@@ -243,18 +253,18 @@ void ReadMail::updateView() | |||
243 | text += "\nAwaiting download\n"; | 253 | text += "\nAwaiting download\n"; |
244 | text += "Size of mail: " + mailStringSize; | 254 | text += "Size of mail: " + mailStringSize; |
245 | } | 255 | } |
246 | 256 | ||
247 | emailView->setText(text); | 257 | emailView->setText(text); |
248 | } | 258 | } |
249 | 259 | ||
250 | if (mail->files.count() == 0) | 260 | if (mail->files.count() == 0) |
251 | attatchmentsButton->setEnabled(FALSE); | 261 | attachmentButton->setEnabled(FALSE); |
252 | else attatchmentsButton->setEnabled(TRUE); | 262 | else attachmentButton->setEnabled(TRUE); |
253 | 263 | ||
254 | setCaption("Examining mail: " + mail->subject); | 264 | setCaption("Examining mail: " + mail->subject); |
255 | } | 265 | } |
256 | 266 | ||
257 | //update view with current EmailListItem (item) | 267 | //update view with current EmailListItem (item) |
258 | void ReadMail::update(QListView *thisView, Email *mailIn) | 268 | void ReadMail::update(QListView *thisView, Email *mailIn) |
259 | { | 269 | { |
260 | view = thisView; | 270 | view = thisView; |
@@ -334,17 +344,17 @@ void ReadMail::updateButtons() | |||
334 | } | 344 | } |
335 | 345 | ||
336 | void ReadMail::shiftText() | 346 | void ReadMail::shiftText() |
337 | { | 347 | { |
338 | plainTxt = ! plainTxt; | 348 | plainTxt = ! plainTxt; |
339 | updateView(); | 349 | updateView(); |
340 | } | 350 | } |
341 | 351 | ||
342 | void ReadMail::viewAttatchments() | 352 | void ReadMail::viewAttachments() |
343 | { | 353 | { |
344 | viewAtt->update(mail, inbox); | 354 | viewAtt->update(mail, inbox); |
345 | viewAtt->showMaximized(); | 355 | viewAtt->showMaximized(); |
346 | } | 356 | } |
347 | 357 | ||
348 | void ReadMail::reply() | 358 | void ReadMail::reply() |
349 | { | 359 | { |
350 | emit replyRequested(*mail, (bool&)TRUE); | 360 | emit replyRequested(*mail, (bool&)TRUE); |
diff --git a/noncore/unsupported/mailit/readmail.h b/noncore/unsupported/mailit/readmail.h index 0fe0646..df32c34 100644 --- a/noncore/unsupported/mailit/readmail.h +++ b/noncore/unsupported/mailit/readmail.h | |||
@@ -52,17 +52,17 @@ signals: | |||
52 | void viewingMail(Email *); | 52 | void viewingMail(Email *); |
53 | 53 | ||
54 | public slots: | 54 | public slots: |
55 | void close(); | 55 | void close(); |
56 | void next(); | 56 | void next(); |
57 | void previous(); | 57 | void previous(); |
58 | void deleteItem(); | 58 | void deleteItem(); |
59 | void shiftText(); | 59 | void shiftText(); |
60 | void viewAttatchments(); | 60 | void viewAttachments(); |
61 | void reply(); | 61 | void reply(); |
62 | void forward(); | 62 | void forward(); |
63 | 63 | ||
64 | private: | 64 | private: |
65 | void init(); | 65 | void init(); |
66 | void updateButtons(); | 66 | void updateButtons(); |
67 | 67 | ||
68 | private: | 68 | private: |
@@ -75,15 +75,15 @@ private: | |||
75 | QToolBar *bar; | 75 | QToolBar *bar; |
76 | QMenuBar *menu; | 76 | QMenuBar *menu; |
77 | QPopupMenu *viewMenu, *mailMenu; | 77 | QPopupMenu *viewMenu, *mailMenu; |
78 | QAction *deleteButton; | 78 | QAction *deleteButton; |
79 | QMimeSourceFactory *mime; | 79 | QMimeSourceFactory *mime; |
80 | QAction *plainTextButton; | 80 | QAction *plainTextButton; |
81 | QAction *nextButton; | 81 | QAction *nextButton; |
82 | QTextView *emailView; | 82 | QTextView *emailView; |
83 | QAction *attatchmentsButton; | 83 | QAction *attachmentButton; |
84 | QAction *previousButton; | 84 | QAction *previousButton; |
85 | QAction *replyButton; | 85 | QAction *replyButton; |
86 | QAction *forwardButton; | 86 | QAction *forwardButton; |
87 | }; | 87 | }; |
88 | 88 | ||
89 | #endif // READMAIL_H | 89 | #endif // READMAIL_H |
diff --git a/noncore/unsupported/mailit/smtpclient.cpp b/noncore/unsupported/mailit/smtpclient.cpp index b2e38e5..8a51a5b 100644 --- a/noncore/unsupported/mailit/smtpclient.cpp +++ b/noncore/unsupported/mailit/smtpclient.cpp | |||
@@ -82,90 +82,82 @@ void SmtpClient::errorHandling(int status) | |||
82 | void SmtpClient::incomingData() | 82 | void SmtpClient::incomingData() |
83 | { | 83 | { |
84 | QString response; | 84 | QString response; |
85 | 85 | ||
86 | if (!socket->canReadLine()) | 86 | if (!socket->canReadLine()) |
87 | return; | 87 | return; |
88 | 88 | ||
89 | response = socket->readLine(); | 89 | response = socket->readLine(); |
90 | //qDebug(response); | ||
91 | 90 | ||
92 | switch(status) { | 91 | switch(status) { |
93 | case Init: { | 92 | case Init: { |
94 | if (response[0] == '2') { | 93 | if (response[0] == '2') { |
95 | status = From; | 94 | status = From; |
96 | mailPtr = mailList.first(); | 95 | mailPtr = mailList.first(); |
97 | *stream << "HELO there\r\n"; | 96 | *stream << "HELO there\r\n"; |
98 | //qDebug("HELO"); | ||
99 | } else errorHandling(ErrUnknownResponse); | 97 | } else errorHandling(ErrUnknownResponse); |
100 | break; | 98 | break; |
101 | } | 99 | } |
102 | case From: { | 100 | case From: { |
103 | if (response[0] == '2') { | 101 | if (response[0] == '2') { |
104 | *stream << "MAIL FROM: " << mailPtr->from << "\r\n"; | 102 | *stream << "MAIL FROM: " << mailPtr->from << "\r\n"; |
105 | status = Recv; | 103 | status = Recv; |
106 | //qDebug("MAIL FROM: "+mailPtr->from); | ||
107 | } else errorHandling(ErrUnknownResponse); | 104 | } else errorHandling(ErrUnknownResponse); |
108 | break; | 105 | break; |
109 | } | 106 | } |
110 | case Recv: { | 107 | case Recv: { |
111 | if (response[0] == '2') { | 108 | if (response[0] == '2') { |
112 | it = mailPtr->to.begin(); | 109 | it = mailPtr->to.begin(); |
113 | if (it == NULL) | 110 | if (it == NULL) |
114 | errorHandling(ErrUnknownResponse); | 111 | errorHandling(ErrUnknownResponse); |
115 | *stream << "RCPT TO: " << *it << ">\r\n"; | 112 | *stream << "RCPT TO: " << *it << ">\r\n"; |
116 | //qDebug("RCPT TO: "+ *it); | ||
117 | status = MRcv; | 113 | status = MRcv; |
118 | } else errorHandling(ErrUnknownResponse); | 114 | } else errorHandling(ErrUnknownResponse); |
119 | break; | 115 | break; |
120 | } | 116 | } |
121 | case MRcv: { | 117 | case MRcv: { |
122 | if (response[0] == '2') { | 118 | if (response[0] == '2') { |
123 | it++; | 119 | it++; |
124 | if ( it != mailPtr->to.end() ) { | 120 | if ( it != mailPtr->to.end() ) { |
125 | *stream << "RCPT TO: <" << *it << ">\r\n"; | 121 | *stream << "RCPT TO: <" << *it << ">\r\n"; |
126 | //qDebug("RCPT TO: "+ *it); | ||
127 | break; | 122 | break; |
128 | } else { | 123 | } else { |
129 | status = Data; | 124 | status = Data; |
130 | } | 125 | } |
131 | } else errorHandling(ErrUnknownResponse); | 126 | } else errorHandling(ErrUnknownResponse); |
132 | } | 127 | } |
133 | case Data: { | 128 | case Data: { |
134 | if (response[0] == '2') { | 129 | if (response[0] == '2') { |
135 | *stream << "DATA\r\n"; | 130 | *stream << "DATA\r\n"; |
136 | status = Body; | 131 | status = Body; |
137 | //qDebug("DATA"); | ||
138 | emit updateStatus(tr("Sending: ") + mailPtr->subject); | 132 | emit updateStatus(tr("Sending: ") + mailPtr->subject); |
139 | } else errorHandling(ErrUnknownResponse); | 133 | } else errorHandling(ErrUnknownResponse); |
140 | break; | 134 | break; |
141 | } | 135 | } |
142 | case Body: { | 136 | case Body: { |
143 | if (response[0] == '3') { | 137 | if (response[0] == '3') { |
144 | *stream << mailPtr->body << "\r\n.\r\n"; | 138 | *stream << mailPtr->body << "\r\n.\r\n"; |
145 | mailPtr = mailList.next(); | 139 | mailPtr = mailList.next(); |
146 | if (mailPtr != NULL) { | 140 | if (mailPtr != NULL) { |
147 | status = From; | 141 | status = From; |
148 | } else { | 142 | } else { |
149 | status = Quit; | 143 | status = Quit; |
150 | } | 144 | } |
151 | //qDebug("BODY"); | ||
152 | } else errorHandling(ErrUnknownResponse); | 145 | } else errorHandling(ErrUnknownResponse); |
153 | break; | 146 | break; |
154 | } | 147 | } |
155 | case Quit: { | 148 | case Quit: { |
156 | if (response[0] == '2') { | 149 | if (response[0] == '2') { |
157 | *stream << "QUIT\r\n"; | 150 | *stream << "QUIT\r\n"; |
158 | status = Done; | 151 | status = Done; |
159 | QString temp; | 152 | QString temp; |
160 | temp.setNum(mailList.count()); | 153 | temp.setNum(mailList.count()); |
161 | emit updateStatus(tr("Sent ") + temp + tr(" messages")); | 154 | emit updateStatus(tr("Sent ") + temp + tr(" messages")); |
162 | emit mailSent(); | 155 | emit mailSent(); |
163 | mailList.clear(); | 156 | mailList.clear(); |
164 | sending = FALSE; | 157 | sending = FALSE; |
165 | socket->close(); | 158 | socket->close(); |
166 | //qDebug("QUIT"); | ||
167 | } else errorHandling(ErrUnknownResponse); | 159 | } else errorHandling(ErrUnknownResponse); |
168 | break; | 160 | break; |
169 | } | 161 | } |
170 | } | 162 | } |
171 | } | 163 | } |
diff --git a/noncore/unsupported/mailit/textparser.cpp b/noncore/unsupported/mailit/textparser.cpp index f082417..3fa5f6e 100644 --- a/noncore/unsupported/mailit/textparser.cpp +++ b/noncore/unsupported/mailit/textparser.cpp | |||
@@ -57,37 +57,47 @@ void TextParser::init() | |||
57 | void TextParser::createSeparators() | 57 | void TextParser::createSeparators() |
58 | { | 58 | { |
59 | separators = " @#,.:;<>*/(){}|'?-+=_"; | 59 | separators = " @#,.:;<>*/(){}|'?-+=_"; |
60 | } | 60 | } |
61 | 61 | ||
62 | /*Returns pos of given search criteria, -1 if not found */ | 62 | /*Returns pos of given search criteria, -1 if not found */ |
63 | int TextParser::find(QString target, QChar sep, int pos, bool upperCase) | 63 | int TextParser::find(QString target, QChar sep, int pos, bool upperCase) |
64 | { | 64 | { |
65 | |||
66 | t_splitElm parsstr; | ||
67 | QString pString; | ||
68 | |||
65 | int atLine = 0, atPosElm = 0; | 69 | int atLine = 0, atPosElm = 0; |
66 | 70 | ||
67 | for (int x = 0; x < totalElmCount; x++) { | 71 | getLineReference(pos,&atLine,&atPosElm); |
68 | if (x >= pos) { | 72 | |
69 | if (upperCase) { | 73 | for (int x = pos; x < totalElmCount; x++) |
70 | if ((splitDone[atLine].elm[atPosElm].str.upper() == target) && | 74 | { |
71 | (splitDone[atLine].elm[atPosElm].separator == sep)) | 75 | parsstr=splitDone[atLine].elm[atPosElm++]; |
72 | return x; | 76 | |
73 | } else { | 77 | if (upperCase) |
74 | if ((splitDone[atLine].elm[atPosElm].str == target) && | 78 | { |
75 | (splitDone[atLine].elm[atPosElm].separator == sep)) | 79 | pString=parsstr.str.upper(); |
76 | return x; | 80 | target=target.upper(); |
77 | } | 81 | } |
78 | } | 82 | else |
79 | atPosElm++; | 83 | { |
80 | if (atPosElm >= splitDone[atLine].elmCount) { //new Line | 84 | pString=parsstr.str; |
85 | } | ||
86 | if ((pString == target) && (parsstr.separator == sep)) | ||
87 | { | ||
88 | return x; | ||
89 | } | ||
90 | if (atPosElm >= splitDone[atLine].elmCount) | ||
91 | { //new Line | ||
81 | atLine++; | 92 | atLine++; |
82 | atPosElm = 0; | 93 | atPosElm = 0; |
83 | } | 94 | } |
84 | } | 95 | } |
85 | |||
86 | return -1; | 96 | return -1; |
87 | } | 97 | } |
88 | 98 | ||
89 | int TextParser::elmCount() | 99 | int TextParser::elmCount() |
90 | { | 100 | { |
91 | return totalElmCount; | 101 | return totalElmCount; |
92 | } | 102 | } |
93 | 103 | ||
diff --git a/noncore/unsupported/mailit/viewatt.cpp b/noncore/unsupported/mailit/viewatt.cpp index b6f5015..21885c2 100644 --- a/noncore/unsupported/mailit/viewatt.cpp +++ b/noncore/unsupported/mailit/viewatt.cpp | |||
@@ -14,34 +14,37 @@ | |||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include "resource.h" | 20 | #include "resource.h" |
21 | #include "viewatt.h" | 21 | #include "viewatt.h" |
22 | #include <qwhatsthis.h> | ||
22 | #include <qpe/applnk.h> | 23 | #include <qpe/applnk.h> |
23 | #include <qpe/mimetype.h> | 24 | #include <qpe/mimetype.h> |
24 | 25 | ||
25 | ViewAtt::ViewAtt(QWidget *parent, const char *name, WFlags f) | 26 | ViewAtt::ViewAtt(QWidget *parent, const char *name, WFlags f) |
26 | : QMainWindow(parent, name, f) | 27 | : QMainWindow(parent, name, f) |
27 | { | 28 | { |
28 | setCaption("Exploring attatchments"); | 29 | setCaption("Exploring attatchments"); |
29 | 30 | ||
30 | setToolBarsMovable( FALSE ); | 31 | setToolBarsMovable( FALSE ); |
31 | bar = new QToolBar(this); | 32 | bar = new QToolBar(this); |
32 | installButton = new QAction( tr( "Install" ), Resource::loadPixmap( "exec" ), QString::null, CTRL + Key_C, this, 0 ); | 33 | installButton = new QAction( tr( "Install" ), Resource::loadPixmap( "exec" ), QString::null, CTRL + Key_C, this, 0 ); |
33 | connect(installButton, SIGNAL(activated()), this, SLOT(install()) ); | 34 | connect(installButton, SIGNAL(activated()), this, SLOT(install()) ); |
35 | installButton->setWhatsThis(tr("Click here to install the attachment to your Documents")); | ||
34 | 36 | ||
35 | listView = new QListView(this, "AttView"); | 37 | listView = new QListView(this, "AttView"); |
36 | listView->addColumn( "Attatchment" ); | 38 | listView->addColumn( "Attatchment" ); |
37 | listView->addColumn( "Type" ); | 39 | listView->addColumn( "Type" ); |
38 | listView->addColumn( "Installed" ); | 40 | listView->addColumn( "Installed" ); |
39 | setCentralWidget(listView); | 41 | setCentralWidget(listView); |
42 | QWhatsThis::add(listView,QWidget::tr("This is an overview about all attachments in the mail")); | ||
40 | } | 43 | } |
41 | 44 | ||
42 | void ViewAtt::update(Email *mailIn, bool inbox) | 45 | void ViewAtt::update(Email *mailIn, bool inbox) |
43 | { | 46 | { |
44 | QListViewItem *item; | 47 | QListViewItem *item; |
45 | Enclosure *ePtr; | 48 | Enclosure *ePtr; |
46 | 49 | ||
47 | 50 | ||
diff --git a/noncore/unsupported/mailit/writemail.cpp b/noncore/unsupported/mailit/writemail.cpp index a9dcb02..0336c83 100644 --- a/noncore/unsupported/mailit/writemail.cpp +++ b/noncore/unsupported/mailit/writemail.cpp | |||
@@ -13,26 +13,27 @@ | |||
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qmessagebox.h> | 20 | #include <qmessagebox.h> |
21 | #include <qwhatsthis.h> | ||
21 | #include "writemail.h" | 22 | #include "writemail.h" |
22 | #include <qpe/resource.h> | 23 | #include <qpe/resource.h> |
23 | 24 | ||
24 | WriteMail::WriteMail( QWidget* parent, const char* name, WFlags fl ) | 25 | WriteMail::WriteMail( QWidget* parent, const char* name, WFlags fl ) |
25 | : QMainWindow( parent, name, fl ) | 26 | : QMainWindow( parent, name, fl ) |
26 | { | 27 | { |
27 | showingAddressList = FALSE; | 28 | showingAddressList = FALSE; |
28 | init(); | 29 | init(); |
29 | 30 | ||
30 | addAtt = new AddAtt(0, "Add Attatchments"); | 31 | addAtt = new AddAtt(0, "Add Attachments"); |
31 | } | 32 | } |
32 | 33 | ||
33 | WriteMail::~WriteMail() | 34 | WriteMail::~WriteMail() |
34 | { | 35 | { |
35 | delete addAtt; | 36 | delete addAtt; |
36 | } | 37 | } |
37 | 38 | ||
38 | void WriteMail::setAddressList(AddressList *list) | 39 | void WriteMail::setAddressList(AddressList *list) |
@@ -59,96 +60,103 @@ void WriteMail::init() | |||
59 | menu = new QMenuBar( bar ); | 60 | menu = new QMenuBar( bar ); |
60 | 61 | ||
61 | mailMenu = new QPopupMenu(menu); | 62 | mailMenu = new QPopupMenu(menu); |
62 | menu->insertItem( tr( "&Mail" ), mailMenu); | 63 | menu->insertItem( tr( "&Mail" ), mailMenu); |
63 | addMenu = new QPopupMenu(menu); | 64 | addMenu = new QPopupMenu(menu); |
64 | menu->insertItem( tr( "&Add" ), addMenu); | 65 | menu->insertItem( tr( "&Add" ), addMenu); |
65 | 66 | ||
66 | bar = new QToolBar(this); | 67 | bar = new QToolBar(this); |
67 | attatchButton = new QAction(tr("Attatchment"), Resource::loadPixmap("mailit/attach"), QString::null, 0, this, 0); | 68 | attachButton = new QAction(tr("Attachment"), Resource::loadPixmap("mailit/attach"), QString::null, 0, this, 0); |
68 | attatchButton->addTo(bar); | 69 | attachButton->addTo(bar); |
69 | attatchButton->addTo(addMenu); | 70 | attachButton->addTo(addMenu); |
70 | connect( attatchButton, SIGNAL( activated() ), this, SLOT( attatchFile() ) ); | 71 | connect( attachButton, SIGNAL( activated() ), this, SLOT( attachFile() ) ); |
71 | 72 | attachButton->setWhatsThis(tr("Click here to attach files to your mail")); | |
73 | |||
72 | confirmButton = new QAction(tr("Enque mail"), Resource::loadPixmap("OKButton"), QString::null, 0, this, 0); | 74 | confirmButton = new QAction(tr("Enque mail"), Resource::loadPixmap("OKButton"), QString::null, 0, this, 0); |
73 | confirmButton->addTo(bar); | 75 | confirmButton->addTo(bar); |
74 | confirmButton->addTo(mailMenu); | 76 | confirmButton->addTo(mailMenu); |
75 | connect( confirmButton, SIGNAL( activated() ), this, SLOT( accept() ) ); | 77 | connect( confirmButton, SIGNAL( activated() ), this, SLOT( accept() ) ); |
78 | confirmButton->setWhatsThis(tr("This button puts your mail in the send queue")); | ||
76 | 79 | ||
77 | newButton = new QAction(tr("New mail"), Resource::loadPixmap("new"), QString::null, 0, this, 0); | 80 | newButton = new QAction(tr("New mail"), Resource::loadPixmap("new"), QString::null, 0, this, 0); |
78 | newButton->addTo(mailMenu); | 81 | newButton->addTo(mailMenu); |
79 | connect( newButton, SIGNAL( activated() ), this, SLOT( newMail() ) ); | 82 | connect( newButton, SIGNAL( activated() ), this, SLOT( newMail() ) ); |
80 | 83 | newButton->setWhatsThis(tr("Click here to create a new mail")); | |
84 | |||
81 | widget = new QWidget(this, "widget"); | 85 | widget = new QWidget(this, "widget"); |
82 | grid = new QGridLayout( widget ); | 86 | grid = new QGridLayout( widget ); |
83 | 87 | ||
84 | recipientsBox = new QComboBox( FALSE, widget, "toLabel" ); | 88 | recipientsBox = new QComboBox( FALSE, widget, "toLabel" ); |
85 | recipientsBox->insertItem( tr( "To:" ) ); | 89 | recipientsBox->insertItem( tr( "To:" ) ); |
86 | recipientsBox->insertItem( tr( "CC:" ) ); | 90 | recipientsBox->insertItem( tr( "CC:" ) ); |
87 | recipientsBox->setCurrentItem(0); | 91 | recipientsBox->setCurrentItem(0); |
88 | grid->addWidget( recipientsBox, 0, 0 ); | 92 | grid->addWidget( recipientsBox, 0, 0 ); |
89 | connect(recipientsBox,SIGNAL(activated(int)),this, SLOT(changeRecipients(int))); | 93 | connect(recipientsBox,SIGNAL(activated(int)),this, SLOT(changeRecipients(int))); |
90 | 94 | ||
91 | |||
92 | subjetLabel = new QLabel( widget, "subjetLabel" ); | 95 | subjetLabel = new QLabel( widget, "subjetLabel" ); |
93 | subjetLabel->setText( tr( "Subject:" ) ); | 96 | subjetLabel->setText( tr( "Subject:" ) ); |
94 | 97 | ||
95 | grid->addWidget( subjetLabel, 1, 0 ); | 98 | grid->addWidget( subjetLabel, 1, 0 ); |
96 | 99 | ||
97 | ToolButton13_2 = new QToolButton( widget, "ToolButton13_2" ); | 100 | ToolButton13_2 = new QToolButton( widget, "ToolButton13_2" ); |
98 | ToolButton13_2->setText( tr( "..." ) ); | 101 | ToolButton13_2->setText( tr( "..." ) ); |
99 | grid->addWidget( ToolButton13_2, 1, 2 ); | 102 | grid->addWidget( ToolButton13_2, 1, 2 ); |
100 | 103 | ||
101 | subjectInput = new QLineEdit( widget, "subjectInput" ); | 104 | subjectInput = new QLineEdit( widget, "subjectInput" ); |
102 | grid->addWidget( subjectInput, 1, 1 ); | 105 | grid->addWidget( subjectInput, 1, 1 ); |
106 | QWhatsThis::add(subjectInput,QWidget::tr("The mail subject should be entered here")); | ||
103 | 107 | ||
104 | toInput = new QLineEdit( widget, "toInput" ); | 108 | toInput = new QLineEdit( widget, "toInput" ); |
105 | grid->addWidget( toInput, 0, 1 ); | 109 | grid->addWidget( toInput, 0, 1 ); |
110 | QWhatsThis::add(recipientsBox,QWidget::tr("Recipients can be entered here")); | ||
106 | 111 | ||
107 | ccInput = new QLineEdit( widget, "ccInput" ); | 112 | ccInput = new QLineEdit( widget, "ccInput" ); |
108 | ccInput->hide(); | 113 | ccInput->hide(); |
109 | grid->addWidget( ccInput, 0, 1 ); | 114 | grid->addWidget( ccInput, 0, 1 ); |
115 | QWhatsThis::add(ccInput,QWidget::tr("If you would like to send copies of your mail they can be entered here")); | ||
110 | 116 | ||
111 | |||
112 | addressButton = new QToolButton( widget, "addressButton" ); | 117 | addressButton = new QToolButton( widget, "addressButton" ); |
113 | addressButton->setPixmap( Resource::loadPixmap("AddressBook") ); | 118 | addressButton->setPixmap( Resource::loadPixmap("AddressBook") ); |
114 | addressButton->setToggleButton(TRUE); | 119 | addressButton->setToggleButton(TRUE); |
115 | grid->addWidget( addressButton, 0, 2 ); | 120 | grid->addWidget( addressButton, 0, 2 ); |
116 | connect(addressButton, SIGNAL(clicked()), this, SLOT(getAddress()) ); | 121 | connect(addressButton, SIGNAL(clicked()), this, SLOT(getAddress()) ); |
122 | QWhatsThis::add(addressButton,QWidget::tr("This button opens the address selector with all mail adresses from your OPIE addressbook")); | ||
117 | 123 | ||
118 | emailInput = new QMultiLineEdit( widget, "emailInput" ); | 124 | emailInput = new QMultiLineEdit( widget, "emailInput" ); |
119 | grid->addMultiCellWidget( emailInput, 2, 2, 0, 2); | 125 | grid->addMultiCellWidget( emailInput, 2, 2, 0, 2); |
126 | QWhatsThis::add(recipientsBox,QWidget::tr("Enter your mail text here")); | ||
120 | 127 | ||
121 | |||
122 | addressView = new QListView( widget, "addressView"); | 128 | addressView = new QListView( widget, "addressView"); |
123 | addressView->addColumn("Name"); | 129 | addressView->addColumn("Name"); |
124 | addressView->addColumn("EMail"); | 130 | addressView->addColumn("EMail"); |
125 | addressView->setAllColumnsShowFocus(TRUE); | 131 | addressView->setAllColumnsShowFocus(TRUE); |
126 | addressView->setMultiSelection(TRUE); | 132 | addressView->setMultiSelection(TRUE); |
127 | addressView->hide(); | 133 | addressView->hide(); |
128 | grid->addMultiCellWidget( addressView, 3, 3, 0, 2); | 134 | grid->addMultiCellWidget( addressView, 3, 3, 0, 2); |
129 | 135 | QWhatsThis::add(recipientsBox,QWidget::tr("Chose the recipients from this list")); | |
136 | |||
130 | okButton = new QToolButton(bar, "ok"); | 137 | okButton = new QToolButton(bar, "ok"); |
131 | okButton->setPixmap( Resource::loadPixmap("enter") ); | 138 | okButton->setPixmap( Resource::loadPixmap("enter") ); |
132 | okButton->hide(); | 139 | okButton->hide(); |
133 | connect(okButton, SIGNAL(clicked()), this, SLOT(addRecipients()) ); | 140 | connect(okButton, SIGNAL(clicked()), this, SLOT(addRecipients()) ); |
141 | QWhatsThis::add(okButton,QWidget::tr("Queue your mail by clicking here")); | ||
134 | 142 | ||
135 | setCentralWidget(widget); | 143 | setCentralWidget(widget); |
136 | } | 144 | } |
137 | 145 | ||
138 | void WriteMail::reject() | 146 | void WriteMail::reject() |
139 | { | 147 | { |
140 | emit cancelMail(); | 148 | emit cancelMail(); |
141 | } | 149 | } |
142 | 150 | ||
143 | // need to insert date | 151 | // need to insert date |
144 | void WriteMail::accept() | 152 | void WriteMail::accept() |
145 | { | 153 | { |
146 | QStringList attatchedFiles, attatchmentsType; | 154 | QStringList attachedFiles, attachmentsType; |
147 | int idCount = 0; | 155 | int idCount = 0; |
148 | 156 | ||
149 | if (toInput->text() == "") | 157 | if (toInput->text() == "") |
150 | { | 158 | { |
151 | QMessageBox::warning(this,tr("No recipient"), tr("Send mail to whom?"), tr("OK\n")); | 159 | QMessageBox::warning(this,tr("No recipient"), tr("Send mail to whom?"), tr("OK\n")); |
152 | return; | 160 | return; |
153 | } | 161 | } |
154 | 162 | ||
@@ -191,23 +199,23 @@ void WriteMail::accept() | |||
191 | mail.rawMail += ",\n"; | 199 | mail.rawMail += ",\n"; |
192 | } | 200 | } |
193 | 201 | ||
194 | mail.rawMail += mail.from; | 202 | mail.rawMail += mail.from; |
195 | mail.rawMail += "\nSubject: "; | 203 | mail.rawMail += "\nSubject: "; |
196 | mail.rawMail += mail.subject; | 204 | mail.rawMail += mail.subject; |
197 | mail.rawMail += "\n\n"; | 205 | mail.rawMail += "\n\n"; |
198 | 206 | ||
199 | attatchedFiles = addAtt->returnAttatchedFiles(); | 207 | attachedFiles = addAtt->returnattachedFiles(); |
200 | attatchmentsType = addAtt->returnFileTypes(); | 208 | attachmentsType = addAtt->returnFileTypes(); |
201 | 209 | ||
202 | QStringList::Iterator itType = attatchmentsType.begin(); | 210 | QStringList::Iterator itType = attachmentsType.begin(); |
203 | 211 | ||
204 | Enclosure e; | 212 | Enclosure e; |
205 | for ( QStringList::Iterator it = attatchedFiles.begin(); it != attatchedFiles.end(); ++it ) { | 213 | for ( QStringList::Iterator it = attachedFiles.begin(); it != attachedFiles.end(); ++it ) { |
206 | e.id = idCount; | 214 | e.id = idCount; |
207 | e.originalName = (*it).latin1(); | 215 | e.originalName = (*it).latin1(); |
208 | e.contentType = (*itType).latin1(); | 216 | e.contentType = (*itType).latin1(); |
209 | e.contentAttribute = (*itType).latin1(); | 217 | e.contentAttribute = (*itType).latin1(); |
210 | e.saved = TRUE; | 218 | e.saved = TRUE; |
211 | mail.addEnclosure(&e); | 219 | mail.addEnclosure(&e); |
212 | 220 | ||
213 | itType++; | 221 | itType++; |
@@ -231,17 +239,17 @@ void WriteMail::getAddress() | |||
231 | 239 | ||
232 | } else { | 240 | } else { |
233 | addressView->hide(); | 241 | addressView->hide(); |
234 | okButton->hide(); | 242 | okButton->hide(); |
235 | emailInput->show(); | 243 | emailInput->show(); |
236 | } | 244 | } |
237 | } | 245 | } |
238 | 246 | ||
239 | void WriteMail::attatchFile() | 247 | void WriteMail::attachFile() |
240 | { | 248 | { |
241 | addAtt->showMaximized(); | 249 | addAtt->showMaximized(); |
242 | } | 250 | } |
243 | 251 | ||
244 | void WriteMail::reply(Email replyMail, bool replyAll) | 252 | void WriteMail::reply(Email replyMail, bool replyAll) |
245 | { | 253 | { |
246 | int pos; | 254 | int pos; |
247 | 255 | ||
@@ -251,17 +259,17 @@ void WriteMail::reply(Email replyMail, bool replyAll) | |||
251 | toInput->setText(mail.fromMail); | 259 | toInput->setText(mail.fromMail); |
252 | //replyAll ? ccInput->setText(mail.c) | 260 | //replyAll ? ccInput->setText(mail.c) |
253 | 261 | ||
254 | addRecipients(replyAll); | 262 | addRecipients(replyAll); |
255 | 263 | ||
256 | subjectInput->setText(tr("Re: ") + mail.subject); | 264 | subjectInput->setText(tr("Re: ") + mail.subject); |
257 | 265 | ||
258 | pos = 0; | 266 | pos = 0; |
259 | mail.body.insert(pos, ">>"); | 267 | mail.body.insert(pos, ">"); |
260 | while (pos != -1) { | 268 | while (pos != -1) { |
261 | pos = mail.body.find('\n', pos); | 269 | pos = mail.body.find('\n', pos); |
262 | if (pos != -1) | 270 | if (pos != -1) |
263 | mail.body.insert(++pos, ">>"); | 271 | mail.body.insert(++pos, ">>"); |
264 | } | 272 | } |
265 | 273 | ||
266 | emailInput->setText(mail.body); | 274 | emailInput->setText(mail.body); |
267 | } | 275 | } |
diff --git a/noncore/unsupported/mailit/writemail.h b/noncore/unsupported/mailit/writemail.h index f193b13..921f27e 100644 --- a/noncore/unsupported/mailit/writemail.h +++ b/noncore/unsupported/mailit/writemail.h | |||
@@ -50,17 +50,17 @@ public: | |||
50 | 50 | ||
51 | signals: | 51 | signals: |
52 | void sendMailRequested(const Email &mail); | 52 | void sendMailRequested(const Email &mail); |
53 | void cancelMail(); | 53 | void cancelMail(); |
54 | 54 | ||
55 | 55 | ||
56 | public slots: | 56 | public slots: |
57 | void getAddress(); | 57 | void getAddress(); |
58 | void attatchFile(); | 58 | void attachFile(); |
59 | void addRecipients(); | 59 | void addRecipients(); |
60 | void newMail(); | 60 | void newMail(); |
61 | void accept(); | 61 | void accept(); |
62 | void reject(); | 62 | void reject(); |
63 | void changeRecipients(int); | 63 | void changeRecipients(int); |
64 | 64 | ||
65 | private: | 65 | private: |
66 | bool getRecipients(bool); | 66 | bool getRecipients(bool); |
@@ -74,17 +74,17 @@ private: | |||
74 | 74 | ||
75 | QToolBar *bar; | 75 | QToolBar *bar; |
76 | QMenuBar *menu; | 76 | QMenuBar *menu; |
77 | QPopupMenu *addMenu, *mailMenu; | 77 | QPopupMenu *addMenu, *mailMenu; |
78 | QListView *addressView; | 78 | QListView *addressView; |
79 | 79 | ||
80 | QToolButton *okButton; | 80 | QToolButton *okButton; |
81 | QWidget *widget; | 81 | QWidget *widget; |
82 | QAction *attatchButton; | 82 | QAction *attachButton; |
83 | QAction *confirmButton; | 83 | QAction *confirmButton; |
84 | QAction *newButton; | 84 | QAction *newButton; |
85 | QLabel* subjetLabel; | 85 | QLabel* subjetLabel; |
86 | QToolButton* ToolButton13_2; | 86 | QToolButton* ToolButton13_2; |
87 | QComboBox* recipientsBox; | 87 | QComboBox* recipientsBox; |
88 | QLineEdit *subjectInput; | 88 | QLineEdit *subjectInput; |
89 | QLineEdit *toInput; | 89 | QLineEdit *toInput; |
90 | QLineEdit *ccInput; | 90 | QLineEdit *ccInput; |