summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/mailistviewitem.cpp2
-rw-r--r--kmicromail/mainwindow.cpp1
2 files changed, 1 insertions, 2 deletions
diff --git a/kmicromail/mailistviewitem.cpp b/kmicromail/mailistviewitem.cpp
index 15fa148..41cee52 100644
--- a/kmicromail/mailistviewitem.cpp
+++ b/kmicromail/mailistviewitem.cpp
@@ -1,99 +1,99 @@
1// CHANGED 2004-08-06 Lutz Rogowski 1// CHANGED 2004-08-06 Lutz Rogowski
2#include "mailistviewitem.h" 2#include "mailistviewitem.h"
3#include <libmailwrapper/abstractmail.h> 3#include <libmailwrapper/abstractmail.h>
4#include <qtextstream.h> 4#include <qtextstream.h>
5#include <kiconloader.h> 5#include <kiconloader.h>
6#include "koprefs.h" 6#include "koprefs.h"
7//#include <qpe/resource.h> 7//#include <qpe/resource.h>
8 8
9MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) 9MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item )
10 :KListViewItem(parent,item),mail_data() 10 :KListViewItem(parent,item),mail_data()
11{ 11{
12} 12}
13 13
14void MailListViewItem::showEntry() 14void MailListViewItem::showEntry()
15{ 15{
16 if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) { 16 if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) {
17 setPixmap( 0, SmallIcon ( "kmmsgreplied") ); 17 setPixmap( 0, SmallIcon ( "kmmsgreplied") );
18 mKeyMap.insert(0, "r" ); 18 mKeyMap.insert(0, "r" );
19 } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) { 19 } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) {
20 /* I think it looks nicer if there are not such a log of icons but only on mails 20 /* I think it looks nicer if there are not such a log of icons but only on mails
21 replied or new - Alwin*/ 21 replied or new - Alwin*/
22 //setPixmap( 0,SmallIcon ("kmmsgunseen") ); 22 //setPixmap( 0,SmallIcon ("kmmsgunseen") );
23 mKeyMap.insert(0, "s" ); 23 mKeyMap.insert(0, "s" );
24 } else { 24 } else {
25 setPixmap( 0,SmallIcon ( "kmmsgnew") ); 25 setPixmap( 0,SmallIcon ( "kmmsgnew") );
26 mKeyMap.insert(0, "u" ); 26 mKeyMap.insert(0, "u" );
27 } 27 }
28 QString fsize = mail_data->MsgsizeString(); 28 QString fsize = mail_data->MsgsizeString();
29 // 1.23 29 // 1.23
30 // 11.23 30 // 11.23
31 // 111.23 31 // 111.23
32 // 999.23 maxlen 32 // 999.23 maxlen
33 QString fsort; 33 QString fsort;
34 switch(fsize.length() ) { 34 switch(fsize.length() ) {
35 case 6: 35 case 6:
36 fsort = "00" + fsize ; 36 fsort = "00" + fsize ;
37 break; 37 break;
38 case 7: 38 case 7:
39 fsort = "0" + fsize ; 39 fsort = "0" + fsize ;
40 break; 40 break;
41 default: 41 default:
42 fsort = fsize ; 42 fsort = fsize ;
43 break; 43 break;
44 44
45 } 45 }
46 46
47 setText(3, fsize ); 47 setText(3, fsize );
48 //qDebug("fsize *%s* ",fsize.latin1() ); 48 //qDebug("fsize *%s* ",fsize.latin1() );
49 //qDebug("fsort *%s* ",fsort.latin1() ); 49 //qDebug("fsort *%s* ",fsort.latin1() );
50 if ( fsize.right(2) == "kB" ) { 50 if ( fsize.right(2) == "kB" ) {
51 mKeyMap.insert(3, "k" + fsort); 51 mKeyMap.insert(3, "k" + fsort);
52 } else { 52 } else {
53 mKeyMap.insert(3, "M" +fsort ); 53 mKeyMap.insert(3, "M" +fsort );
54 } 54 }
55 setText(1,mail_data->getSubject()); 55 setText(1,mail_data->getSubject());
56 setText(2,mail_data->getFrom()); 56 setText(2,mail_data->getFrom());
57 mKeyMap.insert(4,mail_data->getIsoDate()); 57 mKeyMap.insert(4,mail_data->getIsoDate());
58 setText(4,mail_data->getDate()); 58 setText(4," "+mail_data->getDate());
59 if ( KOPrefs::instance()->mShowToField ) 59 if ( KOPrefs::instance()->mShowToField )
60 setText(5,mail_data->To()[0]); 60 setText(5,mail_data->To()[0]);
61} 61}
62 62
63void MailListViewItem::storeData(const RecMailP&data) 63void MailListViewItem::storeData(const RecMailP&data)
64{ 64{
65 mail_data = data; 65 mail_data = data;
66} 66}
67void MailListViewItem::setSortKey(int column,const QString &key) 67void MailListViewItem::setSortKey(int column,const QString &key)
68{ 68{
69 mKeyMap.insert(column,key); 69 mKeyMap.insert(column,key);
70} 70}
71QString MailListViewItem::key(int column, bool) const 71QString MailListViewItem::key(int column, bool) const
72{ 72{
73 // to make is fast, we use here special cases 73 // to make is fast, we use here special cases
74 if ( column == 3 || column == 4 || column == 0) { 74 if ( column == 3 || column == 4 || column == 0) {
75 return *mKeyMap.find(column); 75 return *mKeyMap.find(column);
76 } 76 }
77 if ( column == 1 ) { 77 if ( column == 1 ) {
78 if ( text(1).left(4).lower() == "re: " ) 78 if ( text(1).left(4).lower() == "re: " )
79 return text(1).mid(4); 79 return text(1).mid(4);
80 80
81 } 81 }
82 return text(column); 82 return text(column);
83 /* 83 /*
84 QMap<int,QString>::ConstIterator it = mKeyMap.find(column); 84 QMap<int,QString>::ConstIterator it = mKeyMap.find(column);
85 if (it == mKeyMap.end()) return text(column); 85 if (it == mKeyMap.end()) return text(column);
86 else return *it; 86 else return *it;
87 */ 87 */
88} 88}
89 89
90const RecMailP& MailListViewItem::data()const 90const RecMailP& MailListViewItem::data()const
91{ 91{
92 return mail_data; 92 return mail_data;
93} 93}
94 94
95MAILLIB::ATYPE MailListViewItem::wrapperType() 95MAILLIB::ATYPE MailListViewItem::wrapperType()
96{ 96{
97 if (!mail_data->Wrapper()) return MAILLIB::A_UNDEFINED; 97 if (!mail_data->Wrapper()) return MAILLIB::A_UNDEFINED;
98 return mail_data->Wrapper()->getType(); 98 return mail_data->Wrapper()->getType();
99} 99}
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp
index 3dde3cd..d547dda 100644
--- a/kmicromail/mainwindow.cpp
+++ b/kmicromail/mainwindow.cpp
@@ -1,447 +1,446 @@
1 1
2// CHANGED 2004-08-06 Lutz Rogowski 2// CHANGED 2004-08-06 Lutz Rogowski
3#include <qlabel.h> 3#include <qlabel.h>
4#include <qvbox.h> 4#include <qvbox.h>
5#include <qheader.h> 5#include <qheader.h>
6#include <qtimer.h> 6#include <qtimer.h>
7#include <qlayout.h> 7#include <qlayout.h>
8//#include <kdialog.h> 8//#include <kdialog.h>
9#include <kiconloader.h> 9#include <kiconloader.h>
10#include <kapplication.h> 10#include <kapplication.h>
11 11
12#ifdef DESKTOP_VERSION 12#ifdef DESKTOP_VERSION
13#include <qapplication.h> 13#include <qapplication.h>
14#include <qstatusbar.h> 14#include <qstatusbar.h>
15#include <kabc/stdaddressbook.h> 15#include <kabc/stdaddressbook.h>
16extern QStatusBar* globalSstatusBarMainWindow; 16extern QStatusBar* globalSstatusBarMainWindow;
17#else 17#else
18#include <qpe/qpeapplication.h> 18#include <qpe/qpeapplication.h>
19#include <klocale.h> 19#include <klocale.h>
20#endif 20#endif
21#include "defines.h" 21#include "defines.h"
22#include "koprefs.h" 22#include "koprefs.h"
23#include "mainwindow.h" 23#include "mainwindow.h"
24#include "mailistviewitem.h" 24#include "mailistviewitem.h"
25#include <KDGanttMinimizeSplitter.h> 25#include <KDGanttMinimizeSplitter.h>
26#include <libkdepim/kpimglobalprefs.h> 26#include <libkdepim/kpimglobalprefs.h>
27 27
28#include "koprefs.h" 28#include "koprefs.h"
29 29
30MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 30MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
31 : QMainWindow( parent, name ) //, flags ) 31 : QMainWindow( parent, name ) //, flags )
32{ 32{
33#ifdef DESKTOP_VERSION 33#ifdef DESKTOP_VERSION
34 globalSstatusBarMainWindow = statusBar(); 34 globalSstatusBarMainWindow = statusBar();
35#endif 35#endif
36 setCaption( i18n( "KOpieMail/Pi" ) ); 36 setCaption( i18n( "KOpieMail/Pi" ) );
37 setToolBarsMovable( false ); 37 setToolBarsMovable( false );
38 //KABC::StdAddressBook::self(); 38 //KABC::StdAddressBook::self();
39 toolBar = new QToolBar( this ); 39 toolBar = new QToolBar( this );
40 menuBar = new QPEMenuBar( toolBar ); 40 menuBar = new QPEMenuBar( toolBar );
41 mailMenu = new QPopupMenu( menuBar ); 41 mailMenu = new QPopupMenu( menuBar );
42 menuBar->insertItem( i18n( "Mail" ), mailMenu ); 42 menuBar->insertItem( i18n( "Mail" ), mailMenu );
43 settingsMenu = new QPopupMenu( menuBar ); 43 settingsMenu = new QPopupMenu( menuBar );
44 menuBar->insertItem( i18n( "Settings" ), settingsMenu ); 44 menuBar->insertItem( i18n( "Settings" ), settingsMenu );
45 45
46 addToolBar( toolBar ); 46 addToolBar( toolBar );
47 toolBar->setHorizontalStretchable( true ); 47 toolBar->setHorizontalStretchable( true );
48 QAction* getMail = new QAction( i18n( "Get all new mails" ), SmallIcon("enter"), 48 QAction* getMail = new QAction( i18n( "Get all new mails" ), SmallIcon("enter"),
49 0, 0, this ); 49 0, 0, this );
50 connect(getMail, SIGNAL( activated() ), 50 connect(getMail, SIGNAL( activated() ),
51 SLOT( slotGetAllMail() ) ); 51 SLOT( slotGetAllMail() ) );
52 getMail->addTo( mailMenu ); 52 getMail->addTo( mailMenu );
53 53
54 getMail = new QAction( i18n( "Get new messages" ), SmallIcon("add"), 54 getMail = new QAction( i18n( "Get new messages" ), SmallIcon("add"),
55 0, 0, this ); 55 0, 0, this );
56 getMail->addTo( toolBar ); 56 getMail->addTo( toolBar );
57 getMail->addTo( mailMenu ); 57 getMail->addTo( mailMenu );
58 connect(getMail, SIGNAL( activated() ), 58 connect(getMail, SIGNAL( activated() ),
59 SLOT( slotGetMail() ) ); 59 SLOT( slotGetMail() ) );
60 60
61 composeMail = new QAction( i18n( "Compose new mail" ), SmallIcon("composemail"), 61 composeMail = new QAction( i18n( "Compose new mail" ), SmallIcon("composemail"),
62 0, 0, this ); 62 0, 0, this );
63 composeMail->addTo( toolBar ); 63 composeMail->addTo( toolBar );
64 composeMail->addTo( mailMenu ); 64 composeMail->addTo( mailMenu );
65 65
66 sendQueued = new QAction( i18n( "Send queued mails" ), SmallIcon("sendqueued") , 66 sendQueued = new QAction( i18n( "Send queued mails" ), SmallIcon("sendqueued") ,
67 0, 0, this ); 67 0, 0, this );
68 sendQueued->addTo( toolBar ); 68 sendQueued->addTo( toolBar );
69 sendQueued->addTo( mailMenu ); 69 sendQueued->addTo( mailMenu );
70 70
71 /* 71 /*
72 syncFolders = new QAction( i18n( "Sync mailfolders" ), ICON_SYNC, 72 syncFolders = new QAction( i18n( "Sync mailfolders" ), ICON_SYNC,
73 0, 0, this ); 73 0, 0, this );
74 syncFolders->addTo( toolBar ); 74 syncFolders->addTo( toolBar );
75 syncFolders->addTo( mailMenu ); 75 syncFolders->addTo( mailMenu );
76 */ 76 */
77 77
78 showFolders = new QAction( i18n( "Show/Hide folders" ), SmallIcon("showfolders") , 78 showFolders = new QAction( i18n( "Show/Hide folders" ), SmallIcon("showfolders") ,
79 0, 0, this, 0, true ); 79 0, 0, this, 0, true );
80 showFolders->addTo( toolBar ); 80 showFolders->addTo( toolBar );
81 showFolders->addTo( mailMenu ); 81 showFolders->addTo( mailMenu );
82 showFolders->setOn( true ); 82 showFolders->setOn( true );
83 connect(showFolders, SIGNAL( toggled(bool) ), 83 connect(showFolders, SIGNAL( toggled(bool) ),
84 SLOT( slotShowFolders(bool) ) ); 84 SLOT( slotShowFolders(bool) ) );
85 85
86 /* 86 /*
87 searchMails = new QAction( i18n( "Search mails" ), SmallIcon("find") ), 87 searchMails = new QAction( i18n( "Search mails" ), SmallIcon("find") ),
88 0, 0, this ); 88 0, 0, this );
89 searchMails->kopddTo( toolBar ); 89 searchMails->kopddTo( toolBar );
90 searchMails->addTo( mailMenu ); 90 searchMails->addTo( mailMenu );
91 */ 91 */
92 92
93 deleteMails = new QAction(i18n("Delete Mail"), SmallIcon("trash"), 0, 0, this); 93 deleteMails = new QAction(i18n("Delete Mail"), SmallIcon("trash"), 0, 0, this);
94 deleteMails->addTo( toolBar ); 94 deleteMails->addTo( toolBar );
95 deleteMails->addTo( mailMenu ); 95 deleteMails->addTo( mailMenu );
96 connect( deleteMails, SIGNAL( activated() ), 96 connect( deleteMails, SIGNAL( activated() ),
97 SLOT( slotDeleteAllMail() ) ); 97 SLOT( slotDeleteAllMail() ) );
98 98
99 editSettings = new QAction( i18n( "Configure OM/Pi..." ), SmallIcon("SettingsIcon") , 99 editSettings = new QAction( i18n( "Configure OM/Pi..." ), SmallIcon("SettingsIcon") ,
100 0, 0, this ); 100 0, 0, this );
101 editSettings->addTo( settingsMenu ); 101 editSettings->addTo( settingsMenu );
102 connect( editSettings, SIGNAL( activated() ), 102 connect( editSettings, SIGNAL( activated() ),
103 SLOT( slotEditSettings() ) ); 103 SLOT( slotEditSettings() ) );
104 104
105 105
106 QAction * editSettings2 = new QAction( i18n( "Global Settings..." ), SmallIcon("SettingsIcon") , 106 QAction * editSettings2 = new QAction( i18n( "Global Settings..." ), SmallIcon("SettingsIcon") ,
107 0, 0, this ); 107 0, 0, this );
108 editSettings2->addTo( settingsMenu ); 108 editSettings2->addTo( settingsMenu );
109 connect( editSettings2, SIGNAL( activated() ), 109 connect( editSettings2, SIGNAL( activated() ),
110 SLOT( slotEditGlobalSettings() ) ); 110 SLOT( slotEditGlobalSettings() ) );
111 111
112 112
113 113
114 editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") , 114 editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") ,
115 0, 0, this ); 115 0, 0, this );
116 editAccounts->addTo( settingsMenu ); 116 editAccounts->addTo( settingsMenu );
117 codecMenu = new QPopupMenu( menuBar ); 117 codecMenu = new QPopupMenu( menuBar );
118 codecMenu->insertItem( "Western (iso-8859-1)",0,0); 118 codecMenu->insertItem( "Western (iso-8859-1)",0,0);
119 codecMenu->insertItem( "Cyrillic (iso-8859-5)",1,1); 119 codecMenu->insertItem( "Cyrillic (iso-8859-5)",1,1);
120 codecMenu->insertItem( "Western (iso-8859-15)",2,2); 120 codecMenu->insertItem( "Western (iso-8859-15)",2,2);
121 codecMenu->insertItem( "Chinese (big-5)",3,3); 121 codecMenu->insertItem( "Chinese (big-5)",3,3);
122 codecMenu->insertItem( "Unicode (utf-8)",4,4); 122 codecMenu->insertItem( "Unicode (utf-8)",4,4);
123 codecMenu->insertItem( "Userdefined ("+KOPrefs::instance()->mSendCodec+")",5,5); 123 codecMenu->insertItem( "Userdefined ("+KOPrefs::instance()->mSendCodec+")",5,5);
124 //disabled 124 //disabled
125 //settingsMenu->insertItem( i18n("Codec for new mails"), codecMenu); 125 //settingsMenu->insertItem( i18n("Codec for new mails"), codecMenu);
126 //setCentralWidget( view ); 126 //setCentralWidget( view );
127 127
128 QVBox* wrapperBox = new QVBox( this ); 128 QVBox* wrapperBox = new QVBox( this );
129 setCentralWidget( wrapperBox ); 129 setCentralWidget( wrapperBox );
130 130
131 // QWidget *view = new QWidget( wrapperBox ); 131 // QWidget *view = new QWidget( wrapperBox );
132 KDGanttMinimizeSplitter* splithor = new KDGanttMinimizeSplitter( Qt::Vertical, wrapperBox); 132 KDGanttMinimizeSplitter* splithor = new KDGanttMinimizeSplitter( Qt::Vertical, wrapperBox);
133 splithor->setMinimizeDirection( KDGanttMinimizeSplitter::Down); 133 splithor->setMinimizeDirection( KDGanttMinimizeSplitter::Down);
134 KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, splithor); 134 KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, splithor);
135 split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); 135 split->setMinimizeDirection( KDGanttMinimizeSplitter::Left);
136 //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); 136 //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight );
137 subLE = 0; 137 subLE = 0;
138 fromLE = 0; 138 fromLE = 0;
139 toLE = 0; 139 toLE = 0;
140 if ( KOPrefs::instance()->mShowInfoSub || KOPrefs::instance()->mShowInfoFrom || KOPrefs::instance()->mShowInfoTo ) { 140 if ( KOPrefs::instance()->mShowInfoSub || KOPrefs::instance()->mShowInfoFrom || KOPrefs::instance()->mShowInfoTo ) {
141 QWidget* infoBox = new QWidget( splithor ); 141 QWidget* infoBox = new QWidget( splithor );
142 QGridLayout *griLay = new QGridLayout( infoBox, 2,2); 142 QGridLayout *griLay = new QGridLayout( infoBox, 2,2);
143 if ( KOPrefs::instance()->mShowInfoSub ) { 143 if ( KOPrefs::instance()->mShowInfoSub ) {
144 griLay->addWidget( new QLabel ( i18n("Su:"), infoBox ),0,0 ); 144 griLay->addWidget( new QLabel ( i18n("Su:"), infoBox ),0,0 );
145 griLay->addWidget( subLE = new QLineEdit( infoBox ),0,1) ; 145 griLay->addWidget( subLE = new QLineEdit( infoBox ),0,1) ;
146 } 146 }
147 if ( KOPrefs::instance()->mShowInfoFrom ) { 147 if ( KOPrefs::instance()->mShowInfoFrom ) {
148 griLay->addWidget( new QLabel ( i18n("Fr:"), infoBox ),1,0 ); 148 griLay->addWidget( new QLabel ( i18n("Fr:"), infoBox ),1,0 );
149 griLay->addWidget( fromLE = new QLineEdit( infoBox ),1,1) ; 149 griLay->addWidget( fromLE = new QLineEdit( infoBox ),1,1) ;
150 } 150 }
151 if ( KOPrefs::instance()->mShowInfoTo ) { 151 if ( KOPrefs::instance()->mShowInfoTo ) {
152 griLay->addWidget( new QLabel ( i18n("To:"), infoBox ),2,0 ); 152 griLay->addWidget( new QLabel ( i18n("To:"), infoBox ),2,0 );
153 griLay->addWidget( toLE = new QLineEdit( infoBox ),2,1) ; 153 griLay->addWidget( toLE = new QLineEdit( infoBox ),2,1) ;
154 } 154 }
155 infoBox->setMaximumHeight( infoBox->sizeHint().height() ); 155 infoBox->setMaximumHeight( infoBox->sizeHint().height() );
156 if ( !KOPrefs::instance()->mShowInfoStart ) { 156 if ( !KOPrefs::instance()->mShowInfoStart ) {
157 QTimer::singleShot( 1,splithor, SLOT ( toggle() ) ); 157 QTimer::singleShot( 1,splithor, SLOT ( toggle() ) );
158 } 158 }
159 } 159 }
160 160
161 161
162 folderView = new AccountView( split ); 162 folderView = new AccountView( split );
163 folderView->header()->hide(); 163 folderView->header()->hide();
164 folderView->setRootIsDecorated( false ); 164 folderView->setRootIsDecorated( false );
165 folderView->addColumn( i18n( "Mailbox" ) ); 165 folderView->addColumn( i18n( "Mailbox" ) );
166 166
167 //layout->addWidget( folderView ); 167 //layout->addWidget( folderView );
168 168
169 mailView = new KListView( split ); 169 mailView = new KListView( split );
170 mailView->addColumn( i18n( " " ) ); 170 mailView->addColumn( i18n( " " ) );
171 mailView->addColumn( i18n( "Subject" ),QListView::Manual ); 171 mailView->addColumn( i18n( "Subject" ),QListView::Manual );
172 mailView->addColumn( i18n( "Sender" ),QListView::Manual ); 172 mailView->addColumn( i18n( "Sender" ),QListView::Manual );
173 mailView->addColumn( i18n( "Size" ),QListView::Manual); 173 mailView->addColumn( i18n( "Size" ),QListView::Manual);
174 mailView->addColumn( i18n( "Date" ),QListView::Manual); 174 mailView->addColumn( i18n( "Date" ),QListView::Manual);
175 if ( KOPrefs::instance()->mShowToField ) 175 if ( KOPrefs::instance()->mShowToField )
176 mailView->addColumn( i18n( "To" ),QListView::Manual); 176 mailView->addColumn( i18n( "To" ),QListView::Manual);
177 mailView->setAllColumnsShowFocus(true); 177 mailView->setAllColumnsShowFocus(true);
178 //mailView->setSorting(-1); 178 //mailView->setSorting(-1);
179 mailView->setRootIsDecorated( false ); 179 mailView->setRootIsDecorated( false );
180 statusWidget = new StatusWidget( wrapperBox ); 180 statusWidget = new StatusWidget( wrapperBox );
181 statusWidget->hide(); 181 statusWidget->hide();
182 mailView->setSelectionMode( QListView::Multi ); 182 mailView->setSelectionMode( QListView::Multi );
183 mailView->setMultiSelection( true); 183 mailView->setMultiSelection( true);
184 mailView->setAlternateBackground(KPimGlobalPrefs::instance()->mAlternateColor ); 184 mailView->setAlternateBackground(KPimGlobalPrefs::instance()->mAlternateColor );
185 //layout->addWidget( mailView ); 185 //layout->addWidget( mailView );
186 //layout->setStretchFactor( folderView, 1 ); 186 //layout->setStretchFactor( folderView, 1 );
187 //layout->setStretchFactor( mailView, 2 ); 187 //layout->setStretchFactor( mailView, 2 );
188 188
189 slotAdjustLayout(); 189 slotAdjustLayout();
190#ifndef DESKTOP_VERSION 190#ifndef DESKTOP_VERSION
191 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); 191 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold);
192 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); 192 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold);
193 if ( subLE ) 193 if ( subLE )
194 QPEApplication::setStylusOperation( subLE ,QPEApplication::RightOnHold); 194 QPEApplication::setStylusOperation( subLE ,QPEApplication::RightOnHold);
195 if ( fromLE ) 195 if ( fromLE )
196 QPEApplication::setStylusOperation( fromLE ,QPEApplication::RightOnHold); 196 QPEApplication::setStylusOperation( fromLE ,QPEApplication::RightOnHold);
197 if ( toLE ) 197 if ( toLE )
198 QPEApplication::setStylusOperation( toLE ,QPEApplication::RightOnHold); 198 QPEApplication::setStylusOperation( toLE ,QPEApplication::RightOnHold);
199#endif 199#endif
200 connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, 200 connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this,
201 SLOT( mailLeftClicked(QListViewItem*) ) ); 201 SLOT( mailLeftClicked(QListViewItem*) ) );
202 connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, 202 connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this,
203 SLOT( mailLeftClicked(QListViewItem*) ) ); 203 SLOT( mailLeftClicked(QListViewItem*) ) );
204 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, 204 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
205 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); 205 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) );
206 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), 206 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)),
207 this,SLOT(refreshMailView(const QValueList<RecMailP>&))); 207 this,SLOT(refreshMailView(const QValueList<RecMailP>&)));
208 208
209 connect( mailView, SIGNAL( currentChanged (QListViewItem* )),this, 209 connect( mailView, SIGNAL( currentChanged (QListViewItem* )),this,
210 SLOT( setInfoFields(QListViewItem*) ) ); 210 SLOT( setInfoFields(QListViewItem*) ) );
211 211
212 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); 212 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
213 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); 213 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
214// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); 214// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
215 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); 215 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
216 //mailView->setMultiSelection ( true ); 216 //mailView->setMultiSelection ( true );
217 //mailView->setSelectionMode( QListView::Extended ); 217 //mailView->setSelectionMode( QListView::Extended );
218 QValueList<int> list; 218 QValueList<int> list;
219 int fw = 100; 219 int fw = 100;
220 if ( QApplication::desktop()->width() > 320 ) 220 if ( QApplication::desktop()->width() > 320 )
221 fw = 50; 221 fw = 50;
222 list.append( fw ); 222 list.append( fw );
223 list.append( 100 ); 223 list.append( 100 );
224 split->setSizes( list ); 224 split->setSizes( list );
225 QTimer::singleShot( 100, this, SLOT( slotAdjustColumns() ) ); 225 QTimer::singleShot( 100, this, SLOT( slotAdjustColumns() ) );
226 mailView->setShowSortIndicator ( true ); 226 mailView->setShowSortIndicator ( true );
227 QLabel *spacer = new QLabel( toolBar ); 227 QLabel *spacer = new QLabel( toolBar );
228 spacer->setBackgroundMode( QWidget::PaletteButton ); 228 spacer->setBackgroundMode( QWidget::PaletteButton );
229 toolBar->setStretchableWidget( spacer ); 229 toolBar->setStretchableWidget( spacer );
230 230
231 QAction* closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this); 231 QAction* closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this);
232 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); 232 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) );
233 if ( QApplication::desktop()->width() > 320 ) 233 if ( QApplication::desktop()->width() > 320 )
234 closeMail->addTo(toolBar); 234 closeMail->addTo(toolBar);
235 closeMail->addTo(mailMenu); 235 closeMail->addTo(mailMenu);
236 236
237 237
238 QPopupMenu* helpMenu = new QPopupMenu( menuBar ); 238 QPopupMenu* helpMenu = new QPopupMenu( menuBar );
239 menuBar->insertItem( i18n( "Help" ), helpMenu ); 239 menuBar->insertItem( i18n( "Help" ), helpMenu );
240 QAction* li = new QAction(i18n("About"), QPixmap(), 0, 0, this); 240 QAction* li = new QAction(i18n("About"), QPixmap(), 0, 0, this);
241 connect( li, SIGNAL( activated() ), SLOT( showAbout()) ); 241 connect( li, SIGNAL( activated() ), SLOT( showAbout()) );
242 li->addTo(helpMenu); 242 li->addTo(helpMenu);
243 li = new QAction(i18n("Licence"),QPixmap(), 0, 0, this); 243 li = new QAction(i18n("Licence"),QPixmap(), 0, 0, this);
244 connect( li, SIGNAL( activated() ), SLOT( showLicence()) ); 244 connect( li, SIGNAL( activated() ), SLOT( showLicence()) );
245 li->addTo(helpMenu); 245 li->addTo(helpMenu);
246 li = new QAction(i18n("LibEtPan Licence"), QPixmap(), 0, 0, this); 246 li = new QAction(i18n("LibEtPan Licence"), QPixmap(), 0, 0, this);
247 connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) ); 247 connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) );
248 li->addTo(helpMenu); 248 li->addTo(helpMenu);
249 connect( codecMenu, SIGNAL( activated(int) ), this, SLOT( slotSetCodec( int )) ); 249 connect( codecMenu, SIGNAL( activated(int) ), this, SLOT( slotSetCodec( int )) );
250 slotSetCodec( KOPrefs::instance()->mCurrentCodec ); 250 slotSetCodec( KOPrefs::instance()->mCurrentCodec );
251 menuBar->setMaximumWidth( menuBar->sizeHint().width()); 251 menuBar->setMaximumWidth( menuBar->sizeHint().width());
252 //menuBar->setMaximumSize( menuBar->sizeHint()); 252 //menuBar->setMaximumSize( menuBar->sizeHint());
253#ifdef DESKTOP_VERSION 253#ifdef DESKTOP_VERSION
254 resize ( 640, 480 ); 254 resize ( 640, 480 );
255#endif 255#endif
256} 256}
257 257
258MainWindow::~MainWindow() 258MainWindow::~MainWindow()
259{ 259{
260} 260}
261 261
262void MainWindow::setInfoFields(QListViewItem* item ) 262void MainWindow::setInfoFields(QListViewItem* item )
263{ 263{
264 if ( item == 0) { 264 if ( item == 0) {
265 if ( subLE ) subLE->setText(""); 265 if ( subLE ) subLE->setText("");
266 if ( fromLE ) fromLE->setText(""); 266 if ( fromLE ) fromLE->setText("");
267 if ( toLE ) toLE->setText(""); 267 if ( toLE ) toLE->setText("");
268 return; 268 return;
269 } 269 }
270 RecMailP mail = ((MailListViewItem*)item)->data(); 270 RecMailP mail = ((MailListViewItem*)item)->data();
271 if ( subLE ) subLE->setText(mail->getSubject()); 271 if ( subLE ) subLE->setText(mail->getSubject());
272 if ( fromLE ) fromLE->setText(mail->getFrom()); 272 if ( fromLE ) fromLE->setText(mail->getFrom());
273 if ( toLE ) toLE->setText(mail->To().join(";" )); 273 if ( toLE ) toLE->setText(mail->To().join(";" ));
274 if ( subLE ) subLE->setCursorPosition(0); 274 if ( subLE ) subLE->setCursorPosition(0);
275 if ( fromLE ) fromLE->setCursorPosition(0); 275 if ( fromLE ) fromLE->setCursorPosition(0);
276 if ( toLE ) toLE->setCursorPosition(0); 276 if ( toLE ) toLE->setCursorPosition(0);
277 277
278} 278}
279void MainWindow::slotSetCodec( int codec ) 279void MainWindow::slotSetCodec( int codec )
280{ 280{
281 codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, false ); 281 codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, false );
282 //qDebug("codec %d ", codec); 282 //qDebug("codec %d ", codec);
283 KOPrefs::instance()->mCurrentCodec = codec; 283 KOPrefs::instance()->mCurrentCodec = codec;
284 KOPrefs::instance()->isDirty = true; 284 KOPrefs::instance()->isDirty = true;
285 QString name; 285 QString name;
286 switch ( codec ) { 286 switch ( codec ) {
287 case 0: 287 case 0:
288 name = "iso-8859-1"; 288 name = "iso-8859-1";
289 break; 289 break;
290 case 1: 290 case 1:
291 name = "iso-8859-5"; 291 name = "iso-8859-5";
292 break; 292 break;
293 case 2: 293 case 2:
294 name = "iso-8859-15"; 294 name = "iso-8859-15";
295 break; 295 break;
296 case 3: 296 case 3:
297 name = "big-5"; 297 name = "big-5";
298 break; 298 break;
299 case 4: 299 case 4:
300 name = "utf-8"; 300 name = "utf-8";
301 break; 301 break;
302 case 5: 302 case 5:
303 name = KOPrefs::instance()->mSendCodec.lower(); 303 name = KOPrefs::instance()->mSendCodec.lower();
304 break; 304 break;
305 } 305 }
306 KOPrefs::instance()->mCurrentCodeName = name ; 306 KOPrefs::instance()->mCurrentCodeName = name ;
307 codecMenu->changeItem ( 5, "Userdefined ("+KOPrefs::instance()->mSendCodec+")"); 307 codecMenu->changeItem ( 5, "Userdefined ("+KOPrefs::instance()->mSendCodec+")");
308 codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, true ); 308 codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, true );
309} 309}
310void MainWindow::showLicence() 310void MainWindow::showLicence()
311{ 311{
312 KApplication::showLicence(); 312 KApplication::showLicence();
313} 313}
314void MainWindow::showAbout() 314void MainWindow::showAbout()
315{ 315{
316 QString version; 316 QString version;
317#include <../version> 317#include <../version>
318 318
319 QString cap = "About KOpieMail/Pi"; 319 QString cap = "About KOpieMail/Pi";
320 QString text =i18n("KOpieMail/Platform-independent\n") + 320 QString text =i18n("KOpieMail/Platform-independent\n") +
321 "(OM/Pi) " + version + " - " 321 "(OM/Pi) " + version + " - "
322 322
323#ifdef DESKTOP_VERSION 323#ifdef DESKTOP_VERSION
324 "Desktop Edition\n" 324 "Desktop Edition\n"
325#else 325#else
326 "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n" 326 "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n"
327#endif 327#endif
328 "www.pi-sync.info\n\n" 328 "www.pi-sync.info\n\n"
329 329
330 330
331 331
332"Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.info>\n" 332"Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.info>\n"
333 "KOpieMail/Pi is based on Opie Mail\n" 333 "KOpieMail/Pi is based on Opie Mail\n"
334 "Copyright (c) Rajko Albrecht and the Opie team\n" 334 "Copyright (c) Rajko Albrecht and the Opie team\n"
335 "KOpieMail/Pi is licensed under the GPL\n" 335 "KOpieMail/Pi is licensed under the GPL\n"
336 "\n" 336 "\n"
337 "KOpieMail/Pi uses LibEtPan - a mail stuff library\n" 337 "KOpieMail/Pi uses LibEtPan - a mail stuff library\n"
338 "Copyright (C) 2001, 2002 - DINH Viet Hoa\n" 338 "Copyright (C) 2001, 2002 - DINH Viet Hoa\n"
339 "libEtPan has its own licence - see LibEtPan licence\n"; 339 "libEtPan has its own licence - see LibEtPan licence\n";
340 340
341 KApplication::showText( cap, text ); 341 KApplication::showText( cap, text );
342} 342}
343void MainWindow::showEtpanLicence() 343void MainWindow::showEtpanLicence()
344{ 344{
345 KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" ); 345 KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" );
346 346
347} 347}
348void MainWindow::appMessage(const QCString &, const QByteArray &) 348void MainWindow::appMessage(const QCString &, const QByteArray &)
349{ 349{
350 qDebug("appMessage implemented by subclass"); 350 qDebug("appMessage implemented by subclass");
351} 351}
352 352
353void MainWindow::slotAdjustLayout() { 353void MainWindow::slotAdjustLayout() {
354 354
355 /* 355 /*
356 QWidget *d = QApplication::desktop(); 356 QWidget *d = QApplication::desktop();
357 357
358 if ( d->width() < d->height() ) { 358 if ( d->width() < d->height() ) {
359 layout->setDirection( QBoxLayout::TopToBottom ); 359 layout->setDirection( QBoxLayout::TopToBottom );
360 } else { 360 } else {
361 layout->setDirection( QBoxLayout::LeftToRight ); 361 layout->setDirection( QBoxLayout::LeftToRight );
362 } 362 }
363 */ 363 */
364} 364}
365 365
366void MainWindow::slotAdjustColumns() 366void MainWindow::slotAdjustColumns()
367{ 367{
368 368
369 if ( !folderView->isHidden() ) 369 if ( !folderView->isHidden() )
370 folderView->setColumnWidth( 0, folderView->visibleWidth() ); 370 folderView->setColumnWidth( 0, folderView->visibleWidth() );
371 371
372 mailView->setColumnWidth( 0, 10 ); 372 mailView->setColumnWidth( 0, 10 );
373 mailView->setColumnWidth( 1, 100 ); 373 mailView->setColumnWidth( 1, 100 );
374 mailView->setColumnWidth( 2, 100 ); 374 mailView->setColumnWidth( 2, 100 );
375 mailView->setColumnWidth( 3, 70 ); 375 mailView->setColumnWidth( 3, 70 );
376 mailView->setColumnWidth( 4, 180 ); 376 mailView->setColumnWidth( 4, 180 );
377 if ( KOPrefs::instance()->mShowToField ) 377 if ( KOPrefs::instance()->mShowToField )
378 mailView->setColumnWidth( 5, 100 ); 378 mailView->setColumnWidth( 5, 100 );
379 mailView->setColumnAlignment( 3, AlignRight); 379 mailView->setColumnAlignment( 3, AlignRight);
380 mailView->setColumnAlignment( 4, AlignRight);
381} 380}
382void MainWindow::slotAdjustColumnsWide() 381void MainWindow::slotAdjustColumnsWide()
383{ 382{
384 if ( !folderView->isHidden() ) 383 if ( !folderView->isHidden() )
385 folderView->setColumnWidth( 0, folderView->visibleWidth() ); 384 folderView->setColumnWidth( 0, folderView->visibleWidth() );
386 385
387 mailView->setColumnWidth( 0, 10 ); 386 mailView->setColumnWidth( 0, 10 );
388 mailView->setColumnWidth( 1, 200 ); 387 mailView->setColumnWidth( 1, 200 );
389 mailView->setColumnWidth( 2, 200 ); 388 mailView->setColumnWidth( 2, 200 );
390 mailView->setColumnWidth( 3, 70 ); 389 mailView->setColumnWidth( 3, 70 );
391 mailView->setColumnWidth( 4, 180 ); 390 mailView->setColumnWidth( 4, 180 );
392 if ( KOPrefs::instance()->mShowToField ) 391 if ( KOPrefs::instance()->mShowToField )
393 mailView->setColumnWidth( 5, 100 ); 392 mailView->setColumnWidth( 5, 100 );
394 mailView->setColumnAlignment( 3, AlignRight); 393 mailView->setColumnAlignment( 3, AlignRight);
395} 394}
396 395
397void MainWindow::slotEditSettings() 396void MainWindow::slotEditSettings()
398{ 397{
399} 398}
400void MainWindow::slotEditGlobalSettings() 399void MainWindow::slotEditGlobalSettings()
401{ 400{
402} 401}
403 402
404void MainWindow::slotShowFolders( bool ) 403void MainWindow::slotShowFolders( bool )
405{ 404{
406 qDebug("not implemented: "); 405 qDebug("not implemented: ");
407} 406}
408 407
409void MainWindow::refreshMailView(const QValueList<RecMailP>&) 408void MainWindow::refreshMailView(const QValueList<RecMailP>&)
410{ 409{
411 qDebug("not implemented: "); 410 qDebug("not implemented: ");
412} 411}
413 412
414void MainWindow::mailLeftClicked(QListViewItem * ) 413void MainWindow::mailLeftClicked(QListViewItem * )
415{ 414{
416 qDebug("not implemented: "); 415 qDebug("not implemented: ");
417} 416}
418 417
419void MainWindow::displayMail() 418void MainWindow::displayMail()
420{ 419{
421 qDebug("not implemented: "); 420 qDebug("not implemented: ");
422} 421}
423 422
424void MainWindow::slotDeleteMail() 423void MainWindow::slotDeleteMail()
425{ 424{
426 qDebug("not implemented: "); 425 qDebug("not implemented: ");
427} 426}
428 427
429void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) 428void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int )
430{ 429{
431 qDebug("not implemented: "); 430 qDebug("not implemented: ");
432} 431}
433 432
434void MainWindow::slotSendQueued() 433void MainWindow::slotSendQueued()
435{ 434{
436 qDebug("not implemented: "); 435 qDebug("not implemented: ");
437} 436}
438 437
439void MainWindow::slotEditAccounts() 438void MainWindow::slotEditAccounts()
440{ 439{
441 qDebug("not implemented: "); 440 qDebug("not implemented: ");
442} 441}
443 442
444void MainWindow::slotComposeMail() 443void MainWindow::slotComposeMail()
445{ 444{
446 qDebug("not implemented: "); 445 qDebug("not implemented: ");
447} 446}