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