27#include "kojournaleditor.h"
29#include "koeditorgeneraljournal.h"
30#include "koeditordetails.h"
31#include "kodialogmanager.h"
34#include <libkcal/journal.h>
35#include <libkcal/calendarlocal.h>
36#include <korganizer/baseview.h>
38#include <tdemessagebox.h>
52KOJournalEditor::~KOJournalEditor()
54 emit dialogClose( mJournal );
63void KOJournalEditor::reload()
65 kdDebug(5851) <<
"reloading Journal" << endl;
71void KOJournalEditor::setupGeneral()
73 mGeneral =
new KOEditorGeneralJournal(
this);
75 if (KOPrefs::instance()->mCompactDialogs) {
76 TQFrame *topFrame = addPage(i18n(
"General"));
78 TQBoxLayout *topLayout =
new TQVBoxLayout( topFrame );
79 topLayout->setMargin( marginHint() );
80 topLayout->setSpacing( spacingHint() );
82 mGeneral->initTitle( topFrame, topLayout );
83 mGeneral->initDate( topFrame, topLayout );
84 mGeneral->initDescription( topFrame, topLayout );
86 TQFrame *topFrame = addPage(i18n(
"&General"));
88 TQBoxLayout *topLayout =
new TQVBoxLayout(topFrame);
89 topLayout->setSpacing(spacingHint());
91 mGeneral->initTitle( topFrame, topLayout );
92 mGeneral->initDate( topFrame, topLayout );
93 mGeneral->initDescription( topFrame, topLayout );
96 mGeneral->finishSetup();
121 if ( description.isEmpty() && summary.contains(
"\n") ) {
122 mGeneral->setDescription( summary );
123 int pos = summary.find(
"\n" );
124 mGeneral->setSummary( summary.left( pos ) );
126 mGeneral->setSummary( summary );
127 mGeneral->setDescription( description );
133void KOJournalEditor::loadDefaults()
135 setDate( TQDate::currentDate() );
145 mChanger->changeIncidence( oldJournal, mJournal, KOGlobals::NOTHING_MODIFIED,
this );
150 KOPrefs::instance()->email() ) );
154 if ( !mChanger->addIncidence( mJournal, mResource, mSubResource,
this ) ) {
164void KOJournalEditor::deleteJournal()
166 kdDebug(5850) <<
"Delete journal" << endl;
169 emit deleteIncidenceSignal( mJournal );
170 emit dialogClose( mJournal );
176 mGeneral->setDefaults( date );
177 mDetails->setDefaults();
182 kdDebug(5851)<<
"read Journal"<<endl;
183 mGeneral->readJournal( journal, date );
184 mDetails->readEvent( journal );
189 mGeneral->writeJournal( journal );
190 mDetails->writeEvent( journal );
195 return mGeneral->validateInput() && mDetails->validateInput();
198int KOJournalEditor::msgItemDelete()
200 return KMessageBox::warningContinueCancel(
this,
201 i18n(
"This journal entry will be permanently deleted."),
202 i18n(
"KOrganizer Confirmation"), KGuiItem( i18n(
"Delete"),
"edit-delete" ));
214 Journal::List journals = cal.
journals();
215 if ( journals.count() == 0 ) {
216 KMessageBox::error(
this,
217 i18n(
"Template does not contain a valid journal.") );
223void KOJournalEditor::slotSaveTemplate(
const TQString &templateName )
227 saveAsTemplate( journal, templateName );
230TQStringList& KOJournalEditor::templates()
const
232 return KOPrefs::instance()->mJournalTemplates;
234#include "kojournaleditor.moc"
virtual Journal::List journals(JournalSortField sortField=JournalSortUnsorted, SortDirection sortDirection=SortDirectionAscending)
void setOrganizer(const Person &o)
This is the base class for the calendar component editors.
KOJournalEditor(Calendar *calendar, TQWidget *parent)
Constructs a new Journal editor.
void newJournal()
Clear editor for new Journal.
void modified()
This Journal has been modified externally.
void editIncidence(Incidence *, const TQDate &date, Calendar *)
Edit an existing Journal.
bool validateInput()
Check if the input is valid.
void init()
Initialize editor.
void setDate(const TQDate &date)
Set widgets to default values.
void setTexts(const TQString &summary, const TQString &description=TQString())
Sets the given summary and description.
bool processInput()
Process user input and create or update event.
void writeJournal(Journal *)
Write event settings to event object.
void readJournal(Journal *, const TQDate &date)
Read event object and setup widgets accordingly.