Diffstat (limited to 'noncore/net/mail/accountview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/accountview.cpp | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index 0fe8475..c747a8b 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp | |||
@@ -14,97 +14,96 @@ | |||
14 | 14 | ||
15 | /* QT */ | 15 | /* QT */ |
16 | #include <qmessagebox.h> | 16 | #include <qmessagebox.h> |
17 | #include <qpopupmenu.h> | 17 | #include <qpopupmenu.h> |
18 | 18 | ||
19 | using namespace Opie::Core; | 19 | using namespace Opie::Core; |
20 | AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) | 20 | AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) |
21 | : QListView( parent, name, flags ) | 21 | : QListView( parent, name, flags ) |
22 | { | 22 | { |
23 | connect( this, SIGNAL( selectionChanged(QListViewItem*) ), | 23 | connect( this, SIGNAL( selectionChanged(QListViewItem*) ), |
24 | SLOT( refresh(QListViewItem*) ) ); | 24 | SLOT( refresh(QListViewItem*) ) ); |
25 | connect( this, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, | 25 | connect( this, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, |
26 | SLOT( slotHold(int,QListViewItem*,const QPoint&,int) ) ); | 26 | SLOT( slotHold(int,QListViewItem*,const QPoint&,int) ) ); |
27 | setSorting(0); | 27 | setSorting(0); |
28 | } | 28 | } |
29 | 29 | ||
30 | AccountView::~AccountView() | 30 | AccountView::~AccountView() |
31 | { | 31 | { |
32 | imapAccounts.clear(); | 32 | imapAccounts.clear(); |
33 | mhAccounts.clear(); | 33 | mhAccounts.clear(); |
34 | } | 34 | } |
35 | 35 | ||
36 | void AccountView::slotContextMenu(int id) | 36 | void AccountView::slotContextMenu(int id) |
37 | { | 37 | { |
38 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); | 38 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); |
39 | if (!view) return; | 39 | if (!view) return; |
40 | view->contextMenuSelected(id); | 40 | view->contextMenuSelected(id); |
41 | } | 41 | } |
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 | |||
63 | mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); | 62 | mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); |
64 | 63 | ||
65 | Account *it; | 64 | Account *it; |
66 | for ( it = list.first(); it; it = list.next() ) { | 65 | for ( it = list.first(); it; it = list.next() ) { |
67 | if ( it->getType() == MAILLIB::A_IMAP ) { | 66 | if ( it->getType() == MAILLIB::A_IMAP ) { |
68 | IMAPaccount *imap = static_cast<IMAPaccount *>(it); | 67 | IMAPaccount *imap = static_cast<IMAPaccount *>(it); |
69 | odebug << "added IMAP " + imap->getAccountName() << oendl; | 68 | odebug << "added IMAP " + imap->getAccountName() << oendl; |
70 | imapAccounts.append(new IMAPviewItem( imap, this )); | 69 | imapAccounts.append(new IMAPviewItem( imap, this )); |
71 | } else if ( it->getType() == MAILLIB::A_POP3 ) { | 70 | } else if ( it->getType() == MAILLIB::A_POP3 ) { |
72 | POP3account *pop3 = static_cast<POP3account *>(it); | 71 | POP3account *pop3 = static_cast<POP3account *>(it); |
73 | odebug << "added POP3 " + pop3->getAccountName() << oendl; | 72 | odebug << "added POP3 " + pop3->getAccountName() << oendl; |
74 | /* must not be hold 'cause it isn't required */ | 73 | /* must not be hold 'cause it isn't required */ |
75 | (void) new POP3viewItem( pop3, this ); | 74 | (void) new POP3viewItem( pop3, this ); |
76 | } else if ( it->getType() == MAILLIB::A_NNTP ) { | 75 | } else if ( it->getType() == MAILLIB::A_NNTP ) { |
77 | NNTPaccount *nntp = static_cast<NNTPaccount *>(it); | 76 | NNTPaccount *nntp = static_cast<NNTPaccount *>(it); |
78 | odebug << "added NNTP " + nntp->getAccountName() << oendl; | 77 | odebug << "added NNTP " + nntp->getAccountName() << oendl; |
79 | /* must not be hold 'cause it isn't required */ | 78 | /* must not be hold 'cause it isn't required */ |
80 | (void) new NNTPviewItem( nntp, this ); | 79 | (void) new NNTPviewItem( nntp, this ); |
81 | } else if ( it->getType() == MAILLIB::A_MH ) { | 80 | } else if ( it->getType() == MAILLIB::A_MH ) { |
82 | } | 81 | } |
83 | } | 82 | } |
84 | } | 83 | } |
85 | 84 | ||
86 | void AccountView::refresh(QListViewItem *item) | 85 | void AccountView::refresh(QListViewItem *item) |
87 | { | 86 | { |
88 | 87 | ||
89 | odebug << "AccountView refresh..." << oendl; | 88 | odebug << "AccountView refresh..." << oendl; |
90 | if ( item ) | 89 | if ( item ) |
91 | { | 90 | { |
92 | m_currentItem = item; | 91 | m_currentItem = item; |
93 | QValueList<RecMailP> headerlist; | 92 | QValueList<RecMailP> headerlist; |
94 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 93 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
95 | view->refresh(headerlist); | 94 | view->refresh(headerlist); |
96 | emit refreshMailview(headerlist); | 95 | emit refreshMailview(headerlist); |
97 | } | 96 | } |
98 | } | 97 | } |
99 | 98 | ||
100 | void AccountView::refreshCurrent() | 99 | void AccountView::refreshCurrent() |
101 | { | 100 | { |
102 | m_currentItem = currentItem(); | 101 | m_currentItem = currentItem(); |
103 | if ( !m_currentItem ) return; | 102 | if ( !m_currentItem ) return; |
104 | QValueList<RecMailP> headerlist; | 103 | QValueList<RecMailP> headerlist; |
105 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); | 104 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); |
106 | view->refresh(headerlist); | 105 | view->refresh(headerlist); |
107 | emit refreshMailview(headerlist); | 106 | emit refreshMailview(headerlist); |
108 | } | 107 | } |
109 | 108 | ||
110 | void AccountView::refreshAll() | 109 | void AccountView::refreshAll() |