summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koeditorgeneraltodo.cpp20
-rw-r--r--korganizer/kolistview.cpp41
-rw-r--r--korganizer/kotodoeditor.cpp17
-rw-r--r--korganizer/kotodoview.cpp11
4 files changed, 49 insertions, 40 deletions
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp
index 4a1576a..e86b4d0 100644
--- a/korganizer/koeditorgeneraltodo.cpp
+++ b/korganizer/koeditorgeneraltodo.cpp
@@ -40,4 +40,5 @@
#include <kstandarddirs.h>
#include <kfiledialog.h>
+#include <kdialog.h>
#include <libkcal/todo.h>
@@ -89,14 +90,14 @@ void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout)
i18n("Date && Time"),parent);
timeLayout->addWidget(timeGroupBox);
- timeGroupBox->layout()->setSpacing( 0 );
- timeGroupBox->layout()->setMargin( 5 );
+ timeGroupBox->layout()->setSpacing( KDialog::spacingHintSmall() );
+ timeGroupBox->layout()->setMargin( KDialog::marginHint() );
QFrame *timeBoxFrame = new QFrame(timeGroupBox);
QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,3,3);
- layoutTimeBox->setSpacing(topLayout->spacing());
+ layoutTimeBox->setSpacing(KDialog::spacingHintSmall());
layoutTimeBox->setColStretch( 1, 1 );
mDueCheck = new QCheckBox(i18n("Due:"),timeBoxFrame);
- layoutTimeBox->addWidget(mDueCheck,0,0);
+ layoutTimeBox->addWidget(mDueCheck,1,0);
connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(enableDueEdit(bool)));
connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(showAlarm()));
@@ -104,19 +105,19 @@ void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout)
mDueDateEdit = new KDateEdit(timeBoxFrame);
- layoutTimeBox->addWidget(mDueDateEdit,0,1);
+ layoutTimeBox->addWidget(mDueDateEdit,1,1);
mDueTimeEdit = new KOTimeEdit(timeBoxFrame);
- layoutTimeBox->addWidget(mDueTimeEdit,0,2);
+ layoutTimeBox->addWidget(mDueTimeEdit,1,2);
mStartCheck = new QCheckBox(i18n("Start:"),timeBoxFrame);
- layoutTimeBox->addWidget(mStartCheck,1,0);
+ layoutTimeBox->addWidget(mStartCheck,0,0);
connect(mStartCheck,SIGNAL(toggled(bool)),SLOT(enableStartEdit(bool)));
mStartDateEdit = new KDateEdit(timeBoxFrame);
- layoutTimeBox->addWidget(mStartDateEdit,1,1);
+ layoutTimeBox->addWidget(mStartDateEdit,0,1);
mStartTimeEdit = new KOTimeEdit(timeBoxFrame);
- layoutTimeBox->addWidget(mStartTimeEdit,1,2);
+ layoutTimeBox->addWidget(mStartTimeEdit,0,2);
@@ -342,5 +343,4 @@ void KOEditorGeneralTodo::writeTodo(Todo *todo)
QDateTime comp ( mCompleteDateEdit->date(), mCompleteTimeEdit->getTime() );
if ( comp.isValid () ) {
- todo->setPercentComplete(0);
todo->setPercentComplete(100);
todo->setCompleted(comp);
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index bbf83d9..fd86095 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -372,6 +372,4 @@ void KOListView::setAlarm()
if ( !kap.exec() )
return;
-
-
QStringList itemList;
QPtrList<KOListViewItem> sel ;
@@ -429,9 +427,7 @@ void KOListView::setAlarm()
}
}
- temp = item;
+ ListItemVisitor v(item, mStartDate );
+ inc->accept(v);
item = sel.next();
- mUidDict.remove( inc->uid() );
- delete temp;;
- addIncidence( inc );
}
topLevelWidget()->setCaption( i18n("Canged alarm for %1 items").arg( count ) );
@@ -444,4 +440,5 @@ void KOListView::setCategories( bool removeOld )
KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
+ csd->setColorEnabled();
if (! csd->exec()) {
delete csd;
@@ -452,5 +449,5 @@ void KOListView::setCategories( bool removeOld )
// if ( catList.count() == 0 )
// return;
- catList.sort();
+ //catList.sort();
QString categoriesStr = catList.join(",");
int i;
@@ -466,23 +463,27 @@ void KOListView::setCategories( bool removeOld )
KOListViewItem * item, *temp;
item = sel.first();
- Incidence* inc;
+ if( item ) {
+ Incidence* inc = item->data() ;
+ bool setSub = false;
+ if( inc->type() == "Todo" && sel.count() == 1 && inc->relations().count() > 0 ) {
+ int result = KMessageBox::warningYesNoCancel(this,
+ i18n("The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?").arg( inc->summary().left ( 25 ) ),
+ i18n("Todo has subtodos"),
+ i18n("Yes"),
+ i18n("No"));
+ if (result == KMessageBox::Cancel) item = 0;
+ if (result == KMessageBox::Yes) setSub = true;
+ }
while ( item ) {
inc = item->data();
if ( removeOld ) {
- inc->setCategories( categoriesStr );
+ inc->setCategories( catList, setSub );
} else {
- itemList = QStringList::split (",", inc->categoriesStr() );
- for( i = 0; i< catList.count(); ++i ) {
- if ( !itemList.contains (catList[i]))
- itemList.append( catList[i] );
- }
- itemList.sort();
- inc->setCategories( itemList.join(",") );
+ inc->addCategories( catList, setSub );
}
- temp = item;
+ ListItemVisitor v(item, mStartDate );
+ inc->accept(v);
item = sel.next();
- mUidDict.remove( inc->uid() );
- delete temp;;
- addIncidence( inc );
+ }
}
QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp
index 6a05cc8..5513e8b 100644
--- a/korganizer/kotodoeditor.cpp
+++ b/korganizer/kotodoeditor.cpp
@@ -111,9 +111,9 @@ void KOTodoEditor::setupGeneral()
QBoxLayout *topLayout = new QVBoxLayout(topFrame);
if ( QApplication::desktop()->width() < 480 ) {
- topLayout->setMargin(1);
- topLayout->setSpacing(1);
+ topLayout->setMargin(marginHintSmall());
+ topLayout->setSpacing(spacingHintSmall());
} else {
- topLayout->setMargin(marginHint()-1);
- topLayout->setSpacing(spacingHint()-1);
+ topLayout->setMargin(marginHint());
+ topLayout->setSpacing(spacingHint());
}
mGeneral->initHeader(topFrame,topLayout);
@@ -345,4 +345,8 @@ void KOTodoEditor::readTodo(Todo *todo)
void KOTodoEditor::writeTodo(Todo *event)
{
+ bool maybeComputeRecurrenceTime = false;
+ if( event->hasRecurrenceID() && event->percentComplete() < 100)
+ maybeComputeRecurrenceTime = true;
+ event->setHasRecurrenceID( false );
mGeneral->writeTodo(event);
mDetails->writeEvent(event);
@@ -355,5 +359,8 @@ void KOTodoEditor::writeTodo(Todo *event)
mRecurrence->writeEvent(event);
if ( event->doesRecur() ) {
- event->setRecurrenceID( event->dtStart().addSecs(-1) );
+ int addSec = -1 ;
+ if ( maybeComputeRecurrenceTime && event->percentComplete() == 100 )
+ addSec = 1;
+ event->setRecurrenceID( event->dtStart().addSecs( addSec ) );
event->setRecurDates();
} else {
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 25be63a..f26d16d 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -466,7 +466,4 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
mItemPopupMenu = new QPopupMenu(this);
- mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this,
- SLOT (toggleRunningItem()));
- mItemPopupMenu->insertSeparator();
mItemPopupMenu->insertItem(i18n("Show..."), this,
SLOT (showTodo()));
@@ -484,4 +481,7 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
SLOT (cancelTodo()));
mItemPopupMenu->insertSeparator();
+ mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this,
+ SLOT (toggleRunningItem()));
+ mItemPopupMenu->insertSeparator();
/*
mItemPopupMenu->insertItem( i18n("New Todo..."), this,
@@ -513,6 +513,4 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
mPopupMenu->insertItem(i18n("Show Completed"),
this, SLOT( toggleCompleted() ),0,3 );
- mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
- this, SLOT( toggleQuickTodo() ),0,4 );
mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"),
this, SLOT( toggleRunning() ),0,5 );
@@ -523,4 +521,7 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
mPopupMenu->insertItem(i18n(" set all flat","Display all flat"),
this, SLOT( setAllFlat() ),0,8 );
+ mPopupMenu->insertSeparator();
+ mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
+ this, SLOT( toggleQuickTodo() ),0,4 );
mDocPrefs = new DocPrefs( name );