26 #include <kcmultidialog.h>
27 #include <ksettings/dialog.h>
30 #include <libtdepim/categoryeditdialog.h>
32 #include "calendarview.h"
33 #include "koprefsdialog.h"
35 #include "koeventeditor.h"
36 #include "kotodoeditor.h"
37 #include "kojournaleditor.h"
38 #include "searchdialog.h"
39 #include "filtereditdialog.h"
40 #ifndef KORG_NOARCHIVE
41 #include "archivedialog.h"
43 #include "koviewmanager.h"
44 #include "koagendaview.h"
45 #include "koglobals.h"
47 #include "kodialogmanager.h"
48 #include "kodialogmanager.moc"
57 DialogManagerVisitor() : mDialogManager( 0 ) {}
61 mDialogManager = manager;
62 return incidence->
accept( *
this );
69 class KODialogManager::EditorDialogVisitor :
70 public KODialogManager::DialogManagerVisitor
73 EditorDialogVisitor() : DialogManagerVisitor(), mEditor( 0 ) {}
76 bool visit(
Event * ) { mEditor = mDialogManager->getEventEditor();
return mEditor; }
77 bool visit(
Todo * ) { mEditor = mDialogManager->getTodoEditor();
return mEditor; }
78 bool visit(
Journal * ) { mEditor = mDialogManager->getJournalEditor();
return mEditor; }
84 KODialogManager::KODialogManager(
CalendarView *mainView ) :
85 TQObject(), mMainView( mainView )
90 mFilterEditDialog = 0;
92 mCategoryEditDialog =
new KPIM::CategoryEditDialog( KOPrefs::instance(), mMainView );
95 KWin::setMainWindow( mCategoryEditDialog, 0 );
96 connect( mainView, TQ_SIGNAL( categoriesChanged() ),
97 mCategoryEditDialog, TQ_SLOT( reload() ) );
98 KOGlobals::fitDialogToScreen( mCategoryEditDialog );
101 KODialogManager::~KODialogManager()
103 delete mOptionsDialog;
104 delete mSearchDialog;
105 #ifndef KORG_NOARCHIVE
106 delete mArchiveDialog;
108 delete mFilterEditDialog;
111 void KODialogManager::errorSaveIncidence( TQWidget *parent,
Incidence *incidence )
113 KMessageBox::sorry( parent, i18n(
"Unable to save %1 \"%2\".")
114 .arg( i18n( incidence->type() ) )
115 .arg( incidence->
summary() ) );
118 void KODialogManager::showOptionsDialog()
120 if (!mOptionsDialog) {
122 mOptionsDialog =
new TDEConfigureDialog();
125 connect( mOptionsDialog->dialog(),
126 TQ_SIGNAL( configCommitted(
const TQCString & ) ),
127 mMainView, TQ_SLOT( updateConfig() ) );
129 mOptionsDialog =
new KCMultiDialog( mMainView,
"KorganizerPreferences" );
130 connect( mOptionsDialog, TQ_SIGNAL( configCommitted(
const TQCString & ) ),
131 mMainView, TQ_SLOT( updateConfig(
const TQCString& ) ) );
133 connect( mOptionsDialog, TQ_SIGNAL( applyClicked() ),
134 mMainView, TQ_SLOT( updateConfig() ) );
135 connect( mOptionsDialog, TQ_SIGNAL( okClicked() ),
136 mMainView, TQ_SLOT( updateConfig() ) );
138 connect(mCategoryEditDialog,TQ_SIGNAL(categoryConfigChanged()),
139 mOptionsDialog,TQ_SLOT(updateCategories()));
142 TQStringList modules;
144 modules.append(
"korganizer_configmain.desktop" );
145 modules.append(
"korganizer_configtime.desktop" );
146 modules.append(
"korganizer_configviews.desktop" );
147 modules.append(
"korganizer_configfonts.desktop" );
148 modules.append(
"korganizer_configcolors.desktop" );
149 modules.append(
"korganizer_configgroupscheduling.desktop" );
150 modules.append(
"korganizer_configgroupautomation.desktop" );
151 modules.append(
"korganizer_configfreebusy.desktop" );
152 modules.append(
"korganizer_configplugins.desktop" );
153 modules.append(
"korganizer_configdesignerfields.desktop" );
156 TQStringList::iterator mit;
157 for ( mit = modules.begin(); mit != modules.end(); ++mit )
158 mOptionsDialog->addModule( *mit );
162 mOptionsDialog->show();
163 mOptionsDialog->raise();
166 void KODialogManager::showCategoryEditDialog()
168 mCategoryEditDialog->show();
171 void KODialogManager::showSearchDialog()
173 if ( !mSearchDialog ) {
174 mSearchDialog =
new SearchDialog( mMainView->calendar(), mMainView );
175 connect( mSearchDialog, TQ_SIGNAL(showIncidenceSignal(
Incidence *,
const TQDate &)),
176 mMainView, TQ_SLOT(showIncidence(
Incidence *,
const TQDate &)) );
177 connect( mSearchDialog, TQ_SIGNAL(editIncidenceSignal(
Incidence *,
const TQDate &)),
178 mMainView, TQ_SLOT(editIncidence(
Incidence *,
const TQDate &)) );
179 connect( mSearchDialog, TQ_SIGNAL(deleteIncidenceSignal(
Incidence *)),
180 mMainView, TQ_SLOT(deleteIncidence(
Incidence *)) );
181 connect( mMainView, TQ_SIGNAL(closingDown()),mSearchDialog,TQ_SLOT(reject()) );
184 mSearchDialog->show();
185 mSearchDialog->raise();
188 void KODialogManager::showArchiveDialog()
190 #ifndef KORG_NOARCHIVE
191 if (!mArchiveDialog) {
192 mArchiveDialog =
new ArchiveDialog(mMainView->calendar(),mMainView);
193 connect(mArchiveDialog,TQ_SIGNAL(eventsDeleted()),
194 mMainView,TQ_SLOT(updateView()));
195 connect(mArchiveDialog,TQ_SIGNAL(autoArchivingSettingsModified()),
196 mMainView,TQ_SLOT(slotAutoArchivingSettingsModified()));
198 mArchiveDialog->show();
199 mArchiveDialog->raise();
202 TQApplication::restoreOverrideCursor();
206 void KODialogManager::showFilterEditDialog( TQPtrList<CalFilter> *filters )
208 if ( !mFilterEditDialog ) {
210 connect( mFilterEditDialog, TQ_SIGNAL( filterChanged() ),
211 mMainView, TQ_SLOT( updateFilter() ) );
212 connect( mFilterEditDialog, TQ_SIGNAL( editCategories() ),
213 mCategoryEditDialog, TQ_SLOT( show() ) );
214 connect( mCategoryEditDialog, TQ_SIGNAL( categoryConfigChanged() ),
215 mFilterEditDialog, TQ_SLOT( updateCategoryConfig() ) );
217 mFilterEditDialog->show();
218 mFilterEditDialog->raise();
223 if ( !incidence )
return 0;
224 EditorDialogVisitor v;
225 if ( v.act( incidence,
this ) ) {
235 connectEditor( eventEditor );
239 void KODialogManager::connectTypeAhead(
KOEventEditor *editor,
242 if ( editor && agenda ) {
243 agenda->setTypeAheadReceiver( editor->typeAheadReceiver() );
244 connect( editor, TQ_SIGNAL( focusReceivedSignal() ),
245 agenda, TQ_SLOT( finishTypeAhead() ) );
251 connect( editor, TQ_SIGNAL( deleteIncidenceSignal(
Incidence * ) ),
252 mMainView, TQ_SLOT( deleteIncidence(
Incidence * ) ) );
254 connect( mCategoryEditDialog, TQ_SIGNAL( categoryConfigChanged() ),
255 editor, TQ_SIGNAL( updateCategoryConfig() ) );
256 connect( editor, TQ_SIGNAL( editCategories() ),
257 mCategoryEditDialog, TQ_SLOT( show() ) );
259 connect( editor, TQ_SIGNAL( dialogClose(
Incidence * ) ),
260 mMainView, TQ_SLOT( dialogClosing(
Incidence * ) ) );
261 connect( editor, TQ_SIGNAL( editCanceled(
Incidence * ) ),
262 mMainView, TQ_SLOT( editCanceled(
Incidence * ) ) );
263 connect( mMainView, TQ_SIGNAL( closingDown() ), editor, TQ_SLOT( reject() ) );
265 connect( editor, TQ_SIGNAL( deleteAttendee(
Incidence * ) ),
266 mMainView, TQ_SIGNAL( cancelAttendees(
Incidence * ) ) );
271 kdDebug(5850) << k_funcinfo << endl;
273 connectEditor( todoEditor );
280 connectEditor( journalEditor );
281 return journalEditor;
284 void KODialogManager::updateSearchDialog()
286 if (mSearchDialog) mSearchDialog->updateView();
This is the main calendar widget.
This is the class to add/edit a calendar filter.
virtual bool visit(FreeBusy *)
virtual bool accept(Visitor &)
This class manages the dialogs used by the calendar view.
KOJournalEditor * getJournalEditor()
Get an editor dialog for a Journal.
KOIncidenceEditor * getEditor(Incidence *)
Get the appropriate editor for the given incidence.
KOEventEditor * getEventEditor()
Get an editor dialog for an Event.
KOTodoEditor * getTodoEditor()
Get an editor dialog for a Todo.
This class provides a dialog for editing an event.
This is the base class for the calendar component editors.
This class provides a dialog for editing a Journal.
This class provides a dialog for editing a Todo.
Base class for single/multi agenda views.