summaryrefslogtreecommitdiffabout
path: root/kmicromail/accountview.cpp
Unidiff
Diffstat (limited to 'kmicromail/accountview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/accountview.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/kmicromail/accountview.cpp b/kmicromail/accountview.cpp
index 4ead545..85523b1 100644
--- a/kmicromail/accountview.cpp
+++ b/kmicromail/accountview.cpp
@@ -78,99 +78,126 @@ void AccountView::populate( QList<Account> list )
78 (void) new POP3viewItem( pop3, this ); 78 (void) new POP3viewItem( pop3, this );
79 } 79 }
80 else if ( it->getType() == MAILLIB::A_NNTP ) 80 else if ( it->getType() == MAILLIB::A_NNTP )
81 { 81 {
82 NNTPaccount *nntp = static_cast<NNTPaccount *>(it); 82 NNTPaccount *nntp = static_cast<NNTPaccount *>(it);
83 /* must not be hold 'cause it isn't required */ 83 /* must not be hold 'cause it isn't required */
84 (void) new NNTPviewItem( nntp, this ); 84 (void) new NNTPviewItem( nntp, this );
85 } 85 }
86 } 86 }
87} 87}
88 88
89void AccountView::refresh(QListViewItem *item) 89void AccountView::refresh(QListViewItem *item)
90{ 90{
91 if ( item ) 91 if ( item )
92 { 92 {
93 m_currentItem = item; 93 m_currentItem = item;
94 QValueList<RecMailP> headerlist; 94 QValueList<RecMailP> headerlist;
95 AccountViewItem *view = static_cast<AccountViewItem *>(item); 95 AccountViewItem *view = static_cast<AccountViewItem *>(item);
96 view->refresh(headerlist); 96 view->refresh(headerlist);
97 emit refreshMailview(headerlist); 97 emit refreshMailview(headerlist);
98 } 98 }
99} 99}
100 100
101void AccountView::refreshCurrent() 101void AccountView::refreshCurrent()
102{ 102{
103 m_currentItem = currentItem(); 103 m_currentItem = currentItem();
104 if ( !m_currentItem ) return; 104 if ( !m_currentItem ) return;
105 QValueList<RecMailP> headerlist; 105 QValueList<RecMailP> headerlist;
106 AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); 106 AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem);
107 view->refresh(headerlist); 107 view->refresh(headerlist);
108 emit refreshMailview(headerlist); 108 emit refreshMailview(headerlist);
109} 109}
110 110
111void AccountView::refreshAll() 111void AccountView::refreshAll()
112{ 112{
113} 113}
114 114
115RecBodyP AccountView::fetchBody(const RecMailP&aMail) 115RecBodyP AccountView::fetchBody(const RecMailP&aMail)
116{ 116{
117 QListViewItem*item = selectedItem (); 117 QListViewItem*item = selectedItem ();
118 if (!item) return new RecBody(); 118 if (!item) return new RecBody();
119 AccountViewItem *view = static_cast<AccountViewItem *>(item); 119 AccountViewItem *view = static_cast<AccountViewItem *>(item);
120 return view->fetchBody(aMail); 120 return view->fetchBody(aMail);
121} 121}
122 122
123void AccountView::setupFolderselect(Selectstore*sels) 123void AccountView::setupFolderselect(Selectstore*sels)
124{ 124{
125 sels->showMaximized(); 125 sels->showMaximized();
126 QStringList sFolders; 126 QStringList sFolders;
127 unsigned int i = 0; 127 unsigned int i = 0;
128 for (i=0; i < mhAccounts.count();++i) 128 for (i=0; i < mhAccounts.count();++i)
129 { 129 {
130 mhAccounts[i]->refresh(false); 130 mhAccounts[i]->refresh(false);
131 sFolders = mhAccounts[i]->subFolders(); 131 sFolders = mhAccounts[i]->subFolders();
132 sels->addAccounts(mhAccounts[i]->getWrapper(),sFolders); 132 sels->addAccounts(mhAccounts[i]->getWrapper(),sFolders);
133 } 133 }
134 for (i=0; i < imapAccounts.count();++i) 134 for (i=0; i < imapAccounts.count();++i)
135 { 135 {
136 if (imapAccounts[i]->offline()) 136 if (imapAccounts[i]->offline())
137 continue; 137 continue;
138 imapAccounts[i]->refreshFolders(false); 138 imapAccounts[i]->refreshFolders(false);
139 sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders()); 139 sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders());
140 } 140 }
141} 141}
142void AccountView::downloadMailsInbox(const FolderP&fromFolder,AbstractMail*fromWrapper)
143{
144 AbstractMail*targetMail = 0;
145 QString targetFolder = "";
146 Selectstore sels;
147 setupFolderselect(&sels);
148 if (!sels.exec()) return;
149 targetMail = sels.currentMail();
150 targetFolder = sels.currentFolder();
151 if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) ||
152 targetFolder.isEmpty())
153 {
154 return;
155 }
156 if (sels.newFolder() && !targetMail->createMbox(targetFolder))
157 {
158 QMessageBox::critical(0,tr("Error creating new Folder"),
159 tr("<center>Error while creating<br>new folder - breaking.</center>"));
160 return;
161 }
162 int maxsize = 0;
163 if ( sels.useSize->isChecked())
164 maxsize = sels.sizeSpinBox->value();
165
166 fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails(), maxsize);
167 refreshCurrent();
168}
142 169
143void AccountView::downloadMails(const FolderP&fromFolder,AbstractMail*fromWrapper) 170void AccountView::downloadMails(const FolderP&fromFolder,AbstractMail*fromWrapper)
144{ 171{
145 AbstractMail*targetMail = 0; 172 AbstractMail*targetMail = 0;
146 QString targetFolder = ""; 173 QString targetFolder = "";
147 Selectstore sels; 174 Selectstore sels;
148 setupFolderselect(&sels); 175 setupFolderselect(&sels);
149 if (!sels.exec()) return; 176 if (!sels.exec()) return;
150 targetMail = sels.currentMail(); 177 targetMail = sels.currentMail();
151 targetFolder = sels.currentFolder(); 178 targetFolder = sels.currentFolder();
152 if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || 179 if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) ||
153 targetFolder.isEmpty()) 180 targetFolder.isEmpty())
154 { 181 {
155 return; 182 return;
156 } 183 }
157 if (sels.newFolder() && !targetMail->createMbox(targetFolder)) 184 if (sels.newFolder() && !targetMail->createMbox(targetFolder))
158 { 185 {
159 QMessageBox::critical(0,tr("Error creating new Folder"), 186 QMessageBox::critical(0,tr("Error creating new Folder"),
160 tr("<center>Error while creating<br>new folder - breaking.</center>")); 187 tr("<center>Error while creating<br>new folder - breaking.</center>"));
161 return; 188 return;
162 } 189 }
163 int maxsize = 0; 190 int maxsize = 0;
164 if ( sels.useSize->isChecked()) 191 if ( sels.useSize->isChecked())
165 maxsize = sels.sizeSpinBox->value(); 192 maxsize = sels.sizeSpinBox->value();
166 193
167 fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails(), maxsize); 194 fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails(), maxsize);
168 refreshCurrent(); 195 refreshCurrent();
169} 196}
170 197
171bool AccountView::currentisDraft() 198bool AccountView::currentisDraft()
172{ 199{
173 AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); 200 AccountViewItem *view = static_cast<AccountViewItem *>(currentItem());
174 if (!view) return false; 201 if (!view) return false;
175 return view->isDraftfolder(); 202 return view->isDraftfolder();
176} 203}