32 #include <calendarsupport/archivedialog.h>
33 #include <calendarsupport/categoryconfig.h>
34 #include <calendarsupport/utils.h>
36 #include <incidenceeditor-ng/categoryeditdialog.h>
37 #include <incidenceeditor-ng/incidencedialog.h>
38 #include <incidenceeditor-ng/incidencedialogfactory.h>
40 #include <Akonadi/Item>
42 #include <KCalCore/Visitor>
44 #include <KCMultiDialog>
50 class KODialogManager::DialogManagerVisitor :
public KCalCore::Visitor
53 DialogManagerVisitor() : mDialogManager( 0 ) {}
55 bool act( KCalCore::IncidenceBase::Ptr incidence,
KODialogManager *manager )
57 mDialogManager = manager;
58 return incidence->accept( *
this, incidence );
66 :
QObject(), mMainView( mainView )
71 mFilterEditDialog = 0;
72 mCategoryEditDialog = 0;
77 delete mOptionsDialog;
79 delete mArchiveDialog;
80 delete mFilterEditDialog;
81 delete mCategoryEditDialog;
86 if ( !mOptionsDialog ) {
87 mOptionsDialog =
new KCMultiDialog( mMainView );
88 connect( mOptionsDialog, SIGNAL(configCommitted(QByteArray)),
89 mMainView, SLOT(updateConfig(QByteArray)) );
92 modules.append( QLatin1String(
"korganizer_configmain.desktop") );
93 modules.append( QLatin1String(
"korganizer_configtime.desktop") );
94 modules.append( QLatin1String(
"korganizer_configviews.desktop") );
95 modules.append( QLatin1String(
"korganizer_configcolorsandfonts.desktop") );
96 modules.append( QLatin1String(
"korganizer_configgroupscheduling.desktop") );
97 modules.append( QLatin1String(
"korganizer_configfreebusy.desktop") );
98 modules.append( QLatin1String(
"korganizer_configplugins.desktop") );
99 modules.append( QLatin1String(
"korganizer_configdesignerfields.desktop") );
102 QStringList::iterator mit;
103 for ( mit = modules.begin(); mit != modules.end(); ++mit ) {
104 mOptionsDialog->addModule( *mit );
108 mOptionsDialog->show();
109 mOptionsDialog->raise();
114 createCategoryEditor();
115 mCategoryEditDialog->exec();
120 if ( !mSearchDialog ) {
123 connect( mSearchDialog, SIGNAL(showIncidenceSignal(Akonadi::Item)),
124 mMainView, SLOT(showIncidence(Akonadi::Item)) );
125 connect( mSearchDialog, SIGNAL(editIncidenceSignal(Akonadi::Item)),
126 mMainView, SLOT(editIncidence(Akonadi::Item)) );
127 connect( mSearchDialog, SIGNAL(deleteIncidenceSignal(Akonadi::Item)),
128 mMainView, SLOT(deleteIncidence(Akonadi::Item)) );
131 mSearchDialog->show();
132 mSearchDialog->raise();
137 if ( !mArchiveDialog ) {
140 connect( mArchiveDialog, SIGNAL(eventsDeleted()),
141 mMainView, SLOT(updateView()) );
142 connect( mArchiveDialog, SIGNAL(autoArchivingSettingsModified()),
143 mMainView, SLOT(slotAutoArchivingSettingsModified()) );
145 mArchiveDialog->show();
146 mArchiveDialog->raise();
149 QApplication::restoreOverrideCursor();
154 createCategoryEditor();
155 if ( !mFilterEditDialog ) {
157 connect( mFilterEditDialog, SIGNAL(filterChanged()),
158 mMainView, SLOT(updateFilter()) );
159 connect( mFilterEditDialog, SIGNAL(editCategories()),
160 mCategoryEditDialog, SLOT(show()) );
161 connect( mCategoryEditDialog, SIGNAL(categoryConfigChanged()),
162 mFilterEditDialog, SLOT(updateCategoryConfig()) );
164 mFilterEditDialog->show();
165 mFilterEditDialog->raise();
170 const KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( item );
175 IncidenceEditorNG::IncidenceDialog *dialog =
176 IncidenceEditorNG::IncidenceDialogFactory::create(
186 if ( dialog && view ) {
193 createCategoryEditor();
194 connect( editor, SIGNAL(deleteIncidenceSignal(Akonadi::Item)),
195 mMainView, SLOT(deleteIncidence(Akonadi::Item)) );
197 connect( mCategoryEditDialog, SIGNAL(categoryConfigChanged()),
198 editor, SIGNAL(updateCategoryConfig()) );
199 connect( editor, SIGNAL(editCategories()),
200 mCategoryEditDialog, SLOT(show()) );
201 connect( editor, SIGNAL(dialogClose(Akonadi::Item)),
202 mMainView, SLOT(dialogClosing(Akonadi::Item)) );
203 connect( editor, SIGNAL(deleteAttendee(Akonadi::Item)),
204 mMainView, SIGNAL(cancelAttendees(Akonadi::Item)) );
209 if ( mSearchDialog ) {
214 void KODialogManager::createCategoryEditor()
216 if ( mCategoryEditDialog == 0 ) {
217 CalendarSupport::CategoryConfig *cc =
220 mCategoryEditDialog =
221 new IncidenceEditorNG::CategoryEditDialog( cc, mMainView );
223 mCategoryEditDialog->setModal(
true );
224 mCategoryEditDialog->setHelp( QLatin1String(
"categories-view"), QLatin1String(
"korganizer") );
226 connect( mMainView, SIGNAL(categoriesChanged()),
227 mCategoryEditDialog, SLOT(reload()) );
228 connect( mCategoryEditDialog, SIGNAL(categoryConfigChanged()),
229 mMainView, SIGNAL(categoryConfigChanged()) );
233 #include "kodialogmanager.moc"
void connectTypeAhead(IncidenceEditorNG::IncidenceDialog *editor, KOEventView *view)
virtual Akonadi::IncidenceChanger * incidenceChanger() const
virtual void setTypeAheadReceiver(QObject *o)
This is the class to add/edit a calendar filter.
IncidenceEditorNG::IncidenceDialog * createDialog(const Akonadi::Item &item)
KOEventView is the abstract base class from which all other calendar views for event data are derived...
void showFilterEditDialog(QList< KCalCore::CalFilter * > *filters)
void showCategoryEditDialog()
This is the main calendar widget.
Akonadi::ETMCalendar::Ptr calendar() const
KODialogManager(CalendarView *)
void updateSearchDialog()
virtual ~KODialogManager()
void connectEditor(IncidenceEditorNG::IncidenceDialog *editor)
static KOPrefs * instance()
Get instance of KOPrefs.
This class manages the dialogs used by the calendar view.