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