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