Diffstat (limited to 'noncore/net/mail/accountview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/accountview.cpp | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index 662e555..0fe8475 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp | |||
@@ -42,77 +42,72 @@ void AccountView::slotContextMenu(int id) | |||
42 | 42 | ||
43 | void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int) | 43 | void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int) |
44 | { | 44 | { |
45 | if (button==1) {return;} | 45 | if (button==1) {return;} |
46 | if (!item) return; | 46 | if (!item) return; |
47 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 47 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
48 | QPopupMenu*m = view->getContextMenu(); | 48 | QPopupMenu*m = view->getContextMenu(); |
49 | if (!m) return; | 49 | if (!m) return; |
50 | connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); | 50 | connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); |
51 | m->setFocus(); | 51 | m->setFocus(); |
52 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 52 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
53 | delete m; | 53 | delete m; |
54 | } | 54 | } |
55 | 55 | ||
56 | void AccountView::populate( QList<Account> list ) | 56 | void AccountView::populate( QList<Account> list ) |
57 | { | 57 | { |
58 | clear(); | 58 | clear(); |
59 | 59 | ||
60 | imapAccounts.clear(); | 60 | imapAccounts.clear(); |
61 | mhAccounts.clear(); | 61 | mhAccounts.clear(); |
62 | 62 | ||
63 | mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); | 63 | mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); |
64 | 64 | ||
65 | Account *it; | 65 | Account *it; |
66 | for ( it = list.first(); it; it = list.next() ) | 66 | for ( it = list.first(); it; it = list.next() ) { |
67 | { | 67 | if ( it->getType() == MAILLIB::A_IMAP ) { |
68 | if ( it->getType() == MAILLIB::A_IMAP ) | ||
69 | { | ||
70 | IMAPaccount *imap = static_cast<IMAPaccount *>(it); | 68 | IMAPaccount *imap = static_cast<IMAPaccount *>(it); |
71 | odebug << "added IMAP " + imap->getAccountName() << oendl; | 69 | odebug << "added IMAP " + imap->getAccountName() << oendl; |
72 | imapAccounts.append(new IMAPviewItem( imap, this )); | 70 | imapAccounts.append(new IMAPviewItem( imap, this )); |
73 | } | 71 | } else if ( it->getType() == MAILLIB::A_POP3 ) { |
74 | else if ( it->getType() == MAILLIB::A_POP3 ) | ||
75 | { | ||
76 | POP3account *pop3 = static_cast<POP3account *>(it); | 72 | POP3account *pop3 = static_cast<POP3account *>(it); |
77 | odebug << "added POP3 " + pop3->getAccountName() << oendl; | 73 | odebug << "added POP3 " + pop3->getAccountName() << oendl; |
78 | /* must not be hold 'cause it isn't required */ | 74 | /* must not be hold 'cause it isn't required */ |
79 | (void) new POP3viewItem( pop3, this ); | 75 | (void) new POP3viewItem( pop3, this ); |
80 | } | 76 | } else if ( it->getType() == MAILLIB::A_NNTP ) { |
81 | else if ( it->getType() == MAILLIB::A_NNTP ) | ||
82 | { | ||
83 | NNTPaccount *nntp = static_cast<NNTPaccount *>(it); | 77 | NNTPaccount *nntp = static_cast<NNTPaccount *>(it); |
84 | odebug << "added NNTP " + nntp->getAccountName() << oendl; | 78 | odebug << "added NNTP " + nntp->getAccountName() << oendl; |
85 | /* must not be hold 'cause it isn't required */ | 79 | /* must not be hold 'cause it isn't required */ |
86 | (void) new NNTPviewItem( nntp, this ); | 80 | (void) new NNTPviewItem( nntp, this ); |
87 | } | 81 | } else if ( it->getType() == MAILLIB::A_MH ) { |
88 | } | 82 | } |
83 | } | ||
89 | } | 84 | } |
90 | 85 | ||
91 | void AccountView::refresh(QListViewItem *item) | 86 | void AccountView::refresh(QListViewItem *item) |
92 | { | 87 | { |
93 | 88 | ||
94 | odebug << "AccountView refresh..." << oendl; | 89 | odebug << "AccountView refresh..." << oendl; |
95 | if ( item ) | 90 | if ( item ) |
96 | { | 91 | { |
97 | m_currentItem = item; | 92 | m_currentItem = item; |
98 | QValueList<RecMailP> headerlist; | 93 | QValueList<RecMailP> headerlist; |
99 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 94 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
100 | view->refresh(headerlist); | 95 | view->refresh(headerlist); |
101 | emit refreshMailview(headerlist); | 96 | emit refreshMailview(headerlist); |
102 | } | 97 | } |
103 | } | 98 | } |
104 | 99 | ||
105 | void AccountView::refreshCurrent() | 100 | void AccountView::refreshCurrent() |
106 | { | 101 | { |
107 | m_currentItem = currentItem(); | 102 | m_currentItem = currentItem(); |
108 | if ( !m_currentItem ) return; | 103 | if ( !m_currentItem ) return; |
109 | QValueList<RecMailP> headerlist; | 104 | QValueList<RecMailP> headerlist; |
110 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); | 105 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); |
111 | view->refresh(headerlist); | 106 | view->refresh(headerlist); |
112 | emit refreshMailview(headerlist); | 107 | emit refreshMailview(headerlist); |
113 | } | 108 | } |
114 | 109 | ||
115 | void AccountView::refreshAll() | 110 | void AccountView::refreshAll() |
116 | { | 111 | { |
117 | } | 112 | } |
118 | 113 | ||
@@ -143,36 +138,36 @@ void AccountView::setupFolderselect(Selectstore*sels) | |||
143 | sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders()); | 138 | sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders()); |
144 | } | 139 | } |
145 | } | 140 | } |
146 | 141 | ||
147 | void AccountView::downloadMails(const FolderP&fromFolder,AbstractMail*fromWrapper) | 142 | void AccountView::downloadMails(const FolderP&fromFolder,AbstractMail*fromWrapper) |
148 | { | 143 | { |
149 | AbstractMail*targetMail = 0; | 144 | AbstractMail*targetMail = 0; |
150 | QString targetFolder = ""; | 145 | QString targetFolder = ""; |
151 | Selectstore sels; | 146 | Selectstore sels; |
152 | setupFolderselect(&sels); | 147 | setupFolderselect(&sels); |
153 | if (!sels.exec()) return; | 148 | if (!sels.exec()) return; |
154 | targetMail = sels.currentMail(); | 149 | targetMail = sels.currentMail(); |
155 | targetFolder = sels.currentFolder(); | 150 | targetFolder = sels.currentFolder(); |
156 | if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || | 151 | if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || |
157 | targetFolder.isEmpty()) | 152 | targetFolder.isEmpty()) |
158 | { | 153 | { |
159 | return; | 154 | return; |
160 | } | 155 | } |
161 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 156 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
162 | { | 157 | { |
163 | QMessageBox::critical(0,tr("Error creating new Folder"), | 158 | QMessageBox::critical(0,tr("Error creating new Folder"), |
164 | tr("<center>Error while creating<br>new folder - breaking.</center>")); | 159 | tr("<center>Error while creating<br>new folder - breaking.</center>")); |
165 | return; | 160 | return; |
166 | } | 161 | } |
167 | odebug << "Targetfolder: " << targetFolder.latin1() << "" << oendl; | 162 | odebug << "Targetfolder: " << targetFolder.latin1() << "" << oendl; |
168 | odebug << "Fromfolder: " << fromFolder->getName().latin1() << "" << oendl; | 163 | odebug << "Fromfolder: " << fromFolder->getName().latin1() << "" << oendl; |
169 | fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails()); | 164 | fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails()); |
170 | refreshCurrent(); | 165 | refreshCurrent(); |
171 | } | 166 | } |
172 | 167 | ||
173 | bool AccountView::currentisDraft() | 168 | bool AccountView::currentisDraft() |
174 | { | 169 | { |
175 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); | 170 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); |
176 | if (!view) return false; | 171 | if (!view) return false; |
177 | return view->isDraftfolder(); | 172 | return view->isDraftfolder(); |
178 | } | 173 | } |