-rw-r--r-- | core/pim/todo/tableview.cpp | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp index c64ad46..3e88974 100644 --- a/core/pim/todo/tableview.cpp +++ b/core/pim/todo/tableview.cpp | |||
@@ -1,49 +1,52 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | This file is part of the Opie Project |
3 | .=l. Copyright (c) 2002 <zecke> | 3 | |
4 | .>+-= | 4 | Copyright (C) Opie Team <opie-devel@handhelds.org> |
5 | _;:, .> :=|. This program is free software; you can | 5 | =. |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .=l. |
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 7 | .>+-= |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | _;:, .> :=|. This program is free software; you can |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | ._= =} : or (at your option) any later version. | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .%`+i> _;_. | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | .i_,=:_. -<s. This program is distributed in the hope that | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | ._= =} : or (at your option) any later version. |
14 | : .. .:, . . . without even the implied warranty of | 14 | .%`+i> _;_. |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | ..}^=.= = ; Library General Public License for more | 17 | : .. .:, . . . without even the implied warranty of |
18 | ++= -. .` .: details. | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | : = ...= . :.=- | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | ..}^=.= = ; Library General Public License for more |
21 | -_. . . )=. = Library General Public License along with | 21 | ++= -. .` .: details. |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | ||
24 | -_. . . )=. = Library General Public License along with | ||
25 | -- :-=` this library; see the file COPYING.LIB. | ||
23 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
26 | |||
27 | */ | 29 | */ |
30 | |||
28 | #include <stdlib.h> | 31 | #include <stdlib.h> |
29 | #include <cmath> | 32 | #include <cmath> |
30 | #include <cctype> | 33 | #include <cctype> |
31 | 34 | ||
32 | #include <opie2/odebug.h> | 35 | #include <opie2/odebug.h> |
33 | #include <opie2/opimrecurrence.h> | 36 | #include <opie2/opimrecurrence.h> |
37 | #include <opie2/oresource.h> | ||
34 | 38 | ||
35 | #include <qpe/config.h> | 39 | #include <qpe/config.h> |
36 | #include <qpe/qpeapplication.h> | 40 | #include <qpe/qpeapplication.h> |
37 | #include <qpe/resource.h> | ||
38 | 41 | ||
39 | #include <qcombobox.h> | 42 | #include <qcombobox.h> |
40 | #include <qlineedit.h> | 43 | #include <qlineedit.h> |
41 | #include <qpopupmenu.h> | 44 | #include <qpopupmenu.h> |
42 | 45 | ||
43 | #include "mainwindow.h" | 46 | #include "mainwindow.h" |
44 | //#include "tableitems.h" | 47 | //#include "tableitems.h" |
45 | #include "tableview.h" | 48 | #include "tableview.h" |
46 | 49 | ||
47 | using namespace Todo; | 50 | using namespace Todo; |
48 | 51 | ||
49 | namespace { | 52 | namespace { |
@@ -81,30 +84,30 @@ void TableView::initConfig() { | |||
81 | int width = config.readNumEntry("Width"+QString::number(i), -1 ); | 84 | int width = config.readNumEntry("Width"+QString::number(i), -1 ); |
82 | setColumnWidth(i, width == -1 ? columnWidth(i) : width ); | 85 | setColumnWidth(i, width == -1 ? columnWidth(i) : width ); |
83 | } | 86 | } |
84 | } | 87 | } |
85 | 88 | ||
86 | TableView::TableView( MainWindow* window, QWidget* wid ) | 89 | TableView::TableView( MainWindow* window, QWidget* wid ) |
87 | : QTable( wid ), TodoView( window ) { | 90 | : QTable( wid ), TodoView( window ) { |
88 | 91 | ||
89 | setName("TableView"); | 92 | setName("TableView"); |
90 | // Load icons | 93 | // Load icons |
91 | // TODO - probably should be done globally somewhere else, | 94 | // TODO - probably should be done globally somewhere else, |
92 | // see also quickeditimpl.cpp/h, taskeditoroverview.cpp/h | 95 | // see also quickeditimpl.cpp/h, taskeditoroverview.cpp/h |
93 | m_pic_completed = Resource::loadPixmap( "todo/completed" ); | 96 | m_pic_completed = Opie::Core::OResource::loadPixmap( "todo/completed" ); |
94 | QString namestr; | 97 | QString namestr; |
95 | for ( unsigned int i = 1; i < 6; i++ ) { | 98 | for ( unsigned int i = 1; i < 6; i++ ) { |
96 | namestr = "todo/priority"; | 99 | namestr = "todo/priority"; |
97 | namestr.append( QString::number( i ) ); | 100 | namestr.append( QString::number( i ) ); |
98 | m_pic_priority[ i - 1 ] = Resource::loadPixmap( namestr ); | 101 | m_pic_priority[ i - 1 ] = Opie::Core::OResource::loadPixmap( namestr ); |
99 | } | 102 | } |
100 | 103 | ||
101 | setUpdatesEnabled( false ); | 104 | setUpdatesEnabled( false ); |
102 | viewport()->setUpdatesEnabled( false ); | 105 | viewport()->setUpdatesEnabled( false ); |
103 | m_enablePaint = false; | 106 | m_enablePaint = false; |
104 | setNumRows(0); | 107 | setNumRows(0); |
105 | setNumCols(4); | 108 | setNumCols(4); |
106 | 109 | ||
107 | horizontalHeader()->setLabel( 0, QWidget::tr("C.") ); | 110 | horizontalHeader()->setLabel( 0, QWidget::tr("C.") ); |
108 | horizontalHeader()->setLabel( 1, QWidget::tr("Priority") ); | 111 | horizontalHeader()->setLabel( 1, QWidget::tr("Priority") ); |
109 | horizontalHeader()->setLabel( 2, QWidget::tr("Summary" ) ); | 112 | horizontalHeader()->setLabel( 2, QWidget::tr("Summary" ) ); |
110 | horizontalHeader()->setLabel( 3, QWidget::tr("Deadline") ); | 113 | horizontalHeader()->setLabel( 3, QWidget::tr("Deadline") ); |
@@ -261,25 +264,25 @@ void TableView::setShowDeadline( bool b ) { | |||
261 | setColumnWidth( 1, width ); | 264 | setColumnWidth( 1, width ); |
262 | col2width -= width; | 265 | col2width -= width; |
263 | if ( b ) { | 266 | if ( b ) { |
264 | width = fontMetrics().boundingRect( horizontalHeader()->label( 3 ) ).width() + 8; | 267 | width = fontMetrics().boundingRect( horizontalHeader()->label( 3 ) ).width() + 8; |
265 | setColumnWidth( 3, width ); | 268 | setColumnWidth( 3, width ); |
266 | col2width -= width; | 269 | col2width -= width; |
267 | } | 270 | } |
268 | setColumnWidth( 2, col2width ); | 271 | setColumnWidth( 2, col2width ); |
269 | } | 272 | } |
270 | void TableView::setShowCategory( const QString& str) { | 273 | void TableView::setShowCategory( const QString& str) { |
271 | if ( str != m_oleCat || m_first ) | 274 | if ( str != m_oleCat || m_first ) |
272 | updateView(); | 275 | updateView(); |
273 | 276 | ||
274 | m_oleCat = str; | 277 | m_oleCat = str; |
275 | m_first = false; | 278 | m_first = false; |
276 | } | 279 | } |
277 | void TableView::clear() { | 280 | void TableView::clear() { |
278 | setNumRows(0); | 281 | setNumRows(0); |
279 | } | 282 | } |
280 | void TableView::slotClicked(int row, int col, int, | 283 | void TableView::slotClicked(int row, int col, int, |
281 | const QPoint& point) { | 284 | const QPoint& point) { |
282 | if ( m_editorWidget.cellWidget() ) { | 285 | if ( m_editorWidget.cellWidget() ) { |
283 | //setCellContentFromEditor(m_editorWidget.cellRow(), m_editorWidget.cellCol() ); | 286 | //setCellContentFromEditor(m_editorWidget.cellRow(), m_editorWidget.cellCol() ); |
284 | endEdit(m_editorWidget.cellRow(), m_editorWidget.cellCol(), | 287 | endEdit(m_editorWidget.cellRow(), m_editorWidget.cellCol(), |
285 | true, true ); | 288 | true, true ); |