summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-25 16:06:31 (UTC)
committer zautrix <zautrix>2005-06-25 16:06:31 (UTC)
commit3867528ada39bb50a18802c499fbc3f6fae26e8c (patch) (side-by-side diff)
tree6b619b3bc6dea00e52648b4a394a61ab4ee8a072
parent49d8fe456ce284a512227a7ca9d4d49688a39cd2 (diff)
downloadkdepimpi-3867528ada39bb50a18802c499fbc3f6fae26e8c.zip
kdepimpi-3867528ada39bb50a18802c499fbc3f6fae26e8c.tar.gz
kdepimpi-3867528ada39bb50a18802c499fbc3f6fae26e8c.tar.bz2
fixxxxx
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt3
-rw-r--r--korganizer/koeditorgeneral.h1
-rw-r--r--korganizer/koeditorgeneralevent.cpp2
-rw-r--r--korganizer/koeditorgeneralevent.h1
-rw-r--r--korganizer/koeditorgeneraltodo.cpp9
-rw-r--r--korganizer/koeditorgeneraltodo.h1
-rw-r--r--korganizer/koeditorrecurrence.cpp42
-rw-r--r--korganizer/koeditorrecurrence.h4
-rw-r--r--korganizer/koeventeditor.cpp4
-rw-r--r--korganizer/kotodoeditor.cpp8
10 files changed, 49 insertions, 26 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index fdaf740..4b965c1 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,56 +1,59 @@
Info about the changes in new versions of KDE-Pim/Pi
********** VERSION 2.1.9 ************
KO/Pi:
Fixed some problems of the new search options in the search dialog.
Fixed some problems in the new resource config options.
Changed the recurrence edit of events and todos such that the recurrence edit page now is notified about a change of the start date on the first page.
+Fixed a problem cearting new events in the agenda view if at the day/time is already an agenda item shown:
+Now you can click on the bottom/top of an allday agenda item and on the left/right of an agenda item to get the "new todo/new event" popup.
+
PwM/Pi:
Added "sec" to the timeout config settings to make it clear the timeout values are seconds.
********** VERSION 2.1.8 ************
KO/Pi:
Added info about the completion state of a todo in the ListView/Searchdialog.
If in TodoView is selected "do not show compledted todos" then completed todos are not shown in the ListView as well.
Fixed some updating problems when changing the filter.
KA/Pi:
In the addressee selection dialog now the formatted name is shown, if not empty.
Added a column "category" to the addressee selection dialog to make it possible to sort addressees after category.
Now in the addressee selection dialog a selected contact is remove with a single click from the selected list.
Fixed in the file selector on the Zaurus the problem that symbolic links to files/dirs were ignored.
Fixed the sorting for size in the file selector on the Z.
Changed the color selection dialog on the Zaurus to a more user friendly version.
********** VERSION 2.1.7 ************
KO/Pi:
Fixed several problems in the new Resource handling.
Added more options to the search dialog.
Fixed a problem in the Month view.
Added more options to the dialog when setting a todo to stopped.
Fixed two small problems in KO/Pi Alarm applet.
********** VERSION 2.1.6 ************
This release is for testing only.
KO/Pi:
Added to the list view (the list view is used in search dialog as well) the possibility to print it.
Added to the list view the possibility to hide entries, if you do not want to print all entries of the list view.
Added to the list view the possibility to add all subtodos of selected todos to an export/beam.
Added to the search dialog the possibility to make an additive search such that you can get a better list for export/printout.
Added to the search dialog the possibility to hide the checkboxes such that there is more space for the list view on the Zaurus.
Fixed a problem in the AlarmTimer Applet: Now utf8 messages are displayed properly.
Added support for multiple calendar files in KO/Pi. Only local ical (*.ics) files are supported as calendars.
In the sync profile config it is still missing to specify a particular calendar to sync with this profile. That setting will be added later.
Now on every sync the set of calendars is synced which are enabled in the resource view.
A calendar is enabled in the resource view if the "eye" column is checked.
diff --git a/korganizer/koeditorgeneral.h b/korganizer/koeditorgeneral.h
index 2069e9c..a8f6443 100644
--- a/korganizer/koeditorgeneral.h
+++ b/korganizer/koeditorgeneral.h
@@ -40,76 +40,77 @@
#include <libkcal/incidence.h>
#include "ktimeedit.h"
class KDateEdit;
class KOLocationBox;
using namespace KCal;
class KOEditorGeneral : public QObject
{
Q_OBJECT
public:
KOEditorGeneral (QObject* parent=0,const char* name=0);
virtual ~KOEditorGeneral();
void setFocusOn( int i );
void initHeader(QWidget *,QBoxLayout *);
void initDescription(QWidget *,QBoxLayout *);
void initSecrecy(QWidget *,QBoxLayout *);
void initCategories(QWidget *,QBoxLayout *);
void initAlarm(QWidget *,QBoxLayout *);
/** Set widgets to default values */
void setDefaults(bool allDay);
/** Read event object and setup widgets accordingly */
void readIncidence(Incidence *);
/** Write event settings to event object */
void writeIncidence(Incidence *);
/** Check if the input is valid. */
bool validateInput() { return true; }
void enableAlarm( bool enable );
void setSecrecy( int num );
public slots:
void setCategories(const QString &);
void editCategories();
protected slots:
void enableAlarmEdit( bool enable );
void disableAlarmEdit( bool disable );
void alarmDisable( bool disable );
void pickAlarmSound();
void pickAlarmProgram();
void slotSetFocusOn();
signals:
void openCategoryDialog();
void allAccepted();
+ void dateTimesChanged(QDateTime,QDateTime);
protected:
int mNextFocus;
//QLineEdit *mSummaryEdit;
//QLineEdit *mLocationEdit;
KOLocationBox *mSummaryEdit;
KOLocationBox *mLocationEdit;
QLabel *mAlarmBell;
QCheckBox *mAlarmButton;
QSpinBox *mAlarmTimeEdit;
QPushButton *mAlarmSoundButton;
QPushButton *mAlarmProgramButton;
QComboBox *mAlarmIncrCombo;
KTextEdit *mDescriptionEdit;
QLabel *mOwnerLabel;
QComboBox *mSecrecyCombo;
QCheckBox *mCancelBox;
QPushButton *mCategoriesButton;
QLabel *mCategoriesLabel;
private:
QString getFittingPath( const QString ) ;
QString mAlarmSound;
QString mAlarmProgram;
QString mAlarmMessage;
};
#endif
diff --git a/korganizer/koeditorgeneralevent.cpp b/korganizer/koeditorgeneralevent.cpp
index af97ee9..3dd7f5c 100644
--- a/korganizer/koeditorgeneralevent.cpp
+++ b/korganizer/koeditorgeneralevent.cpp
@@ -192,97 +192,97 @@ void KOEditorGeneralEvent::setDateTimes(QDateTime start, QDateTime end)
mCurrEndDateTime = end;
setDuration();
emitDateTimeStr();
}
void KOEditorGeneralEvent::sTimeChanged(QTime ti)
{
mStartTimeEdit->setTime( ti );
startTimeChanged ( ti);
}
void KOEditorGeneralEvent::eTimeChanged(QTime ti )
{
mEndTimeEdit->setTime( ti );
endTimeChanged( ti );
}
void KOEditorGeneralEvent::startTimeChanged(QTime newtime)
{
int secsep = mCurrStartDateTime.secsTo(mCurrEndDateTime);
mCurrStartDateTime = QDateTime( mStartDateEdit->date(), QTime(newtime.hour(),newtime.minute(),0) );
// adjust end time so that the event has the same duration as before.
if( secsep > 0 )
mCurrEndDateTime = mCurrStartDateTime.addSecs(secsep);
mEndTimeEdit->setTime(mCurrEndDateTime.time());
mEndDateEdit->setDate(mCurrEndDateTime.date());
emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime);
}
void KOEditorGeneralEvent::endTimeChanged(QTime newtime)
{
mCurrEndDateTime = QDateTime ( mEndDateEdit->date(), QTime(newtime.hour(),newtime.minute(),0));
emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime);
}
void KOEditorGeneralEvent::startDateChanged(QDate newdate)
{
int daysep = mCurrStartDateTime.daysTo(mCurrEndDateTime);
mCurrStartDateTime.setDate(newdate);
// adjust end date so that the event has the same duration as before
mCurrEndDateTime.setDate(mCurrStartDateTime.date().addDays(daysep));
mEndDateEdit->setDate(mCurrEndDateTime.date());
-
+ qDebug("KOEditorGeneralEvent::startDateChanged ");
emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime);
}
void KOEditorGeneralEvent::endDateChanged(QDate newdate)
{
QDateTime newdt(newdate, mCurrEndDateTime.time());
if(newdt < mCurrStartDateTime) {
// oops, we can't let that happen.
newdt = mCurrStartDateTime;
mEndDateEdit->setDate(newdt.date());
mEndTimeEdit->setTime(newdt.time());
}
mCurrEndDateTime = newdt;
emit dateTimesChanged(mCurrStartDateTime,mCurrEndDateTime);
}
void KOEditorGeneralEvent::setDefaults(QDateTime from,QDateTime to,bool allDay)
{
mSummaryEdit->load(KOLocationBox::SUMMARYEVENT);
mLocationEdit->load(KOLocationBox::LOCATION);
KOEditorGeneral::setDefaults(allDay);
mNoTimeButton->setChecked(allDay);
timeStuffDisable(allDay);
mFreeTimeCombo->setCurrentItem( 0 );
setDateTimes(from,to);
}
void KOEditorGeneralEvent::readEvent( Event *event, bool tmpl )
{
QString tmpStr;
mTemplate = tmpl;
// the rest is for the events only
mNoTimeButton->setChecked(event->doesFloat());
timeStuffDisable(event->doesFloat());
setDateTimes(event->dtStart(),event->dtEnd());
mTemplate = false;
switch( event->transparency() ) {
case Event::Transparent:
mFreeTimeCombo->setCurrentItem(1);
break;
case Event::Opaque:
mFreeTimeCombo->setCurrentItem(0);
diff --git a/korganizer/koeditorgeneralevent.h b/korganizer/koeditorgeneralevent.h
index 9649806..d798905 100644
--- a/korganizer/koeditorgeneralevent.h
+++ b/korganizer/koeditorgeneralevent.h
@@ -42,70 +42,69 @@
class KDateEdit;
using namespace KCal;
class KOEditorGeneralEvent : public KOEditorGeneral
{
Q_OBJECT
public:
KOEditorGeneralEvent (QObject* parent=0,const char* name=0);
virtual ~KOEditorGeneralEvent();
void initTime(QWidget *,QBoxLayout *);
void initClass(QWidget *,QBoxLayout *);
void finishSetup();
/** Set widgets to default values */
void setDefaults(QDateTime from,QDateTime to,bool allDay);
/**
Read event object and setup widgets accordingly. If templ is true, the
event is read as template, i.e. the time and date information isn't set.
*/
void readEvent( Event *, bool tmpl = false );
/** Write event settings to event object */
void writeEvent(Event *);
/** Check if the input is valid. */
bool validateInput();
public slots:
void setDateTimes(QDateTime start, QDateTime end);
void setDuration();
protected slots:
void timeStuffDisable(bool disable);
void dontAssociateTime(bool noTime);
void startTimeChanged(QTime);
void startDateChanged(QDate);
void endTimeChanged(QTime);
void endDateChanged(QDate);
void emitDateTimeStr();
void sTimeChanged(QTime);
void eTimeChanged(QTime);
signals:
- void dateTimesChanged(QDateTime start,QDateTime end);
void allDayChanged(bool);
void dateTimeStrChanged(const QString &);
private:
bool mTemplate;
QLabel *mStartDateLabel;
QLabel *mEndDateLabel;
KDateEdit *mStartDateEdit;
KDateEdit *mEndDateEdit;
KOTimeEdit *mStartTimeEdit;
KOTimeEdit *mEndTimeEdit;
QLabel *mDurationLabel;
QCheckBox *mNoTimeButton;
QComboBox *mFreeTimeCombo;
// current start and end date and time
QDateTime mCurrStartDateTime;
QDateTime mCurrEndDateTime;
};
#endif
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp
index e86b4d0..0a734ee 100644
--- a/korganizer/koeditorgeneraltodo.cpp
+++ b/korganizer/koeditorgeneraltodo.cpp
@@ -82,97 +82,98 @@ void KOEditorGeneralTodo::finishSetup()
mSummaryEdit->setFocus();
}
void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout)
{
QBoxLayout *timeLayout = new QVBoxLayout(topLayout);
QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal,
i18n("Date && Time"),parent);
timeLayout->addWidget(timeGroupBox);
timeGroupBox->layout()->setSpacing( KDialog::spacingHintSmall() );
timeGroupBox->layout()->setMargin( KDialog::marginHint() );
QFrame *timeBoxFrame = new QFrame(timeGroupBox);
QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,3,3);
layoutTimeBox->setSpacing(KDialog::spacingHintSmall());
layoutTimeBox->setColStretch( 1, 1 );
mDueCheck = new QCheckBox(i18n("Due:"),timeBoxFrame);
layoutTimeBox->addWidget(mDueCheck,1,0);
connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(enableDueEdit(bool)));
connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(showAlarm()));
mDueDateEdit = new KDateEdit(timeBoxFrame);
layoutTimeBox->addWidget(mDueDateEdit,1,1);
mDueTimeEdit = new KOTimeEdit(timeBoxFrame);
layoutTimeBox->addWidget(mDueTimeEdit,1,2);
mStartCheck = new QCheckBox(i18n("Start:"),timeBoxFrame);
layoutTimeBox->addWidget(mStartCheck,0,0);
connect(mStartCheck,SIGNAL(toggled(bool)),SLOT(enableStartEdit(bool)));
mStartDateEdit = new KDateEdit(timeBoxFrame);
layoutTimeBox->addWidget(mStartDateEdit,0,1);
mStartTimeEdit = new KOTimeEdit(timeBoxFrame);
layoutTimeBox->addWidget(mStartTimeEdit,0,2);
mTimeButton = new QCheckBox(i18n("Time associated"),timeBoxFrame);
layoutTimeBox->addMultiCellWidget(mTimeButton,2,2,0,1);
connect(mTimeButton,SIGNAL(toggled(bool)),SLOT(enableTimeEdits(bool)));
connect(mDueDateEdit,SIGNAL(setTimeTo(QTime)),mDueTimeEdit,SLOT(setTime(QTime)));
connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),mStartTimeEdit,SLOT(setTime(QTime)));
-
+ connect(mStartDateEdit, SIGNAL(dateChanged(QDate)),
+ this, SLOT(startDateChanged(QDate)));
// some more layouting
//layoutTimeBox->setColStretch(3,1);
}
void KOEditorGeneralTodo::initCompletion(QWidget *parent, QBoxLayout *topLayout)
{
mCompletedCombo = new QComboBox(parent);
// xgettext:no-c-format
mCompletedCombo->insertItem(i18n(" 0 %"));
// xgettext:no-c-format
mCompletedCombo->insertItem(i18n(" 20 %"));
// xgettext:no-c-format
mCompletedCombo->insertItem(i18n(" 40 %"));
// xgettext:no-c-format
mCompletedCombo->insertItem(i18n(" 60 %"));
// xgettext:no-c-format
mCompletedCombo->insertItem(i18n(" 80 %"));
// xgettext:no-c-format
mCompletedCombo->insertItem(i18n("100 %"));
connect(mCompletedCombo,SIGNAL(activated(int)),SLOT(completedChanged(int)));
topLayout->addWidget(mCompletedCombo);
mCompletedLabel = new QLabel(i18n("completed"),parent);
topLayout->addWidget(mCompletedLabel);
mCompleteDateEdit = new KDateEdit(parent);
topLayout->addWidget(mCompleteDateEdit );
mCompleteTimeEdit = new KOTimeEdit(parent);
topLayout->addWidget( mCompleteTimeEdit);
mCompletedCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred,QSizePolicy::Preferred) );
mCompletedLabel->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,QSizePolicy::Preferred) );
connect(mCompleteDateEdit,SIGNAL(setTimeTo(QTime)),mCompleteTimeEdit,SLOT(setTime(QTime)));
if ( QApplication::desktop()->width() <= 480 ) {
if ( QApplication::desktop()->width() < 320 )
mCompleteDateEdit->setMaximumWidth( 85 );
else
mCompleteDateEdit->setMaximumWidth( 140 );
topLayout->setSpacing( 0 );
}
}
void KOEditorGeneralTodo::initPriority(QWidget *parent, QBoxLayout *topLayout)
{
@@ -350,97 +351,101 @@ void KOEditorGeneralTodo::writeTodo(Todo *todo)
todo->setCompleted(mCompleted);
}
} else {
todo->setPercentComplete(mCompletedCombo->currentItem() * 20);
}
mSummaryEdit->save(KOLocationBox::SUMMARYTODO);
}
void KOEditorGeneralTodo::enableDueEdit(bool enable)
{
mDueDateEdit->setEnabled( enable );
if(mDueCheck->isChecked() || mStartCheck->isChecked()) {
mTimeButton->setEnabled(true);
}
else {
mTimeButton->setEnabled(false);
mTimeButton->setChecked(false);
}
if (enable) {
mDueTimeEdit->setEnabled( mTimeButton->isChecked() );
} else {
mDueTimeEdit->setEnabled( false );
}
emit datesChecked();
}
void KOEditorGeneralTodo::enableStartEdit( bool enable )
{
mStartDateEdit->setEnabled( enable );
if(mDueCheck->isChecked() || mStartCheck->isChecked()) {
mTimeButton->setEnabled(true);
}
else {
mTimeButton->setEnabled(false);
mTimeButton->setChecked(false);
}
if (enable) {
mStartTimeEdit->setEnabled( mTimeButton->isChecked() );
} else {
mStartTimeEdit->setEnabled( false );
}
emit datesChecked();
}
-
+void KOEditorGeneralTodo::startDateChanged(QDate newdate)
+{
+ if ( mDueCheck->isChecked() )
+ emit dateTimesChanged(newdate,mDueDateEdit->date());
+}
void KOEditorGeneralTodo::enableTimeEdits(bool enable)
{
if(mStartCheck->isChecked()) {
mStartTimeEdit->setEnabled( enable );
}
if(mDueCheck->isChecked()) {
mDueTimeEdit->setEnabled( enable );
}
}
void KOEditorGeneralTodo::showAlarm()
{
if ( mDueCheck->isChecked() ) {
alarmDisable(false);
}
else {
alarmDisable(true);
}
}
bool KOEditorGeneralTodo::validateInput()
{
if (mDueCheck->isChecked()) {
if (!mDueDateEdit->inputIsValid()) {
KMessageBox::sorry(0,i18n("Please specify a valid due date."));
return false;
}
}
if (mStartCheck->isChecked()) {
if (!mStartDateEdit->inputIsValid()) {
KMessageBox::sorry(0,i18n("Please specify a valid start date."));
return false;
}
}
if (mStartCheck->isChecked() && mDueCheck->isChecked()) {
QDateTime startDate;
QDateTime dueDate;
startDate.setDate(mStartDateEdit->date());
dueDate.setDate(mDueDateEdit->date());
if (mTimeButton->isChecked()) {
startDate.setTime(mStartTimeEdit->getTime());
dueDate.setTime(mDueTimeEdit->getTime());
}
if (startDate > dueDate) {
KMessageBox::sorry(0,
i18n("The start date cannot be after the due date."));
diff --git a/korganizer/koeditorgeneraltodo.h b/korganizer/koeditorgeneraltodo.h
index b198539..2e56a7a 100644
--- a/korganizer/koeditorgeneraltodo.h
+++ b/korganizer/koeditorgeneraltodo.h
@@ -30,80 +30,81 @@
#include <qgroupbox.h>
#include <qlineedit.h>
#include <qcombobox.h>
#include <qmultilineedit.h>
#include <qlistview.h>
#include <qradiobutton.h>
#include "koeditorgeneral.h"
#include "koglobals.h"
class KRestrictedLine;
class KDateEdit;
using namespace KCal;
class KOEditorGeneralTodo : public KOEditorGeneral
{
Q_OBJECT
public:
KOEditorGeneralTodo (QObject* parent=0,const char* name=0);
virtual ~KOEditorGeneralTodo();
void initTime(QWidget *, QBoxLayout *);
void initStatus(QWidget *, QBoxLayout *);
void initCompletion(QWidget *, QBoxLayout *);
void initPriority(QWidget *, QBoxLayout *);
void finishSetup();
/** Set widgets to default values */
void setDefaults(QDateTime due,bool allDay);
/** Read todo object and setup widgets accordingly */
void readTodo(Todo *);
/** Write todo settings to event object */
void writeTodo(Todo *);
/** Check if the input is valid. */
bool validateInput();
/** The todo has been modified externally */
void modified (Todo*, int);
signals:
void openCategoryDialog();
void datesChecked();
protected slots:
+ void startDateChanged(QDate newdate);
void completedChanged(int);
void enableDueEdit( bool enable );
void enableStartEdit( bool enable );
void enableTimeEdits( bool enable );
void showAlarm();
protected:
void setCompletedDate();
private:
friend class KOTodoEditor;
KDateEdit *mStartDateEdit;
KOTimeEdit *mStartTimeEdit;
KDateEdit *mCompleteDateEdit;
KOTimeEdit *mCompleteTimeEdit;
QCheckBox *mTimeButton;
QCheckBox *mDueCheck;
KDateEdit *mDueDateEdit;
KOTimeEdit *mDueTimeEdit;
QComboBox *mCompletedCombo;
QLabel *mCompletedLabel;
QLabel *mPriorityLabel;
QComboBox *mPriorityCombo;
QCheckBox *mStartCheck;
QDateTime mCompleted;
};
#endif
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp
index dea8981..de4e4f7 100644
--- a/korganizer/koeditorrecurrence.cpp
+++ b/korganizer/koeditorrecurrence.cpp
@@ -790,231 +790,243 @@ KOEditorRecurrence::KOEditorRecurrence( QWidget* parent, const char *name ) :
}
connect( mExceptionsButton, SIGNAL( clicked() ),
SLOT( showExceptionsDialog() ) );
}
KOEditorRecurrence::~KOEditorRecurrence()
{
}
void KOEditorRecurrence::setEnabled( bool enabled )
{
// kdDebug() << "KOEditorRecurrence::setEnabled(): " << (enabled ? "on" : "off") << endl;
mTimeGroupBox->setEnabled( enabled );
if ( mRecurrenceRangeWidget ) mRecurrenceRangeWidget->setEnabled( enabled );
if ( mRecurrenceRangeButton ) mRecurrenceRangeButton->setEnabled( enabled );
if ( mExceptionsWidget ) mExceptionsWidget->setEnabled( enabled );
if ( mExceptionsButton ) mExceptionsButton->setEnabled( enabled );
mRuleBox->setEnabled( enabled );
}
void KOEditorRecurrence::showCurrentRule( int current )
{
switch ( current ) {
case Daily:
mRuleStack->raiseWidget( mDaily );
break;
case Weekly:
mRuleStack->raiseWidget( mWeekly );
break;
case Monthly:
mRuleStack->raiseWidget( mMonthly );
break;
default:
case Yearly:
mRuleStack->raiseWidget( mYearly );
break;
}
}
void KOEditorRecurrence::setDateTimes( QDateTime start, QDateTime end )
{
// kdDebug() << "KOEditorRecurrence::setDateTimes" << endl;
mRecurrenceRange->setDateTimes( start, end );
mExceptions->setDefaults( end );
}
-
-void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to, bool )
+void KOEditorRecurrence::setDefaultsDates( QDateTime from, QDateTime to )
+{
+ setDateTimes( from, to );
+ QBitArray days( 7 );
+ days.fill( 0 );
+ days.setBit( from.date().dayOfWeek()- 1);
+ mWeekly->setDays( days );
+ bool byPos = mMonthly->byPos();
+ if ( byPos )
+ mMonthly->setByDay( from.date().day()-1 );
+ mMonthly->setByPos((from.date().day()/7), from.date().dayOfWeek()-1 );
+ if ( ! byPos)
+ mMonthly->setByDay( from.date().day()-1 );
+
+ bool byDay = mYearly->byDay();
+ if ( ! byDay )
+ mYearly->setByDay( from.date().dayOfYear() );
+ mYearly->setByMonth( from.date().month(), from.date().day() );
+ if ( byDay )
+ mYearly->setByDay( from.date().dayOfYear() );
+}
+void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to )
{
// qDebug("KOEditorRecurrence::setDefaults %s %s ",from.toString().latin1(),to.toString().latin1() );
- setDateTimes( from, to );
+ //setDateTimes( from, to );
bool enabled = false;
mEnabledCheck->setChecked( enabled );
setEnabled( enabled );
mExceptions->setDefaults( to );
mRecurrenceRange->setDefaults( to );
mRecurrenceChooser->setType( RecurrenceChooser::Weekly );
showCurrentRule( mRecurrenceChooser->type() );
mDaily->setFrequency( 1 );
-
mWeekly->setFrequency( 1 );
- QBitArray days( 7 );
- days.fill( 0 );
- days.setBit( from.date().dayOfWeek()- 1);
- mWeekly->setDays( days );
mMonthly->setFrequency( 1 );
- mMonthly->setByPos((from.date().day()/7), from.date().dayOfWeek()-1 );
- mMonthly->setByDay( from.date().day()-1 );
mYearly->setFrequency( 1 );
- mYearly->setByDay( from.date().dayOfYear() );
- mYearly->setByMonth( from.date().month(), from.date().day() );
+ setDefaultsDates( from, to );
}
void KOEditorRecurrence::readEvent(Incidence *event)
{
QDateTime dtEnd;
if ( event->typeID() == eventID )
dtEnd = ((Event*)event)->dtEnd();
else
dtEnd = ((Todo*)event)->dtDue();
- setDefaults( event->dtStart(), dtEnd, true );
+ setDefaults( event->dtStart(), dtEnd );
QBitArray rDays( 7 );
QPtrList<Recurrence::rMonthPos> rmp;
QPtrList<int> rmd;
int day = 0;
int count = 0;
int month = 0;
setDateTimes( event->dtStart(), dtEnd );
Recurrence *r = event->recurrence();
int f = r->frequency();
int recurs = r->doesRecur();
mEnabledCheck->setChecked( recurs );
setEnabled( recurs );
int recurrenceType = RecurrenceChooser::Weekly;
switch ( recurs ) {
case Recurrence::rNone:
- setDefaults( event->dtStart(), dtEnd, true );
+ setDefaults( event->dtStart(), dtEnd );
break;
case Recurrence::rDaily:
recurrenceType = RecurrenceChooser::Daily;
mDaily->setFrequency( f );
break;
case Recurrence::rWeekly:
recurrenceType = RecurrenceChooser::Weekly;
mWeekly->setFrequency( f );
mWeekly->setDays( r->days() );
break;
case Recurrence::rMonthlyPos:
// we only handle one possibility in the list right now,
// so I have hardcoded calls with first(). If we make the GUI
// more extended, this can be changed.
recurrenceType = RecurrenceChooser::Monthly;
rmp = r->monthPositions();
if ( rmp.first()->negative )
count = 5 - rmp.first()->rPos - 1;
else
count = rmp.first()->rPos - 1;
day = 0;
while ( !rmp.first()->rDays.testBit( day ) ) ++day;
mMonthly->setByPos( count, day );
mMonthly->setFrequency( f );
break;
case Recurrence::rMonthlyDay:
recurrenceType = RecurrenceChooser::Monthly;
rmd = r->monthDays();
day = *rmd.first() - 1;
mMonthly->setByDay( day );
mMonthly->setFrequency( f );
break;
case Recurrence::rYearlyMonth:
{
recurrenceType = RecurrenceChooser::Yearly;
//qDebug("Recurrence::rYearlyMonth: ");
day = event->dtStart().date().day();
rmd = r->yearNums();
if ( rmd.count() > 0 )
month = *rmd.first();
else
month = event->dtStart().date().month() ;
mYearly->setByMonth( month, day );
#if 0
//qDebug("2day = %d ",day );
QPtrList<Recurrence::rMonthPos> monthlist = r->yearMonthPositions();
int month;
if ( !monthlist.isEmpty() ) {
month = monthlist.first()->rPos ;
} else {
month = event->dtStart().date().month() ;
}
mYearly->setByMonth( day, month );
#endif
mYearly->setFrequency( f );
}
break;
case Recurrence::rYearlyDay:
//qDebug("Recurrence::rYearlyDay: ");
recurrenceType = RecurrenceChooser::Yearly;
mYearly->setByDay( event->dtStart().date().dayOfYear() );
mYearly->setFrequency( f );
break;
default:
- setDefaults( event->dtStart(), dtEnd, true );
+ setDefaults( event->dtStart(), dtEnd );
break;
}
mRecurrenceChooser->setType( recurrenceType );
showCurrentRule( recurrenceType );
mRecurrenceRange->setDateTimes( event->dtStart() );
if ( r->doesRecur() ) {
mRecurrenceRange->setDuration( r->duration() );
if ( r->duration() == 0 )
{
if ( r->endDate() < event->dtStart().date() )
mRecurrenceRange->setEndDate( event->dtStart().date() );
else
mRecurrenceRange->setEndDate( r->endDate() );
} else
mRecurrenceRange->setEndDate( event->dtStart().date() );
}
mExceptions->setDates( event->exDates() );
}
void KOEditorRecurrence::writeEvent( Incidence *event )
{
Recurrence *r = event->recurrence();
// clear out any old settings;
r->unsetRecurs();
if ( mEnabledCheck->isChecked() ) {
int duration = mRecurrenceRange->duration();
QDate endDate;
if ( duration == 0 ) endDate = mRecurrenceRange->endDate();
int recurrenceType = mRecurrenceChooser->type();
if ( recurrenceType == RecurrenceChooser::Daily ) {
int freq = mDaily->frequency();
if ( duration != 0 ) r->setDaily( freq, duration );
else r->setDaily( freq, endDate );
} else if ( recurrenceType == RecurrenceChooser::Weekly ) {
int freq = mWeekly->frequency();
QBitArray days = mWeekly->days();
int j;
bool found = false;
for (j = 0; j < 7 ; ++j ) {
found |=days.at(j);
diff --git a/korganizer/koeditorrecurrence.h b/korganizer/koeditorrecurrence.h
index a15afcb..f398f62 100644
--- a/korganizer/koeditorrecurrence.h
+++ b/korganizer/koeditorrecurrence.h
@@ -226,99 +226,99 @@ class RecurrenceRangeWidget : public QWidget, public RecurrenceRangeBase
void setEndDate( const QDate & );
QDate endDate();
void setDateTimes( const QDateTime &start,
const QDateTime &end = QDateTime() );
protected slots:
void showCurrentRange();
private:
QGroupBox *mRangeGroupBox;
QLabel *mStartDateLabel;
QRadioButton *mNoEndDateButton;
QRadioButton *mEndDurationButton;
QSpinBox *mEndDurationEdit;
QRadioButton *mEndDateButton;
KDateEdit *mEndDateEdit;
};
class RecurrenceRangeDialog : public KDialogBase, public RecurrenceRangeBase
{
public:
RecurrenceRangeDialog( QWidget *parent = 0, const char *name = 0 );
void setDefaults( const QDateTime &from );
void setDuration( int );
int duration();
void setEndDate( const QDate & );
QDate endDate();
void setDateTimes( const QDateTime &start,
const QDateTime &end = QDateTime() );
private:
RecurrenceRangeWidget *mRecurrenceRangeWidget;
};
class KOEditorRecurrence : public QWidget
{
Q_OBJECT
public:
KOEditorRecurrence ( QWidget *parent = 0, const char *name = 0 );
virtual ~KOEditorRecurrence();
enum { Daily, Weekly, Monthly, Yearly };
- /** Set widgets to default values */
- void setDefaults( QDateTime from, QDateTime to, bool allday );
/** Read event object and setup widgets accordingly */
void readEvent( Incidence * );
/** Write event settings to event object */
void writeEvent( Incidence * );
/** Check if the input is valid. */
bool validateInput();
public slots:
+ void setDefaultsDates( QDateTime from, QDateTime to );
+ void setDefaults( QDateTime from, QDateTime to );
void setEnabled( bool );
void setDateTimes( QDateTime start, QDateTime end );
void setDateTimeStr( const QString & );
signals:
void dateTimesChanged( QDateTime start, QDateTime end );
protected slots:
void showCurrentRule( int );
void showExceptionsDialog();
void showRecurrenceRangeDialog();
private:
QCheckBox *mEnabledCheck;
QGroupBox *mTimeGroupBox;
QLabel *mDateTimeLabel;
QGroupBox *mRuleBox;
QWidgetStack *mRuleStack;
RecurrenceChooser *mRecurrenceChooser;
RecurDaily *mDaily;
RecurWeekly *mWeekly;
RecurMonthly *mMonthly;
RecurYearly *mYearly;
RecurrenceRangeBase *mRecurrenceRange;
RecurrenceRangeWidget *mRecurrenceRangeWidget;
RecurrenceRangeDialog *mRecurrenceRangeDialog;
QPushButton *mRecurrenceRangeButton;
ExceptionsBase *mExceptions;
ExceptionsDialog *mExceptionsDialog;
ExceptionsWidget *mExceptionsWidget;
QPushButton *mExceptionsButton;
};
#endif
diff --git a/korganizer/koeventeditor.cpp b/korganizer/koeventeditor.cpp
index 02d4a78..75dae34 100644
--- a/korganizer/koeventeditor.cpp
+++ b/korganizer/koeventeditor.cpp
@@ -27,97 +27,97 @@
#include <qhbox.h>
#include <qdir.h>
#include <qlayout.h>
#include <qwidgetstack.h>
#include <qapplication.h>
#include <kiconloader.h>
#include <kstandarddirs.h>
#include <kdebug.h>
#include <klocale.h>
#include <kfiledialog.h>
#include <kmessagebox.h>
#include <libkcal/calendarresources.h>
#include <libkcal/resourcecalendar.h>
#include <kresources/resourceselectdialog.h>
#include <libkdepim/categoryselectdialog.h>
#include <libkcal/calendarlocal.h>
#include <libkcal/icalformat.h>
#include "koprefs.h"
#include "koeventeditor.h"
extern int globalFlagBlockAgenda;
KOEventEditor::KOEventEditor( Calendar *calendar, QWidget *parent ) :
KOIncidenceEditor( i18n("Edit Event"), calendar, parent )
{
mEvent = 0;
init();
if ( QApplication::desktop()->height() <= 240 )
hideButtons();
}
KOEventEditor::~KOEventEditor()
{
//emit dialogClose( mEvent );
}
void KOEventEditor::init()
{
setupGeneral();
setupAttendeesTab();
setupRecurrence();
// Propagate date time settings to recurrence tab
connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)),
- mRecurrence,SLOT(setDateTimes(QDateTime,QDateTime)));
+ mRecurrence,SLOT(setDefaultsDates(QDateTime,QDateTime)));
connect(mGeneral,SIGNAL(dateTimeStrChanged(const QString &)),
mRecurrence,SLOT(setDateTimeStr(const QString &)));
// Category dialog
// connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show()));
//connect(mCategoryDialog,SIGNAL(categoriesSelected(const QString &)),
// mGeneral,SLOT(setCategories(const QString &)));
}
void KOEventEditor::reload()
{
if ( mEvent ) readEvent( mEvent );
}
void KOEventEditor::setSecrecy( int sec )
{
mGeneral->setSecrecy( sec );
}
void KOEventEditor::setCategories( QString s )
{
mGeneral->setCategories(s);
}
void KOEventEditor::setupGeneral()
{
mGeneral = new KOEditorGeneralEvent( this, "KOEditorGeneralEvent" );
connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) );
if( KOPrefs::instance()->mCompactDialogs ) {
QFrame *topFrame = addPage(i18n("General"));
QBoxLayout *topLayout = new QVBoxLayout(topFrame);
topLayout->setSpacing(spacingHint()-1);
topLayout->setMargin(marginHint()-1);
mGeneral->initHeader(topFrame,topLayout);
mGeneral->initTime(topFrame,topLayout);
// QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout);
mGeneral->initAlarm(topFrame,topLayout);
mGeneral->enableAlarm( false );
QBoxLayout *buttonLayout;
if ( QApplication::desktop()->width() < 500 && QApplication::desktop()->height() > 240 )
buttonLayout = new QVBoxLayout( topLayout );
else
buttonLayout = new QHBoxLayout( topLayout );
QHBox* buttonWidget = new QHBox (topFrame);
QIconSet icon;
@@ -235,97 +235,97 @@ bool KOEventEditor::processInput( bool emitTime )
emit jumpToTime( event->dtStart().date() );
globalFlagBlockAgenda = 2;
}
if (mEvent) {
event->setRevision(event->revision()+1);
emit eventChanged(event);
} else {
mCalendar->addEvent(event);
mEvent = event;
emit eventAdded(event);
}
return true;
}
void KOEventEditor::deleteEvent()
{
kdDebug() << "Delete event" << endl;
if (mEvent) {
if (KOPrefs::instance()->mConfirm) {
switch (msgItemDelete()) {
case KMessageBox::Continue: // OK
emit eventToBeDeleted(mEvent);
emit dialogClose(mEvent);
mCalendar->deleteEvent(mEvent);
emit eventDeleted();
reject();
break;
}
}
else {
emit eventToBeDeleted(mEvent);
emit dialogClose(mEvent);
mCalendar->deleteEvent(mEvent);
emit eventDeleted();
reject();
}
} else {
reject();
}
}
void KOEventEditor::setDefaults(QDateTime from, QDateTime to, bool allDay)
{
mGeneral->setDefaults(from,to,allDay);
mDetails->setDefaults();
- mRecurrence->setDefaults(from,to,allDay);
+ mRecurrence->setDefaults(from,to);
showPage( 0 );
mGeneral->setFocusOn( 2 );
}
void KOEventEditor::readEvent( Event *event, bool tmpl )
{
mGeneral->readEvent( event, tmpl );
mDetails->readEvent( event );
mRecurrence->readEvent( event );
// categories
//mCategoryDialog->setSelected( event->categories() );
}
void KOEventEditor::writeEvent(Event *event)
{
mGeneral->writeEvent( event );
mDetails->writeEvent( event );
if ( event->organizer() == KOPrefs::instance()->email() ) {
Event *ev = new Event( *event );
ev->registerObserver(0);
mDetails->cancelAttendeeEvent( ev );
if ( ev->attendeeCount() > 0 ) {
emit deleteAttendee( ev );
}
delete(ev);
}
mRecurrence->writeEvent(event);
}
bool KOEventEditor::validateInput()
{
if (!mGeneral->validateInput()) return false;
if (!mDetails->validateInput()) return false;
if (!mRecurrence->validateInput()) return false;
return true;
}
int KOEventEditor::msgItemDelete()
{
return KMessageBox::warningContinueCancel(this,
i18n("This item will be permanently deleted."),
i18n("KOrganizer Confirmation"),i18n("Delete"));
}
void KOEventEditor::slotLoadTemplate()
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp
index 9073bca..8b90ae5 100644
--- a/korganizer/kotodoeditor.cpp
+++ b/korganizer/kotodoeditor.cpp
@@ -30,96 +30,98 @@
#include <qdir.h>
#include <qdatetime.h>
#include <qapplication.h>
#include <qtabwidget.h>
#include <kiconloader.h>
#include <klocale.h>
#include <kfiledialog.h>
#include <kstandarddirs.h>
#include <kmessagebox.h>
#include <libkdepim/categoryselectdialog.h>
#include <libkcal/calendarlocal.h>
#include <libkcal/calendarresources.h>
#include <libkcal/resourcecalendar.h>
#include <libkcal/icalformat.h>
#include <kresources/resourceselectdialog.h>
#include <libkdepim/kdateedit.h>
#include "koprefs.h"
#include "kolocationbox.h"
#include "kotodoeditor.h"
extern int globalFlagBlockAgenda;
KOTodoEditor::KOTodoEditor( Calendar *calendar, QWidget *parent ) :
KOIncidenceEditor( i18n("Edit To-Do"), calendar, parent )
{
mTodo = 0;
mRelatedTodo = 0;
findButton(User1)->hide();
init();
if ( QApplication::desktop()->height() <= 240 )
hideButtons();
}
KOTodoEditor::~KOTodoEditor()
{
emit dialogClose( mTodo );
}
void KOTodoEditor::init()
{
setupGeneral();
setupAttendeesTab();
setupRecurrence();
connect(mGeneral,SIGNAL(datesChecked()),this ,SLOT(checkRecurrence()));
mRecurrence->setDateTimeStr( i18n("<i>The recurrence is computed from the start datetime!</i>") );
+ connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)),
+ mRecurrence,SLOT(setDefaultsDates(QDateTime,QDateTime)));
}
void KOTodoEditor::setupRecurrence()
{
QFrame *topFrame = addPage( i18n("Recurrence") );
QBoxLayout *topLayout = new QVBoxLayout( topFrame );
mRecurrence = new KOEditorRecurrence( topFrame );
topLayout->addWidget( mRecurrence );
}
void KOTodoEditor::setCategories( QString s )
{
mGeneral->setCategories(s);
}
void KOTodoEditor::setSecrecy( int sec )
{
mGeneral->setSecrecy( sec );
}
void KOTodoEditor::reload()
{
if ( mTodo ) readTodo( mTodo );
}
void KOTodoEditor::setupGeneral()
{
mGeneral = new KOEditorGeneralTodo(this);
connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) );
// connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show()));
//connect(mCategoryDialog, SIGNAL(categoriesSelected(const QString &)),
// mGeneral,SLOT(setCategories(const QString &)));
if (KOPrefs::instance()->mCompactDialogs) {
QFrame *topFrame = addPage(i18n("General"));
QBoxLayout *topLayout = new QVBoxLayout(topFrame);
if ( QApplication::desktop()->width() < 480 ) {
topLayout->setMargin(marginHintSmall());
topLayout->setSpacing(spacingHintSmall());
} else {
topLayout->setMargin(marginHint());
topLayout->setSpacing(spacingHint());
}
mGeneral->initHeader(topFrame,topLayout);
mGeneral->initTime(topFrame,topLayout);
mGeneral->initAlarm(topFrame,topLayout);
mGeneral->enableAlarm( false );
@@ -260,122 +262,122 @@ bool KOTodoEditor::processInput( bool emitTime )
void KOTodoEditor::deleteTodo()
{
if (mTodo) {
if (KOPrefs::instance()->mConfirm) {
switch (msgItemDelete()) {
case KMessageBox::Continue: // OK
emit todoToBeDeleted(mTodo);
emit dialogClose(mTodo);
mCalendar->deleteTodo(mTodo);
emit todoDeleted();
reject();
break;
}
}
else {
emit todoToBeDeleted(mTodo);
emit dialogClose(mTodo);
mCalendar->deleteTodo(mTodo);
emit todoDeleted();
reject();
}
} else {
reject();
}
}
void KOTodoEditor::setDefaults(QDateTime due,Todo *relatedEvent,bool allDay)
{
mRelatedTodo = relatedEvent;
mGeneral->setDefaults(due,allDay);
mDetails->setDefaults();
showPage( 0 );
if ( mRelatedTodo ) {
mGeneral->setCategories (mRelatedTodo->categoriesStr ());
mGeneral->setSecrecy (mRelatedTodo->secrecy ());
if ( mRelatedTodo->priority() < 3 )
mGeneral->mPriorityCombo->setCurrentItem(mRelatedTodo->priority()-1);
mGeneral->mSummaryEdit->lineEdit()->setText(mRelatedTodo->summary()+": ");
int len = mRelatedTodo->summary().length();
mGeneral->mSummaryEdit->lineEdit()->setFocus();
mGeneral->mSummaryEdit->lineEdit()->setCursorPosition ( len+2 );
mGeneral->mSummaryEdit->lineEdit()->setSelection ( 0, len+2 );
} else
mGeneral->setFocusOn( 2 );
tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false );
- mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ),true);
+ mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ));
}
void KOTodoEditor::checkRecurrence()
{
if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) {
tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), true );
if ( mTodo )
mRecurrence->readEvent( mTodo );
else {
bool time = mGeneral->mTimeButton->isChecked();
QDateTime from,to;
if ( time ) {
to = QDateTime( mGeneral->mDueDateEdit->date(), mGeneral->mDueTimeEdit->getTime() ) ;
from = QDateTime( mGeneral->mStartDateEdit->date(),mGeneral->mStartTimeEdit->getTime( )) ;
} else {
to = QDateTime( mGeneral->mDueDateEdit->date(), QTime( 0,0,0) ) ;
from = QDateTime( mGeneral->mStartDateEdit->date(),QTime( 0,0,0) ) ;
}
if ( to < from )
to = from;
- mRecurrence->setDefaults(from,to,!time);
+ mRecurrence->setDefaults(from,to);
}
} else {
tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false );
- mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ),true);
+ mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ));
}
}
void KOTodoEditor::readTodo(Todo *todo)
{
mGeneral->readTodo(todo);
mDetails->readEvent(todo);
mRelatedTodo = 0;//todo->relatedTo();
// categories
// mCategoryDialog->setSelected(todo->categories());
// We should handle read-only events here.
}
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);
// set related event, i.e. parent to-do in this case.
if (mRelatedTodo) {
event->setRelatedTo(mRelatedTodo);
}
if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) {
mRecurrence->writeEvent(event);
if ( event->doesRecur() ) {
int addSec = -1 ;
if ( maybeComputeRecurrenceTime && event->percentComplete() == 100 )
addSec = 1;
event->setRecurrenceID( event->dtStart().addSecs( addSec ) );
event->setRecurDates();
} else {
event->setHasRecurrenceID( false );
}
} else {
event->setHasRecurrenceID( false );
event->recurrence()->unsetRecurs();
}
}
bool KOTodoEditor::validateInput()
{
if (!mGeneral->validateInput()) return false;
if (!mDetails->validateInput()) return false;
return true;