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 );
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"