author | zautrix <zautrix> | 2005-08-22 18:52:57 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-08-22 18:52:57 (UTC) |
commit | cb425b4c2d027d49f964368e94a52d3ba5e6aa31 (patch) (unidiff) | |
tree | b867e4c565aab6965059306bac24dd3ab5ca3750 | |
parent | e011ace92e07174effca53b7dde20b9a5b695af0 (diff) | |
download | kdepimpi-cb425b4c2d027d49f964368e94a52d3ba5e6aa31.zip kdepimpi-cb425b4c2d027d49f964368e94a52d3ba5e6aa31.tar.gz kdepimpi-cb425b4c2d027d49f964368e94a52d3ba5e6aa31.tar.bz2 |
ompi fixes
-rw-r--r-- | kmicromail/accountview.cpp | 39 | ||||
-rw-r--r-- | kmicromail/accountview.h | 1 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.cpp | 6 |
3 files changed, 31 insertions, 15 deletions
diff --git a/kmicromail/accountview.cpp b/kmicromail/accountview.cpp index 6227f6d..cef55ab 100644 --- a/kmicromail/accountview.cpp +++ b/kmicromail/accountview.cpp | |||
@@ -6,35 +6,41 @@ | |||
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 <qpe/qpeapplication.h> | 12 | #include <qpe/qpeapplication.h> |
13 | 13 | ||
14 | /* QT */ | 14 | /* QT */ |
15 | #include <qmessagebox.h> | 15 | #include <qmessagebox.h> |
16 | #include <qpopupmenu.h> | 16 | #include <qpopupmenu.h> |
17 | #include <qcheckbox.h> | 17 | #include <qcheckbox.h> |
18 | #include <qtimer.h> | ||
18 | #include <qspinbox.h> | 19 | #include <qspinbox.h> |
19 | #include <klocale.h> | 20 | #include <klocale.h> |
21 | #include <kmessagebox.h> | ||
20 | 22 | ||
21 | using namespace Opie::Core; | 23 | using namespace Opie::Core; |
22 | AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) | 24 | AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) |
23 | : QListView( parent, name, flags ) | 25 | : QListView( parent, name, flags ) |
24 | { | 26 | { |
25 | connect( this, SIGNAL( selectionChanged(QListViewItem*) ), | 27 | //connect( this, SIGNAL( selectionChanged(QListViewItem*) ), |
26 | SLOT( refresh(QListViewItem*) ) ); | 28 | // SLOT( refresh(QListViewItem*) ) ); |
27 | connect( this, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, | 29 | connect( this, SIGNAL( clicked(QListViewItem*) ), |
28 | SLOT( slotHold(int,QListViewItem*,const QPoint&,int) ) ); | 30 | SLOT( refresh(QListViewItem*) ) ); |
31 | connect( this, SIGNAL( returnPressed(QListViewItem*) ), | ||
32 | SLOT( refresh(QListViewItem*) ) ); | ||
33 | connect( this, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, | ||
34 | SLOT( slotHold(int,QListViewItem*,const QPoint&,int) ) ); | ||
29 | setSorting(0); | 35 | setSorting(0); |
30 | } | 36 | } |
31 | 37 | ||
32 | AccountView::~AccountView() | 38 | AccountView::~AccountView() |
33 | { | 39 | { |
34 | imapAccounts.clear(); | 40 | imapAccounts.clear(); |
35 | mhAccounts.clear(); | 41 | mhAccounts.clear(); |
36 | } | 42 | } |
37 | 43 | ||
38 | void AccountView::slotContextMenu(int id) | 44 | void AccountView::slotContextMenu(int id) |
39 | { | 45 | { |
40 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); | 46 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); |
@@ -82,29 +88,33 @@ void AccountView::populate( QList<Account> list ) | |||
82 | { | 88 | { |
83 | NNTPaccount *nntp = static_cast<NNTPaccount *>(it); | 89 | NNTPaccount *nntp = static_cast<NNTPaccount *>(it); |
84 | /* must not be hold 'cause it isn't required */ | 90 | /* must not be hold 'cause it isn't required */ |
85 | (void) new NNTPviewItem( nntp, this ); | 91 | (void) new NNTPviewItem( nntp, this ); |
86 | } | 92 | } |
87 | } | 93 | } |
88 | } | 94 | } |
89 | 95 | ||
90 | void AccountView::refresh(QListViewItem *item) | 96 | void AccountView::refresh(QListViewItem *item) |
91 | { | 97 | { |
92 | if ( item ) | 98 | if ( item ) |
93 | { | 99 | { |
100 | int result = KMessageBox::warningContinueCancel(this, | ||
101 | i18n("Refresh\n%1\n?").arg( item->text(0) ), | ||
102 | i18n("Refresh"),i18n("Refresh"),i18n("Cancel"), | ||
103 | true); | ||
104 | if (result != KMessageBox::Continue) return; | ||
94 | m_currentItem = item; | 105 | m_currentItem = item; |
95 | QValueList<RecMailP> headerlist; | 106 | topLevelWidget()->setCaption( i18n ( "Refreshing %1 ... please wait" ). arg ( m_currentItem->text( 0 ) ) ) ; |
96 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 107 | QTimer::singleShot( 500, this, SLOT ( refreshCurrentSelected() ) ); |
97 | view->refresh(headerlist); | 108 | |
98 | emit refreshMailview(headerlist); | ||
99 | } | 109 | } |
100 | } | 110 | } |
101 | void AccountView::refreshOutgoing() | 111 | void AccountView::refreshOutgoing() |
102 | { | 112 | { |
103 | m_currentItem = currentItem(); | 113 | m_currentItem = currentItem(); |
104 | if ( !m_currentItem ) return; | 114 | if ( !m_currentItem ) return; |
105 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); | 115 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); |
106 | if ( !view->getFolder() ) | 116 | if ( !view->getFolder() ) |
107 | return; | 117 | return; |
108 | QString bName = view->getFolder()->getDisplayName(); | 118 | QString bName = view->getFolder()->getDisplayName(); |
109 | if (bName.startsWith("/")&&bName.length()>1) | 119 | if (bName.startsWith("/")&&bName.length()>1) |
110 | { | 120 | { |
@@ -112,33 +122,40 @@ void AccountView::refreshOutgoing() | |||
112 | } | 122 | } |
113 | int pos = bName.findRev("/"); | 123 | int pos = bName.findRev("/"); |
114 | if (pos > 0) | 124 | if (pos > 0) |
115 | { | 125 | { |
116 | bName.replace(0,pos+1,""); | 126 | bName.replace(0,pos+1,""); |
117 | } | 127 | } |
118 | //qDebug("name *%s* ",bName.lower().latin1() ); | 128 | //qDebug("name *%s* ",bName.lower().latin1() ); |
119 | if ( bName.lower() == "outgoing" || bName.lower() == "sent" || bName.lower() == "sendfailed" ) { | 129 | if ( bName.lower() == "outgoing" || bName.lower() == "sent" || bName.lower() == "sendfailed" ) { |
120 | refreshCurrent(); | 130 | refreshCurrent(); |
121 | // qDebug("refresh "); | 131 | // qDebug("refresh "); |
122 | } | 132 | } |
123 | } | 133 | } |
124 | 134 | void AccountView::refreshCurrentSelected() | |
125 | void AccountView::refreshCurrent() | ||
126 | { | 135 | { |
127 | m_currentItem = currentItem(); | ||
128 | if ( !m_currentItem ) return; | 136 | if ( !m_currentItem ) return; |
129 | QValueList<RecMailP> headerlist; | 137 | QValueList<RecMailP> headerlist; |
130 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); | 138 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); |
131 | view->refresh(headerlist); | 139 | view->refresh(headerlist); |
132 | emit refreshMailview(headerlist); | 140 | emit refreshMailview(headerlist); |
141 | topLevelWidget()->setCaption( i18n ( "KOpieMail/Pi" ) ) ; | ||
142 | } | ||
143 | |||
144 | void AccountView::refreshCurrent() | ||
145 | { | ||
146 | m_currentItem = currentItem(); | ||
147 | if ( !m_currentItem ) return; | ||
148 | topLevelWidget()->setCaption( i18n ( "Refreshing %1 ... please wait" ). arg ( m_currentItem->text( 0 ) ) ) ; | ||
149 | QTimer::singleShot( 500, this, SLOT ( refreshCurrentSelected() ) ); | ||
133 | } | 150 | } |
134 | 151 | ||
135 | void AccountView::refreshAll() | 152 | void AccountView::refreshAll() |
136 | { | 153 | { |
137 | } | 154 | } |
138 | 155 | ||
139 | RecBodyP AccountView::fetchBody(const RecMailP&aMail) | 156 | RecBodyP AccountView::fetchBody(const RecMailP&aMail) |
140 | { | 157 | { |
141 | QListViewItem*item = selectedItem (); | 158 | QListViewItem*item = selectedItem (); |
142 | if (!item) return new RecBody(); | 159 | if (!item) return new RecBody(); |
143 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 160 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
144 | return view->fetchBody(aMail); | 161 | return view->fetchBody(aMail); |
diff --git a/kmicromail/accountview.h b/kmicromail/accountview.h index e403cb8..33f3479 100644 --- a/kmicromail/accountview.h +++ b/kmicromail/accountview.h | |||
@@ -21,24 +21,25 @@ public: | |||
21 | AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); | 21 | AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); |
22 | virtual ~AccountView(); | 22 | virtual ~AccountView(); |
23 | virtual void populate( QList<Account> list ); | 23 | virtual void populate( QList<Account> list ); |
24 | virtual RecBodyP fetchBody(const Opie::Core::OSmartPointer<RecMail>&aMail); | 24 | virtual RecBodyP fetchBody(const Opie::Core::OSmartPointer<RecMail>&aMail); |
25 | virtual void downloadMails(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper); | 25 | virtual void downloadMails(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper); |
26 | virtual void downloadMailsInbox(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper); | 26 | virtual void downloadMailsInbox(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper); |
27 | virtual bool currentisDraft(); | 27 | virtual bool currentisDraft(); |
28 | QValueList<MHviewItem*> allAccounts() { return mhAccounts;} | 28 | QValueList<MHviewItem*> allAccounts() { return mhAccounts;} |
29 | public slots: | 29 | public slots: |
30 | virtual void refreshAll(); | 30 | virtual void refreshAll(); |
31 | virtual void refresh(QListViewItem *item); | 31 | virtual void refresh(QListViewItem *item); |
32 | virtual void refreshCurrent(); | 32 | virtual void refreshCurrent(); |
33 | virtual void refreshCurrentSelected(); | ||
33 | virtual void refreshOutgoing(); | 34 | virtual void refreshOutgoing(); |
34 | virtual void slotHold(int, QListViewItem *,const QPoint&,int); | 35 | virtual void slotHold(int, QListViewItem *,const QPoint&,int); |
35 | virtual void slotContextMenu(int id); | 36 | virtual void slotContextMenu(int id); |
36 | void setupFolderselect(Selectstore*sels); | 37 | void setupFolderselect(Selectstore*sels); |
37 | 38 | ||
38 | signals: | 39 | signals: |
39 | void refreshMailview(const QValueList<RecMailP>& ); | 40 | void refreshMailview(const QValueList<RecMailP>& ); |
40 | 41 | ||
41 | protected: | 42 | protected: |
42 | QListViewItem* m_currentItem; | 43 | QListViewItem* m_currentItem; |
43 | QValueList<IMAPviewItem*> imapAccounts; | 44 | QValueList<IMAPviewItem*> imapAccounts; |
44 | QValueList<MHviewItem*> mhAccounts; | 45 | QValueList<MHviewItem*> mhAccounts; |
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp index 09e52b8..4f0c849 100644 --- a/kmicromail/libmailwrapper/imapwrapper.cpp +++ b/kmicromail/libmailwrapper/imapwrapper.cpp | |||
@@ -38,25 +38,24 @@ int IMAPwrapper::selectMbox(const QString&mbox) | |||
38 | } | 38 | } |
39 | int err = mailimap_select( m_imap, (char*)mbox.latin1()); | 39 | int err = mailimap_select( m_imap, (char*)mbox.latin1()); |
40 | if ( err != MAILIMAP_NO_ERROR ) { | 40 | if ( err != MAILIMAP_NO_ERROR ) { |
41 | m_Lastmbox = ""; | 41 | m_Lastmbox = ""; |
42 | return err; | 42 | return err; |
43 | } | 43 | } |
44 | m_Lastmbox = mbox; | 44 | m_Lastmbox = mbox; |
45 | return err; | 45 | return err; |
46 | } | 46 | } |
47 | 47 | ||
48 | void IMAPwrapper::imap_progress( size_t current, size_t maximum ) | 48 | void IMAPwrapper::imap_progress( size_t current, size_t maximum ) |
49 | { | 49 | { |
50 | qApp->processEvents(); | ||
51 | return; | 50 | return; |
52 | //qDebug("imap progress %d of %d ",current,maximum ); | 51 | //qDebug("imap progress %d of %d ",current,maximum ); |
53 | //Global::statusMessage(i18n("Downloading message %1 of %2").arg( current).arg(maximum)); | 52 | //Global::statusMessage(i18n("Downloading message %1 of %2").arg( current).arg(maximum)); |
54 | //qApp->processEvents() | 53 | //qApp->processEvents() |
55 | static unsigned int last = 0; | 54 | static unsigned int last = 0; |
56 | if ( last != current ) | 55 | if ( last != current ) |
57 | IMAPwrapper::progress(); | 56 | IMAPwrapper::progress(); |
58 | last = current; | 57 | last = current; |
59 | } | 58 | } |
60 | void IMAPwrapper::progress( QString m ) | 59 | void IMAPwrapper::progress( QString m ) |
61 | { | 60 | { |
62 | static QString mProgrMess; | 61 | static QString mProgrMess; |
@@ -149,43 +148,42 @@ void IMAPwrapper::login(bool tryTLS) // = true) | |||
149 | if ( QDialog::Accepted == login.exec() ) { | 148 | if ( QDialog::Accepted == login.exec() ) { |
150 | // ok | 149 | // ok |
151 | user = login.getUser(); | 150 | user = login.getUser(); |
152 | pass = login.getPassword(); | 151 | pass = login.getPassword(); |
153 | } else { | 152 | } else { |
154 | // cancel | 153 | // cancel |
155 | return; | 154 | return; |
156 | } | 155 | } |
157 | } else { | 156 | } else { |
158 | user = account->getUser(); | 157 | user = account->getUser(); |
159 | pass = account->getPassword(); | 158 | pass = account->getPassword(); |
160 | } | 159 | } |
161 | |||
162 | m_imap = mailimap_new( 20, &imap_progress ); | 160 | m_imap = mailimap_new( 20, &imap_progress ); |
163 | 161 | ||
164 | /* connect */ | 162 | /* connect */ |
165 | bool ssl = false; | 163 | bool ssl = false; |
166 | bool try_tls = false; | 164 | bool try_tls = false; |
167 | bool force_tls = false; | 165 | bool force_tls = false; |
168 | 166 | ||
169 | if ( account->ConnectionType() == 2 ) { | 167 | if ( account->ConnectionType() == 2 ) { |
170 | ssl = true; | 168 | ssl = true; |
171 | } | 169 | } |
172 | if (account->ConnectionType()==1) { | 170 | if (account->ConnectionType()==1) { |
173 | force_tls = true; | 171 | force_tls = true; |
174 | } | 172 | } |
175 | 173 | ||
176 | if ( ssl ) { | 174 | if ( ssl ) { |
177 | qDebug("using ssl "); | 175 | //qDebug("using ssl "); |
178 | err = mailimap_ssl_connect( m_imap, (char*)server.latin1(), port ); | 176 | err = mailimap_ssl_connect( m_imap, (char*)server.latin1(), port ); |
179 | qDebug("back "); | 177 | //qDebug("back "); |
180 | } else { | 178 | } else { |
181 | err = mailimap_socket_connect( m_imap, (char*)server.latin1(), port ); | 179 | err = mailimap_socket_connect( m_imap, (char*)server.latin1(), port ); |
182 | } | 180 | } |
183 | 181 | ||
184 | if ( err != MAILIMAP_NO_ERROR && | 182 | if ( err != MAILIMAP_NO_ERROR && |
185 | err != MAILIMAP_NO_ERROR_AUTHENTICATED && | 183 | err != MAILIMAP_NO_ERROR_AUTHENTICATED && |
186 | err != MAILIMAP_NO_ERROR_NON_AUTHENTICATED ) { | 184 | err != MAILIMAP_NO_ERROR_NON_AUTHENTICATED ) { |
187 | QString failure = ""; | 185 | QString failure = ""; |
188 | if (err == MAILIMAP_ERROR_CONNECTION_REFUSED) { | 186 | if (err == MAILIMAP_ERROR_CONNECTION_REFUSED) { |
189 | failure="Connection refused"; | 187 | failure="Connection refused"; |
190 | } else { | 188 | } else { |
191 | failure="Unknown failure"; | 189 | failure="Unknown failure"; |