author | drw <drw> | 2005-02-16 19:53:35 (UTC) |
---|---|---|
committer | drw <drw> | 2005-02-16 19:53:35 (UTC) |
commit | 766ac02e5586cd67b75b320fe1abee513384860c (patch) (unidiff) | |
tree | 17fc4e86195a31fe071c183c691464c34c5deae4 | |
parent | 73e64ac16b0c688c77bc650cd8572314cd846188 (diff) | |
download | opie-766ac02e5586cd67b75b320fe1abee513384860c.zip opie-766ac02e5586cd67b75b320fe1abee513384860c.tar.gz opie-766ac02e5586cd67b75b320fe1abee513384860c.tar.bz2 |
Applied Skyhusker's patch for bug #1538
-rw-r--r-- | core/pim/today/plugins/todolist/todopluginwidget.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/pim/today/plugins/todolist/todopluginwidget.cpp b/core/pim/today/plugins/todolist/todopluginwidget.cpp index 7ce703e..5afd0d8 100644 --- a/core/pim/today/plugins/todolist/todopluginwidget.cpp +++ b/core/pim/today/plugins/todolist/todopluginwidget.cpp | |||
@@ -44,98 +44,98 @@ TodolistPluginWidget::TodolistPluginWidget( QWidget *parent, const char* name ) | |||
44 | if ( todoLabel ) { | 44 | if ( todoLabel ) { |
45 | delete todoLabel; | 45 | delete todoLabel; |
46 | } | 46 | } |
47 | todoLabel = new OClickableLabel( this ); | 47 | todoLabel = new OClickableLabel( this ); |
48 | 48 | ||
49 | connect( todoLabel, SIGNAL( clicked() ), this, SLOT( startTodolist() ) ); | 49 | connect( todoLabel, SIGNAL( clicked() ), this, SLOT( startTodolist() ) ); |
50 | 50 | ||
51 | readConfig(); | 51 | readConfig(); |
52 | getTodo(); | 52 | getTodo(); |
53 | } | 53 | } |
54 | 54 | ||
55 | TodolistPluginWidget::~TodolistPluginWidget() { | 55 | TodolistPluginWidget::~TodolistPluginWidget() { |
56 | delete todo; | 56 | delete todo; |
57 | delete todoLabel; | 57 | delete todoLabel; |
58 | delete layoutTodo; | 58 | delete layoutTodo; |
59 | } | 59 | } |
60 | 60 | ||
61 | 61 | ||
62 | void TodolistPluginWidget::readConfig() { | 62 | void TodolistPluginWidget::readConfig() { |
63 | Config cfg( "todaytodoplugin" ); | 63 | Config cfg( "todaytodoplugin" ); |
64 | cfg.setGroup( "config" ); | 64 | cfg.setGroup( "config" ); |
65 | m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 ); | 65 | m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 ); |
66 | m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); | 66 | m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); |
67 | } | 67 | } |
68 | 68 | ||
69 | void TodolistPluginWidget:: refresh() { | 69 | void TodolistPluginWidget:: refresh() { |
70 | todo->reload(); | 70 | todo->reload(); |
71 | getTodo(); | 71 | getTodo(); |
72 | } | 72 | } |
73 | 73 | ||
74 | void TodolistPluginWidget::reinitialize() { | 74 | void TodolistPluginWidget::reinitialize() { |
75 | readConfig(); | 75 | readConfig(); |
76 | todo->reload(); | 76 | todo->reload(); |
77 | getTodo(); | 77 | getTodo(); |
78 | } | 78 | } |
79 | 79 | ||
80 | /** | 80 | /** |
81 | * Get the todos | 81 | * Get the todos |
82 | */ | 82 | */ |
83 | void TodolistPluginWidget::getTodo() { | 83 | void TodolistPluginWidget::getTodo() { |
84 | 84 | ||
85 | 85 | ||
86 | QString output; | 86 | QString output; |
87 | QString tmpout; | 87 | QString tmpout; |
88 | int count = 0; | 88 | int count = 0; |
89 | int ammount = 0; | 89 | int ammount = 0; |
90 | 90 | ||
91 | // get overdue todos first | 91 | // get overdue todos first |
92 | m_list = todo->sorted( true, 3, 2, 1); | 92 | m_list = todo->sorted( true, OPimTodoAccess::Deadline, OPimTodoAccess::OnlyOverDue, 1); |
93 | 93 | ||
94 | for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { | 94 | for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { |
95 | if (!(*m_it).isCompleted() && ( ammount < m_maxLinesTask ) ) { | 95 | if (!(*m_it).isCompleted() && ( ammount < m_maxLinesTask ) ) { |
96 | QString desc = (*m_it).summary(); | 96 | QString desc = (*m_it).summary(); |
97 | if( desc.isEmpty() ) { | 97 | if( desc.isEmpty() ) { |
98 | desc = (*m_it).description(); | 98 | desc = (*m_it).description(); |
99 | } | 99 | } |
100 | tmpout += "<font color=#e00000><b>[" + QString("%1").arg((*m_it).priority() ) + "]" + desc.mid( 0, m_maxCharClip ) + "</b></font><br>"; | 100 | tmpout += "<font color=#e00000><b>[" + QString("%1").arg((*m_it).priority() ) + "]" + desc.mid( 0, m_maxCharClip ) + "</b></font><br>"; |
101 | ammount++ ; | 101 | ammount++ ; |
102 | } | 102 | } |
103 | } | 103 | } |
104 | 104 | ||
105 | // get total number of still open todos | 105 | // get total number of still open todos |
106 | m_list = todo->sorted( true, 1, 4, 1); | 106 | m_list = todo->sorted( true, 1, OPimTodoAccess::DoNotShowCompleted, 1); |
107 | 107 | ||
108 | for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { | 108 | for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { |
109 | count +=1; | 109 | count +=1; |
110 | // not the overdues, we allready got them, and not if we are | 110 | // not the overdues, we allready got them, and not if we are |
111 | // over the maxlines | 111 | // over the maxlines |
112 | if ( !(*m_it).isOverdue() && ( ammount < m_maxLinesTask ) ) { | 112 | if ( !(*m_it).isOverdue() && ( ammount < m_maxLinesTask ) ) { |
113 | QString desc = (*m_it).summary(); | 113 | QString desc = (*m_it).summary(); |
114 | if( desc.isEmpty() ) { | 114 | if( desc.isEmpty() ) { |
115 | desc = (*m_it).description(); | 115 | desc = (*m_it).description(); |
116 | } | 116 | } |
117 | tmpout += "<b> [" + QString("%1").arg((*m_it).priority() ) + "] </b>" + desc.mid( 0, m_maxCharClip ) + "<br>"; | 117 | tmpout += "<b> [" + QString("%1").arg((*m_it).priority() ) + "] </b>" + desc.mid( 0, m_maxCharClip ) + "<br>"; |
118 | ammount++; | 118 | ammount++; |
119 | } | 119 | } |
120 | } | 120 | } |
121 | 121 | ||
122 | if ( count > 0 ) { | 122 | if ( count > 0 ) { |
123 | if( count == 1 ) { | 123 | if( count == 1 ) { |
124 | output += QObject::tr( "There is <b> 1</b> active task: <br>" ); | 124 | output += QObject::tr( "There is <b> 1</b> active task: <br>" ); |
125 | } else { | 125 | } else { |
126 | output += QObject::tr( "There are <b> %1</b> active tasks: <br>" ).arg( count ); | 126 | output += QObject::tr( "There are <b> %1</b> active tasks: <br>" ).arg( count ); |
127 | } | 127 | } |
128 | output += tmpout; | 128 | output += tmpout; |
129 | } else { | 129 | } else { |
130 | output = QObject::tr( "No active tasks" ); | 130 | output = QObject::tr( "No active tasks" ); |
131 | } | 131 | } |
132 | todoLabel->setText( output ); | 132 | todoLabel->setText( output ); |
133 | } | 133 | } |
134 | 134 | ||
135 | /** | 135 | /** |
136 | * start the todolist | 136 | * start the todolist |
137 | */ | 137 | */ |
138 | void TodolistPluginWidget::startTodolist() { | 138 | void TodolistPluginWidget::startTodolist() { |
139 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 139 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
140 | e << QString( "todolist" ); | 140 | e << QString( "todolist" ); |
141 | } | 141 | } |