author | zautrix <zautrix> | 2004-07-04 12:40:46 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-07-04 12:40:46 (UTC) |
commit | deb87bff56cd9cbb41e352c2ccfa97be142d6e48 (patch) (unidiff) | |
tree | d711d6085e4143e1731da440732e823e69c092a3 /kmicromail/mainwindow.cpp | |
parent | 4a947dbc08cc7640dda4f8a89ddb3c80ecc5f9ea (diff) | |
download | kdepimpi-deb87bff56cd9cbb41e352c2ccfa97be142d6e48.zip kdepimpi-deb87bff56cd9cbb41e352c2ccfa97be142d6e48.tar.gz kdepimpi-deb87bff56cd9cbb41e352c2ccfa97be142d6e48.tar.bz2 |
Make sorting in KM working
-rw-r--r-- | kmicromail/mainwindow.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp index 78377ea..ddc7b3e 100644 --- a/kmicromail/mainwindow.cpp +++ b/kmicromail/mainwindow.cpp | |||
@@ -1,232 +1,232 @@ | |||
1 | #include <qlabel.h> | 1 | #include <qlabel.h> |
2 | #include <qvbox.h> | 2 | #include <qvbox.h> |
3 | #include <qheader.h> | 3 | #include <qheader.h> |
4 | #include <qtimer.h> | 4 | #include <qtimer.h> |
5 | #include <qlayout.h> | 5 | #include <qlayout.h> |
6 | #include <kdialog.h> | 6 | #include <kdialog.h> |
7 | #include <kiconloader.h> | 7 | #include <kiconloader.h> |
8 | 8 | ||
9 | #ifndef DESKTOP_VERSION | 9 | #ifndef DESKTOP_VERSION |
10 | #include <qpe/qpeapplication.h> | 10 | #include <qpe/qpeapplication.h> |
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 | ||
19 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | 19 | MainWindow::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 | QLabel *spacer = new QLabel( toolBar ); |
36 | spacer->setBackgroundMode( QWidget::PaletteButton ); | 36 | spacer->setBackgroundMode( QWidget::PaletteButton ); |
37 | toolBar->setStretchableWidget( spacer ); | 37 | toolBar->setStretchableWidget( spacer ); |
38 | 38 | ||
39 | composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"), | 39 | composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"), |
40 | 0, 0, this ); | 40 | 0, 0, this ); |
41 | composeMail->addTo( toolBar ); | 41 | composeMail->addTo( toolBar ); |
42 | composeMail->addTo( mailMenu ); | 42 | composeMail->addTo( mailMenu ); |
43 | 43 | ||
44 | sendQueued = new QAction( tr( "Send queued mails" ), SmallIcon("sendqueued") , | 44 | sendQueued = new QAction( tr( "Send queued mails" ), SmallIcon("sendqueued") , |
45 | 0, 0, this ); | 45 | 0, 0, this ); |
46 | sendQueued->addTo( toolBar ); | 46 | sendQueued->addTo( toolBar ); |
47 | sendQueued->addTo( mailMenu ); | 47 | sendQueued->addTo( mailMenu ); |
48 | 48 | ||
49 | /* | 49 | /* |
50 | syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, | 50 | syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, |
51 | 0, 0, this ); | 51 | 0, 0, this ); |
52 | syncFolders->addTo( toolBar ); | 52 | syncFolders->addTo( toolBar ); |
53 | syncFolders->addTo( mailMenu ); | 53 | syncFolders->addTo( mailMenu ); |
54 | */ | 54 | */ |
55 | 55 | ||
56 | showFolders = new QAction( tr( "Show/Hide folders" ), SmallIcon("showfolders") , | 56 | showFolders = new QAction( tr( "Show/Hide folders" ), SmallIcon("showfolders") , |
57 | 0, 0, this, 0, true ); | 57 | 0, 0, this, 0, true ); |
58 | showFolders->addTo( toolBar ); | 58 | showFolders->addTo( toolBar ); |
59 | showFolders->addTo( mailMenu ); | 59 | showFolders->addTo( mailMenu ); |
60 | showFolders->setOn( true ); | 60 | showFolders->setOn( true ); |
61 | connect(showFolders, SIGNAL( toggled(bool) ), | 61 | connect(showFolders, SIGNAL( toggled(bool) ), |
62 | SLOT( slotShowFolders(bool) ) ); | 62 | SLOT( slotShowFolders(bool) ) ); |
63 | 63 | ||
64 | /* | 64 | /* |
65 | searchMails = new QAction( tr( "Search mails" ), SmallIcon("find") ), | 65 | searchMails = new QAction( tr( "Search mails" ), SmallIcon("find") ), |
66 | 0, 0, this ); | 66 | 0, 0, this ); |
67 | searchMails->addTo( toolBar ); | 67 | searchMails->addTo( toolBar ); |
68 | searchMails->addTo( mailMenu ); | 68 | searchMails->addTo( mailMenu ); |
69 | */ | 69 | */ |
70 | 70 | ||
71 | deleteMails = new QAction(tr("Delete Mail"), SmallIcon("trash"), 0, 0, this); | 71 | deleteMails = new QAction(tr("Delete Mail"), SmallIcon("trash"), 0, 0, this); |
72 | deleteMails->addTo( toolBar ); | 72 | deleteMails->addTo( toolBar ); |
73 | deleteMails->addTo( mailMenu ); | 73 | deleteMails->addTo( mailMenu ); |
74 | connect( deleteMails, SIGNAL( activated() ), | 74 | connect( deleteMails, SIGNAL( activated() ), |
75 | SLOT( slotDeleteMail() ) ); | 75 | SLOT( slotDeleteMail() ) ); |
76 | 76 | ||
77 | editSettings = new QAction( tr( "Edit settings" ), SmallIcon("SettingsIcon") , | 77 | editSettings = new QAction( tr( "Edit settings" ), SmallIcon("SettingsIcon") , |
78 | 0, 0, this ); | 78 | 0, 0, this ); |
79 | editSettings->addTo( settingsMenu ); | 79 | editSettings->addTo( settingsMenu ); |
80 | connect( editSettings, SIGNAL( activated() ), | 80 | connect( editSettings, SIGNAL( activated() ), |
81 | SLOT( slotEditSettings() ) ); | 81 | SLOT( slotEditSettings() ) ); |
82 | editAccounts = new QAction( tr( "Configure accounts" ), SmallIcon("editaccounts") , | 82 | editAccounts = new QAction( tr( "Configure accounts" ), SmallIcon("editaccounts") , |
83 | 0, 0, this ); | 83 | 0, 0, this ); |
84 | editAccounts->addTo( settingsMenu ); | 84 | editAccounts->addTo( settingsMenu ); |
85 | 85 | ||
86 | //setCentralWidget( view ); | 86 | //setCentralWidget( view ); |
87 | 87 | ||
88 | QVBox* wrapperBox = new QVBox( this ); | 88 | QVBox* wrapperBox = new QVBox( this ); |
89 | setCentralWidget( wrapperBox ); | 89 | setCentralWidget( wrapperBox ); |
90 | 90 | ||
91 | // QWidget *view = new QWidget( wrapperBox ); | 91 | // QWidget *view = new QWidget( wrapperBox ); |
92 | KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); | 92 | KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); |
93 | split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); | 93 | split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); |
94 | //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); | 94 | //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); |
95 | 95 | ||
96 | folderView = new AccountView( split ); | 96 | folderView = new AccountView( split ); |
97 | folderView->header()->hide(); | 97 | folderView->header()->hide(); |
98 | folderView->setRootIsDecorated( true ); | 98 | folderView->setRootIsDecorated( false ); |
99 | folderView->addColumn( tr( "Mailbox" ) ); | 99 | folderView->addColumn( tr( "Mailbox" ) ); |
100 | 100 | ||
101 | //layout->addWidget( folderView ); | 101 | //layout->addWidget( folderView ); |
102 | 102 | ||
103 | mailView = new QListView( split ); | 103 | mailView = new QListView( split ); |
104 | mailView->addColumn( tr( "" ) ); | 104 | mailView->addColumn( tr( " " ) ); |
105 | mailView->addColumn( tr( "Subject" ),QListView::Manual ); | 105 | mailView->addColumn( tr( "Subject" ),QListView::Manual ); |
106 | mailView->addColumn( tr( "Sender" ),QListView::Manual ); | 106 | mailView->addColumn( tr( "Sender" ),QListView::Manual ); |
107 | mailView->addColumn( tr( "Size" ),QListView::Manual); | 107 | mailView->addColumn( tr( "Size" ),QListView::Manual); |
108 | mailView->addColumn( tr( "Date" )); | 108 | mailView->addColumn( tr( "Date" ),QListView::Manual); |
109 | mailView->setAllColumnsShowFocus(true); | 109 | mailView->setAllColumnsShowFocus(true); |
110 | //mailView->setSorting(-1); | 110 | //mailView->setSorting(-1); |
111 | 111 | mailView->setRootIsDecorated( false ); | |
112 | statusWidget = new StatusWidget( wrapperBox ); | 112 | statusWidget = new StatusWidget( wrapperBox ); |
113 | statusWidget->hide(); | 113 | statusWidget->hide(); |
114 | 114 | ||
115 | //layout->addWidget( mailView ); | 115 | //layout->addWidget( mailView ); |
116 | //layout->setStretchFactor( folderView, 1 ); | 116 | //layout->setStretchFactor( folderView, 1 ); |
117 | //layout->setStretchFactor( mailView, 2 ); | 117 | //layout->setStretchFactor( mailView, 2 ); |
118 | 118 | ||
119 | slotAdjustLayout(); | 119 | slotAdjustLayout(); |
120 | #ifndef DESKTOP_VERSION | 120 | #ifndef DESKTOP_VERSION |
121 | QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); | 121 | QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); |
122 | QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); | 122 | QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); |
123 | #endif | 123 | #endif |
124 | connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, | 124 | connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, |
125 | SLOT( mailLeftClicked(QListViewItem*) ) ); | 125 | SLOT( mailLeftClicked(QListViewItem*) ) ); |
126 | connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, | 126 | connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, |
127 | SLOT( mailLeftClicked(QListViewItem*) ) ); | 127 | SLOT( mailLeftClicked(QListViewItem*) ) ); |
128 | connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, | 128 | connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, |
129 | SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); | 129 | SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); |
130 | connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), | 130 | connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), |
131 | this,SLOT(refreshMailView(const QValueList<RecMailP>&))); | 131 | this,SLOT(refreshMailView(const QValueList<RecMailP>&))); |
132 | connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); | 132 | connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); |
133 | connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); | 133 | connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); |
134 | // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); | 134 | // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); |
135 | connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); | 135 | connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); |
136 | mailView->setMultiSelection ( true ); | 136 | mailView->setMultiSelection ( true ); |
137 | //mailView->setSelectionMode( QListView::Extended ); | 137 | //mailView->setSelectionMode( QListView::Extended ); |
138 | QValueList<int> list; | 138 | QValueList<int> list; |
139 | int fw = 100; | 139 | int fw = 100; |
140 | if ( QApplication::desktop()->width() > 320 ) | 140 | if ( QApplication::desktop()->width() > 320 ) |
141 | fw = 50; | 141 | fw = 50; |
142 | list.append( fw ); | 142 | list.append( fw ); |
143 | list.append( 100 ); | 143 | list.append( 100 ); |
144 | split->setSizes( list ); | 144 | split->setSizes( list ); |
145 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); | 145 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); |
146 | mailView->setShowSortIndicator ( true ); | 146 | mailView->setShowSortIndicator ( true ); |
147 | } | 147 | } |
148 | 148 | ||
149 | MainWindow::~MainWindow() | 149 | MainWindow::~MainWindow() |
150 | { | 150 | { |
151 | } | 151 | } |
152 | 152 | ||
153 | void MainWindow::appMessage(const QCString &, const QByteArray &) | 153 | void MainWindow::appMessage(const QCString &, const QByteArray &) |
154 | { | 154 | { |
155 | qDebug("appMessage implemented by subclass"); | 155 | qDebug("appMessage implemented by subclass"); |
156 | } | 156 | } |
157 | 157 | ||
158 | void MainWindow::slotAdjustLayout() { | 158 | void MainWindow::slotAdjustLayout() { |
159 | 159 | ||
160 | /* | 160 | /* |
161 | QWidget *d = QApplication::desktop(); | 161 | QWidget *d = QApplication::desktop(); |
162 | 162 | ||
163 | if ( d->width() < d->height() ) { | 163 | if ( d->width() < d->height() ) { |
164 | layout->setDirection( QBoxLayout::TopToBottom ); | 164 | layout->setDirection( QBoxLayout::TopToBottom ); |
165 | } else { | 165 | } else { |
166 | layout->setDirection( QBoxLayout::LeftToRight ); | 166 | layout->setDirection( QBoxLayout::LeftToRight ); |
167 | } | 167 | } |
168 | */ | 168 | */ |
169 | } | 169 | } |
170 | 170 | ||
171 | void MainWindow::slotAdjustColumns() | 171 | void MainWindow::slotAdjustColumns() |
172 | { | 172 | { |
173 | bool hidden = folderView->isHidden(); | 173 | bool hidden = folderView->isHidden(); |
174 | if ( hidden ) folderView->show(); | 174 | if ( hidden ) folderView->show(); |
175 | folderView->setColumnWidth( 0, folderView->visibleWidth() ); | 175 | folderView->setColumnWidth( 0, folderView->visibleWidth() ); |
176 | if ( hidden ) folderView->hide(); | 176 | if ( hidden ) folderView->hide(); |
177 | 177 | ||
178 | mailView->setColumnWidth( 0, 10 ); | 178 | mailView->setColumnWidth( 0, 10 ); |
179 | mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 ); | 179 | mailView->setColumnWidth( 1, 80 ); |
180 | mailView->setColumnWidth( 2, 80 ); | 180 | mailView->setColumnWidth( 2, 80 ); |
181 | mailView->setColumnWidth( 3, 50 ); | 181 | mailView->setColumnWidth( 3, 50 ); |
182 | mailView->setColumnWidth( 4, 50 ); | 182 | mailView->setColumnWidth( 4, 50 ); |
183 | } | 183 | } |
184 | 184 | ||
185 | void MainWindow::slotEditSettings() | 185 | void MainWindow::slotEditSettings() |
186 | { | 186 | { |
187 | } | 187 | } |
188 | 188 | ||
189 | void MainWindow::slotShowFolders( bool ) | 189 | void MainWindow::slotShowFolders( bool ) |
190 | { | 190 | { |
191 | qDebug("not implemented: "); | 191 | qDebug("not implemented: "); |
192 | } | 192 | } |
193 | 193 | ||
194 | void MainWindow::refreshMailView(const QValueList<RecMailP>&) | 194 | void MainWindow::refreshMailView(const QValueList<RecMailP>&) |
195 | { | 195 | { |
196 | qDebug("not implemented: "); | 196 | qDebug("not implemented: "); |
197 | } | 197 | } |
198 | 198 | ||
199 | void MainWindow::mailLeftClicked(QListViewItem * ) | 199 | void MainWindow::mailLeftClicked(QListViewItem * ) |
200 | { | 200 | { |
201 | qDebug("not implemented: "); | 201 | qDebug("not implemented: "); |
202 | } | 202 | } |
203 | 203 | ||
204 | void MainWindow::displayMail() | 204 | void MainWindow::displayMail() |
205 | { | 205 | { |
206 | qDebug("not implemented: "); | 206 | qDebug("not implemented: "); |
207 | } | 207 | } |
208 | 208 | ||
209 | void MainWindow::slotDeleteMail() | 209 | void MainWindow::slotDeleteMail() |
210 | { | 210 | { |
211 | qDebug("not implemented: "); | 211 | qDebug("not implemented: "); |
212 | } | 212 | } |
213 | 213 | ||
214 | void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) | 214 | void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) |
215 | { | 215 | { |
216 | qDebug("not implemented: "); | 216 | qDebug("not implemented: "); |
217 | } | 217 | } |
218 | 218 | ||
219 | void MainWindow::slotSendQueued() | 219 | void MainWindow::slotSendQueued() |
220 | { | 220 | { |
221 | qDebug("not implemented: "); | 221 | qDebug("not implemented: "); |
222 | } | 222 | } |
223 | 223 | ||
224 | void MainWindow::slotEditAccounts() | 224 | void MainWindow::slotEditAccounts() |
225 | { | 225 | { |
226 | qDebug("not implemented: "); | 226 | qDebug("not implemented: "); |
227 | } | 227 | } |
228 | 228 | ||
229 | void MainWindow::slotComposeMail() | 229 | void MainWindow::slotComposeMail() |
230 | { | 230 | { |
231 | qDebug("not implemented: "); | 231 | qDebug("not implemented: "); |
232 | } | 232 | } |