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