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