summaryrefslogtreecommitdiffabout
path: root/kmicromail
authorzautrix <zautrix>2005-01-23 16:22:03 (UTC)
committer zautrix <zautrix>2005-01-23 16:22:03 (UTC)
commitec69f34e62250f95a1f8757c5d58da0bf330678a (patch) (unidiff)
treea487425ea28b2dfe706dbca22c1351baddc52549 /kmicromail
parentabe5f73892c123110faec5648b484628b3265fd6 (diff)
downloadkdepimpi-ec69f34e62250f95a1f8757c5d58da0bf330678a.zip
kdepimpi-ec69f34e62250f95a1f8757c5d58da0bf330678a.tar.gz
kdepimpi-ec69f34e62250f95a1f8757c5d58da0bf330678a.tar.bz2
xxx
Diffstat (limited to 'kmicromail') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/imapwrapper.cpp1
-rw-r--r--kmicromail/mainwindow.cpp2
-rw-r--r--kmicromail/mainwindow.h1
3 files changed, 2 insertions, 2 deletions
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp
index b890725..d9496af 100644
--- a/kmicromail/libmailwrapper/imapwrapper.cpp
+++ b/kmicromail/libmailwrapper/imapwrapper.cpp
@@ -14,97 +14,96 @@ using namespace Opie::Core;
14int IMAPwrapper::mMax = 0; 14int IMAPwrapper::mMax = 0;
15int IMAPwrapper::mCurrent = 0; 15int IMAPwrapper::mCurrent = 0;
16 16
17IMAPwrapper::IMAPwrapper( IMAPaccount *a ) 17IMAPwrapper::IMAPwrapper( IMAPaccount *a )
18 : AbstractMail() 18 : AbstractMail()
19{ 19{
20 account = a; 20 account = a;
21 m_imap = 0; 21 m_imap = 0;
22 m_Lastmbox = ""; 22 m_Lastmbox = "";
23 mCurrent = 0; 23 mCurrent = 0;
24 mMax = 0; 24 mMax = 0;
25} 25}
26 26
27IMAPwrapper::~IMAPwrapper() 27IMAPwrapper::~IMAPwrapper()
28{ 28{
29 logout(); 29 logout();
30} 30}
31 31
32/* to avoid to often select statements in loops etc. 32/* to avoid to often select statements in loops etc.
33 we trust that we are logged in and connection is established!*/ 33 we trust that we are logged in and connection is established!*/
34int IMAPwrapper::selectMbox(const QString&mbox) 34int IMAPwrapper::selectMbox(const QString&mbox)
35{ 35{
36 if (mbox == m_Lastmbox) { 36 if (mbox == m_Lastmbox) {
37 return MAILIMAP_NO_ERROR; 37 return MAILIMAP_NO_ERROR;
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
48void IMAPwrapper::imap_progress( size_t current, size_t maximum ) 48void IMAPwrapper::imap_progress( size_t current, size_t maximum )
49{ 49{
50 qApp->processEvents(); 50 qApp->processEvents();
51 return; 51 return;
52 //qDebug("imap progress %d of %d ",current,maximum ); 52 //qDebug("imap progress %d of %d ",current,maximum );
53 //Global::statusMessage(i18n("Downloading message %1 of %2").arg( current).arg(maximum)); 53 //Global::statusMessage(i18n("Downloading message %1 of %2").arg( current).arg(maximum));
54 //qApp->processEvents() 54 //qApp->processEvents()
55 static unsigned int last = 0; 55 static unsigned int last = 0;
56 if ( last != current ) 56 if ( last != current )
57 IMAPwrapper::progress(); 57 IMAPwrapper::progress();
58 last = current; 58 last = current;
59} 59}
60void IMAPwrapper::progress( QString m ) 60void IMAPwrapper::progress( QString m )
61{ 61{
62
63 static QString mProgrMess; 62 static QString mProgrMess;
64 if ( m != QString::null ) { 63 if ( m != QString::null ) {
65 mProgrMess = m; 64 mProgrMess = m;
66 mCurrent = 1; 65 mCurrent = 1;
67 return; 66 return;
68 } 67 }
69 QString mess; 68 QString mess;
70 //qDebug("progress "); 69 //qDebug("progress ");
71 if ( mMax ) mess = mProgrMess +i18n(" message %1 of %2").arg( mCurrent++).arg(mMax); 70 if ( mMax ) mess = mProgrMess +i18n(" message %1 of %2").arg( mCurrent++).arg(mMax);
72 else mess = mProgrMess +i18n(" message %1").arg( mCurrent++); 71 else mess = mProgrMess +i18n(" message %1").arg( mCurrent++);
73 Global::statusMessage(mess); 72 Global::statusMessage(mess);
74 //qDebug("Progress %s %s", mess.latin1(), m.latin1()); 73 //qDebug("Progress %s %s", mess.latin1(), m.latin1());
75 qApp->processEvents(); 74 qApp->processEvents();
76} 75}
77bool IMAPwrapper::start_tls(bool force_tls) 76bool IMAPwrapper::start_tls(bool force_tls)
78{ 77{
79 int err; 78 int err;
80 bool try_tls = force_tls; 79 bool try_tls = force_tls;
81 mailimap_capability_data * cap_data = 0; 80 mailimap_capability_data * cap_data = 0;
82 81
83 err = mailimap_capability(m_imap,&cap_data); 82 err = mailimap_capability(m_imap,&cap_data);
84 if (err != MAILIMAP_NO_ERROR) { 83 if (err != MAILIMAP_NO_ERROR) {
85 Global::statusMessage("error getting capabilities!"); 84 Global::statusMessage("error getting capabilities!");
86 return false; 85 return false;
87 } 86 }
88 clistiter * cur; 87 clistiter * cur;
89 for(cur = clist_begin(cap_data->cap_list) ; cur != NULL;cur = clist_next(cur)) { 88 for(cur = clist_begin(cap_data->cap_list) ; cur != NULL;cur = clist_next(cur)) {
90 struct mailimap_capability * cap; 89 struct mailimap_capability * cap;
91 cap = (struct mailimap_capability *)clist_content(cur); 90 cap = (struct mailimap_capability *)clist_content(cur);
92 if (cap->cap_type == MAILIMAP_CAPABILITY_NAME) { 91 if (cap->cap_type == MAILIMAP_CAPABILITY_NAME) {
93 if (strcasecmp(cap->cap_data.cap_name, "STARTTLS") == 0) { 92 if (strcasecmp(cap->cap_data.cap_name, "STARTTLS") == 0) {
94 try_tls = true; 93 try_tls = true;
95 break; 94 break;
96 } 95 }
97 } 96 }
98 } 97 }
99 if (cap_data) { 98 if (cap_data) {
100 mailimap_capability_data_free(cap_data); 99 mailimap_capability_data_free(cap_data);
101 } 100 }
102 if (try_tls) { 101 if (try_tls) {
103 err = mailimap_starttls(m_imap); 102 err = mailimap_starttls(m_imap);
104 if (err != MAILIMAP_NO_ERROR && force_tls) { 103 if (err != MAILIMAP_NO_ERROR && force_tls) {
105 Global::statusMessage(i18n("Server has no TLS support!")); 104 Global::statusMessage(i18n("Server has no TLS support!"));
106 try_tls = false; 105 try_tls = false;
107 } else { 106 } else {
108 mailstream_low * low; 107 mailstream_low * low;
109 mailstream_low * new_low; 108 mailstream_low * new_low;
110 low = mailstream_get_low(m_imap->imap_stream); 109 low = mailstream_get_low(m_imap->imap_stream);
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp
index 0e4a64f..1dc374b 100644
--- a/kmicromail/mainwindow.cpp
+++ b/kmicromail/mainwindow.cpp
@@ -46,97 +46,97 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
46 0, 0, this ); 46 0, 0, this );
47 connect(getMail, SIGNAL( activated() ), 47 connect(getMail, SIGNAL( activated() ),
48 SLOT( slotGetAllMail() ) ); 48 SLOT( slotGetAllMail() ) );
49 getMail->addTo( mailMenu ); 49 getMail->addTo( mailMenu );
50 50
51 getMail = new QAction( i18n( "Get new messages" ), SmallIcon("add"), 51 getMail = new QAction( i18n( "Get new messages" ), SmallIcon("add"),
52 0, 0, this ); 52 0, 0, this );
53 getMail->addTo( toolBar ); 53 getMail->addTo( toolBar );
54 getMail->addTo( mailMenu ); 54 getMail->addTo( mailMenu );
55 connect(getMail, SIGNAL( activated() ), 55 connect(getMail, SIGNAL( activated() ),
56 SLOT( slotGetMail() ) ); 56 SLOT( slotGetMail() ) );
57 57
58 composeMail = new QAction( i18n( "Compose new mail" ), SmallIcon("composemail"), 58 composeMail = new QAction( i18n( "Compose new mail" ), SmallIcon("composemail"),
59 0, 0, this ); 59 0, 0, this );
60 composeMail->addTo( toolBar ); 60 composeMail->addTo( toolBar );
61 composeMail->addTo( mailMenu ); 61 composeMail->addTo( mailMenu );
62 62
63 sendQueued = new QAction( i18n( "Send queued mails" ), SmallIcon("sendqueued") , 63 sendQueued = new QAction( i18n( "Send queued mails" ), SmallIcon("sendqueued") ,
64 0, 0, this ); 64 0, 0, this );
65 sendQueued->addTo( toolBar ); 65 sendQueued->addTo( toolBar );
66 sendQueued->addTo( mailMenu ); 66 sendQueued->addTo( mailMenu );
67 67
68 /* 68 /*
69 syncFolders = new QAction( i18n( "Sync mailfolders" ), ICON_SYNC, 69 syncFolders = new QAction( i18n( "Sync mailfolders" ), ICON_SYNC,
70 0, 0, this ); 70 0, 0, this );
71 syncFolders->addTo( toolBar ); 71 syncFolders->addTo( toolBar );
72 syncFolders->addTo( mailMenu ); 72 syncFolders->addTo( mailMenu );
73 */ 73 */
74 74
75 showFolders = new QAction( i18n( "Show/Hide folders" ), SmallIcon("showfolders") , 75 showFolders = new QAction( i18n( "Show/Hide folders" ), SmallIcon("showfolders") ,
76 0, 0, this, 0, true ); 76 0, 0, this, 0, true );
77 showFolders->addTo( toolBar ); 77 showFolders->addTo( toolBar );
78 showFolders->addTo( mailMenu ); 78 showFolders->addTo( mailMenu );
79 showFolders->setOn( true ); 79 showFolders->setOn( true );
80 connect(showFolders, SIGNAL( toggled(bool) ), 80 connect(showFolders, SIGNAL( toggled(bool) ),
81 SLOT( slotShowFolders(bool) ) ); 81 SLOT( slotShowFolders(bool) ) );
82 82
83 /* 83 /*
84 searchMails = new QAction( i18n( "Search mails" ), SmallIcon("find") ), 84 searchMails = new QAction( i18n( "Search mails" ), SmallIcon("find") ),
85 0, 0, this ); 85 0, 0, this );
86 searchMails->addTo( toolBar ); 86 searchMails->addTo( toolBar );
87 searchMails->addTo( mailMenu ); 87 searchMails->addTo( mailMenu );
88 */ 88 */
89 89
90 deleteMails = new QAction(i18n("Delete Mail"), SmallIcon("trash"), 0, 0, this); 90 deleteMails = new QAction(i18n("Delete Mail"), SmallIcon("trash"), 0, 0, this);
91 deleteMails->addTo( toolBar ); 91 deleteMails->addTo( toolBar );
92 deleteMails->addTo( mailMenu ); 92 deleteMails->addTo( mailMenu );
93 connect( deleteMails, SIGNAL( activated() ), 93 connect( deleteMails, SIGNAL( activated() ),
94 SLOT( slotDeleteMail() ) ); 94 SLOT( slotDeleteAllMail() ) );
95 95
96 editSettings = new QAction( i18n( "Edit settings" ), SmallIcon("SettingsIcon") , 96 editSettings = new QAction( i18n( "Edit settings" ), SmallIcon("SettingsIcon") ,
97 0, 0, this ); 97 0, 0, this );
98 editSettings->addTo( settingsMenu ); 98 editSettings->addTo( settingsMenu );
99 connect( editSettings, SIGNAL( activated() ), 99 connect( editSettings, SIGNAL( activated() ),
100 SLOT( slotEditSettings() ) ); 100 SLOT( slotEditSettings() ) );
101 editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") , 101 editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") ,
102 0, 0, this ); 102 0, 0, this );
103 editAccounts->addTo( settingsMenu ); 103 editAccounts->addTo( settingsMenu );
104 codecMenu = new QPopupMenu( menuBar ); 104 codecMenu = new QPopupMenu( menuBar );
105 codecMenu->insertItem( "Western (iso-8859-1)",0,0); 105 codecMenu->insertItem( "Western (iso-8859-1)",0,0);
106 codecMenu->insertItem( "Cyrillic (iso-8859-5)",1,1); 106 codecMenu->insertItem( "Cyrillic (iso-8859-5)",1,1);
107 codecMenu->insertItem( "Western (iso-8859-15)",2,2); 107 codecMenu->insertItem( "Western (iso-8859-15)",2,2);
108 codecMenu->insertItem( "Chinese (big-5)",3,3); 108 codecMenu->insertItem( "Chinese (big-5)",3,3);
109 codecMenu->insertItem( "Unicode (utf-8)",4,4); 109 codecMenu->insertItem( "Unicode (utf-8)",4,4);
110 codecMenu->insertItem( "Userdefined ("+KOPrefs::instance()->mSendCodec+")",5,5); 110 codecMenu->insertItem( "Userdefined ("+KOPrefs::instance()->mSendCodec+")",5,5);
111 //disabled 111 //disabled
112 //settingsMenu->insertItem( i18n("Codec for new mails"), codecMenu); 112 //settingsMenu->insertItem( i18n("Codec for new mails"), codecMenu);
113 //setCentralWidget( view ); 113 //setCentralWidget( view );
114 114
115 QVBox* wrapperBox = new QVBox( this ); 115 QVBox* wrapperBox = new QVBox( this );
116 setCentralWidget( wrapperBox ); 116 setCentralWidget( wrapperBox );
117 117
118 // QWidget *view = new QWidget( wrapperBox ); 118 // QWidget *view = new QWidget( wrapperBox );
119 KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); 119 KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox);
120 split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); 120 split->setMinimizeDirection( KDGanttMinimizeSplitter::Left);
121 //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); 121 //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight );
122 122
123 folderView = new AccountView( split ); 123 folderView = new AccountView( split );
124 folderView->header()->hide(); 124 folderView->header()->hide();
125 folderView->setRootIsDecorated( false ); 125 folderView->setRootIsDecorated( false );
126 folderView->addColumn( i18n( "Mailbox" ) ); 126 folderView->addColumn( i18n( "Mailbox" ) );
127 127
128 //layout->addWidget( folderView ); 128 //layout->addWidget( folderView );
129 129
130 mailView = new QListView( split ); 130 mailView = new QListView( split );
131 mailView->addColumn( i18n( " " ) ); 131 mailView->addColumn( i18n( " " ) );
132 mailView->addColumn( i18n( "Subject" ),QListView::Manual ); 132 mailView->addColumn( i18n( "Subject" ),QListView::Manual );
133 mailView->addColumn( i18n( "Sender" ),QListView::Manual ); 133 mailView->addColumn( i18n( "Sender" ),QListView::Manual );
134 mailView->addColumn( i18n( "Size" ),QListView::Manual); 134 mailView->addColumn( i18n( "Size" ),QListView::Manual);
135 mailView->addColumn( i18n( "Date" ),QListView::Manual); 135 mailView->addColumn( i18n( "Date" ),QListView::Manual);
136 mailView->setAllColumnsShowFocus(true); 136 mailView->setAllColumnsShowFocus(true);
137 //mailView->setSorting(-1); 137 //mailView->setSorting(-1);
138 mailView->setRootIsDecorated( false ); 138 mailView->setRootIsDecorated( false );
139 statusWidget = new StatusWidget( wrapperBox ); 139 statusWidget = new StatusWidget( wrapperBox );
140 statusWidget->hide(); 140 statusWidget->hide();
141 141
142 //layout->addWidget( mailView ); 142 //layout->addWidget( mailView );
diff --git a/kmicromail/mainwindow.h b/kmicromail/mainwindow.h
index d0a5caf..016e44c 100644
--- a/kmicromail/mainwindow.h
+++ b/kmicromail/mainwindow.h
@@ -1,69 +1,70 @@
1 1
2// CHANGED 2004-08-06 Lutz Rogowski 2// CHANGED 2004-08-06 Lutz Rogowski
3#ifndef MAINWINDOW_H 3#ifndef MAINWINDOW_H
4#define MAINWINDOW_H 4#define MAINWINDOW_H
5 5
6#include <qmainwindow.h> 6#include <qmainwindow.h>
7#include <qlistview.h> 7#include <qlistview.h>
8#include <qaction.h> 8#include <qaction.h>
9 9
10#include <qtoolbar.h> 10#include <qtoolbar.h>
11#ifdef DESKTOP_VERSION 11#ifdef DESKTOP_VERSION
12#include <qmenubar.h> 12#include <qmenubar.h>
13#define QPEMenuBar QMenuBar 13#define QPEMenuBar QMenuBar
14#else 14#else
15#include <qpe/qpemenubar.h> 15#include <qpe/qpemenubar.h>
16#endif 16#endif
17 17
18#include "accountview.h" 18#include "accountview.h"
19#include "statuswidget.h" 19#include "statuswidget.h"
20 20
21#include <libmailwrapper/mailtypes.h> 21#include <libmailwrapper/mailtypes.h>
22#include <opie2/osmartpointer.h> 22#include <opie2/osmartpointer.h>
23 23
24class RecMail; 24class RecMail;
25 25
26class MainWindow : public QMainWindow 26class MainWindow : public QMainWindow
27{ 27{
28 Q_OBJECT 28 Q_OBJECT
29 29
30public: 30public:
31 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); 31 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 );
32 virtual ~MainWindow(); 32 virtual ~MainWindow();
33 33
34public slots: 34public slots:
35 virtual void slotAdjustColumns(); 35 virtual void slotAdjustColumns();
36 virtual void appMessage(const QCString &msg, const QByteArray &data); 36 virtual void appMessage(const QCString &msg, const QByteArray &data);
37 virtual void slotComposeMail(); 37 virtual void slotComposeMail();
38 38
39protected slots: 39protected slots:
40 virtual void slotSendQueued(); 40 virtual void slotSendQueued();
41 virtual void slotEditAccounts(); 41 virtual void slotEditAccounts();
42 virtual void slotShowFolders( bool show ); 42 virtual void slotShowFolders( bool show );
43 virtual void refreshMailView(const QValueList<RecMailP>&); 43 virtual void refreshMailView(const QValueList<RecMailP>&);
44 virtual void displayMail(); 44 virtual void displayMail();
45 virtual void slotGetMail() = 0; 45 virtual void slotGetMail() = 0;
46 virtual void slotGetAllMail() = 0; 46 virtual void slotGetAllMail() = 0;
47 virtual void slotDeleteMail(); 47 virtual void slotDeleteMail();
48 virtual void slotDeleteAllMail() = 0;
48 virtual void slotSetCodec(int); 49 virtual void slotSetCodec(int);
49 virtual void mailHold(int, QListViewItem *,const QPoint&,int); 50 virtual void mailHold(int, QListViewItem *,const QPoint&,int);
50 virtual void slotAdjustLayout(); 51 virtual void slotAdjustLayout();
51 virtual void slotEditSettings(); 52 virtual void slotEditSettings();
52 virtual void mailLeftClicked( QListViewItem * ); 53 virtual void mailLeftClicked( QListViewItem * );
53 void showLicence(); 54 void showLicence();
54 void showAbout(); 55 void showAbout();
55 void showEtpanLicence(); 56 void showEtpanLicence();
56 57
57protected: 58protected:
58 QToolBar *toolBar; 59 QToolBar *toolBar;
59 StatusWidget *statusWidget; 60 StatusWidget *statusWidget;
60 QPEMenuBar *menuBar; 61 QPEMenuBar *menuBar;
61 QPopupMenu *mailMenu, *settingsMenu, *codecMenu; 62 QPopupMenu *mailMenu, *settingsMenu, *codecMenu;
62 QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails, 63 QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails,
63 *editSettings, *editAccounts, *syncFolders; 64 *editSettings, *editAccounts, *syncFolders;
64 AccountView *folderView; 65 AccountView *folderView;
65 QListView *mailView; 66 QListView *mailView;
66 //QBoxLayout *layout; 67 //QBoxLayout *layout;
67}; 68};
68 69
69#endif 70#endif