summaryrefslogtreecommitdiffabout
path: root/kmicromail/mainwindow.cpp
Unidiff
Diffstat (limited to 'kmicromail/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/mainwindow.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp
index ddc7b3e..a500dec 100644
--- a/kmicromail/mainwindow.cpp
+++ b/kmicromail/mainwindow.cpp
@@ -11,51 +11,49 @@
11#endif 11#endif
12#include "defines.h" 12#include "defines.h"
13#include "mainwindow.h" 13#include "mainwindow.h"
14#include <KDGanttMinimizeSplitter.h> 14#include <KDGanttMinimizeSplitter.h>
15 15
16 16
17#include <kabc/stdaddressbook.h> 17#include <kabc/stdaddressbook.h>
18 18
19MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 19MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
20 : QMainWindow( parent, name, flags ) 20 : QMainWindow( parent, name, flags )
21{ 21{
22 setCaption( tr( "KMicroMail" ) ); 22 setCaption( tr( "KMicroMail" ) );
23 setToolBarsMovable( false ); 23 setToolBarsMovable( false );
24 KABC::StdAddressBook::self(); 24 KABC::StdAddressBook::self();
25 toolBar = new QToolBar( this ); 25 toolBar = new QToolBar( this );
26 menuBar = new QMenuBar( toolBar ); 26 menuBar = new QMenuBar( toolBar );
27 mailMenu = new QPopupMenu( menuBar ); 27 mailMenu = new QPopupMenu( menuBar );
28 menuBar->insertItem( tr( "Mail" ), mailMenu ); 28 menuBar->insertItem( tr( "Mail" ), mailMenu );
29 settingsMenu = new QPopupMenu( menuBar ); 29 settingsMenu = new QPopupMenu( menuBar );
30 menuBar->insertItem( tr( "Settings" ), settingsMenu ); 30 menuBar->insertItem( tr( "Settings" ), settingsMenu );
31 31
32 addToolBar( toolBar ); 32 addToolBar( toolBar );
33 toolBar->setHorizontalStretchable( true ); 33 toolBar->setHorizontalStretchable( true );
34 34
35 QLabel *spacer = new QLabel( toolBar ); 35
36 spacer->setBackgroundMode( QWidget::PaletteButton );
37 toolBar->setStretchableWidget( spacer );
38 36
39 composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"), 37 composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"),
40 0, 0, this ); 38 0, 0, this );
41 composeMail->addTo( toolBar ); 39 composeMail->addTo( toolBar );
42 composeMail->addTo( mailMenu ); 40 composeMail->addTo( mailMenu );
43 41
44 sendQueued = new QAction( tr( "Send queued mails" ), SmallIcon("sendqueued") , 42 sendQueued = new QAction( tr( "Send queued mails" ), SmallIcon("sendqueued") ,
45 0, 0, this ); 43 0, 0, this );
46 sendQueued->addTo( toolBar ); 44 sendQueued->addTo( toolBar );
47 sendQueued->addTo( mailMenu ); 45 sendQueued->addTo( mailMenu );
48 46
49 /* 47 /*
50 syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, 48 syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC,
51 0, 0, this ); 49 0, 0, this );
52 syncFolders->addTo( toolBar ); 50 syncFolders->addTo( toolBar );
53 syncFolders->addTo( mailMenu ); 51 syncFolders->addTo( mailMenu );
54 */ 52 */
55 53
56 showFolders = new QAction( tr( "Show/Hide folders" ), SmallIcon("showfolders") , 54 showFolders = new QAction( tr( "Show/Hide folders" ), SmallIcon("showfolders") ,
57 0, 0, this, 0, true ); 55 0, 0, this, 0, true );
58 showFolders->addTo( toolBar ); 56 showFolders->addTo( toolBar );
59 showFolders->addTo( mailMenu ); 57 showFolders->addTo( mailMenu );
60 showFolders->setOn( true ); 58 showFolders->setOn( true );
61 connect(showFolders, SIGNAL( toggled(bool) ), 59 connect(showFolders, SIGNAL( toggled(bool) ),
@@ -112,95 +110,103 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
112 statusWidget = new StatusWidget( wrapperBox ); 110 statusWidget = new StatusWidget( wrapperBox );
113 statusWidget->hide(); 111 statusWidget->hide();
114 112
115 //layout->addWidget( mailView ); 113 //layout->addWidget( mailView );
116 //layout->setStretchFactor( folderView, 1 ); 114 //layout->setStretchFactor( folderView, 1 );
117 //layout->setStretchFactor( mailView, 2 ); 115 //layout->setStretchFactor( mailView, 2 );
118 116
119 slotAdjustLayout(); 117 slotAdjustLayout();
120#ifndef DESKTOP_VERSION 118#ifndef DESKTOP_VERSION
121 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); 119 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold);
122 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); 120 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold);
123#endif 121#endif
124 connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, 122 connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this,
125 SLOT( mailLeftClicked(QListViewItem*) ) ); 123 SLOT( mailLeftClicked(QListViewItem*) ) );
126 connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, 124 connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this,
127 SLOT( mailLeftClicked(QListViewItem*) ) ); 125 SLOT( mailLeftClicked(QListViewItem*) ) );
128 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, 126 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
129 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); 127 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) );
130 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), 128 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)),
131 this,SLOT(refreshMailView(const QValueList<RecMailP>&))); 129 this,SLOT(refreshMailView(const QValueList<RecMailP>&)));
132 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); 130 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
133 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); 131 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
134// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); 132// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
135 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); 133 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
136 mailView->setMultiSelection ( true ); 134 //mailView->setMultiSelection ( true );
137 //mailView->setSelectionMode( QListView::Extended ); 135 mailView->setSelectionMode( QListView::Extended );
138 QValueList<int> list; 136 QValueList<int> list;
139 int fw = 100; 137 int fw = 100;
140 if ( QApplication::desktop()->width() > 320 ) 138 if ( QApplication::desktop()->width() > 320 )
141 fw = 50; 139 fw = 50;
142 list.append( fw ); 140 list.append( fw );
143 list.append( 100 ); 141 list.append( 100 );
144 split->setSizes( list ); 142 split->setSizes( list );
145 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); 143 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) );
146 mailView->setShowSortIndicator ( true ); 144 mailView->setShowSortIndicator ( true );
145 QLabel *spacer = new QLabel( toolBar );
146 spacer->setBackgroundMode( QWidget::PaletteButton );
147 toolBar->setStretchableWidget( spacer );
148
149 QAction* closeMail = new QAction(tr("Close"),SmallIcon("exit"), 0, 0, this);
150 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) );
151 closeMail->addTo(toolBar);
152 closeMail->addTo(mailMenu);
147} 153}
148 154
149MainWindow::~MainWindow() 155MainWindow::~MainWindow()
150{ 156{
151} 157}
152 158
153void MainWindow::appMessage(const QCString &, const QByteArray &) 159void MainWindow::appMessage(const QCString &, const QByteArray &)
154{ 160{
155 qDebug("appMessage implemented by subclass"); 161 qDebug("appMessage implemented by subclass");
156} 162}
157 163
158void MainWindow::slotAdjustLayout() { 164void MainWindow::slotAdjustLayout() {
159 165
160 /* 166 /*
161 QWidget *d = QApplication::desktop(); 167 QWidget *d = QApplication::desktop();
162 168
163 if ( d->width() < d->height() ) { 169 if ( d->width() < d->height() ) {
164 layout->setDirection( QBoxLayout::TopToBottom ); 170 layout->setDirection( QBoxLayout::TopToBottom );
165 } else { 171 } else {
166 layout->setDirection( QBoxLayout::LeftToRight ); 172 layout->setDirection( QBoxLayout::LeftToRight );
167 } 173 }
168 */ 174 */
169} 175}
170 176
171void MainWindow::slotAdjustColumns() 177void MainWindow::slotAdjustColumns()
172{ 178{
173 bool hidden = folderView->isHidden(); 179 bool hidden = folderView->isHidden();
174 if ( hidden ) folderView->show(); 180 if ( hidden ) folderView->show();
175 folderView->setColumnWidth( 0, folderView->visibleWidth() ); 181 folderView->setColumnWidth( 0, folderView->visibleWidth() );
176 if ( hidden ) folderView->hide(); 182 if ( hidden ) folderView->hide();
177 183
178 mailView->setColumnWidth( 0, 10 ); 184 mailView->setColumnWidth( 0, 10 );
179 mailView->setColumnWidth( 1, 80 ); 185 mailView->setColumnWidth( 1, 100 );
180 mailView->setColumnWidth( 2, 80 ); 186 mailView->setColumnWidth( 2, 100 );
181 mailView->setColumnWidth( 3, 50 ); 187 mailView->setColumnWidth( 3, 50 );
182 mailView->setColumnWidth( 4, 50 ); 188 mailView->setColumnWidth( 4, 120 );
183} 189}
184 190
185void MainWindow::slotEditSettings() 191void MainWindow::slotEditSettings()
186{ 192{
187} 193}
188 194
189void MainWindow::slotShowFolders( bool ) 195void MainWindow::slotShowFolders( bool )
190{ 196{
191 qDebug("not implemented: "); 197 qDebug("not implemented: ");
192} 198}
193 199
194void MainWindow::refreshMailView(const QValueList<RecMailP>&) 200void MainWindow::refreshMailView(const QValueList<RecMailP>&)
195{ 201{
196 qDebug("not implemented: "); 202 qDebug("not implemented: ");
197} 203}
198 204
199void MainWindow::mailLeftClicked(QListViewItem * ) 205void MainWindow::mailLeftClicked(QListViewItem * )
200{ 206{
201 qDebug("not implemented: "); 207 qDebug("not implemented: ");
202} 208}
203 209
204void MainWindow::displayMail() 210void MainWindow::displayMail()
205{ 211{
206 qDebug("not implemented: "); 212 qDebug("not implemented: ");