summaryrefslogtreecommitdiffabout
path: root/korganizer/kotodoview.cpp
authorzautrix <zautrix>2005-04-14 18:10:19 (UTC)
committer zautrix <zautrix>2005-04-14 18:10:19 (UTC)
commitd334d77ab00b91b9527bb5992b476c656c88b2fa (patch) (unidiff)
tree59679cec875179b5b469830e43303cb9480ab1ac /korganizer/kotodoview.cpp
parentbbdca90c599aaea557d31552c6bc33fc15e397cd (diff)
downloadkdepimpi-d334d77ab00b91b9527bb5992b476c656c88b2fa.zip
kdepimpi-d334d77ab00b91b9527bb5992b476c656c88b2fa.tar.gz
kdepimpi-d334d77ab00b91b9527bb5992b476c656c88b2fa.tar.bz2
transl fix
Diffstat (limited to 'korganizer/kotodoview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoview.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 7817a75..dd2c081 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -140,50 +140,50 @@ void KOTodoListView::contentsDropEvent(QDropEvent *e)
140 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 140 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
141 !QTextDrag::canDecode( e ) ) { 141 !QTextDrag::canDecode( e ) ) {
142 e->ignore(); 142 e->ignore();
143 return; 143 return;
144 } 144 }
145 145
146 DndFactory factory( mCalendar ); 146 DndFactory factory( mCalendar );
147 Todo *todo = factory.createDropTodo(e); 147 Todo *todo = factory.createDropTodo(e);
148 148
149 if (todo) { 149 if (todo) {
150 e->acceptAction(); 150 e->acceptAction();
151 151
152 KOTodoViewItem *destination = 152 KOTodoViewItem *destination =
153 (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); 153 (KOTodoViewItem *)itemAt(contentsToViewport(e->pos()));
154 Todo *destinationEvent = 0; 154 Todo *destinationEvent = 0;
155 if (destination) destinationEvent = destination->todo(); 155 if (destination) destinationEvent = destination->todo();
156 156
157 Todo *existingTodo = mCalendar->todo(todo->uid()); 157 Todo *existingTodo = mCalendar->todo(todo->uid());
158 158
159 if(existingTodo) { 159 if(existingTodo) {
160 Incidence *to = destinationEvent; 160 Incidence *to = destinationEvent;
161 while(to) { 161 while(to) {
162 if (to->uid() == todo->uid()) { 162 if (to->uid() == todo->uid()) {
163 KMessageBox::sorry(this, 163 KMessageBox::sorry(this,
164 i18n("Cannot move To-Do to itself\nor a child of itself"), 164 i18n("Cannot move Todo to itself\nor a child of itself"),
165 i18n("Drop To-Do")); 165 i18n("Drop Todo"));
166 delete todo; 166 delete todo;
167 return; 167 return;
168 } 168 }
169 to = to->relatedTo(); 169 to = to->relatedTo();
170 } 170 }
171 internalDrop = true; 171 internalDrop = true;
172 if ( destinationEvent ) 172 if ( destinationEvent )
173 reparentTodoSignal( destinationEvent, existingTodo ); 173 reparentTodoSignal( destinationEvent, existingTodo );
174 else 174 else
175 unparentTodoSignal(existingTodo); 175 unparentTodoSignal(existingTodo);
176 delete todo; 176 delete todo;
177 } else { 177 } else {
178 mCalendar->addTodo(todo); 178 mCalendar->addTodo(todo);
179 emit todoDropped(todo, KOGlobals::EVENTADDED); 179 emit todoDropped(todo, KOGlobals::EVENTADDED);
180 if ( destinationEvent ) 180 if ( destinationEvent )
181 reparentTodoSignal( destinationEvent, todo ); 181 reparentTodoSignal( destinationEvent, todo );
182 } 182 }
183 } 183 }
184 else { 184 else {
185 QString text; 185 QString text;
186 if (QTextDrag::decode(e,text)) { 186 if (QTextDrag::decode(e,text)) {
187 //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); 187 //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) );
188 KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); 188 KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) ));
189 qDebug("Dropped : " + text); 189 qDebug("Dropped : " + text);
@@ -941,49 +941,48 @@ void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column)
941 } 941 }
942 } else mPopupMenu->popup(QCursor::pos()); 942 } else mPopupMenu->popup(QCursor::pos());
943} 943}
944void KOTodoView::newTodo() 944void KOTodoView::newTodo()
945{ 945{
946 emit newTodoSignal(); 946 emit newTodoSignal();
947} 947}
948 948
949void KOTodoView::newSubTodo() 949void KOTodoView::newSubTodo()
950{ 950{
951 if (mActiveItem) { 951 if (mActiveItem) {
952 emit newSubTodoSignal(mActiveItem->todo()); 952 emit newSubTodoSignal(mActiveItem->todo());
953 } 953 }
954} 954}
955void KOTodoView::unparentTodo() 955void KOTodoView::unparentTodo()
956{ 956{
957 if (mActiveItem) { 957 if (mActiveItem) {
958 emit unparentTodoSignal(mActiveItem->todo()); 958 emit unparentTodoSignal(mActiveItem->todo());
959 } 959 }
960} 960}
961 961
962void KOTodoView::reparentTodo() 962void KOTodoView::reparentTodo()
963{ 963{
964 if (mActiveItem) { 964 if (mActiveItem) {
965 qDebug("KOTodoView::reparentTodo() ");
966 topLevelWidget()->setCaption(i18n("Click on new parent item")); 965 topLevelWidget()->setCaption(i18n("Click on new parent item"));
967 pendingSubtodo = mActiveItem; 966 pendingSubtodo = mActiveItem;
968 } 967 }
969} 968}
970void KOTodoView::editTodo() 969void KOTodoView::editTodo()
971{ 970{
972 if (mActiveItem) { 971 if (mActiveItem) {
973 emit editTodoSignal(mActiveItem->todo()); 972 emit editTodoSignal(mActiveItem->todo());
974 } 973 }
975} 974}
976void KOTodoView::cloneTodo() 975void KOTodoView::cloneTodo()
977{ 976{
978 if (mActiveItem) { 977 if (mActiveItem) {
979 emit cloneTodoSignal((Incidence*)mActiveItem->todo()); 978 emit cloneTodoSignal((Incidence*)mActiveItem->todo());
980 } 979 }
981} 980}
982void KOTodoView::cancelTodo() 981void KOTodoView::cancelTodo()
983{ 982{
984 if (mActiveItem) { 983 if (mActiveItem) {
985 emit cancelTodoSignal((Incidence*)mActiveItem->todo()); 984 emit cancelTodoSignal((Incidence*)mActiveItem->todo());
986 } 985 }
987} 986}
988void KOTodoView::moveTodo() 987void KOTodoView::moveTodo()
989{ 988{
@@ -1141,82 +1140,80 @@ void KOTodoView::toggleRunningItem()
1141 1140
1142void KOTodoView::itemClicked(QListViewItem *item) 1141void KOTodoView::itemClicked(QListViewItem *item)
1143{ 1142{
1144 //qDebug("KOTodoView::itemClicked %d", item); 1143 //qDebug("KOTodoView::itemClicked %d", item);
1145 if (!item) { 1144 if (!item) {
1146 if ( pendingSubtodo != 0 ) { 1145 if ( pendingSubtodo != 0 ) {
1147 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1146 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1148 } 1147 }
1149 pendingSubtodo = 0; 1148 pendingSubtodo = 0;
1150 return; 1149 return;
1151 } 1150 }
1152 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1151 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1153 if ( pendingSubtodo != 0 ) { 1152 if ( pendingSubtodo != 0 ) {
1154 bool allowReparent = true; 1153 bool allowReparent = true;
1155 QListViewItem *par = item; 1154 QListViewItem *par = item;
1156 while ( par ) { 1155 while ( par ) {
1157 if ( par == pendingSubtodo ) { 1156 if ( par == pendingSubtodo ) {
1158 allowReparent = false; 1157 allowReparent = false;
1159 break; 1158 break;
1160 } 1159 }
1161 par = par->parent(); 1160 par = par->parent();
1162 } 1161 }
1163 if ( !allowReparent ) { 1162 if ( !allowReparent ) {
1164 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); 1163 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!"));
1165 qDebug("Recursive reparenting not possible ");
1166 pendingSubtodo = 0; 1164 pendingSubtodo = 0;
1167 } else { 1165 } else {
1168 Todo* newParent = todoItem->todo(); 1166 Todo* newParent = todoItem->todo();
1169 Todo* newSub = pendingSubtodo->todo(); 1167 Todo* newSub = pendingSubtodo->todo();
1170 pendingSubtodo = 0; 1168 pendingSubtodo = 0;
1171 emit reparentTodoSignal( newParent,newSub ); 1169 emit reparentTodoSignal( newParent,newSub );
1172 return; 1170 return;
1173 } 1171 }
1174 } 1172 }
1175#if 0 1173#if 0
1176 // handled by the item itself 1174 // handled by the item itself
1177 bool completed = todoItem->todo()->isCompleted(); // Completed or not? 1175 bool completed = todoItem->todo()->isCompleted(); // Completed or not?
1178 qDebug("com %d ",completed ); 1176 qDebug("com %d ",completed );
1179 qDebug("itemclicked "); 1177 qDebug("itemclicked ");
1180 if (todoItem->isOn()) { 1178 if (todoItem->isOn()) {
1181 qDebug("on "); 1179 qDebug("on ");
1182 if (!completed) { 1180 if (!completed) {
1183 qDebug("set true "); 1181 qDebug("set true ");
1184 todoItem->todo()->setCompleted(QDateTime::currentDateTime()); 1182 todoItem->todo()->setCompleted(QDateTime::currentDateTime());
1185 } 1183 }
1186 } else { 1184 } else {
1187 qDebug("not on "); 1185 qDebug("not on ");
1188 if (completed) { 1186 if (completed) {
1189 qDebug("set false "); 1187 qDebug("set false ");
1190 todoItem->todo()->setCompleted(false); 1188 todoItem->todo()->setCompleted(false);
1191 } 1189 }
1192 } 1190 }
1193#endif 1191#endif
1194} 1192}
1195 1193
1196void KOTodoView::setDocumentId( const QString &id ) 1194void KOTodoView::setDocumentId( const QString &id )
1197{ 1195{
1198 kdDebug() << "KOTodoView::setDocumentId()" << endl;
1199 1196
1200 mDocPrefs->setDoc( id ); 1197 mDocPrefs->setDoc( id );
1201} 1198}
1202 1199
1203void KOTodoView::itemStateChanged( QListViewItem *item ) 1200void KOTodoView::itemStateChanged( QListViewItem *item )
1204{ 1201{
1205 if (!item) return; 1202 if (!item) return;
1206 1203
1207 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1204 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1208 1205
1209// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; 1206// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl;
1210 1207
1211 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); 1208 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() );
1212} 1209}
1213 1210
1214void KOTodoView::saveLayout(KConfig *config, const QString &group) const 1211void KOTodoView::saveLayout(KConfig *config, const QString &group) const
1215{ 1212{
1216 mTodoListView->saveLayout(config,group); 1213 mTodoListView->saveLayout(config,group);
1217} 1214}
1218 1215
1219void KOTodoView::restoreLayout(KConfig *config, const QString &group) 1216void KOTodoView::restoreLayout(KConfig *config, const QString &group)
1220{ 1217{
1221 mTodoListView->restoreLayout(config,group); 1218 mTodoListView->restoreLayout(config,group);
1222} 1219}