Diffstat (limited to 'noncore/net/mail/accountview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/accountview.cpp | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index faa42c3..1183704 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp | |||
@@ -32,55 +32,74 @@ AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) | |||
32 | SLOT( slotMouseClicked(QListViewItem*) ) ); | 32 | SLOT( slotMouseClicked(QListViewItem*) ) ); |
33 | m_currentItem = 0; | 33 | m_currentItem = 0; |
34 | } | 34 | } |
35 | 35 | ||
36 | AccountView::~AccountView() | 36 | AccountView::~AccountView() |
37 | { | 37 | { |
38 | imapAccounts.clear(); | 38 | imapAccounts.clear(); |
39 | mhAccounts.clear(); | 39 | mhAccounts.clear(); |
40 | } | 40 | } |
41 | 41 | ||
42 | void AccountView::slotSelectionChanged(QListViewItem*item) | 42 | void AccountView::slotSelectionChanged(QListViewItem*item) |
43 | { | 43 | { |
44 | odebug << "AccountView: Selection changed" << oendl; | ||
45 | if (!item) { | 44 | if (!item) { |
46 | emit serverSelected(0); | 45 | emit serverSelected(0); |
47 | return; | 46 | return; |
48 | } | 47 | } |
49 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 48 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
50 | |||
51 | emit serverSelected(view->isServer()); | 49 | emit serverSelected(view->isServer()); |
52 | } | 50 | } |
53 | 51 | ||
52 | QMap<int,QString> AccountView::currentServerMenu()const | ||
53 | { | ||
54 | QMap<int,QString> smap; | ||
55 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); | ||
56 | if (!view)return smap; | ||
57 | smap = view->serverMenu(); | ||
58 | return smap; | ||
59 | } | ||
60 | |||
61 | QMap<int,QString> AccountView::currentFolderMenu()const | ||
62 | { | ||
63 | QMap<int,QString> fmap; | ||
64 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); | ||
65 | if (!view)return fmap; | ||
66 | fmap = view->folderMenu(); | ||
67 | return fmap; | ||
68 | } | ||
69 | |||
54 | void AccountView::slotContextMenu(int id) | 70 | void AccountView::slotContextMenu(int id) |
55 | { | 71 | { |
56 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); | 72 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); |
57 | if (!view) return; | 73 | if (!view) return; |
58 | view->contextMenuSelected(id); | 74 | bool del = view->contextMenuSelected(id); |
75 | if (!del && view->isServer()!=2) { | ||
76 | emit refreshMenues(view->isServer()); | ||
77 | } | ||
59 | } | 78 | } |
60 | 79 | ||
61 | void AccountView::slotRightButton(int button, QListViewItem * item,const QPoint&,int) | 80 | void AccountView::slotRightButton(int, QListViewItem * item,const QPoint&,int) |
62 | { | 81 | { |
63 | m_rightPressed = true; | 82 | m_rightPressed = true; |
64 | if (!item) return; | 83 | if (!item) return; |
65 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 84 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
66 | QPopupMenu*m = view->getContextMenu(); | 85 | QPopupMenu*m = view->getContextMenu(); |
67 | if (!m) return; | 86 | if (!m) return; |
68 | connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); | 87 | connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); |
69 | m->setFocus(); | 88 | m->setFocus(); |
70 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 89 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
71 | delete m; | 90 | delete m; |
72 | } | 91 | } |
73 | 92 | ||
74 | void AccountView::slotLeftButton(int button, QListViewItem * item,const QPoint&,int) | 93 | void AccountView::slotLeftButton(int, QListViewItem *,const QPoint&,int) |
75 | { | 94 | { |
76 | m_rightPressed = false; | 95 | m_rightPressed = false; |
77 | } | 96 | } |
78 | 97 | ||
79 | void AccountView::slotMouseClicked(QListViewItem*item) | 98 | void AccountView::slotMouseClicked(QListViewItem*item) |
80 | { | 99 | { |
81 | if (m_rightPressed) return; | 100 | if (m_rightPressed) return; |
82 | if (!item || m_currentItem == item) return; | 101 | if (!item || m_currentItem == item) return; |
83 | /* ### ToDo check settings if on single tab it should open */ | 102 | /* ### ToDo check settings if on single tab it should open */ |
84 | m_currentItem = item; | 103 | m_currentItem = item; |
85 | refresh(m_currentItem); | 104 | refresh(m_currentItem); |
86 | } | 105 | } |