author | alwin <alwin> | 2003-12-14 19:36:09 (UTC) |
---|---|---|
committer | alwin <alwin> | 2003-12-14 19:36:09 (UTC) |
commit | aa2c19611a347a3945d403e20bcef01977d68b6a (patch) (unidiff) | |
tree | 669bf39c587f9ee22e17fe2c61ed0fec78f356d3 /noncore/net | |
parent | 353e1da81b235d7798763bce76428fb473108fb6 (diff) | |
download | opie-aa2c19611a347a3945d403e20bcef01977d68b6a.zip opie-aa2c19611a347a3945d403e20bcef01977d68b6a.tar.gz opie-aa2c19611a347a3945d403e20bcef01977d68b6a.tar.bz2 |
if a mailbox-prefix is set than it will not displayed in folderview
-rw-r--r-- | noncore/net/mail/imapwrapper.cpp | 4 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 4 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailwrapper.cpp | 12 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailwrapper.h | 4 | ||||
-rw-r--r-- | noncore/net/mail/mailwrapper.cpp | 12 | ||||
-rw-r--r-- | noncore/net/mail/mailwrapper.h | 4 |
6 files changed, 32 insertions, 8 deletions
diff --git a/noncore/net/mail/imapwrapper.cpp b/noncore/net/mail/imapwrapper.cpp index b253b49..0ce2c6c 100644 --- a/noncore/net/mail/imapwrapper.cpp +++ b/noncore/net/mail/imapwrapper.cpp | |||
@@ -197,17 +197,19 @@ QList<Folder>* IMAPwrapper::listFolders() | |||
197 | list = (mailimap_mailbox_list *) current->data; | 197 | list = (mailimap_mailbox_list *) current->data; |
198 | // it is better use the deep copy mechanism of qt itself | 198 | // it is better use the deep copy mechanism of qt itself |
199 | // instead of using strdup! | 199 | // instead of using strdup! |
200 | temp = list->mb_name; | 200 | temp = list->mb_name; |
201 | if (temp.lower()=="inbox") | 201 | if (temp.lower()=="inbox") |
202 | continue; | 202 | continue; |
203 | if (temp.lower()==account->getPrefix().lower()) | ||
204 | continue; | ||
203 | if ( (bflags = list->mb_flag) ) { | 205 | if ( (bflags = list->mb_flag) ) { |
204 | selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&& | 206 | selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&& |
205 | bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT); | 207 | bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT); |
206 | } | 208 | } |
207 | folders->append(new IMAPFolder(temp,selectable)); | 209 | folders->append(new IMAPFolder(temp,selectable,account->getPrefix())); |
208 | } | 210 | } |
209 | } else { | 211 | } else { |
210 | qDebug("error fetching folders %s",m_imap->imap_response); | 212 | qDebug("error fetching folders %s",m_imap->imap_response); |
211 | } | 213 | } |
212 | mailimap_list_result_free( result ); | 214 | mailimap_list_result_free( result ); |
213 | return folders; | 215 | return folders; |
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index b253b49..0ce2c6c 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp | |||
@@ -197,17 +197,19 @@ QList<Folder>* IMAPwrapper::listFolders() | |||
197 | list = (mailimap_mailbox_list *) current->data; | 197 | list = (mailimap_mailbox_list *) current->data; |
198 | // it is better use the deep copy mechanism of qt itself | 198 | // it is better use the deep copy mechanism of qt itself |
199 | // instead of using strdup! | 199 | // instead of using strdup! |
200 | temp = list->mb_name; | 200 | temp = list->mb_name; |
201 | if (temp.lower()=="inbox") | 201 | if (temp.lower()=="inbox") |
202 | continue; | 202 | continue; |
203 | if (temp.lower()==account->getPrefix().lower()) | ||
204 | continue; | ||
203 | if ( (bflags = list->mb_flag) ) { | 205 | if ( (bflags = list->mb_flag) ) { |
204 | selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&& | 206 | selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&& |
205 | bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT); | 207 | bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT); |
206 | } | 208 | } |
207 | folders->append(new IMAPFolder(temp,selectable)); | 209 | folders->append(new IMAPFolder(temp,selectable,account->getPrefix())); |
208 | } | 210 | } |
209 | } else { | 211 | } else { |
210 | qDebug("error fetching folders %s",m_imap->imap_response); | 212 | qDebug("error fetching folders %s",m_imap->imap_response); |
211 | } | 213 | } |
212 | mailimap_list_result_free( result ); | 214 | mailimap_list_result_free( result ); |
213 | return folders; | 215 | return folders; |
diff --git a/noncore/net/mail/libmailwrapper/mailwrapper.cpp b/noncore/net/mail/libmailwrapper/mailwrapper.cpp index 3ffc274..96602c2 100644 --- a/noncore/net/mail/libmailwrapper/mailwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mailwrapper.cpp | |||
@@ -31,16 +31,26 @@ Folder::Folder(const QString&tmp_name ) | |||
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 | |||
38 | qDebug( "folder " + name + " - displayed as " + nameDisplay ); | 37 | qDebug( "folder " + name + " - displayed as " + nameDisplay ); |
39 | } | 38 | } |
40 | 39 | ||
40 | |||
41 | IMAPFolder::IMAPFolder(const QString&name,bool select,const QString&prefix ) | ||
42 | : Folder( name ),m_MaySelect(select) | ||
43 | { | ||
44 | if (prefix.length()>0) { | ||
45 | if (nameDisplay.startsWith(prefix) && nameDisplay.length()>prefix.length()) { | ||
46 | nameDisplay=nameDisplay.right(nameDisplay.length()-prefix.length()); | ||
47 | } | ||
48 | } | ||
49 | } | ||
50 | |||
41 | MailWrapper::MailWrapper( Settings *s ) | 51 | MailWrapper::MailWrapper( Settings *s ) |
42 | : QObject() | 52 | : QObject() |
43 | { | 53 | { |
44 | settings = s; | 54 | settings = s; |
45 | } | 55 | } |
46 | 56 | ||
diff --git a/noncore/net/mail/libmailwrapper/mailwrapper.h b/noncore/net/mail/libmailwrapper/mailwrapper.h index 34fd5c5..6994dd8 100644 --- a/noncore/net/mail/libmailwrapper/mailwrapper.h +++ b/noncore/net/mail/libmailwrapper/mailwrapper.h | |||
@@ -73,21 +73,21 @@ class Folder : public QObject | |||
73 | public: | 73 | public: |
74 | Folder( const QString&init_name ); | 74 | Folder( const QString&init_name ); |
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 | 78 | ||
79 | private: | 79 | protected: |
80 | QString nameDisplay, name; | 80 | QString nameDisplay, name; |
81 | 81 | ||
82 | }; | 82 | }; |
83 | 83 | ||
84 | class IMAPFolder : public Folder | 84 | class IMAPFolder : public Folder |
85 | { | 85 | { |
86 | public: | 86 | public: |
87 | IMAPFolder( QString name,bool select=true ) : Folder( name ),m_MaySelect(select) {} | 87 | IMAPFolder(const QString&name,bool select=true,const QString&prefix="" ); |
88 | virtual bool may_select()const{return m_MaySelect;} | 88 | virtual bool may_select()const{return m_MaySelect;} |
89 | private: | 89 | private: |
90 | bool m_MaySelect; | 90 | bool m_MaySelect; |
91 | }; | 91 | }; |
92 | 92 | ||
93 | class MailWrapper : public QObject | 93 | class MailWrapper : public QObject |
diff --git a/noncore/net/mail/mailwrapper.cpp b/noncore/net/mail/mailwrapper.cpp index 3ffc274..96602c2 100644 --- a/noncore/net/mail/mailwrapper.cpp +++ b/noncore/net/mail/mailwrapper.cpp | |||
@@ -31,16 +31,26 @@ Folder::Folder(const QString&tmp_name ) | |||
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 | |||
38 | qDebug( "folder " + name + " - displayed as " + nameDisplay ); | 37 | qDebug( "folder " + name + " - displayed as " + nameDisplay ); |
39 | } | 38 | } |
40 | 39 | ||
40 | |||
41 | IMAPFolder::IMAPFolder(const QString&name,bool select,const QString&prefix ) | ||
42 | : Folder( name ),m_MaySelect(select) | ||
43 | { | ||
44 | if (prefix.length()>0) { | ||
45 | if (nameDisplay.startsWith(prefix) && nameDisplay.length()>prefix.length()) { | ||
46 | nameDisplay=nameDisplay.right(nameDisplay.length()-prefix.length()); | ||
47 | } | ||
48 | } | ||
49 | } | ||
50 | |||
41 | MailWrapper::MailWrapper( Settings *s ) | 51 | MailWrapper::MailWrapper( Settings *s ) |
42 | : QObject() | 52 | : QObject() |
43 | { | 53 | { |
44 | settings = s; | 54 | settings = s; |
45 | } | 55 | } |
46 | 56 | ||
diff --git a/noncore/net/mail/mailwrapper.h b/noncore/net/mail/mailwrapper.h index 34fd5c5..6994dd8 100644 --- a/noncore/net/mail/mailwrapper.h +++ b/noncore/net/mail/mailwrapper.h | |||
@@ -73,21 +73,21 @@ class Folder : public QObject | |||
73 | public: | 73 | public: |
74 | Folder( const QString&init_name ); | 74 | Folder( const QString&init_name ); |
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 | 78 | ||
79 | private: | 79 | protected: |
80 | QString nameDisplay, name; | 80 | QString nameDisplay, name; |
81 | 81 | ||
82 | }; | 82 | }; |
83 | 83 | ||
84 | class IMAPFolder : public Folder | 84 | class IMAPFolder : public Folder |
85 | { | 85 | { |
86 | public: | 86 | public: |
87 | IMAPFolder( QString name,bool select=true ) : Folder( name ),m_MaySelect(select) {} | 87 | IMAPFolder(const QString&name,bool select=true,const QString&prefix="" ); |
88 | virtual bool may_select()const{return m_MaySelect;} | 88 | virtual bool may_select()const{return m_MaySelect;} |
89 | private: | 89 | private: |
90 | bool m_MaySelect; | 90 | bool m_MaySelect; |
91 | }; | 91 | }; |
92 | 92 | ||
93 | class MailWrapper : public QObject | 93 | class MailWrapper : public QObject |