author | zautrix <zautrix> | 2005-08-23 20:09:28 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-08-23 20:09:28 (UTC) |
commit | 6f5464760f5fb1e4c13027464cfe4943b85d29a0 (patch) (unidiff) | |
tree | 3c074b7e313d965516b60b9ba97fe27a7ee774a1 /kmicromail/accountview.cpp | |
parent | 13a736b71dec27ef7ffef06b91f34d220d89cce6 (diff) | |
download | kdepimpi-6f5464760f5fb1e4c13027464cfe4943b85d29a0.zip kdepimpi-6f5464760f5fb1e4c13027464cfe4943b85d29a0.tar.gz kdepimpi-6f5464760f5fb1e4c13027464cfe4943b85d29a0.tar.bz2 |
fixx
-rw-r--r-- | kmicromail/accountview.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kmicromail/accountview.cpp b/kmicromail/accountview.cpp index 4879d57..d1d4f7e 100644 --- a/kmicromail/accountview.cpp +++ b/kmicromail/accountview.cpp | |||
@@ -37,129 +37,129 @@ AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) | |||
37 | 37 | ||
38 | AccountView::~AccountView() | 38 | AccountView::~AccountView() |
39 | { | 39 | { |
40 | imapAccounts.clear(); | 40 | imapAccounts.clear(); |
41 | mhAccounts.clear(); | 41 | mhAccounts.clear(); |
42 | } | 42 | } |
43 | 43 | ||
44 | void AccountView::slotContextMenu(int id) | 44 | void AccountView::slotContextMenu(int id) |
45 | { | 45 | { |
46 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); | 46 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); |
47 | if (!view) return; | 47 | if (!view) return; |
48 | view->contextMenuSelected(id); | 48 | view->contextMenuSelected(id); |
49 | } | 49 | } |
50 | 50 | ||
51 | void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int) | 51 | void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int) |
52 | { | 52 | { |
53 | if (button==1) {return;} | 53 | if (button==1) {return;} |
54 | if (!item) return; | 54 | if (!item) return; |
55 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 55 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
56 | QPopupMenu*m = view->getContextMenu(); | 56 | QPopupMenu*m = view->getContextMenu(); |
57 | if (!m) return; | 57 | if (!m) return; |
58 | connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); | 58 | connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); |
59 | m->setFocus(); | 59 | m->setFocus(); |
60 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 60 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
61 | delete m; | 61 | delete m; |
62 | } | 62 | } |
63 | 63 | ||
64 | void AccountView::populate( QList<Account> list ) | 64 | void AccountView::populate( QList<Account> list ) |
65 | { | 65 | { |
66 | clear(); | 66 | clear(); |
67 | 67 | ||
68 | imapAccounts.clear(); | 68 | imapAccounts.clear(); |
69 | mhAccounts.clear(); | 69 | mhAccounts.clear(); |
70 | 70 | ||
71 | mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); | 71 | mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); |
72 | 72 | ||
73 | Account *it; | 73 | Account *it; |
74 | for ( it = list.first(); it; it = list.next() ) | 74 | for ( it = list.first(); it; it = list.next() ) |
75 | { | 75 | { |
76 | if ( it->getType() == MAILLIB::A_IMAP ) | 76 | if ( it->getType() == MAILLIB::A_IMAP ) |
77 | { | 77 | { |
78 | IMAPaccount *imap = static_cast<IMAPaccount *>(it); | 78 | IMAPaccount *imap = static_cast<IMAPaccount *>(it); |
79 | imapAccounts.append(new IMAPviewItem( imap, this )); | 79 | imapAccounts.append(new IMAPviewItem( imap, this )); |
80 | } | 80 | } |
81 | else if ( it->getType() == MAILLIB::A_POP3 ) | 81 | else if ( it->getType() == MAILLIB::A_POP3 ) |
82 | { | 82 | { |
83 | POP3account *pop3 = static_cast<POP3account *>(it); | 83 | POP3account *pop3 = static_cast<POP3account *>(it); |
84 | /* must not be hold 'cause it isn't required */ | 84 | /* must not be hold 'cause it isn't required */ |
85 | (void) new POP3viewItem( pop3, this ); | 85 | (void) new POP3viewItem( pop3, this ); |
86 | } | 86 | } |
87 | else if ( it->getType() == MAILLIB::A_NNTP ) | 87 | else if ( it->getType() == MAILLIB::A_NNTP ) |
88 | { | 88 | { |
89 | NNTPaccount *nntp = static_cast<NNTPaccount *>(it); | 89 | NNTPaccount *nntp = static_cast<NNTPaccount *>(it); |
90 | /* must not be hold 'cause it isn't required */ | 90 | /* must not be hold 'cause it isn't required */ |
91 | (void) new NNTPviewItem( nntp, this ); | 91 | (void) new NNTPviewItem( nntp, this ); |
92 | } | 92 | } |
93 | } | 93 | } |
94 | } | 94 | } |
95 | 95 | ||
96 | void AccountView::refresh(QListViewItem *item) | 96 | void AccountView::refresh(QListViewItem *item) |
97 | { | 97 | { |
98 | if ( item ) | 98 | if ( item ) |
99 | { | 99 | { |
100 | bool ask = true; | 100 | bool ask = true; |
101 | qDebug("text -%s- ",item->text( 0 ).latin1() ); | 101 | //qDebug("text -%s- ",item->text( 0 ).latin1() ); |
102 | if ( item->text( 0 ) == i18n (" Local Mailfolders") ) | 102 | if ( item->text( 0 ) == i18n (" Local Mailfolders") ) |
103 | ask = false; | 103 | ask = false; |
104 | else { | 104 | else { |
105 | if ( item->parent() ) | 105 | if ( item->parent() ) |
106 | if ( item->parent()->text( 0 ) == i18n (" Local Mailfolders") ) | 106 | if ( item->parent()->text( 0 ) == i18n (" Local Mailfolders") ) |
107 | ask = false; | 107 | ask = false; |
108 | } | 108 | } |
109 | if ( ask ) { | 109 | if ( ask ) { |
110 | int result = KMessageBox::warningContinueCancel(this, | 110 | int result = KMessageBox::warningContinueCancel(this, |
111 | i18n("Refresh\n%1\n?").arg( item->text(0) ), | 111 | i18n("Refresh\n%1\n?").arg( item->text(0) ), |
112 | i18n("Refresh"),i18n("Refresh"),i18n("Cancel"), | 112 | i18n("Refresh"),i18n("Refresh"),i18n("Cancel"), |
113 | true); | 113 | true); |
114 | if (result != KMessageBox::Continue) return; | 114 | if (result != KMessageBox::Continue) return; |
115 | } | 115 | } |
116 | m_currentItem = item; | 116 | m_currentItem = item; |
117 | topLevelWidget()->setCaption( i18n ( "Refreshing %1 ... please wait" ). arg ( m_currentItem->text( 0 ) ) ) ; | 117 | topLevelWidget()->setCaption( i18n ( "Refreshing %1 ... please wait" ). arg ( m_currentItem->text( 0 ) ) ) ; |
118 | QTimer::singleShot( 500, this, SLOT ( refreshCurrentSelected() ) ); | 118 | QTimer::singleShot( 500, this, SLOT ( refreshCurrentSelected() ) ); |
119 | 119 | ||
120 | } | 120 | } |
121 | } | 121 | } |
122 | void AccountView::refreshOutgoing() | 122 | void AccountView::refreshOutgoing() |
123 | { | 123 | { |
124 | m_currentItem = currentItem(); | 124 | m_currentItem = currentItem(); |
125 | if ( !m_currentItem ) return; | 125 | if ( !m_currentItem ) return; |
126 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); | 126 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); |
127 | if ( !view->getFolder() ) | 127 | if ( !view->getFolder() ) |
128 | return; | 128 | return; |
129 | QString bName = view->getFolder()->getDisplayName(); | 129 | QString bName = view->getFolder()->getDisplayName(); |
130 | if (bName.startsWith("/")&&bName.length()>1) | 130 | if (bName.startsWith("/")&&bName.length()>1) |
131 | { | 131 | { |
132 | bName.replace(0,1,""); | 132 | bName.replace(0,1,""); |
133 | } | 133 | } |
134 | int pos = bName.findRev("/"); | 134 | int pos = bName.findRev("/"); |
135 | if (pos > 0) | 135 | if (pos > 0) |
136 | { | 136 | { |
137 | bName.replace(0,pos+1,""); | 137 | bName.replace(0,pos+1,""); |
138 | } | 138 | } |
139 | //qDebug("name *%s* ",bName.lower().latin1() ); | 139 | //qDebug("name *%s* ",bName.lower().latin1() ); |
140 | if ( bName.lower() == "outgoing" || bName.lower() == "sent" || bName.lower() == "sendfailed" ) { | 140 | if ( bName.lower() == "outgoing" || bName.lower() == "sent" || bName.lower() == "sendfailed" ) { |
141 | refreshCurrent(); | 141 | refreshCurrent(); |
142 | // qDebug("refresh "); | 142 | // qDebug("refresh "); |
143 | } | 143 | } |
144 | } | 144 | } |
145 | void AccountView::refreshCurrentSelected() | 145 | void AccountView::refreshCurrentSelected() |
146 | { | 146 | { |
147 | if ( !m_currentItem ) return; | 147 | if ( !m_currentItem ) return; |
148 | QValueList<RecMailP> headerlist; | 148 | QValueList<RecMailP> headerlist; |
149 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); | 149 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); |
150 | view->refresh(headerlist); | 150 | view->refresh(headerlist); |
151 | emit refreshMailview(headerlist); | 151 | emit refreshMailview(headerlist); |
152 | topLevelWidget()->setCaption( i18n ( "KOpieMail/Pi" ) ) ; | 152 | topLevelWidget()->setCaption( i18n ( "KOpieMail/Pi" ) ) ; |
153 | } | 153 | } |
154 | 154 | ||
155 | void AccountView::refreshCurrent() | 155 | void AccountView::refreshCurrent() |
156 | { | 156 | { |
157 | m_currentItem = currentItem(); | 157 | m_currentItem = currentItem(); |
158 | if ( !m_currentItem ) return; | 158 | if ( !m_currentItem ) return; |
159 | topLevelWidget()->setCaption( i18n ( "Refreshing %1 ... please wait" ). arg ( m_currentItem->text( 0 ) ) ) ; | 159 | topLevelWidget()->setCaption( i18n ( "Refreshing %1 ... please wait" ). arg ( m_currentItem->text( 0 ) ) ) ; |
160 | QTimer::singleShot( 500, this, SLOT ( refreshCurrentSelected() ) ); | 160 | QTimer::singleShot( 500, this, SLOT ( refreshCurrentSelected() ) ); |
161 | } | 161 | } |
162 | 162 | ||
163 | void AccountView::refreshAll() | 163 | void AccountView::refreshAll() |
164 | { | 164 | { |
165 | } | 165 | } |