summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-11-30 08:30:24 (UTC)
committer zautrix <zautrix>2005-11-30 08:30:24 (UTC)
commit042f35a481acf6c4e711e98184abb6c9f6542429 (patch) (side-by-side diff)
tree47622f89ebfb6c677797d7906f167ba80976ab7d /korganizer
parent14bd7cc7412ffdbca09e1cd63a230222a3fbfd53 (diff)
downloadkdepimpi-042f35a481acf6c4e711e98184abb6c9f6542429.zip
kdepimpi-042f35a481acf6c4e711e98184abb6c9f6542429.tar.gz
kdepimpi-042f35a481acf6c4e711e98184abb6c9f6542429.tar.bz2
commit
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeditorgeneral.cpp7
-rw-r--r--korganizer/koeditorgeneral.h2
-rw-r--r--korganizer/koeventeditor.cpp4
-rw-r--r--korganizer/koeventviewer.cpp8
-rw-r--r--korganizer/koincidenceeditor.cpp5
-rw-r--r--korganizer/koincidenceeditor.h3
-rw-r--r--korganizer/kotodoeditor.cpp4
7 files changed, 28 insertions, 5 deletions
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp
index 92e5a0f..21f220c 100644
--- a/korganizer/koeditorgeneral.cpp
+++ b/korganizer/koeditorgeneral.cpp
@@ -98,97 +98,96 @@ void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout)
else
headerLayout->addMultiCellWidget(mSummaryEdit,0,0,1,2);
connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
QLabel *locationLabel = new QLabel(i18n("Location:"),parent);
if ( QApplication::desktop()->height() < 320 )
headerLayout->addWidget(locationLabel,0,2);
else
headerLayout->addWidget(locationLabel,1,0);
mLocationEdit = new KOLocationBox(TRUE,parent,30);
mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->height() > 240 )
mLocationEdit->setMaximumHeight( hei + 6);
// mLocationEdit = new QLineEdit(parent);
connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
mCalendarBox = new QComboBox ( parent );
mCalendarBox->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
if ( QApplication::desktop()->height() < 320 ) {
headerLayout->addWidget(mLocationEdit,0,3);
headerLayout->addWidget(mCalendarBox,0,4);
headerLayout->setColStretch( 1, 10);
headerLayout->setColStretch( 3, 10);
mCalendarBox->setMaximumWidth( 64 );
}
else {
headerLayout->addWidget(mLocationEdit,1,1);
headerLayout->addWidget(mCalendarBox,1,2);
int str = 3;
if ( QApplication::desktop()->width() < 640 ) {
--str;
if ( QApplication::desktop()->width() < 320 )
--str;
}
headerLayout->setColStretch( 1, str);
headerLayout->setColStretch( 2, 1);
}
}
void KOEditorGeneral::setFocusOn( int i )
{
mNextFocus = i;
QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() ));
}
void KOEditorGeneral::slotSetFocusOn()
{
- mNextFocus;
if ( mNextFocus == 1 ) {
mDescriptionEdit->setFocus();
mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333);
}
if ( mNextFocus == 2 ) {
mSummaryEdit->setFocus();
}
}
void KOEditorGeneral::editCategories()
{
// qDebug("KOEditorGeneral::editCategories() ");
KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &)));
//KOGlobals::fitDialogToScreen( csd );
csd->setColorEnabled();
csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) );
csd->exec();
delete csd;
}
void KOEditorGeneral::showCatPopup()
{
mCatPopup->clear();
QStringList checkedCategories = QStringList::split (",", mCategoriesLabel->text());
int index = 0;
for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin ();
it != KOPrefs::instance()->mCustomCategories.end ();
++it) {
mCatPopup->insertItem (*it, index );
//mCategory[index] = *it;
if (checkedCategories.find (*it) != checkedCategories.end ()) mCatPopup->setItemChecked (index, true);
++index;
}
}
void KOEditorGeneral::selectedCatPopup( int index )
{
QStringList categories = QStringList::split (",", mCategoriesLabel->text());
QString colcat = categories.first();
if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ())
categories.remove (KOPrefs::instance()->mCustomCategories[index]);
else
categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]);
categories.sort ();
if ( !colcat.isEmpty() ) {
if ( categories.find ( colcat ) != categories.end () ) {
categories.remove( colcat );
categories.prepend( colcat );
}
@@ -310,97 +309,97 @@ void KOEditorGeneral::pickAlarmSound()
if (!fileName.isEmpty()) {
mAlarmSound = fileName;
QToolTip::remove(mAlarmSoundButton);
QString dispStr = i18n("Playing '%1'").arg(fileName);
QToolTip::add(mAlarmSoundButton, dispStr);
mAlarmProgramButton->setOn(false);
mAlarmSoundButton->setOn(true);
QToolTip::add(mAlarmProgramButton, i18n("No program set"));
} else {
mAlarmProgramButton->setOn(oldState);
mAlarmSoundButton->setOn(!oldState);
}
if (mAlarmProgramButton->isOn())
((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) );
if ( mAlarmSoundButton->isOn())
((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) );
}
void KOEditorGeneral::pickAlarmProgram()
{
bool oldState = mAlarmProgramButton->isOn();
QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm: ") , 0));
if (!fileName.isEmpty()) {
mAlarmProgram = fileName;
QToolTip::remove(mAlarmProgramButton);
QString dispStr = i18n("Running '%1'").arg(fileName);
QToolTip::add(mAlarmProgramButton, dispStr);
mAlarmSoundButton->setOn(false);
mAlarmProgramButton->setOn(true);
QToolTip::add(mAlarmSoundButton, i18n("No sound set"));
} else {
mAlarmProgramButton->setOn(!oldState);
mAlarmSoundButton->setOn(oldState);
}
if (mAlarmProgramButton->isOn())
((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) );
if ( mAlarmSoundButton->isOn())
((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) );
}
-QString KOEditorGeneral::getFittingPath( const QString s )
+QString KOEditorGeneral::getFittingPath( const QString & s )
{
int maxlen = 50;
if ( QApplication::desktop()->width() < 640 ) {
if ( QApplication::desktop()->width() < 320 )
maxlen = 22;
else
maxlen = 35;
}
if ( s.length() > maxlen ) {
return "..."+s.right(maxlen -3);
}
return s;
}
void KOEditorGeneral::enableAlarmEdit(bool enable)
{
if ( enable ) {
if (!mAlarmProgramButton->isOn() && !mAlarmSoundButton->isOn()) {
mAlarmSoundButton->setOn( true );
if ( mAlarmSound.isEmpty() )
mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile;
else {
if ( ! QFile::exists( mAlarmSound ) )
mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile;
}
}
}
((QWidget*)parent())->topLevelWidget()->setCaption(mAlarmMessage);
mAlarmTimeEdit->setEnabled(enable);
mAlarmSoundButton->setEnabled(enable);
mAlarmProgramButton->setEnabled(enable);
mAlarmIncrCombo->setEnabled(enable);
}
void KOEditorGeneral::disableAlarmEdit(bool disable)
{
enableAlarmEdit( !disable );
}
void KOEditorGeneral::enableAlarm( bool enable )
{
enableAlarmEdit( enable );
}
void KOEditorGeneral::alarmDisable(bool disable)
{
if (!disable) {
//mAlarmBell->setEnabled(true);
@@ -575,50 +574,52 @@ void KOEditorGeneral::readIncidence(Incidence *event)
}
setCategories(event->categoriesStr());
}
void KOEditorGeneral::writeIncidence(Incidence *event)
{
// kdDebug() << "KOEditorGeneral::writeEvent()" << endl;
mLocationEdit->save(KOLocationBox::LOCATION);
event->setSummary(mSummaryEdit->currentText());
event->setLocation(mLocationEdit->currentText());
event->setDescription(mDescriptionEdit->text());
event->setCategories(mCategoriesLabel->text());
event->setSecrecy(mSecrecyCombo->currentItem());
event->setCancelled(mCancelBox->isChecked() );;
// alarm stuff
if (mAlarmButton->isChecked()) {
if (event->alarms().count() == 0)
event->newAlarm();
QPtrList<Alarm> alarms = event->alarms();
Alarm *alarm;
for (alarm = alarms.first(); alarm; alarm = alarms.next() ) {
alarm->setEnabled(true);
int j = mAlarmTimeEdit->value()* -60;
if (mAlarmIncrCombo->currentItem() == 1)
j = j * 60;
else if (mAlarmIncrCombo->currentItem() == 2)
j = j * (60 * 24);
alarm->setStartOffset( j );
if (!mAlarmProgram.isEmpty() && mAlarmProgramButton->isOn()) {
alarm->setProcedureAlarm(mAlarmProgram);
}
else if (!mAlarmSound.isEmpty() && mAlarmSoundButton->isOn())
alarm->setAudioAlarm(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 = event->alarms().first();
if ( alarm ) {
alarm->setEnabled(false);
alarm->setType(Alarm::Invalid);
}
}
- event->setCalID( getCalendarID() );
+ int id = getCalendarID();
+ event->setCalID( id );
+ event->setAlarmEnabled( KOPrefs::instance()->getCalendar( id )->isAlarmEnabled );
}
diff --git a/korganizer/koeditorgeneral.h b/korganizer/koeditorgeneral.h
index d8b15af..b10a5d4 100644
--- a/korganizer/koeditorgeneral.h
+++ b/korganizer/koeditorgeneral.h
@@ -71,55 +71,55 @@ class KOEditorGeneral : public QObject
/** Check if the input is valid. */
bool validateInput() { return true; }
void enableAlarm( bool enable );
void setSecrecy( int num );
int getCalendarID();
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();
void showCatPopup();
void selectedCatPopup( int );
signals:
void openCategoryDialog();
void allAccepted();
void dateTimesChanged(QDateTime,QDateTime);
protected:
void fillCalCombo( int setToID = 0 );
int mNextFocus;
//QLineEdit *mSummaryEdit;
//QLineEdit *mLocationEdit;
KOLocationBox *mSummaryEdit;
KOLocationBox *mLocationEdit;
QComboBox *mCalendarBox;
QLabel *mAlarmBell;
QCheckBox *mAlarmButton;
QSpinBox *mAlarmTimeEdit;
QPushButton *mAlarmSoundButton;
QPushButton *mAlarmProgramButton;
QComboBox *mAlarmIncrCombo;
KTextEdit *mDescriptionEdit;
QLabel *mOwnerLabel;
QComboBox *mSecrecyCombo;
QCheckBox *mCancelBox;
QPushButton *mCategoriesButton;
QPushButton *mCategoriesLabel;
private:
QPopupMenu * mCatPopup;
- QString getFittingPath( const QString ) ;
+ QString getFittingPath( const QString &) ;
QString mAlarmSound;
QString mAlarmProgram;
QString mAlarmMessage;
};
#endif
diff --git a/korganizer/koeventeditor.cpp b/korganizer/koeventeditor.cpp
index 9ede543..3e87197 100644
--- a/korganizer/koeventeditor.cpp
+++ b/korganizer/koeventeditor.cpp
@@ -1,75 +1,76 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001,2002 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qtooltip.h>
#include <qframe.h>
#include <qpixmap.h>
#include <qhbox.h>
+#include <qtimer.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(setDefaultsDates(QDateTime,QDateTime)));
@@ -204,96 +205,99 @@ void KOEventEditor::editEvent(Event *event, bool showDescription)
}
void KOEventEditor::newEvent( QDateTime from, QDateTime to, bool allDay )
{
// init();
mEvent = 0;
setDefaults(from,to,allDay);
}
void KOEventEditor::loadDefaults()
{
int fmt = KOPrefs::instance()->mStartTime;
QDateTime from(QDate::currentDate(), QTime(fmt,0,0));
QDateTime to(QDate::currentDate(),
QTime(fmt+KOPrefs::instance()->mDefaultDuration,0,0));
setDefaults(from,to,false);
}
bool KOEventEditor::processInput( bool emitTime )
{
if (!validateInput()) return false;
Event *event = 0;
if (mEvent) event = mEvent;
else {
event = new Event;
event->setOrganizer(KOPrefs::instance()->email());
}
writeEvent(event);
if ( emitTime ) {
globalFlagBlockAgenda = 1;
emit showAgendaView( false );
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);
+ if ( event->isAlarmEnabled () && !event->alarmEnabled () ) {
+ QTimer::singleShot( 0, this, SLOT ( alarmWarning() ) );
+ }
}
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);
showPage( 0 );
mGeneral->setFocusOn( 2 );
}
void KOEventEditor::readEvent( Event *event, bool tmpl )
{
mGeneral->readEvent( event, tmpl );
mDetails->readEvent( event );
mRecurrence->readEvent( event );
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index 02b54da..607e549 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -359,96 +359,100 @@ void KOEventViewer::appendEvent(Event *event, int mode )
}
if (event->doesRecur()) {
QString recurText = event->recurrenceText();
addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>");
bool ok;
QDate start = QDate::currentDate();
QDateTime next;
next = event->getNextOccurence( QDateTime::currentDateTime() , &ok );
if ( ok ) {
if ( wideScreen ){
addTag("p",i18n("<b>Next recurrence is on:</b>") +" " + KGlobal::locale()->formatDate( next.date(), shortDate ) );
} else {
addTag("p",i18n("<b>Next recurrence is on:</b>") );
addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate ));
}
mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true );
} else {
bool last;
QDate nextd;
nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last );
if ( last ) {
if ( wideScreen ){
addTag("p",i18n("<b>Last recurrence was on:</b>") +" " + KGlobal::locale()->formatDate( nextd, shortDate ));
} else{
addTag("p",i18n("<b>Last recurrence was on:</b>") );
addTag("p", KGlobal::locale()->formatDate( nextd, shortDate ));
}
}
}
} else {
mMailSubject += i18n(" - " )+event->dtStartStr( true );
}
if (event->isAlarmEnabled()) {
Alarm *alarm =event->alarms().first() ;
QDateTime t = alarm->time();
QString s =i18n("( %1 before )").arg( alarm->offsetText() );
if(wideScreen ){
addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate ));
}else{
addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
}
//addTag("p",s);
+ if ( !(event->alarmEnabled() ) ) {
+ addTag("p", "<em>("+i18n("Enable alarm in resource settings") + ")</em>");
+
+ }
}
addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr());
formatCategories(event);
formatAttendees(event);
if ( KOPrefs::instance()->mEVshowCreated ) {
if(wideScreen ){
addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate ));
}else{
addTag("p",i18n("<b>Created: ") +" </b>");
addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
}
}
if ( KOPrefs::instance()->mEVshowChanged ) {
if(wideScreen ){
addTag("p",i18n("<b>Last modified: ") +" </b>" + KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) );
}else{
addTag("p",i18n("<b>Last modified: ") +" </b>");
addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
}
}
if ( KOPrefs::instance()->mEVshowDetails ) {
if (!event->description().isEmpty()) {
addTag("p",i18n("<b>Details: </b>"));
addTag("p",deTag(event->description()));
}
}
setText(mText);
//QWhatsThis::add(this,mText);
}
void KOEventViewer::appendTodo(Todo *event, int mode )
{
mMailSubject = "";
mCurrentIncidence = event;
topLevelWidget()->setCaption(i18n("Todo Viewer"));
bool shortDate = KOPrefs::instance()->mShortDateInViewer;
bool wideScreen = ( QApplication::desktop()->width() >= 640 );
if (mode == 0 ) {
addTag("h2",deTag(event->summary()));
formatReadOnly(event);
@@ -476,96 +480,100 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
mText +="<font color=\"#B00000\">";
addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) );
mText += "</font>";
} else {
mText.append(i18n("<p><i>%1 % completed</i></p>")
.arg(event->percentComplete()));
}
if (event->cancelled ()) {
mText +="<font color=\"#B00000\">";
addTag("i",i18n("This todo has been cancelled!"));
mText.append("<br>");
mText += "</font>";
mMailSubject += i18n("(cancelled)");
}
if (event->doesRecur()) {
QString recurText = event->recurrence()->recurrenceText();
addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>");
}
if (event->hasStartDate()) {
mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer)));
}
if (event->hasDueDate()) {
mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer)));
mMailSubject += i18n(" - " )+event->dtDueStr( true );
}
if (!event->location().isEmpty()) {
addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) );
mMailSubject += i18n(" at ") + event->location();
}
mText.append(i18n("<p><b>Priority:</b> %2</p>")
.arg(QString::number(event->priority())));
if (event->isAlarmEnabled()) {
Alarm *alarm =event->alarms().first() ;
QDateTime t = alarm->time();
QString s =i18n("( %1 before )").arg( alarm->offsetText() );
if ( wideScreen ) {
addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate ));
} else {
addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
}
+ if ( !(event->alarmEnabled() ) ) {
+ addTag("p", "<em>("+i18n("Enable alarm in resource settings") + ")</em>");
+
+ }
}
addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr());
formatCategories(event);
formatAttendees(event);
if ( KOPrefs::instance()->mEVshowCreated ) {
if(wideScreen ){
addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate ));
} else {
addTag("p",i18n("<b>Created: ") +" </b>");
addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
}
}
if ( KOPrefs::instance()->mEVshowChanged ) {
if(wideScreen ){
addTag("p",i18n("<b>Last modified: ") +" </b>" +KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) );
} else {
addTag("p",i18n("<b>Last modified: ") +" </b>");
addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
}
}
if ( event->relatedTo() ) {
addTag("b",i18n("Parent todo:<br>"));
QString t_name = "[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] ";// +event->relatedTo()->summary());
mText += t_name;
mText += "<a href=\"todo_uid:" + event->relatedTo()->uid() + "\">";
mText += deTag(event->relatedTo()->summary());
mText += "</a><br>";
// mText.append(deTag("[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] " +event->relatedTo()->summary()) +"<br>");
}
QPtrList<Incidence> Relations = event->relations();
Incidence *to;
if ( Relations.first() )
addTag("b",i18n("Sub todos:<br>"));
for (to=Relations.first();to;to=Relations.next()) {
QString t_name = "[" +QString::number(((Todo*)to)->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%] ";// +to->relatedTo()->summary());
mText += t_name;
mText += "<a href=\"todo_uid:" + to->uid() + "\">";
mText += deTag(to->summary());
diff --git a/korganizer/koincidenceeditor.cpp b/korganizer/koincidenceeditor.cpp
index 9bc0302..236f6f9 100644
--- a/korganizer/koincidenceeditor.cpp
+++ b/korganizer/koincidenceeditor.cpp
@@ -45,96 +45,101 @@
#include "koincidenceeditor.h"
KOIncidenceEditor::KOIncidenceEditor( const QString &caption,
Calendar *calendar, QWidget *parent ) :
KDialogBase( Tabbed, caption, Ok | Apply | Cancel |/* Default | */User1, Ok,
parent, caption, true, false ),
mSaveTemplateDialog( 0 )
{
mCalendar = calendar;
setButtonText( Default, i18n("Template...") );
QString saveTemplateText;
// if ( KOPrefs::instance()->mCompactDialogs ) {
// showButton( User1, false );
// showButton( Apply, false );
// } else {
showButton( Apply, false );
saveTemplateText = i18n("Ok+Agenda");
// }
setButtonText( User1, saveTemplateText );
//mCategoryDialog = new KPIM::CategorySelectDialog( KOPrefs::instance(), this );
// KOGlobals::fitDialogToScreen( mCategoryDialog );
//connect(mCategoryDialog,SIGNAL(editCategories()),SIGNAL(editCategories()));
//connect( this, SIGNAL( defaultClicked() ), SLOT( slotLoadTemplate() ) );
// connect( this, SIGNAL( user1Clicked() ), SLOT( slotSaveTemplate() ) );
connect( this, SIGNAL( user1Clicked() ), SLOT( slotShowIncidence() ) );
}
KOIncidenceEditor::~KOIncidenceEditor()
{
//delete mCategoryDialog;
}
void KOIncidenceEditor::setupAttendeesTab()
{
QFrame *topFrame = addPage(i18n("Attendees"));
QBoxLayout *topLayout = new QVBoxLayout(topFrame);
mDetails = new KOEditorDetails(spacingHint()-2,topFrame);
topLayout->addWidget(mDetails);
}
+void KOIncidenceEditor::alarmWarning()
+{
+ KMessageBox::information( 0, i18n("The alarm for this calendar\nis currently disabled!\nEnable it in resource settings."), i18n("Alarm disabled warning"));
+
+}
void KOIncidenceEditor::slotApply()
{
processInput( false );
}
void KOIncidenceEditor::accept()
{
slotOk();
}
void KOIncidenceEditor::slotOk()
{
if ( processInput( false ) ) QDialog::accept();
}
void KOIncidenceEditor::updateCategoryConfig()
{
qDebug("KOIncidenceEditor::updateCategoryConfig() is dead! ");
//mCategoryDialog->updateCategoryConfig();
}
void KOIncidenceEditor::slotCancel()
{
reject();
}
void KOIncidenceEditor::slotLoadTemplate()
{
kdDebug() << "KOIncidenceEditor::loadTemplate()" << endl;
}
void KOIncidenceEditor::slotShowIncidence()
{
if ( processInput(true ) ) {
accept();
}
}
void KOIncidenceEditor::slotSaveTemplate()
{
kdDebug() << "KOIncidenceEditor::saveTemplate()" << endl;
}
void KOIncidenceEditor::createSaveTemplateDialog( SaveTemplateDialog::IncidenceType type )
{
if ( !mSaveTemplateDialog ) {
mSaveTemplateDialog = new SaveTemplateDialog( type, this );
connect( mSaveTemplateDialog, SIGNAL( templateSelected( const QString & ) ),
SLOT( saveTemplate( const QString & ) ) );
diff --git a/korganizer/koincidenceeditor.h b/korganizer/koincidenceeditor.h
index bfd6cc6..2e4bbf8 100644
--- a/korganizer/koincidenceeditor.h
+++ b/korganizer/koincidenceeditor.h
@@ -20,86 +20,87 @@
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KOINCIDENCEEDITOR_H
#define KOINCIDENCEEDITOR_H
#include <kdialogbase.h>
#include <libkcal/calendar.h>
#include "koeditordetails.h"
#include "savetemplatedialog.h"
class QDateTime;
namespace KPIM { class CategorySelectDialog; }
using namespace KCal;
/**
This is the base class for the calendar component editors.
*/
class KOIncidenceEditor : public KDialogBase
{
Q_OBJECT
public:
/**
Construct new IncidenceEditor.
*/
KOIncidenceEditor( const QString &caption, Calendar *calendar,
QWidget *parent );
virtual ~KOIncidenceEditor();
/** Initialize editor. This function creates the tab widgets. */
virtual void init() = 0;
void accept();
virtual void setCategories( QString )= 0;
virtual void reload() = 0;
public slots:
void updateCategoryConfig();
signals:
void editCategories();
void showAgendaView( bool );
void dialogClose( Incidence * );
void jumpToTime( const QDate & );
- protected slots:
+ protected slots:
+ void alarmWarning();
void slotApply();
void slotOk();
void slotCancel();
void slotShowIncidence();
virtual void slotLoadTemplate();
virtual void slotSaveTemplate();
virtual void saveTemplate( const QString & ) = 0;
protected:
void setupAttendeesTab();
void createSaveTemplateDialog( SaveTemplateDialog::IncidenceType );
QString loadTemplate( Calendar *cal, const QString &type,
const QStringList &templates );
void saveAsTemplate( Incidence *, const QString &name );
/**
Process user input and create or update event. Returns false if input is invalid.
*/
virtual bool processInput( bool emitTime ) { return false; }
Calendar *mCalendar;
//KPIM::CategorySelectDialog *mCategoryDialog;
KOEditorDetails *mDetails;
private:
SaveTemplateDialog *mSaveTemplateDialog;
};
#endif
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp
index 682f83b..20a35d2 100644
--- a/korganizer/kotodoeditor.cpp
+++ b/korganizer/kotodoeditor.cpp
@@ -1,77 +1,78 @@
/*
This file is part of KOrganizer.
Copyright (c) 1997, 1998 Preston Brown
Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qtooltip.h>
#include <qframe.h>
#include <qpixmap.h>
#include <qlayout.h>
#include <qhbox.h>
+#include <qtimer.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();
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>") );
@@ -214,96 +215,99 @@ void KOTodoEditor::editTodo(Todo *todo, bool editDescription)
mGeneral->setFocusOn( 1 );
} else {
showPage( 0 );
mGeneral->setFocusOn( 2 );
}
checkRecurrence();
}
void KOTodoEditor::newTodo(QDateTime due,Todo *relatedTodo,bool allDay)
{
//init();
mTodo = 0;
setDefaults(due,relatedTodo,allDay);
}
void KOTodoEditor::loadDefaults()
{
setDefaults(QDateTime::currentDateTime().addDays(7),0,false);
}
bool KOTodoEditor::processInput( bool emitTime )
{
if (!validateInput()) return false;
Todo *todo = 0;
if (mTodo) todo = mTodo;
else {
todo = new Todo;
todo->setOrganizer(KOPrefs::instance()->email());
}
writeTodo(todo);
if ( emitTime ) {
globalFlagBlockAgenda = 1;
emit showAgendaView( false );
if ( todo->hasDueDate() )
emit jumpToTime( todo->dtDue().date() );
globalFlagBlockAgenda = 2;
}
if (mTodo) {
todo->setRevision(todo->revision()+1);
emit todoChanged(todo);
} else {
mCalendar->addTodo(todo);
mTodo = todo;
emit todoAdded(todo);
+ if ( todo->isAlarmEnabled () && !todo->alarmEnabled () ) {
+ QTimer::singleShot( 0, this, SLOT ( alarmWarning() ) );
+ }
}
return true;
}
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->fillCalCombo(mRelatedTodo->calID() );
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 );