-rw-r--r-- | noncore/net/mail/accountview.cpp | 65 | ||||
-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, 98 insertions, 23 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 | |||
@@ -108,2 +108,3 @@ void IMAPviewItem::refresh(QList<RecMail>&) | |||
108 | { | 108 | { |
109 | if (childCount()>0) return; | ||
109 | QList<Folder> *folders = wrapper->listFolders(); | 110 | QList<Folder> *folders = wrapper->listFolders(); |
@@ -119,8 +120,44 @@ void IMAPviewItem::refresh(QList<RecMail>&) | |||
119 | QListViewItem*item = 0; | 120 | QListViewItem*item = 0; |
121 | QListViewItem*titem = 0; | ||
122 | QListViewItem*inboxitem = 0; | ||
123 | QString fname,del,search; | ||
124 | int pos; | ||
125 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
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 | |||
120 | for ( it = folders->first(); it; it = folders->next() ) { | 137 | for ( it = folders->first(); it; it = folders->next() ) { |
121 | item = new IMAPfolderItem( it, this , item ); | 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) ); | ||
122 | item->setSelectable(it->may_select()); | 160 | item->setSelectable(it->may_select()); |
123 | } | 161 | } |
124 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 162 | } |
125 | folders->setAutoDelete(false); | ||
126 | delete folders; | 163 | delete folders; |
@@ -139,3 +176,3 @@ IMAPfolderItem::~IMAPfolderItem() | |||
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 | { |
@@ -151,2 +188,20 @@ IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QList | |||
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) |
@@ -171,3 +226,3 @@ AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) | |||
171 | SLOT( refresh( QListViewItem * ) ) ); | 226 | SLOT( refresh( QListViewItem * ) ) ); |
172 | setSorting(-1); | 227 | setSorting(0); |
173 | } | 228 | } |
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 | |||
@@ -72,2 +72,3 @@ 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(); |
@@ -75,2 +76,3 @@ public: | |||
75 | virtual RecBody fetchBody(const RecMail&); | 76 | virtual RecBody fetchBody(const RecMail&); |
77 | bool matchName(const QString&name)const; | ||
76 | private: | 78 | private: |
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 | |||
@@ -167,2 +167,3 @@ QList<Folder>* IMAPwrapper::listFolders() | |||
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 ) { |
@@ -174,3 +175,4 @@ QList<Folder>* IMAPwrapper::listFolders() | |||
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; |
@@ -208,3 +210,4 @@ QList<Folder>* IMAPwrapper::listFolders() | |||
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 | } |
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 | |||
@@ -167,2 +167,3 @@ QList<Folder>* IMAPwrapper::listFolders() | |||
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 ) { |
@@ -174,3 +175,4 @@ QList<Folder>* IMAPwrapper::listFolders() | |||
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; |
@@ -208,3 +210,4 @@ QList<Folder>* IMAPwrapper::listFolders() | |||
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 | } |
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 | |||
@@ -19,3 +19,3 @@ Attachment::Attachment( DocLnk lnk ) | |||
19 | 19 | ||
20 | Folder::Folder(const QString&tmp_name ) | 20 | Folder::Folder(const QString&tmp_name, const QString&sep ) |
21 | { | 21 | { |
@@ -37,7 +37,12 @@ Folder::Folder(const QString&tmp_name ) | |||
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 | { |
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 | |||
@@ -73,3 +73,3 @@ class Folder : public QObject | |||
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; } |
@@ -77,5 +77,6 @@ public: | |||
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 | ||
@@ -86,3 +87,3 @@ class IMAPFolder : public Folder | |||
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;} |
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 | |||
@@ -325,3 +325,3 @@ QList<Folder>* POP3wrapper::listFolders() | |||
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); |
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 | |||
@@ -19,3 +19,3 @@ Attachment::Attachment( DocLnk lnk ) | |||
19 | 19 | ||
20 | Folder::Folder(const QString&tmp_name ) | 20 | Folder::Folder(const QString&tmp_name, const QString&sep ) |
21 | { | 21 | { |
@@ -37,7 +37,12 @@ Folder::Folder(const QString&tmp_name ) | |||
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 | { |
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 | |||
@@ -73,3 +73,3 @@ class Folder : public QObject | |||
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; } |
@@ -77,5 +77,6 @@ public: | |||
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 | ||
@@ -86,3 +87,3 @@ class IMAPFolder : public Folder | |||
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;} |
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 | |||
@@ -325,3 +325,3 @@ QList<Folder>* POP3wrapper::listFolders() | |||
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); |