summaryrefslogtreecommitdiffabout
path: root/kmicromail/mainwindow.cpp
Unidiff
Diffstat (limited to 'kmicromail/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/mainwindow.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp
index 24196b4..e020297 100644
--- a/kmicromail/mainwindow.cpp
+++ b/kmicromail/mainwindow.cpp
@@ -1,265 +1,290 @@
1#include <qlabel.h> 1#include <qlabel.h>
2#include <qvbox.h> 2#include <qvbox.h>
3#include <qheader.h> 3#include <qheader.h>
4#include <qtimer.h> 4#include <qtimer.h>
5#include <qlayout.h> 5#include <qlayout.h>
6#include <kdialog.h> 6#include <kdialog.h>
7#include <kiconloader.h> 7#include <kiconloader.h>
8#include <kapplication.h> 8#include <kapplication.h>
9 9
10#ifndef DESKTOP_VERSION 10#ifndef DESKTOP_VERSION
11#include <qpe/qpeapplication.h> 11#include <qpe/qpeapplication.h>
12#endif 12#endif
13#include "defines.h" 13#include "defines.h"
14#include "mainwindow.h" 14#include "mainwindow.h"
15#include <KDGanttMinimizeSplitter.h> 15#include <KDGanttMinimizeSplitter.h>
16 16
17 17
18#include <kabc/stdaddressbook.h> 18#include <kabc/stdaddressbook.h>
19 19
20MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 20MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
21 : QMainWindow( parent, name ) //, flags ) 21 : QMainWindow( parent, name ) //, flags )
22{ 22{
23 setCaption( tr( "OpieMail/Pi" ) ); 23 setCaption( tr( "OpieMail/Pi" ) );
24 setToolBarsMovable( false ); 24 setToolBarsMovable( false );
25 KABC::StdAddressBook::self(); 25 KABC::StdAddressBook::self();
26 toolBar = new QToolBar( this ); 26 toolBar = new QToolBar( this );
27 menuBar = new QMenuBar( toolBar ); 27 menuBar = new QMenuBar( toolBar );
28 mailMenu = new QPopupMenu( menuBar ); 28 mailMenu = new QPopupMenu( menuBar );
29 menuBar->insertItem( tr( "Mail" ), mailMenu ); 29 menuBar->insertItem( tr( "Mail" ), mailMenu );
30 settingsMenu = new QPopupMenu( menuBar ); 30 settingsMenu = new QPopupMenu( menuBar );
31 menuBar->insertItem( tr( "Settings" ), settingsMenu ); 31 menuBar->insertItem( tr( "Settings" ), settingsMenu );
32 32
33 addToolBar( toolBar ); 33 addToolBar( toolBar );
34 toolBar->setHorizontalStretchable( true ); 34 toolBar->setHorizontalStretchable( true );
35 35
36 36
37 37
38 composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"), 38 composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"),
39 0, 0, this ); 39 0, 0, this );
40 composeMail->addTo( toolBar ); 40 composeMail->addTo( toolBar );
41 composeMail->addTo( mailMenu ); 41 composeMail->addTo( mailMenu );
42 42
43 sendQueued = new QAction( tr( "Send queued mails" ), SmallIcon("sendqueued") , 43 sendQueued = new QAction( tr( "Send queued mails" ), SmallIcon("sendqueued") ,
44 0, 0, this ); 44 0, 0, this );
45 sendQueued->addTo( toolBar ); 45 sendQueued->addTo( toolBar );
46 sendQueued->addTo( mailMenu ); 46 sendQueued->addTo( mailMenu );
47 47
48 /* 48 /*
49 syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, 49 syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC,
50 0, 0, this ); 50 0, 0, this );
51 syncFolders->addTo( toolBar ); 51 syncFolders->addTo( toolBar );
52 syncFolders->addTo( mailMenu ); 52 syncFolders->addTo( mailMenu );
53 */ 53 */
54 54
55 showFolders = new QAction( tr( "Show/Hide folders" ), SmallIcon("showfolders") , 55 showFolders = new QAction( tr( "Show/Hide folders" ), SmallIcon("showfolders") ,
56 0, 0, this, 0, true ); 56 0, 0, this, 0, true );
57 showFolders->addTo( toolBar ); 57 showFolders->addTo( toolBar );
58 showFolders->addTo( mailMenu ); 58 showFolders->addTo( mailMenu );
59 showFolders->setOn( true ); 59 showFolders->setOn( true );
60 connect(showFolders, SIGNAL( toggled(bool) ), 60 connect(showFolders, SIGNAL( toggled(bool) ),
61 SLOT( slotShowFolders(bool) ) ); 61 SLOT( slotShowFolders(bool) ) );
62 62
63 /* 63 /*
64 searchMails = new QAction( tr( "Search mails" ), SmallIcon("find") ), 64 searchMails = new QAction( tr( "Search mails" ), SmallIcon("find") ),
65 0, 0, this ); 65 0, 0, this );
66 searchMails->addTo( toolBar ); 66 searchMails->addTo( toolBar );
67 searchMails->addTo( mailMenu ); 67 searchMails->addTo( mailMenu );
68 */ 68 */
69 69
70 deleteMails = new QAction(tr("Delete Mail"), SmallIcon("trash"), 0, 0, this); 70 deleteMails = new QAction(tr("Delete Mail"), SmallIcon("trash"), 0, 0, this);
71 deleteMails->addTo( toolBar ); 71 deleteMails->addTo( toolBar );
72 deleteMails->addTo( mailMenu ); 72 deleteMails->addTo( mailMenu );
73 connect( deleteMails, SIGNAL( activated() ), 73 connect( deleteMails, SIGNAL( activated() ),
74 SLOT( slotDeleteMail() ) ); 74 SLOT( slotDeleteMail() ) );
75 75
76 editSettings = new QAction( tr( "Edit settings" ), SmallIcon("SettingsIcon") , 76 editSettings = new QAction( tr( "Edit settings" ), SmallIcon("SettingsIcon") ,
77 0, 0, this ); 77 0, 0, this );
78 editSettings->addTo( settingsMenu ); 78 editSettings->addTo( settingsMenu );
79 connect( editSettings, SIGNAL( activated() ), 79 connect( editSettings, SIGNAL( activated() ),
80 SLOT( slotEditSettings() ) ); 80 SLOT( slotEditSettings() ) );
81 editAccounts = new QAction( tr( "Configure accounts" ), SmallIcon("editaccounts") , 81 editAccounts = new QAction( tr( "Configure accounts" ), SmallIcon("editaccounts") ,
82 0, 0, this ); 82 0, 0, this );
83 editAccounts->addTo( settingsMenu ); 83 editAccounts->addTo( settingsMenu );
84 84
85 //setCentralWidget( view ); 85 //setCentralWidget( view );
86 86
87 QVBox* wrapperBox = new QVBox( this ); 87 QVBox* wrapperBox = new QVBox( this );
88 setCentralWidget( wrapperBox ); 88 setCentralWidget( wrapperBox );
89 89
90 // QWidget *view = new QWidget( wrapperBox ); 90 // QWidget *view = new QWidget( wrapperBox );
91 KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); 91 KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox);
92 split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); 92 split->setMinimizeDirection( KDGanttMinimizeSplitter::Left);
93 //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); 93 //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight );
94 94
95 folderView = new AccountView( split ); 95 folderView = new AccountView( split );
96 folderView->header()->hide(); 96 folderView->header()->hide();
97 folderView->setRootIsDecorated( false ); 97 folderView->setRootIsDecorated( false );
98 folderView->addColumn( tr( "Mailbox" ) ); 98 folderView->addColumn( tr( "Mailbox" ) );
99 99
100 //layout->addWidget( folderView ); 100 //layout->addWidget( folderView );
101 101
102 mailView = new QListView( split ); 102 mailView = new QListView( split );
103 mailView->addColumn( tr( " " ) ); 103 mailView->addColumn( tr( " " ) );
104 mailView->addColumn( tr( "Subject" ),QListView::Manual ); 104 mailView->addColumn( tr( "Subject" ),QListView::Manual );
105 mailView->addColumn( tr( "Sender" ),QListView::Manual ); 105 mailView->addColumn( tr( "Sender" ),QListView::Manual );
106 mailView->addColumn( tr( "Size" ),QListView::Manual); 106 mailView->addColumn( tr( "Size" ),QListView::Manual);
107 mailView->addColumn( tr( "Date" ),QListView::Manual); 107 mailView->addColumn( tr( "Date" ),QListView::Manual);
108 mailView->setAllColumnsShowFocus(true); 108 mailView->setAllColumnsShowFocus(true);
109 //mailView->setSorting(-1); 109 //mailView->setSorting(-1);
110 mailView->setRootIsDecorated( false ); 110 mailView->setRootIsDecorated( false );
111 statusWidget = new StatusWidget( wrapperBox ); 111 statusWidget = new StatusWidget( wrapperBox );
112 statusWidget->hide(); 112 statusWidget->hide();
113 113
114 //layout->addWidget( mailView ); 114 //layout->addWidget( mailView );
115 //layout->setStretchFactor( folderView, 1 ); 115 //layout->setStretchFactor( folderView, 1 );
116 //layout->setStretchFactor( mailView, 2 ); 116 //layout->setStretchFactor( mailView, 2 );
117 117
118 slotAdjustLayout(); 118 slotAdjustLayout();
119#ifndef DESKTOP_VERSION 119#ifndef DESKTOP_VERSION
120 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); 120 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold);
121 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); 121 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold);
122#endif 122#endif
123 connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, 123 connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this,
124 SLOT( mailLeftClicked(QListViewItem*) ) ); 124 SLOT( mailLeftClicked(QListViewItem*) ) );
125 connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, 125 connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this,
126 SLOT( mailLeftClicked(QListViewItem*) ) ); 126 SLOT( mailLeftClicked(QListViewItem*) ) );
127 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, 127 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
128 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); 128 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) );
129 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), 129 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)),
130 this,SLOT(refreshMailView(const QValueList<RecMailP>&))); 130 this,SLOT(refreshMailView(const QValueList<RecMailP>&)));
131 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); 131 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
132 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); 132 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
133// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); 133// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
134 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); 134 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
135 //mailView->setMultiSelection ( true ); 135 //mailView->setMultiSelection ( true );
136 mailView->setSelectionMode( QListView::Extended ); 136 mailView->setSelectionMode( QListView::Extended );
137 QValueList<int> list; 137 QValueList<int> list;
138 int fw = 100; 138 int fw = 100;
139 if ( QApplication::desktop()->width() > 320 ) 139 if ( QApplication::desktop()->width() > 320 )
140 fw = 50; 140 fw = 50;
141 list.append( fw ); 141 list.append( fw );
142 list.append( 100 ); 142 list.append( 100 );
143 split->setSizes( list ); 143 split->setSizes( list );
144 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); 144 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) );
145 mailView->setShowSortIndicator ( true ); 145 mailView->setShowSortIndicator ( true );
146 QLabel *spacer = new QLabel( toolBar ); 146 QLabel *spacer = new QLabel( toolBar );
147 spacer->setBackgroundMode( QWidget::PaletteButton ); 147 spacer->setBackgroundMode( QWidget::PaletteButton );
148 toolBar->setStretchableWidget( spacer ); 148 toolBar->setStretchableWidget( spacer );
149 149
150 QAction* closeMail = new QAction(tr("Close"),SmallIcon("exit"), 0, 0, this); 150 QAction* closeMail = new QAction(tr("Close"),SmallIcon("exit"), 0, 0, this);
151 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); 151 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) );
152 closeMail->addTo(toolBar); 152 closeMail->addTo(toolBar);
153 closeMail->addTo(mailMenu); 153 closeMail->addTo(mailMenu);
154 154
155 155
156 QPopupMenu* helpMenu = new QPopupMenu( menuBar ); 156 QPopupMenu* helpMenu = new QPopupMenu( menuBar );
157 menuBar->insertItem( tr( "Help" ), helpMenu ); 157 menuBar->insertItem( tr( "Help" ), helpMenu );
158 QAction* li = new QAction(tr("About"), QPixmap(), 0, 0, this); 158 QAction* li = new QAction(tr("About"), QPixmap(), 0, 0, this);
159 connect( li, SIGNAL( activated() ), SLOT( showAbout()) ); 159 connect( li, SIGNAL( activated() ), SLOT( showAbout()) );
160 li->addTo(helpMenu); 160 li->addTo(helpMenu);
161 li = new QAction(tr("Licence"),QPixmap(), 0, 0, this); 161 li = new QAction(tr("Licence"),QPixmap(), 0, 0, this);
162 connect( li, SIGNAL( activated() ), SLOT( showLicence()) ); 162 connect( li, SIGNAL( activated() ), SLOT( showLicence()) );
163 li->addTo(helpMenu); 163 li->addTo(helpMenu);
164 li = new QAction(tr("LibEtPan Licence"), QPixmap(), 0, 0, this); 164 li = new QAction(tr("LibEtPan Licence"), QPixmap(), 0, 0, this);
165 connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) ); 165 connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) );
166 li->addTo(helpMenu); 166 li->addTo(helpMenu);
167} 167}
168 168
169MainWindow::~MainWindow() 169MainWindow::~MainWindow()
170{ 170{
171} 171}
172 172
173void MainWindow::showLicence() 173void MainWindow::showLicence()
174{ 174{
175 KApplication::showLicence(); 175 KApplication::showLicence();
176} 176}
177void MainWindow::showAbout() 177void MainWindow::showAbout()
178{ 178{
179 qDebug("MainWindow::showAbout() "); 179 QString version;
180#include <../version>
181
182 QString cap = "About KOpieMail/Pi";
183 QString text =i18n("KOpieMail/Platform-independent\n") +
184 "(OM/Pi) " + version + " - "
185
186#ifdef DESKTOP_VERSION
187 "Desktop Edition\n"
188#else
189 "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n"
190#endif
191 "www.pi-sync.net\n\n"
192
193
194
195"Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.net>\n"
196 "KOpieMail/Pi is based on Opie Mail\n"
197 "Copyright (c) Rajko Albrecht and the Opie team\n"
198 "KOpieMail/Pi is licensed under the GPL\n"
199 "\n"
200 "KOpieMail/Pi uses LibEtPan - a mail stuff library\n"
201 "Copyright (C) 2001, 2002 - DINH Viet Hoa\n"
202 "libEtPan has its own licence - see LibEtPan licence\n";
203
204 KApplication::showText( cap, text );
180} 205}
181void MainWindow::showEtpanLicence() 206void MainWindow::showEtpanLicence()
182{ 207{
183 KApplication::showFile( "LibEtPan licence", "kdepim/kmicromail/COPYRIGHTlibetpan" ); 208 KApplication::showFile( "LibEtPan licence", "kdepim/kmicromail/COPYRIGHTlibetpan" );
184 209
185} 210}
186void MainWindow::appMessage(const QCString &, const QByteArray &) 211void MainWindow::appMessage(const QCString &, const QByteArray &)
187{ 212{
188 qDebug("appMessage implemented by subclass"); 213 qDebug("appMessage implemented by subclass");
189} 214}
190 215
191void MainWindow::slotAdjustLayout() { 216void MainWindow::slotAdjustLayout() {
192 217
193 /* 218 /*
194 QWidget *d = QApplication::desktop(); 219 QWidget *d = QApplication::desktop();
195 220
196 if ( d->width() < d->height() ) { 221 if ( d->width() < d->height() ) {
197 layout->setDirection( QBoxLayout::TopToBottom ); 222 layout->setDirection( QBoxLayout::TopToBottom );
198 } else { 223 } else {
199 layout->setDirection( QBoxLayout::LeftToRight ); 224 layout->setDirection( QBoxLayout::LeftToRight );
200 } 225 }
201 */ 226 */
202} 227}
203 228
204void MainWindow::slotAdjustColumns() 229void MainWindow::slotAdjustColumns()
205{ 230{
206 bool hidden = folderView->isHidden(); 231 bool hidden = folderView->isHidden();
207 if ( hidden ) folderView->show(); 232 if ( hidden ) folderView->show();
208 folderView->setColumnWidth( 0, folderView->visibleWidth() ); 233 folderView->setColumnWidth( 0, folderView->visibleWidth() );
209 if ( hidden ) folderView->hide(); 234 if ( hidden ) folderView->hide();
210 235
211 mailView->setColumnWidth( 0, 10 ); 236 mailView->setColumnWidth( 0, 10 );
212 mailView->setColumnWidth( 1, 100 ); 237 mailView->setColumnWidth( 1, 100 );
213 mailView->setColumnWidth( 2, 100 ); 238 mailView->setColumnWidth( 2, 100 );
214 mailView->setColumnWidth( 3, 50 ); 239 mailView->setColumnWidth( 3, 50 );
215 mailView->setColumnWidth( 4, 120 ); 240 mailView->setColumnWidth( 4, 120 );
216} 241}
217 242
218void MainWindow::slotEditSettings() 243void MainWindow::slotEditSettings()
219{ 244{
220} 245}
221 246
222void MainWindow::slotShowFolders( bool ) 247void MainWindow::slotShowFolders( bool )
223{ 248{
224 qDebug("not implemented: "); 249 qDebug("not implemented: ");
225} 250}
226 251
227void MainWindow::refreshMailView(const QValueList<RecMailP>&) 252void MainWindow::refreshMailView(const QValueList<RecMailP>&)
228{ 253{
229 qDebug("not implemented: "); 254 qDebug("not implemented: ");
230} 255}
231 256
232void MainWindow::mailLeftClicked(QListViewItem * ) 257void MainWindow::mailLeftClicked(QListViewItem * )
233{ 258{
234 qDebug("not implemented: "); 259 qDebug("not implemented: ");
235} 260}
236 261
237void MainWindow::displayMail() 262void MainWindow::displayMail()
238{ 263{
239 qDebug("not implemented: "); 264 qDebug("not implemented: ");
240} 265}
241 266
242void MainWindow::slotDeleteMail() 267void MainWindow::slotDeleteMail()
243{ 268{
244 qDebug("not implemented: "); 269 qDebug("not implemented: ");
245} 270}
246 271
247void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) 272void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int )
248{ 273{
249 qDebug("not implemented: "); 274 qDebug("not implemented: ");
250} 275}
251 276
252void MainWindow::slotSendQueued() 277void MainWindow::slotSendQueued()
253{ 278{
254 qDebug("not implemented: "); 279 qDebug("not implemented: ");
255} 280}
256 281
257void MainWindow::slotEditAccounts() 282void MainWindow::slotEditAccounts()
258{ 283{
259 qDebug("not implemented: "); 284 qDebug("not implemented: ");
260} 285}
261 286
262void MainWindow::slotComposeMail() 287void MainWindow::slotComposeMail()
263{ 288{
264 qDebug("not implemented: "); 289 qDebug("not implemented: ");
265} 290}