author | alwin <alwin> | 2005-03-20 00:12:11 (UTC) |
---|---|---|
committer | alwin <alwin> | 2005-03-20 00:12:11 (UTC) |
commit | bde8cf28573964aeb78fa9785cf1514cb8aa35a7 (patch) (unidiff) | |
tree | e91895f42ea3f9f5ac3d77128b8715b359ab54bf /noncore/net/mail/accountview.cpp | |
parent | 9b608c7c967b2a22d4c6a8d8b98a4635d3b21204 (diff) | |
download | opie-bde8cf28573964aeb78fa9785cf1514cb8aa35a7.zip opie-bde8cf28573964aeb78fa9785cf1514cb8aa35a7.tar.gz opie-bde8cf28573964aeb78fa9785cf1514cb8aa35a7.tar.bz2 |
user may switch open folders/mails on single-click
Diffstat (limited to 'noncore/net/mail/accountview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/accountview.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index 1183704..0e739e2 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp | |||
@@ -1,65 +1,74 @@ | |||
1 | 1 | ||
2 | #include "accountview.h" | 2 | #include "accountview.h" |
3 | #include "accountitem.h" | 3 | #include "accountitem.h" |
4 | #include "selectstore.h" | 4 | #include "selectstore.h" |
5 | 5 | ||
6 | #include <libmailwrapper/settings.h> | 6 | #include <libmailwrapper/settings.h> |
7 | #include <libmailwrapper/mailwrapper.h> | 7 | #include <libmailwrapper/mailwrapper.h> |
8 | #include <libmailwrapper/mailtypes.h> | 8 | #include <libmailwrapper/mailtypes.h> |
9 | #include <libmailwrapper/abstractmail.h> | 9 | #include <libmailwrapper/abstractmail.h> |
10 | 10 | ||
11 | /* OPIE */ | 11 | /* OPIE */ |
12 | #include <opie2/odebug.h> | 12 | #include <opie2/odebug.h> |
13 | #include <qpe/qpeapplication.h> | 13 | #include <qpe/qpeapplication.h> |
14 | #include <qpe/config.h> | ||
14 | 15 | ||
15 | /* QT */ | 16 | /* QT */ |
16 | #include <qmessagebox.h> | 17 | #include <qmessagebox.h> |
17 | #include <qpopupmenu.h> | 18 | #include <qpopupmenu.h> |
18 | 19 | ||
19 | using namespace Opie::Core; | 20 | using namespace Opie::Core; |
20 | AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) | 21 | AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) |
21 | : QListView( parent, name, flags ) | 22 | : QListView( parent, name, flags ) |
22 | { | 23 | { |
23 | setSorting(0); | 24 | setSorting(0); |
24 | setSelectionMode(Single); | 25 | setSelectionMode(Single); |
25 | m_rightPressed = false; | 26 | m_rightPressed = false; |
26 | 27 | ||
27 | connect( this, SIGNAL( selectionChanged(QListViewItem*) ), | 28 | connect( this, SIGNAL( selectionChanged(QListViewItem*) ), |
28 | SLOT( slotSelectionChanged(QListViewItem*) ) ); | 29 | SLOT( slotSelectionChanged(QListViewItem*) ) ); |
29 | connect( this, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, | 30 | connect( this, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, |
30 | SLOT( slotMouseButton(int,QListViewItem*,const QPoint&,int) ) ); | 31 | SLOT( slotMouseButton(int,QListViewItem*,const QPoint&,int) ) ); |
31 | connect( this, SIGNAL(clicked(QListViewItem*) ),this, | 32 | connect( this, SIGNAL(clicked(QListViewItem*) ),this, |
32 | SLOT( slotMouseClicked(QListViewItem*) ) ); | 33 | SLOT( slotMouseClicked(QListViewItem*) ) ); |
33 | m_currentItem = 0; | 34 | m_currentItem = 0; |
35 | readSettings(); | ||
34 | } | 36 | } |
35 | 37 | ||
36 | AccountView::~AccountView() | 38 | AccountView::~AccountView() |
37 | { | 39 | { |
38 | imapAccounts.clear(); | 40 | imapAccounts.clear(); |
39 | mhAccounts.clear(); | 41 | mhAccounts.clear(); |
40 | } | 42 | } |
41 | 43 | ||
44 | void AccountView::readSettings() | ||
45 | { | ||
46 | Config cfg("mail"); | ||
47 | cfg.setGroup( "Settings" ); | ||
48 | m_clickopens = cfg.readBoolEntry("clickOpensFolder",true); | ||
49 | } | ||
50 | |||
42 | void AccountView::slotSelectionChanged(QListViewItem*item) | 51 | void AccountView::slotSelectionChanged(QListViewItem*item) |
43 | { | 52 | { |
44 | if (!item) { | 53 | if (!item) { |
45 | emit serverSelected(0); | 54 | emit serverSelected(0); |
46 | return; | 55 | return; |
47 | } | 56 | } |
48 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 57 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
49 | emit serverSelected(view->isServer()); | 58 | emit serverSelected(view->isServer()); |
50 | } | 59 | } |
51 | 60 | ||
52 | QMap<int,QString> AccountView::currentServerMenu()const | 61 | QMap<int,QString> AccountView::currentServerMenu()const |
53 | { | 62 | { |
54 | QMap<int,QString> smap; | 63 | QMap<int,QString> smap; |
55 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); | 64 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); |
56 | if (!view)return smap; | 65 | if (!view)return smap; |
57 | smap = view->serverMenu(); | 66 | smap = view->serverMenu(); |
58 | return smap; | 67 | return smap; |
59 | } | 68 | } |
60 | 69 | ||
61 | QMap<int,QString> AccountView::currentFolderMenu()const | 70 | QMap<int,QString> AccountView::currentFolderMenu()const |
62 | { | 71 | { |
63 | QMap<int,QString> fmap; | 72 | QMap<int,QString> fmap; |
64 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); | 73 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); |
65 | if (!view)return fmap; | 74 | if (!view)return fmap; |
@@ -77,49 +86,49 @@ void AccountView::slotContextMenu(int id) | |||
77 | } | 86 | } |
78 | } | 87 | } |
79 | 88 | ||
80 | void AccountView::slotRightButton(int, QListViewItem * item,const QPoint&,int) | 89 | void AccountView::slotRightButton(int, QListViewItem * item,const QPoint&,int) |
81 | { | 90 | { |
82 | m_rightPressed = true; | 91 | m_rightPressed = true; |
83 | if (!item) return; | 92 | if (!item) return; |
84 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 93 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
85 | QPopupMenu*m = view->getContextMenu(); | 94 | QPopupMenu*m = view->getContextMenu(); |
86 | if (!m) return; | 95 | if (!m) return; |
87 | connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); | 96 | connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); |
88 | m->setFocus(); | 97 | m->setFocus(); |
89 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 98 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
90 | delete m; | 99 | delete m; |
91 | } | 100 | } |
92 | 101 | ||
93 | void AccountView::slotLeftButton(int, QListViewItem *,const QPoint&,int) | 102 | void AccountView::slotLeftButton(int, QListViewItem *,const QPoint&,int) |
94 | { | 103 | { |
95 | m_rightPressed = false; | 104 | m_rightPressed = false; |
96 | } | 105 | } |
97 | 106 | ||
98 | void AccountView::slotMouseClicked(QListViewItem*item) | 107 | void AccountView::slotMouseClicked(QListViewItem*item) |
99 | { | 108 | { |
100 | if (m_rightPressed) return; | 109 | if (m_rightPressed) return; |
101 | if (!item || m_currentItem == item) return; | 110 | if (!item || m_currentItem == item||!m_clickopens) return; |
102 | /* ### ToDo check settings if on single tab it should open */ | 111 | /* ### ToDo check settings if on single tab it should open */ |
103 | m_currentItem = item; | 112 | m_currentItem = item; |
104 | refresh(m_currentItem); | 113 | refresh(m_currentItem); |
105 | } | 114 | } |
106 | 115 | ||
107 | void AccountView::slotMouseButton(int button, QListViewItem * item,const QPoint&pos,int column) | 116 | void AccountView::slotMouseButton(int button, QListViewItem * item,const QPoint&pos,int column) |
108 | { | 117 | { |
109 | if (button==1) { | 118 | if (button==1) { |
110 | slotLeftButton(button,item,pos,column); | 119 | slotLeftButton(button,item,pos,column); |
111 | } else if (button==2) { | 120 | } else if (button==2) { |
112 | slotRightButton(button,item,pos,column); | 121 | slotRightButton(button,item,pos,column); |
113 | } | 122 | } |
114 | } | 123 | } |
115 | 124 | ||
116 | void AccountView::populate( QList<Account> list ) | 125 | void AccountView::populate( QList<Account> list ) |
117 | { | 126 | { |
118 | clear(); | 127 | clear(); |
119 | 128 | ||
120 | imapAccounts.clear(); | 129 | imapAccounts.clear(); |
121 | mhAccounts.clear(); | 130 | mhAccounts.clear(); |
122 | mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); | 131 | mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); |
123 | 132 | ||
124 | Account *it; | 133 | Account *it; |
125 | for ( it = list.first(); it; it = list.next() ) { | 134 | for ( it = list.first(); it; it = list.next() ) { |