summaryrefslogtreecommitdiff
path: root/core/pim/today/plugins/todolist/todopluginwidget.cpp
Unidiff
Diffstat (limited to 'core/pim/today/plugins/todolist/todopluginwidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/pim/today/plugins/todolist/todopluginwidget.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/core/pim/today/plugins/todolist/todopluginwidget.cpp b/core/pim/today/plugins/todolist/todopluginwidget.cpp
index 15081ec..0364f94 100644
--- a/core/pim/today/plugins/todolist/todopluginwidget.cpp
+++ b/core/pim/today/plugins/todolist/todopluginwidget.cpp
@@ -61,12 +61,19 @@ void TodolistPluginWidget::readConfig() {
61 cfg.setGroup( "config" ); 61 cfg.setGroup( "config" );
62 m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 ); 62 m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 );
63 m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); 63 m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 );
64} 64}
65 65
66void TodolistPluginWidget:: refresh() { 66void TodolistPluginWidget:: refresh() {
67 todo->reload();
68 getTodo();
69}
70
71void TodolistPluginWidget::reinitialize() {
72 readConfig();
73 todo->reload();
67 getTodo(); 74 getTodo();
68} 75}
69 76
70/** 77/**
71 * Get the todos 78 * Get the todos
72 */ 79 */
@@ -76,21 +83,21 @@ void TodolistPluginWidget::getTodo() {
76 QString output; 83 QString output;
77 QString tmpout; 84 QString tmpout;
78 int count = 0; 85 int count = 0;
79 int ammount = 0; 86 int ammount = 0;
80 87
81 // get overdue todos first 88 // get overdue todos first
82 m_list = todo->overDue(); 89 m_list = todo->sorted( true, 3, 2, 1);
83 90
84 for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { 91 for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) {
85 if (!(*m_it).isCompleted() && ( ammount < m_maxLinesTask ) ) { 92 if (!(*m_it).isCompleted() && ( ammount < m_maxLinesTask ) ) {
86 QString desc = (*m_it).summary(); 93 QString desc = (*m_it).summary();
87 if( desc.isEmpty() ) { 94 if( desc.isEmpty() ) {
88 desc = (*m_it).description(); 95 desc = (*m_it).description();
89 } 96 }
90 tmpout += "<font color=#e00000><b>-" + desc.mid( 0, m_maxCharClip ) + "</b></font><br>"; 97 tmpout += "<font color=#e00000><b>[" + QString("%1").arg((*m_it).priority() ) + "]" + desc.mid( 0, m_maxCharClip ) + "</b></font><br>";
91 ammount++ ; 98 ammount++ ;
92 } 99 }
93 } 100 }
94 101
95 // get total number of still open todos 102 // get total number of still open todos
96 m_list = todo->sorted( true, 1, 4, 1); 103 m_list = todo->sorted( true, 1, 4, 1);
@@ -101,13 +108,13 @@ void TodolistPluginWidget::getTodo() {
101 // over the maxlines 108 // over the maxlines
102 if ( !(*m_it).isOverdue() && ( ammount < m_maxLinesTask ) ) { 109 if ( !(*m_it).isOverdue() && ( ammount < m_maxLinesTask ) ) {
103 QString desc = (*m_it).summary(); 110 QString desc = (*m_it).summary();
104 if( desc.isEmpty() ) { 111 if( desc.isEmpty() ) {
105 desc = (*m_it).description(); 112 desc = (*m_it).description();
106 } 113 }
107 tmpout += "<b>-</b>" + desc.mid( 0, m_maxCharClip ) + "<br>"; 114 tmpout += "<b> [" + QString("%1").arg((*m_it).priority() ) + "] </b>" + desc.mid( 0, m_maxCharClip ) + "<br>";
108 ammount++; 115 ammount++;
109 } 116 }
110 } 117 }
111 118
112 if ( count > 0 ) { 119 if ( count > 0 ) {
113 if( count == 1 ) { 120 if( count == 1 ) {