summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeditorgeneralevent.cpp31
-rw-r--r--korganizer/koeditorrecurrence.cpp6
-rw-r--r--korganizer/kotodoeditor.cpp1
-rw-r--r--korganizer/mainwindow.cpp3
4 files changed, 25 insertions, 16 deletions
diff --git a/korganizer/koeditorgeneralevent.cpp b/korganizer/koeditorgeneralevent.cpp
index 2a49528..d4aa78c 100644
--- a/korganizer/koeditorgeneralevent.cpp
+++ b/korganizer/koeditorgeneralevent.cpp
@@ -331,97 +331,104 @@ void KOEditorGeneralEvent::writeEvent(Event *event)
} // check for float
mSummaryEdit->save(KOLocationBox::SUMMARYEVENT);
event->setTransparency(mFreeTimeCombo->currentItem() > 0
? KCal::Event::Transparent
: KCal::Event::Opaque);
// kdDebug() << "KOEditorGeneralEvent::writeEvent() done" << endl;
}
void KOEditorGeneralEvent::setDuration()
{
QString tmpStr = "", catStr;
int hourdiff, minutediff;
// end<date is an accepted temporary state while typing, but don't show
// any duration if this happens
if(mCurrEndDateTime >= mCurrStartDateTime) {
if (mNoTimeButton->isChecked()) {
int daydiff = mCurrStartDateTime.date().daysTo(mCurrEndDateTime.date()) + 1;
tmpStr = i18n("Duration: ");
tmpStr.append(i18n("1 Day","%n Days",daydiff));
} else {
int secto = mCurrStartDateTime.secsTo( mCurrEndDateTime );
hourdiff = secto / 3600;
minutediff = (secto/60 ) % 60;
if (hourdiff || minutediff){
tmpStr = i18n("Duration: ");
if (hourdiff){
catStr = i18n("1 h","%n h",hourdiff);
tmpStr.append(catStr);
}
if (hourdiff && minutediff){
tmpStr += i18n(", ");
}
if (minutediff){
catStr = i18n("1 min","%n min",minutediff);
tmpStr += catStr;
}
} else tmpStr = "";
}
}
mDurationLabel->setText(tmpStr);
}
void KOEditorGeneralEvent::emitDateTimeStr()
{
KLocale *l = KGlobal::locale();
-
- QString from,to;
- if (mNoTimeButton->isChecked()) {
- from = l->formatDate(mCurrStartDateTime.date());
- to = l->formatDate(mCurrEndDateTime.date());
+ QString startString = "";
+ if ( mCurrStartDateTime.date() < mCurrEndDateTime.date() ) {
+ if ( mNoTimeButton->isChecked() ) {
+ startString = i18n("From: ") + l->formatDate(mCurrStartDateTime.date() );
+ startString += "\n"+i18n("To: ")+ l->formatDate(mCurrEndDateTime.date());
+
+ } else {
+ startString = i18n("From: ") +l->formatDateTime(mCurrStartDateTime, false);
+ startString += "\n"+i18n("To: ")+l->formatDateTime(mCurrEndDateTime, false);
+ }
} else {
- from = l->formatDateTime(mCurrStartDateTime);
- to = l->formatDateTime(mCurrEndDateTime);
+ if ( mNoTimeButton->isChecked() ) {
+ startString = i18n("On: ") + l->formatDate(mCurrStartDateTime.date() );
+ } else {
+ startString = i18n("From: ") + KGlobal::locale()->formatTime(mCurrStartDateTime.time())+
+ "-"+KGlobal::locale()->formatTime(mCurrEndDateTime.time());
+ startString += i18n(" on ")+KGlobal::locale()->formatDate( mCurrStartDateTime.date(), true);
+ }
}
-
- QString str = i18n("From: %1 To: %2 %3").arg(from).arg(to)
- .arg(mDurationLabel->text());
-
- emit dateTimeStrChanged(str);
+ startString +="\n"+mDurationLabel->text();
+ emit dateTimeStrChanged(startString);
}
bool KOEditorGeneralEvent::validateInput()
{
if (!mStartDateEdit->inputIsValid()) {
KMessageBox::sorry( 0,
i18n("Please specify a valid start date,\nfor example '%1'.")
.arg( KGlobal::locale()->formatDate( QDate::currentDate(), true ) ) );
return false;
}
if (!mEndDateEdit->inputIsValid()) {
KMessageBox::sorry( 0,
i18n("Please specify a valid end date,\nfor example '%1'.")
.arg( KGlobal::locale()->formatDate( QDate::currentDate(), true ) ) );
return false;
}
QDateTime startDt,endDt;
startDt.setDate(mStartDateEdit->date());
endDt.setDate(mEndDateEdit->date());
if (!mNoTimeButton->isChecked()) {
startDt.setTime(mStartTimeEdit->getTime());
endDt.setTime(mEndTimeEdit->getTime());
}
if (startDt > endDt) {
KMessageBox::sorry(0,i18n("The event ends before it starts.\n"
"Please correct dates and times."));
return false;
}
return KOEditorGeneral::validateInput();
}
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp
index bf81b01..01c5773 100644
--- a/korganizer/koeditorrecurrence.cpp
+++ b/korganizer/koeditorrecurrence.cpp
@@ -684,113 +684,113 @@ int RecurrenceChooser::type()
else if ( mMonthlyButton->isChecked() ) return Monthly;
else return Yearly;
}
}
void RecurrenceChooser::setType( int type )
{
if ( mTypeCombo ) {
mTypeCombo->setCurrentItem( type );
} else {
switch ( type ) {
case Daily:
mDailyButton->setChecked( true );
break;
case Weekly:
mWeeklyButton->setChecked( true );
break;
case Monthly:
mMonthlyButton->setChecked( true );
break;
case Yearly:
default:
mYearlyButton->setChecked( true );
break;
}
}
}
void RecurrenceChooser::emitChoice()
{
emit chosen ( type() );
}
/////////////////////////////// Main Widget /////////////////////////////
KOEditorRecurrence::KOEditorRecurrence( QWidget* parent, const char *name ) :
QWidget( parent, name )
{
QGridLayout *topLayout = new QGridLayout( this, 2,2 );
topLayout->setSpacing( KDialog::spacingHint() );
topLayout->setMargin( KDialog::marginHintSmall() );
mEnabledCheck = new QCheckBox( i18n("Enable Recurrence"), this );
connect( mEnabledCheck, SIGNAL( toggled( bool ) ),
SLOT( setEnabled( bool ) ) );
topLayout->addMultiCellWidget( mEnabledCheck, 0, 0, 0, 1 );
- mTimeGroupBox = new QGroupBox( 1, Horizontal, i18n("Appointment Time "),
+ mTimeGroupBox = new QGroupBox( 1, Horizontal, i18n("Time"),
this );
topLayout->addMultiCellWidget( mTimeGroupBox, 1, 1 , 0 , 1 );
if ( QApplication::desktop()->width() <= 320) {
mTimeGroupBox->hide();
}
// QFrame *timeFrame = new QFrame( mTimeGroupBox );
// QBoxLayout *layoutTimeFrame = new QHBoxLayout( timeFrame );
// layoutTimeFrame->setSpacing( KDialog::spacingHint() );
mDateTimeLabel = new QLabel( mTimeGroupBox );
// mDateTimeLabel = new QLabel( timeFrame );
// layoutTimeFrame->addWidget( mDateTimeLabel );
-
-
+ //mTimeGroupBox->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum ) );
+ //mDateTimeLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum) );
mRuleBox = new QGroupBox( 1, Horizontal, i18n("Recurrence Rule"), this );
topLayout->addMultiCellWidget( mRuleBox, 2, 2, 0, 1 );
mRecurrenceChooser = new RecurrenceChooser( mRuleBox );
connect( mRecurrenceChooser, SIGNAL( chosen( int ) ),
SLOT( showCurrentRule( int ) ) );
mRuleStack = new QWidgetStack( mRuleBox );
mDaily = new RecurDaily( mRuleStack );
mRuleStack->addWidget( mDaily, 0 );
mWeekly = new RecurWeekly( mRuleStack );
mRuleStack->addWidget( mWeekly, 0 );
mMonthly = new RecurMonthly( mRuleStack );
mRuleStack->addWidget( mMonthly, 0 );
mYearly = new RecurYearly( mRuleStack );
mRuleStack->addWidget( mYearly, 0 );
showCurrentRule( mRecurrenceChooser->type() );
mRecurrenceRangeWidget = 0;
mRecurrenceRangeDialog = new RecurrenceRangeDialog( this );
mRecurrenceRange = mRecurrenceRangeDialog;
mRecurrenceRangeButton = new QPushButton( i18n("Recurrence Range..."),
this );
connect( mRecurrenceRangeButton, SIGNAL( clicked() ),
SLOT( showRecurrenceRangeDialog() ) );
mExceptionsWidget = 0;
mExceptionsDialog = new ExceptionsDialog( this );
mExceptions = mExceptionsDialog;
mExceptionsButton = new QPushButton( i18n("Exceptions..."), this );
if ( QApplication::desktop()->width() < 320 ) {
topLayout->addMultiCellWidget( mRecurrenceRangeButton, 3, 3, 0, 1 );
topLayout->addMultiCellWidget( mExceptionsButton, 4, 4, 0, 1 );
} else {
topLayout->addWidget( mRecurrenceRangeButton, 3, 0 );
topLayout->addWidget( mExceptionsButton, 3, 1 );
}
connect( mExceptionsButton, SIGNAL( clicked() ),
SLOT( showExceptionsDialog() ) );
}
KOEditorRecurrence::~KOEditorRecurrence()
{
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp
index 51e2524..6a05cc8 100644
--- a/korganizer/kotodoeditor.cpp
+++ b/korganizer/kotodoeditor.cpp
@@ -27,96 +27,97 @@
#include <qpixmap.h>
#include <qlayout.h>
#include <qhbox.h>
#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();
}
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>") );
}
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(1);
topLayout->setSpacing(1);
} else {
topLayout->setMargin(marginHint()-1);
topLayout->setSpacing(spacingHint()-1);
}
mGeneral->initHeader(topFrame,topLayout);
mGeneral->initTime(topFrame,topLayout);
mGeneral->initAlarm(topFrame,topLayout);
mGeneral->enableAlarm( false );
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 94f4677..ffc4d9a 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1542,97 +1542,98 @@ QString MainWindow::syncFileName()
#include "koglobals.h"
#include <kcalendarsystem.h>
void MainWindow::updateWeek(QDate seda)
{
int weekNum = KGlobal::locale()->weekNum ( seda );
mWeekPixmap.fill( mWeekBgColor );
QPainter p ( &mWeekPixmap );
p.setFont( mWeekFont );
p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) );
p.end();
QIconSet icon3 ( mWeekPixmap );
mWeekAction->setIconSet ( icon3 );
}
void MainWindow::updateWeekNum(const DateList &selectedDates)
{
updateWeek( selectedDates.first() );
}
void MainWindow::processIncidenceSelection( Incidence *incidence )
{
if ( !incidence ) {
enableIncidenceActions( false );
mNewSubTodoAction->setEnabled( false );
setCaptionToDates();
return;
}
//KGlobal::locale()->formatDateTime(nextA, true);
QString startString = "";
if ( incidence->type() != "Todo" ) {
if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
if ( incidence->doesFloat() ) {
startString += ": "+incidence->dtStartDateStr( true );
startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
} else {
startString = ": "+incidence->dtStartStr(true);
startString += " --- "+((Event*)incidence)->dtEndStr(true);
}
} else {
if ( incidence->dtStart().time() != incidence->dtEnd().time() )
startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
"-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
- if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) {
+
+ if ( incidence->isBirthday() || incidence->isAnniversary() ) {
bool ok;
QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok );
if ( ok ) {
int years = noc.date().year() - incidence->dtStart().date().year();
startString += i18n(" (%1 y.)"). arg( years );
}
}
else
startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
}
}
else
startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
if ( !incidence->location().isEmpty() )
startString += " (" +incidence->location()+")";
setCaption( incidence->summary()+startString);
enableIncidenceActions( true );
if ( incidence->type() == "Event" ) {
mShowAction->setText( i18n("Show Event...") );
mEditAction->setText( i18n("Edit Event...") );
mDeleteAction->setText( i18n("Delete Event...") );
mNewSubTodoAction->setEnabled( false );
} else if ( incidence->type() == "Todo" ) {
mShowAction->setText( i18n("Show Todo...") );
mEditAction->setText( i18n("Edit Todo...") );
mDeleteAction->setText( i18n("Delete Todo...") );
mNewSubTodoAction->setEnabled( true );
} else {
mShowAction->setText( i18n("Show...") );
mShowAction->setText( i18n("Edit...") );
mShowAction->setText( i18n("Delete...") );
mNewSubTodoAction->setEnabled( false );
}
}
void MainWindow::enableIncidenceActions( bool enabled )
{
mShowAction->setEnabled( enabled );
mEditAction->setEnabled( enabled );
mDeleteAction->setEnabled( enabled );
mCloneAction->setEnabled( enabled );