summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-07-01 20:58:33 (UTC)
committer zautrix <zautrix>2005-07-01 20:58:33 (UTC)
commit5c03b6da2ff31c72d8c8b37d3e94f666a22081d0 (patch) (side-by-side diff)
treefb0197957a16aed93322ba61f7c6db2edd453011 /korganizer
parent541878bcf52030d8597d5e79afb6ae1185b2ac2c (diff)
downloadkdepimpi-5c03b6da2ff31c72d8c8b37d3e94f666a22081d0.zip
kdepimpi-5c03b6da2ff31c72d8c8b37d3e94f666a22081d0.tar.gz
kdepimpi-5c03b6da2ff31c72d8c8b37d3e94f666a22081d0.tar.bz2
more fixes
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kolistview.cpp102
1 files changed, 50 insertions, 52 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 4c815d8..1b4397f 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -472,61 +472,47 @@ void KOListView::setAlarm()
if ( !kap.exec() )
return;
- QPtrList<KOListViewItem> sel ;
- QListViewItem *qitem = mListView->firstChild ();
- while ( qitem ) {
- if ( qitem->isSelected() ) {
- Incidence* inc = ((KOListViewItem *) qitem)->data();
- if ( inc->typeID() != journalID ) {
- if ( inc->typeID() == todoID ) {
- if ( ((Todo*)inc)->hasDueDate() )
- sel.append(((KOListViewItem *)qitem));
- } else
- sel.append(((KOListViewItem *)qitem));
- }
- }
- qitem = qitem->nextSibling();
- }
+ QPtrList<Incidence> delSel = getSelectedIncidences( true, true, false, true ); // no journals, only due todos
+ Incidence* inc = delSel.first();
int count = 0;
- KOListViewItem * item, *temp;
- item = sel.first();
- Incidence* inc;
- while ( item ) {
- inc = item->data();
- ++count;
- if (kap.mAlarmButton->isChecked()) {
- if (inc->alarms().count() == 0)
- inc->newAlarm();
- QPtrList<Alarm> alarms = inc->alarms();
- Alarm *alarm;
- for (alarm = alarms.first(); alarm; alarm = alarms.next() ) {
- alarm->setEnabled(true);
- int j = kap.mAlarmTimeEdit->value()* -60;
- if (kap.mAlarmIncrCombo->currentItem() == 1)
- j = j * 60;
- else if (kap.mAlarmIncrCombo->currentItem() == 2)
- j = j * (60 * 24);
- alarm->setStartOffset( j );
-
- if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) {
- alarm->setProcedureAlarm(kap.mAlarmProgram);
- }
- else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn())
- alarm->setAudioAlarm(kap.mAlarmSound);
- else
- alarm->setType(Alarm::Invalid);
- //alarm->setAudioAlarm("default");
- // TODO: Deal with multiple alarms
- break; // For now, stop after the first alarm
+ while ( inc ) {
+ ++count;
+ if (kap.mAlarmButton->isChecked()) {
+ if (inc->alarms().count() == 0)
+ inc->newAlarm();
+ QPtrList<Alarm> alarms = inc->alarms();
+ Alarm *alarm;
+ for (alarm = alarms.first(); alarm; alarm = alarms.next() ) {
+ alarm->setEnabled(true);
+ int j = kap.mAlarmTimeEdit->value()* -60;
+ if (kap.mAlarmIncrCombo->currentItem() == 1)
+ j = j * 60;
+ else if (kap.mAlarmIncrCombo->currentItem() == 2)
+ j = j * (60 * 24);
+ alarm->setStartOffset( j );
+
+ if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) {
+ alarm->setProcedureAlarm(kap.mAlarmProgram);
}
- } else {
- Alarm* alarm = inc->alarms().first();
- if ( alarm ) {
- alarm->setEnabled(false);
+ else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn())
+ alarm->setAudioAlarm(kap.mAlarmSound);
+ else
alarm->setType(Alarm::Invalid);
- }
+ //alarm->setAudioAlarm("default");
+ // TODO: Deal with multiple alarms
+ break; // For now, stop after the first alarm
}
+ } else {
+ Alarm* alarm = inc->alarms().first();
+ if ( alarm ) {
+ alarm->setEnabled(false);
+ alarm->setType(Alarm::Invalid);
+ }
+ }
+ KOListViewItem* item = getItemForEvent(inc);
+ if (item) {
ListItemVisitor v(item, mStartDate );
inc->accept(v);
- item = sel.next();
+ }
+ inc = delSel.next();
}
topLevelWidget()->setCaption( i18n("Changed alarm for %1 items").arg( count ) );
@@ -700,5 +686,17 @@ QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents, bool
}
if ( addSubTodos ) {
- inc->addRelationsToList( &delSel );
+ QPtrList<Incidence> tempSel ;
+ inc->addRelationsToList( &tempSel );
+ Incidence* tempinc = tempSel.first();
+ while ( tempinc ) {
+ if ( delSel.findRef( tempinc ) == -1 ) {
+ if ( tempinc->typeID() == todoID && onlyDueTodos ) {
+ if ( ((Todo*)tempinc)->hasDueDate() )
+ delSel.append( tempinc );
+ } else
+ delSel.append( tempinc );
+ }
+ tempinc = tempSel.next();
+ }
}
}