summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/tableview.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp
index cec8b5e..ae27fab 100644
--- a/core/pim/todo/tableview.cpp
+++ b/core/pim/todo/tableview.cpp
@@ -46,24 +46,28 @@
46using namespace Todo; 46using namespace Todo;
47 47
48namespace { 48namespace {
49 static const int BoxSize = 14; 49 static const int BoxSize = 14;
50 static const int RowHeight = 20; 50 static const int RowHeight = 20;
51} 51}
52 52
53 53
54void TableView::initConfig() { 54void TableView::initConfig() {
55 Config config( "todo" ); 55 Config config( "todo" );
56 config.setGroup( "Options" ); 56 config.setGroup( "Options" );
57 m_completeStrokeWidth = config.readNumEntry( "CompleteStrokeWidth", 8 ); 57 m_completeStrokeWidth = config.readNumEntry( "CompleteStrokeWidth", 8 );
58 for (int i = 0; i < numCols(); i++ ) {
59 int width = config.readNumEntry("Width"+QString::number(i), -1 );
60 setColumnWidth(i, width == -1 ? columnWidth(i) : width );
61 }
58} 62}
59 63
60TableView::TableView( MainWindow* window, QWidget* wid ) 64TableView::TableView( MainWindow* window, QWidget* wid )
61 : QTable( wid ), TodoView( window ) { 65 : QTable( wid ), TodoView( window ) {
62 66
63 // Load icons 67 // Load icons
64 // TODO - probably should be done globally somewhere else, 68 // TODO - probably should be done globally somewhere else,
65 // see also quickeditimpl.cpp/h, taskeditoroverview.cpp/h 69 // see also quickeditimpl.cpp/h, taskeditoroverview.cpp/h
66 m_pic_completed = Resource::loadPixmap( "todo/completed" ); 70 m_pic_completed = Resource::loadPixmap( "todo/completed" );
67 QString namestr; 71 QString namestr;
68 for ( unsigned int i = 1; i < 6; i++ ) { 72 for ( unsigned int i = 1; i < 6; i++ ) {
69 namestr = "todo/priority"; 73 namestr = "todo/priority";
@@ -94,44 +98,50 @@ TableView::TableView( MainWindow* window, QWidget* wid )
94 this, SLOT( slotClicked(int, int, int, const QPoint& ) ) ); 98 this, SLOT( slotClicked(int, int, int, const QPoint& ) ) );
95 connect((QTable*)this, SIGNAL( pressed( int, int, int, const QPoint& ) ), 99 connect((QTable*)this, SIGNAL( pressed( int, int, int, const QPoint& ) ),
96 this, SLOT( slotPressed(int, int, int, const QPoint& ) ) ); 100 this, SLOT( slotPressed(int, int, int, const QPoint& ) ) );
97 connect((QTable*)this, SIGNAL(valueChanged(int, int) ), 101 connect((QTable*)this, SIGNAL(valueChanged(int, int) ),
98 this, SLOT( slotValueChanged(int, int) ) ); 102 this, SLOT( slotValueChanged(int, int) ) );
99 connect((QTable*)this, SIGNAL(currentChanged(int, int) ), 103 connect((QTable*)this, SIGNAL(currentChanged(int, int) ),
100 this, SLOT( slotCurrentChanged(int, int) ) ); 104 this, SLOT( slotCurrentChanged(int, int) ) );
101 105
102 m_menuTimer = new QTimer( this ); 106 m_menuTimer = new QTimer( this );
103 connect( m_menuTimer, SIGNAL(timeout()), 107 connect( m_menuTimer, SIGNAL(timeout()),
104 this, SLOT(slotShowMenu()) ); 108 this, SLOT(slotShowMenu()) );
105 109
110 /* now let's init the config */
111 initConfig();
112
113
106 m_enablePaint = true; 114 m_enablePaint = true;
107 setUpdatesEnabled( true ); 115 setUpdatesEnabled( true );
108 viewport()->setUpdatesEnabled( true ); 116 viewport()->setUpdatesEnabled( true );
109 viewport()->update(); 117 viewport()->update();
110 setSortOrder( 0 ); 118 setSortOrder( 0 );
111 setAscending( TRUE ); 119 setAscending( TRUE );
112 m_first = true; 120 m_first = true;
113 121
114 /* now let's init the config */ 122
115 initConfig();
116} 123}
117/* a new day has started 124/* a new day has started
118 * update the day 125 * update the day
119 */ 126 */
120void TableView::newDay() { 127void TableView::newDay() {
121 clear(); 128 clear();
122 updateView(); 129 updateView();
123} 130}
124TableView::~TableView() { 131TableView::~TableView() {
125 132 Config config( "todo" );
133 config.setGroup( "Options" );
134 for (int i = 0; i < numCols(); i++ )
135 config.writeEntry("Width"+QString::number(i), columnWidth(i) );
126} 136}
127void TableView::slotShowMenu() { 137void TableView::slotShowMenu() {
128 QPopupMenu *menu = todoWindow()->contextMenu( current(), sorted()[currentRow()].recurrence().doesRecur() ); 138 QPopupMenu *menu = todoWindow()->contextMenu( current(), sorted()[currentRow()].recurrence().doesRecur() );
129 menu->exec(QCursor::pos() ); 139 menu->exec(QCursor::pos() );
130 delete menu; 140 delete menu;
131} 141}
132QString TableView::type() const { 142QString TableView::type() const {
133 return QString::fromLatin1( tr("Table View") ); 143 return QString::fromLatin1( tr("Table View") );
134} 144}
135int TableView::current() { 145int TableView::current() {
136 int uid = sorted().uidAt(currentRow() ); 146 int uid = sorted().uidAt(currentRow() );
137 147