-rw-r--r-- | noncore/net/mail/accountview.cpp | 69 | ||||
-rw-r--r-- | noncore/net/mail/accountview.h | 2 | ||||
-rw-r--r-- | noncore/net/mail/imapwrapper.cpp | 7 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 7 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailwrapper.cpp | 11 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailwrapper.h | 7 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.cpp | 2 | ||||
-rw-r--r-- | noncore/net/mail/mailwrapper.cpp | 11 | ||||
-rw-r--r-- | noncore/net/mail/mailwrapper.h | 7 | ||||
-rw-r--r-- | noncore/net/mail/pop3wrapper.cpp | 2 |
10 files changed, 100 insertions, 25 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index 8e21d39..b6bf298 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp | |||
@@ -101,59 +101,114 @@ IMAPviewItem::~IMAPviewItem() | |||
101 | 101 | ||
102 | AbstractMail *IMAPviewItem::getWrapper() | 102 | AbstractMail *IMAPviewItem::getWrapper() |
103 | { | 103 | { |
104 | return wrapper; | 104 | return wrapper; |
105 | } | 105 | } |
106 | 106 | ||
107 | void IMAPviewItem::refresh(QList<RecMail>&) | 107 | void IMAPviewItem::refresh(QList<RecMail>&) |
108 | { | 108 | { |
109 | if (childCount()>0) return; | ||
109 | QList<Folder> *folders = wrapper->listFolders(); | 110 | QList<Folder> *folders = wrapper->listFolders(); |
110 | 111 | ||
111 | QListViewItem *child = firstChild(); | 112 | QListViewItem *child = firstChild(); |
112 | while ( child ) { | 113 | while ( child ) { |
113 | QListViewItem *tmp = child; | 114 | QListViewItem *tmp = child; |
114 | child = child->nextSibling(); | 115 | child = child->nextSibling(); |
115 | delete tmp; | 116 | delete tmp; |
116 | } | 117 | } |
117 | 118 | ||
118 | Folder *it; | 119 | Folder *it; |
119 | QListViewItem*item = 0; | 120 | QListViewItem*item = 0; |
120 | for ( it = folders->first(); it; it = folders->next() ) { | 121 | QListViewItem*titem = 0; |
121 | item = new IMAPfolderItem( it, this , item ); | 122 | QListViewItem*inboxitem = 0; |
122 | item->setSelectable(it->may_select()); | 123 | QString fname,del,search; |
123 | } | 124 | int pos; |
124 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 125 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
125 | folders->setAutoDelete(false); | 126 | folders->setAutoDelete(false); |
127 | |||
128 | for ( it = folders->first(); it; it = folders->next() ) { | ||
129 | if (it->getDisplayName().lower()=="inbox") { | ||
130 | inboxitem = new IMAPfolderItem( it, this , item ); | ||
131 | folders->remove(it); | ||
132 | qDebug("inbox found"); | ||
133 | break; | ||
134 | } | ||
135 | } | ||
136 | |||
137 | for ( it = folders->first(); it; it = folders->next() ) { | ||
138 | fname = it->getDisplayName(); | ||
139 | pos = fname.findRev(it->Separator()); | ||
140 | if (pos != -1) { | ||
141 | fname = fname.left(pos); | ||
142 | qDebug(fname); | ||
143 | } | ||
144 | IMAPfolderItem*pitem = (IMAPfolderItem*)firstChild(); | ||
145 | while (pitem) { | ||
146 | if (pitem->matchName(fname)) { | ||
147 | break; | ||
148 | } | ||
149 | pitem=(IMAPfolderItem*)pitem->nextSibling(); | ||
150 | } | ||
151 | if (pitem) { | ||
152 | titem = item; | ||
153 | item = new IMAPfolderItem(it,pitem,item,this); | ||
154 | item->setSelectable(it->may_select()); | ||
155 | /* setup the short name */ | ||
156 | item->setText(0,it->getDisplayName().right(it->getDisplayName().length()-pos-1)); | ||
157 | item = titem; | ||
158 | } else { | ||
159 | item = new IMAPfolderItem( it, this , (inboxitem?inboxitem:item) ); | ||
160 | item->setSelectable(it->may_select()); | ||
161 | } | ||
162 | } | ||
126 | delete folders; | 163 | delete folders; |
127 | } | 164 | } |
128 | 165 | ||
129 | RecBody IMAPviewItem::fetchBody(const RecMail&) | 166 | RecBody IMAPviewItem::fetchBody(const RecMail&) |
130 | { | 167 | { |
131 | return RecBody(); | 168 | return RecBody(); |
132 | } | 169 | } |
133 | 170 | ||
134 | IMAPfolderItem::~IMAPfolderItem() | 171 | IMAPfolderItem::~IMAPfolderItem() |
135 | { | 172 | { |
136 | delete folder; | 173 | delete folder; |
137 | } | 174 | } |
138 | 175 | ||
139 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QListViewItem*after ) | 176 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QListViewItem*after ) |
140 | : AccountViewItem( parent,after ) | 177 | : AccountViewItem( parent ) |
141 | { | 178 | { |
142 | folder = folderInit; | 179 | folder = folderInit; |
143 | imap = parent; | 180 | imap = parent; |
144 | if (folder->getDisplayName().lower()!="inbox") { | 181 | if (folder->getDisplayName().lower()!="inbox") { |
145 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 182 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
146 | } else { | 183 | } else { |
147 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 184 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
148 | } | 185 | } |
149 | setText( 0, folder->getDisplayName() ); | 186 | setText( 0, folder->getDisplayName() ); |
150 | } | 187 | } |
151 | 188 | ||
189 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) | ||
190 | : AccountViewItem( parent,after ) | ||
191 | { | ||
192 | folder = folderInit; | ||
193 | imap = master; | ||
194 | if (folder->getDisplayName().lower()!="inbox") { | ||
195 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | ||
196 | } else { | ||
197 | setPixmap( 0, PIXMAP_INBOXFOLDER); | ||
198 | } | ||
199 | setText( 0, folder->getDisplayName() ); | ||
200 | } | ||
201 | |||
202 | bool IMAPfolderItem::matchName(const QString&name)const | ||
203 | { | ||
204 | return folder->getDisplayName()==name; | ||
205 | } | ||
206 | |||
152 | void IMAPfolderItem::refresh(QList<RecMail>&target) | 207 | void IMAPfolderItem::refresh(QList<RecMail>&target) |
153 | { | 208 | { |
154 | if (folder->may_select()) | 209 | if (folder->may_select()) |
155 | imap->getWrapper()->listMessages( folder->getName(),target ); | 210 | imap->getWrapper()->listMessages( folder->getName(),target ); |
156 | } | 211 | } |
157 | 212 | ||
158 | RecBody IMAPfolderItem::fetchBody(const RecMail&aMail) | 213 | RecBody IMAPfolderItem::fetchBody(const RecMail&aMail) |
159 | { | 214 | { |
@@ -164,17 +219,17 @@ RecBody IMAPfolderItem::fetchBody(const RecMail&aMail) | |||
164 | * Generic stuff | 219 | * Generic stuff |
165 | */ | 220 | */ |
166 | 221 | ||
167 | AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) | 222 | AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) |
168 | : QListView( parent, name, flags ) | 223 | : QListView( parent, name, flags ) |
169 | { | 224 | { |
170 | connect( this, SIGNAL( selectionChanged( QListViewItem * ) ), | 225 | connect( this, SIGNAL( selectionChanged( QListViewItem * ) ), |
171 | SLOT( refresh( QListViewItem * ) ) ); | 226 | SLOT( refresh( QListViewItem * ) ) ); |
172 | setSorting(-1); | 227 | setSorting(0); |
173 | } | 228 | } |
174 | 229 | ||
175 | void AccountView::populate( QList<Account> list ) | 230 | void AccountView::populate( QList<Account> list ) |
176 | { | 231 | { |
177 | clear(); | 232 | clear(); |
178 | 233 | ||
179 | Account *it; | 234 | Account *it; |
180 | for ( it = list.first(); it; it = list.next() ) { | 235 | for ( it = list.first(); it; it = list.next() ) { |
diff --git a/noncore/net/mail/accountview.h b/noncore/net/mail/accountview.h index d035af4..a57935f 100644 --- a/noncore/net/mail/accountview.h +++ b/noncore/net/mail/accountview.h | |||
@@ -65,19 +65,21 @@ private: | |||
65 | AbstractMail *wrapper; | 65 | AbstractMail *wrapper; |
66 | }; | 66 | }; |
67 | 67 | ||
68 | class IMAPfolderItem : public AccountViewItem | 68 | class IMAPfolderItem : public AccountViewItem |
69 | { | 69 | { |
70 | 70 | ||
71 | public: | 71 | public: |
72 | IMAPfolderItem( Folder *folder, IMAPviewItem *parent , QListViewItem*after ); | 72 | IMAPfolderItem( Folder *folder, IMAPviewItem *parent , QListViewItem*after ); |
73 | IMAPfolderItem( Folder *folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ); | ||
73 | ~IMAPfolderItem(); | 74 | ~IMAPfolderItem(); |
74 | virtual void refresh(QList<RecMail>&); | 75 | virtual void refresh(QList<RecMail>&); |
75 | virtual RecBody fetchBody(const RecMail&); | 76 | virtual RecBody fetchBody(const RecMail&); |
77 | bool matchName(const QString&name)const; | ||
76 | private: | 78 | private: |
77 | Folder *folder; | 79 | Folder *folder; |
78 | IMAPviewItem *imap; | 80 | IMAPviewItem *imap; |
79 | }; | 81 | }; |
80 | 82 | ||
81 | class AccountView : public QListView | 83 | class AccountView : public QListView |
82 | { | 84 | { |
83 | Q_OBJECT | 85 | Q_OBJECT |
diff --git a/noncore/net/mail/imapwrapper.cpp b/noncore/net/mail/imapwrapper.cpp index d56d7f9..8a86c95 100644 --- a/noncore/net/mail/imapwrapper.cpp +++ b/noncore/net/mail/imapwrapper.cpp | |||
@@ -160,24 +160,26 @@ QList<Folder>* IMAPwrapper::listFolders() | |||
160 | * We must not forget to filter them out in next loop! | 160 | * We must not forget to filter them out in next loop! |
161 | * it seems like ugly code. and yes - it is ugly code. but the best way. | 161 | * it seems like ugly code. and yes - it is ugly code. but the best way. |
162 | */ | 162 | */ |
163 | QString temp; | 163 | QString temp; |
164 | mask = "INBOX" ; | 164 | mask = "INBOX" ; |
165 | result = clist_new(); | 165 | result = clist_new(); |
166 | mailimap_mailbox_list *list; | 166 | mailimap_mailbox_list *list; |
167 | err = mailimap_list( m_imap, (char*)"", (char*)mask, &result ); | 167 | err = mailimap_list( m_imap, (char*)"", (char*)mask, &result ); |
168 | QString del; | ||
168 | if ( err == MAILIMAP_NO_ERROR ) { | 169 | if ( err == MAILIMAP_NO_ERROR ) { |
169 | current = result->first; | 170 | current = result->first; |
170 | for ( int i = result->count; i > 0; i-- ) { | 171 | for ( int i = result->count; i > 0; i-- ) { |
171 | list = (mailimap_mailbox_list *) current->data; | 172 | list = (mailimap_mailbox_list *) current->data; |
172 | // it is better use the deep copy mechanism of qt itself | 173 | // it is better use the deep copy mechanism of qt itself |
173 | // instead of using strdup! | 174 | // instead of using strdup! |
174 | temp = list->mb_name; | 175 | temp = list->mb_name; |
175 | folders->append( new IMAPFolder(temp)); | 176 | del = list->mb_delimiter; |
177 | folders->append( new IMAPFolder(temp,del,true,account->getPrefix())); | ||
176 | current = current->next; | 178 | current = current->next; |
177 | } | 179 | } |
178 | } else { | 180 | } else { |
179 | qDebug("error fetching folders: %s",m_imap->imap_response); | 181 | qDebug("error fetching folders: %s",m_imap->imap_response); |
180 | } | 182 | } |
181 | mailimap_list_result_free( result ); | 183 | mailimap_list_result_free( result ); |
182 | 184 | ||
183 | /* | 185 | /* |
@@ -201,17 +203,18 @@ QList<Folder>* IMAPwrapper::listFolders() | |||
201 | if (temp.lower()=="inbox") | 203 | if (temp.lower()=="inbox") |
202 | continue; | 204 | continue; |
203 | if (temp.lower()==account->getPrefix().lower()) | 205 | if (temp.lower()==account->getPrefix().lower()) |
204 | continue; | 206 | continue; |
205 | if ( (bflags = list->mb_flag) ) { | 207 | if ( (bflags = list->mb_flag) ) { |
206 | selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&& | 208 | selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&& |
207 | bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT); | 209 | bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT); |
208 | } | 210 | } |
209 | folders->append(new IMAPFolder(temp,selectable,account->getPrefix())); | 211 | del = list->mb_delimiter; |
212 | folders->append(new IMAPFolder(temp,del,selectable,account->getPrefix())); | ||
210 | } | 213 | } |
211 | } else { | 214 | } else { |
212 | qDebug("error fetching folders %s",m_imap->imap_response); | 215 | qDebug("error fetching folders %s",m_imap->imap_response); |
213 | } | 216 | } |
214 | mailimap_list_result_free( result ); | 217 | mailimap_list_result_free( result ); |
215 | return folders; | 218 | return folders; |
216 | } | 219 | } |
217 | 220 | ||
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index d56d7f9..8a86c95 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp | |||
@@ -160,24 +160,26 @@ QList<Folder>* IMAPwrapper::listFolders() | |||
160 | * We must not forget to filter them out in next loop! | 160 | * We must not forget to filter them out in next loop! |
161 | * it seems like ugly code. and yes - it is ugly code. but the best way. | 161 | * it seems like ugly code. and yes - it is ugly code. but the best way. |
162 | */ | 162 | */ |
163 | QString temp; | 163 | QString temp; |
164 | mask = "INBOX" ; | 164 | mask = "INBOX" ; |
165 | result = clist_new(); | 165 | result = clist_new(); |
166 | mailimap_mailbox_list *list; | 166 | mailimap_mailbox_list *list; |
167 | err = mailimap_list( m_imap, (char*)"", (char*)mask, &result ); | 167 | err = mailimap_list( m_imap, (char*)"", (char*)mask, &result ); |
168 | QString del; | ||
168 | if ( err == MAILIMAP_NO_ERROR ) { | 169 | if ( err == MAILIMAP_NO_ERROR ) { |
169 | current = result->first; | 170 | current = result->first; |
170 | for ( int i = result->count; i > 0; i-- ) { | 171 | for ( int i = result->count; i > 0; i-- ) { |
171 | list = (mailimap_mailbox_list *) current->data; | 172 | list = (mailimap_mailbox_list *) current->data; |
172 | // it is better use the deep copy mechanism of qt itself | 173 | // it is better use the deep copy mechanism of qt itself |
173 | // instead of using strdup! | 174 | // instead of using strdup! |
174 | temp = list->mb_name; | 175 | temp = list->mb_name; |
175 | folders->append( new IMAPFolder(temp)); | 176 | del = list->mb_delimiter; |
177 | folders->append( new IMAPFolder(temp,del,true,account->getPrefix())); | ||
176 | current = current->next; | 178 | current = current->next; |
177 | } | 179 | } |
178 | } else { | 180 | } else { |
179 | qDebug("error fetching folders: %s",m_imap->imap_response); | 181 | qDebug("error fetching folders: %s",m_imap->imap_response); |
180 | } | 182 | } |
181 | mailimap_list_result_free( result ); | 183 | mailimap_list_result_free( result ); |
182 | 184 | ||
183 | /* | 185 | /* |
@@ -201,17 +203,18 @@ QList<Folder>* IMAPwrapper::listFolders() | |||
201 | if (temp.lower()=="inbox") | 203 | if (temp.lower()=="inbox") |
202 | continue; | 204 | continue; |
203 | if (temp.lower()==account->getPrefix().lower()) | 205 | if (temp.lower()==account->getPrefix().lower()) |
204 | continue; | 206 | continue; |
205 | if ( (bflags = list->mb_flag) ) { | 207 | if ( (bflags = list->mb_flag) ) { |
206 | selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&& | 208 | selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&& |
207 | bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT); | 209 | bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT); |
208 | } | 210 | } |
209 | folders->append(new IMAPFolder(temp,selectable,account->getPrefix())); | 211 | del = list->mb_delimiter; |
212 | folders->append(new IMAPFolder(temp,del,selectable,account->getPrefix())); | ||
210 | } | 213 | } |
211 | } else { | 214 | } else { |
212 | qDebug("error fetching folders %s",m_imap->imap_response); | 215 | qDebug("error fetching folders %s",m_imap->imap_response); |
213 | } | 216 | } |
214 | mailimap_list_result_free( result ); | 217 | mailimap_list_result_free( result ); |
215 | return folders; | 218 | return folders; |
216 | } | 219 | } |
217 | 220 | ||
diff --git a/noncore/net/mail/libmailwrapper/mailwrapper.cpp b/noncore/net/mail/libmailwrapper/mailwrapper.cpp index 96602c2..858283f 100644 --- a/noncore/net/mail/libmailwrapper/mailwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mailwrapper.cpp | |||
@@ -12,17 +12,17 @@ | |||
12 | #include "defines.h" | 12 | #include "defines.h" |
13 | 13 | ||
14 | Attachment::Attachment( DocLnk lnk ) | 14 | Attachment::Attachment( DocLnk lnk ) |
15 | { | 15 | { |
16 | doc = lnk; | 16 | doc = lnk; |
17 | size = QFileInfo( doc.file() ).size(); | 17 | size = QFileInfo( doc.file() ).size(); |
18 | } | 18 | } |
19 | 19 | ||
20 | Folder::Folder(const QString&tmp_name ) | 20 | Folder::Folder(const QString&tmp_name, const QString&sep ) |
21 | { | 21 | { |
22 | name = tmp_name; | 22 | name = tmp_name; |
23 | nameDisplay = name; | 23 | nameDisplay = name; |
24 | 24 | ||
25 | for ( int pos = nameDisplay.find( '&' ); pos != -1; | 25 | for ( int pos = nameDisplay.find( '&' ); pos != -1; |
26 | pos = nameDisplay.find( '&' ) ) { | 26 | pos = nameDisplay.find( '&' ) ) { |
27 | int end = nameDisplay.find( '-' ); | 27 | int end = nameDisplay.find( '-' ); |
28 | if ( end == -1 || end <= pos ) break; | 28 | if ( end == -1 || end <= pos ) break; |
@@ -30,21 +30,26 @@ Folder::Folder(const QString&tmp_name ) | |||
30 | // TODO: do real base64 decoding here ! | 30 | // TODO: do real base64 decoding here ! |
31 | if ( str64.compare( "APw" ) == 0 ) { | 31 | if ( str64.compare( "APw" ) == 0 ) { |
32 | nameDisplay = nameDisplay.replace( pos, end - pos + 1, "ue" ); | 32 | nameDisplay = nameDisplay.replace( pos, end - pos + 1, "ue" ); |
33 | } else if ( str64.compare( "APY" ) == 0 ) { | 33 | } else if ( str64.compare( "APY" ) == 0 ) { |
34 | nameDisplay = nameDisplay.replace( pos, end - pos + 1, "oe" ); | 34 | nameDisplay = nameDisplay.replace( pos, end - pos + 1, "oe" ); |
35 | } | 35 | } |
36 | } | 36 | } |
37 | qDebug( "folder " + name + " - displayed as " + nameDisplay ); | 37 | qDebug( "folder " + name + " - displayed as " + nameDisplay ); |
38 | separator = sep; | ||
38 | } | 39 | } |
39 | 40 | ||
41 | const QString& Folder::Separator()const | ||
42 | { | ||
43 | return separator; | ||
44 | } | ||
40 | 45 | ||
41 | IMAPFolder::IMAPFolder(const QString&name,bool select,const QString&prefix ) | 46 | IMAPFolder::IMAPFolder(const QString&name,const QString&sep, bool select,const QString&prefix ) |
42 | : Folder( name ),m_MaySelect(select) | 47 | : Folder( name,sep ),m_MaySelect(select) |
43 | { | 48 | { |
44 | if (prefix.length()>0) { | 49 | if (prefix.length()>0) { |
45 | if (nameDisplay.startsWith(prefix) && nameDisplay.length()>prefix.length()) { | 50 | if (nameDisplay.startsWith(prefix) && nameDisplay.length()>prefix.length()) { |
46 | nameDisplay=nameDisplay.right(nameDisplay.length()-prefix.length()); | 51 | nameDisplay=nameDisplay.right(nameDisplay.length()-prefix.length()); |
47 | } | 52 | } |
48 | } | 53 | } |
49 | } | 54 | } |
50 | 55 | ||
diff --git a/noncore/net/mail/libmailwrapper/mailwrapper.h b/noncore/net/mail/libmailwrapper/mailwrapper.h index 6994dd8..d78f8e9 100644 --- a/noncore/net/mail/libmailwrapper/mailwrapper.h +++ b/noncore/net/mail/libmailwrapper/mailwrapper.h | |||
@@ -66,30 +66,31 @@ private: | |||
66 | QString name, mail, to, cc, bcc, reply, subject, message; | 66 | QString name, mail, to, cc, bcc, reply, subject, message; |
67 | }; | 67 | }; |
68 | 68 | ||
69 | class Folder : public QObject | 69 | class Folder : public QObject |
70 | { | 70 | { |
71 | Q_OBJECT | 71 | Q_OBJECT |
72 | 72 | ||
73 | public: | 73 | public: |
74 | Folder( const QString&init_name ); | 74 | Folder( const QString&init_name,const QString&sep ); |
75 | const QString&getDisplayName()const { return nameDisplay; } | 75 | const QString&getDisplayName()const { return nameDisplay; } |
76 | const QString&getName()const { return name; } | 76 | const QString&getName()const { return name; } |
77 | virtual bool may_select()const{return true;}; | 77 | virtual bool may_select()const{return true;}; |
78 | const QString&Separator()const; | ||
78 | 79 | ||
79 | protected: | 80 | protected: |
80 | QString nameDisplay, name; | 81 | QString nameDisplay, name, separator; |
81 | 82 | ||
82 | }; | 83 | }; |
83 | 84 | ||
84 | class IMAPFolder : public Folder | 85 | class IMAPFolder : public Folder |
85 | { | 86 | { |
86 | public: | 87 | public: |
87 | IMAPFolder(const QString&name,bool select=true,const QString&prefix="" ); | 88 | IMAPFolder(const QString&name, const QString&sep, bool select=true,const QString&prefix="" ); |
88 | virtual bool may_select()const{return m_MaySelect;} | 89 | virtual bool may_select()const{return m_MaySelect;} |
89 | private: | 90 | private: |
90 | bool m_MaySelect; | 91 | bool m_MaySelect; |
91 | }; | 92 | }; |
92 | 93 | ||
93 | class MailWrapper : public QObject | 94 | class MailWrapper : public QObject |
94 | { | 95 | { |
95 | Q_OBJECT | 96 | Q_OBJECT |
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp index 075d8c7..4508a95 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp | |||
@@ -318,17 +318,17 @@ void POP3wrapper::logout() | |||
318 | 318 | ||
319 | QList<Folder>* POP3wrapper::listFolders() | 319 | QList<Folder>* POP3wrapper::listFolders() |
320 | { | 320 | { |
321 | /* TODO: integrate MH directories | 321 | /* TODO: integrate MH directories |
322 | but not before version 0.1 ;) | 322 | but not before version 0.1 ;) |
323 | */ | 323 | */ |
324 | QList<Folder> * folders = new QList<Folder>(); | 324 | QList<Folder> * folders = new QList<Folder>(); |
325 | folders->setAutoDelete( false ); | 325 | folders->setAutoDelete( false ); |
326 | Folder*inb=new Folder("INBOX"); | 326 | Folder*inb=new Folder("INBOX","/"); |
327 | folders->append(inb); | 327 | folders->append(inb); |
328 | return folders; | 328 | return folders; |
329 | } | 329 | } |
330 | 330 | ||
331 | QString POP3wrapper::fetchTextPart(const RecMail&,const RecPart&) | 331 | QString POP3wrapper::fetchTextPart(const RecMail&,const RecPart&) |
332 | { | 332 | { |
333 | return ""; | 333 | return ""; |
334 | } | 334 | } |
diff --git a/noncore/net/mail/mailwrapper.cpp b/noncore/net/mail/mailwrapper.cpp index 96602c2..858283f 100644 --- a/noncore/net/mail/mailwrapper.cpp +++ b/noncore/net/mail/mailwrapper.cpp | |||
@@ -12,17 +12,17 @@ | |||
12 | #include "defines.h" | 12 | #include "defines.h" |
13 | 13 | ||
14 | Attachment::Attachment( DocLnk lnk ) | 14 | Attachment::Attachment( DocLnk lnk ) |
15 | { | 15 | { |
16 | doc = lnk; | 16 | doc = lnk; |
17 | size = QFileInfo( doc.file() ).size(); | 17 | size = QFileInfo( doc.file() ).size(); |
18 | } | 18 | } |
19 | 19 | ||
20 | Folder::Folder(const QString&tmp_name ) | 20 | Folder::Folder(const QString&tmp_name, const QString&sep ) |
21 | { | 21 | { |
22 | name = tmp_name; | 22 | name = tmp_name; |
23 | nameDisplay = name; | 23 | nameDisplay = name; |
24 | 24 | ||
25 | for ( int pos = nameDisplay.find( '&' ); pos != -1; | 25 | for ( int pos = nameDisplay.find( '&' ); pos != -1; |
26 | pos = nameDisplay.find( '&' ) ) { | 26 | pos = nameDisplay.find( '&' ) ) { |
27 | int end = nameDisplay.find( '-' ); | 27 | int end = nameDisplay.find( '-' ); |
28 | if ( end == -1 || end <= pos ) break; | 28 | if ( end == -1 || end <= pos ) break; |
@@ -30,21 +30,26 @@ Folder::Folder(const QString&tmp_name ) | |||
30 | // TODO: do real base64 decoding here ! | 30 | // TODO: do real base64 decoding here ! |
31 | if ( str64.compare( "APw" ) == 0 ) { | 31 | if ( str64.compare( "APw" ) == 0 ) { |
32 | nameDisplay = nameDisplay.replace( pos, end - pos + 1, "ue" ); | 32 | nameDisplay = nameDisplay.replace( pos, end - pos + 1, "ue" ); |
33 | } else if ( str64.compare( "APY" ) == 0 ) { | 33 | } else if ( str64.compare( "APY" ) == 0 ) { |
34 | nameDisplay = nameDisplay.replace( pos, end - pos + 1, "oe" ); | 34 | nameDisplay = nameDisplay.replace( pos, end - pos + 1, "oe" ); |
35 | } | 35 | } |
36 | } | 36 | } |
37 | qDebug( "folder " + name + " - displayed as " + nameDisplay ); | 37 | qDebug( "folder " + name + " - displayed as " + nameDisplay ); |
38 | separator = sep; | ||
38 | } | 39 | } |
39 | 40 | ||
41 | const QString& Folder::Separator()const | ||
42 | { | ||
43 | return separator; | ||
44 | } | ||
40 | 45 | ||
41 | IMAPFolder::IMAPFolder(const QString&name,bool select,const QString&prefix ) | 46 | IMAPFolder::IMAPFolder(const QString&name,const QString&sep, bool select,const QString&prefix ) |
42 | : Folder( name ),m_MaySelect(select) | 47 | : Folder( name,sep ),m_MaySelect(select) |
43 | { | 48 | { |
44 | if (prefix.length()>0) { | 49 | if (prefix.length()>0) { |
45 | if (nameDisplay.startsWith(prefix) && nameDisplay.length()>prefix.length()) { | 50 | if (nameDisplay.startsWith(prefix) && nameDisplay.length()>prefix.length()) { |
46 | nameDisplay=nameDisplay.right(nameDisplay.length()-prefix.length()); | 51 | nameDisplay=nameDisplay.right(nameDisplay.length()-prefix.length()); |
47 | } | 52 | } |
48 | } | 53 | } |
49 | } | 54 | } |
50 | 55 | ||
diff --git a/noncore/net/mail/mailwrapper.h b/noncore/net/mail/mailwrapper.h index 6994dd8..d78f8e9 100644 --- a/noncore/net/mail/mailwrapper.h +++ b/noncore/net/mail/mailwrapper.h | |||
@@ -66,30 +66,31 @@ private: | |||
66 | QString name, mail, to, cc, bcc, reply, subject, message; | 66 | QString name, mail, to, cc, bcc, reply, subject, message; |
67 | }; | 67 | }; |
68 | 68 | ||
69 | class Folder : public QObject | 69 | class Folder : public QObject |
70 | { | 70 | { |
71 | Q_OBJECT | 71 | Q_OBJECT |
72 | 72 | ||
73 | public: | 73 | public: |
74 | Folder( const QString&init_name ); | 74 | Folder( const QString&init_name,const QString&sep ); |
75 | const QString&getDisplayName()const { return nameDisplay; } | 75 | const QString&getDisplayName()const { return nameDisplay; } |
76 | const QString&getName()const { return name; } | 76 | const QString&getName()const { return name; } |
77 | virtual bool may_select()const{return true;}; | 77 | virtual bool may_select()const{return true;}; |
78 | const QString&Separator()const; | ||
78 | 79 | ||
79 | protected: | 80 | protected: |
80 | QString nameDisplay, name; | 81 | QString nameDisplay, name, separator; |
81 | 82 | ||
82 | }; | 83 | }; |
83 | 84 | ||
84 | class IMAPFolder : public Folder | 85 | class IMAPFolder : public Folder |
85 | { | 86 | { |
86 | public: | 87 | public: |
87 | IMAPFolder(const QString&name,bool select=true,const QString&prefix="" ); | 88 | IMAPFolder(const QString&name, const QString&sep, bool select=true,const QString&prefix="" ); |
88 | virtual bool may_select()const{return m_MaySelect;} | 89 | virtual bool may_select()const{return m_MaySelect;} |
89 | private: | 90 | private: |
90 | bool m_MaySelect; | 91 | bool m_MaySelect; |
91 | }; | 92 | }; |
92 | 93 | ||
93 | class MailWrapper : public QObject | 94 | class MailWrapper : public QObject |
94 | { | 95 | { |
95 | Q_OBJECT | 96 | Q_OBJECT |
diff --git a/noncore/net/mail/pop3wrapper.cpp b/noncore/net/mail/pop3wrapper.cpp index 075d8c7..4508a95 100644 --- a/noncore/net/mail/pop3wrapper.cpp +++ b/noncore/net/mail/pop3wrapper.cpp | |||
@@ -318,17 +318,17 @@ void POP3wrapper::logout() | |||
318 | 318 | ||
319 | QList<Folder>* POP3wrapper::listFolders() | 319 | QList<Folder>* POP3wrapper::listFolders() |
320 | { | 320 | { |
321 | /* TODO: integrate MH directories | 321 | /* TODO: integrate MH directories |
322 | but not before version 0.1 ;) | 322 | but not before version 0.1 ;) |
323 | */ | 323 | */ |
324 | QList<Folder> * folders = new QList<Folder>(); | 324 | QList<Folder> * folders = new QList<Folder>(); |
325 | folders->setAutoDelete( false ); | 325 | folders->setAutoDelete( false ); |
326 | Folder*inb=new Folder("INBOX"); | 326 | Folder*inb=new Folder("INBOX","/"); |
327 | folders->append(inb); | 327 | folders->append(inb); |
328 | return folders; | 328 | return folders; |
329 | } | 329 | } |
330 | 330 | ||
331 | QString POP3wrapper::fetchTextPart(const RecMail&,const RecPart&) | 331 | QString POP3wrapper::fetchTextPart(const RecMail&,const RecPart&) |
332 | { | 332 | { |
333 | return ""; | 333 | return ""; |
334 | } | 334 | } |