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>
39 #include <tdelocale.h>
52 KOJournalEditor::~KOJournalEditor()
54 emit dialogClose( mJournal );
63 void KOJournalEditor::reload()
65 kdDebug(5851) <<
"reloading Journal" << endl;
71 void 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 );
133 void KOJournalEditor::loadDefaults()
135 setDate( TQDate::currentDate() );
145 mChanger->changeIncidence( oldJournal, mJournal, KOGlobals::NOTHING_MODIFIED,
this );
149 mJournal->setOrganizer(
Person( KOPrefs::instance()->fullName(),
150 KOPrefs::instance()->email() ) );
154 if ( !mChanger->addIncidence( mJournal, mResource, mSubResource,
this ) ) {
164 void 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();
198 int 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.") );
223 void KOJournalEditor::slotSaveTemplate(
const TQString &templateName )
227 saveAsTemplate( journal, templateName );
230 TQStringList& KOJournalEditor::templates()
const
232 return KOPrefs::instance()->mJournalTemplates;
234 #include "kojournaleditor.moc"
void setDate(const TQDate &date)
Set widgets to default values.
void modified()
This Journal has been modified externally.
void newJournal()
Clear editor for new Journal.
bool processInput()
Process user input and create or update event.
void setTexts(const TQString &summary, const TQString &description=TQString())
Sets the given summary and description.
KOJournalEditor(Calendar *calendar, TQWidget *parent)
Constructs a new Journal editor.
void editIncidence(Incidence *, const TQDate &date, Calendar *)
Edit an existing Journal.
void init()
Initialize editor.
void readJournal(Journal *, const TQDate &date)
Read event object and setup widgets accordingly.
bool validateInput()
Check if the input is valid.
virtual Journal::List journals(JournalSortField sortField=JournalSortUnsorted, SortDirection sortDirection=SortDirectionAscending)
This is the base class for the calendar component editors.
void writeJournal(Journal *)
Write event settings to event object.