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