00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
#include <kcmultidialog.h>
00023
#include <ksettings/dialog.h>
00024
00025
#include <libkdepim/categoryeditdialog.h>
00026
00027
#include "calendarview.h"
00028
#include "incomingdialog.h"
00029
#include "outgoingdialog.h"
00030
#include "koprefsdialog.h"
00031
#include "koeventeditor.h"
00032
#include "koprefs.h"
00033
#include "kotodoeditor.h"
00034
#include "searchdialog.h"
00035
#include "filtereditdialog.h"
00036
#ifndef KORG_NOPLUGINS
00037
#include "plugindialog.h"
00038
#endif
00039
#ifndef KORG_NOARCHIVE
00040
#include "archivedialog.h"
00041
#endif
00042
#include "koviewmanager.h"
00043
#include "koagendaview.h"
00044
00045
#include "kodialogmanager.h"
00046
#include "kodialogmanager.moc"
00047
00048 KODialogManager::KODialogManager(
CalendarView *mainView ) :
00049 QObject(), mMainView( mainView )
00050 {
00051 mOutgoingDialog = 0;
00052 mIncomingDialog = 0;
00053 mOptionsDialog = 0;
00054 mSearchDialog = 0;
00055 mArchiveDialog = 0;
00056 mFilterEditDialog = 0;
00057 mPluginDialog = 0;
00058
00059 mCategoryEditDialog =
new KPIM::CategoryEditDialog(KOPrefs::instance(),mMainView);
00060 KOGlobals::fitDialogToScreen( mCategoryEditDialog );
00061 }
00062
00063 KODialogManager::~KODialogManager()
00064 {
00065
delete mOutgoingDialog;
00066
delete mIncomingDialog;
00067
delete mOptionsDialog;
00068
delete mSearchDialog;
00069
#ifndef KORG_NOARCHIVE
00070
delete mArchiveDialog;
00071
#endif
00072
delete mFilterEditDialog;
00073
#ifndef KORG_NOPLUGINS
00074
delete mPluginDialog;
00075
#endif
00076
}
00077
00078
void KODialogManager::errorSaveEvent( QWidget *parent )
00079 {
00080 KMessageBox::sorry( parent, i18n(
"Unable to save event.") );
00081 }
00082
00083
void KODialogManager::errorSaveTodo( QWidget *parent )
00084 {
00085 KMessageBox::sorry( parent, i18n(
"Unable to save todo item.") );
00086 }
00087
00088
void KODialogManager::errorSaveJournal( QWidget *parent )
00089 {
00090 KMessageBox::sorry( parent, i18n(
"Unable to save journal entry.") );
00091 }
00092
00093 OutgoingDialog *KODialogManager::outgoingDialog()
00094 {
00095 createOutgoingDialog();
00096
return mOutgoingDialog;
00097 }
00098
00099
void KODialogManager::createOutgoingDialog()
00100 {
00101
if (!mOutgoingDialog) {
00102 mOutgoingDialog =
new OutgoingDialog(mMainView->
calendar(),mMainView);
00103
if (mIncomingDialog) mIncomingDialog->setOutgoingDialog(mOutgoingDialog);
00104 connect(mOutgoingDialog,SIGNAL(numMessagesChanged(
int)),
00105 mMainView,SIGNAL(numOutgoingChanged(
int)));
00106 }
00107 }
00108
00109
void KODialogManager::showOptionsDialog()
00110 {
00111
if (!mOptionsDialog) {
00112
#if 0
00113
mOptionsDialog =
new KConfigureDialog();
00114
00115
00116 connect( mOptionsDialog->dialog(),
00117 SIGNAL( configCommitted(
const QCString & ) ),
00118 mMainView, SLOT( updateConfig() ) );
00119
#else
00120
mOptionsDialog =
new KCMultiDialog( mMainView,
"KorganizerPreferences" );
00121 connect( mOptionsDialog, SIGNAL( configCommitted(
const QCString & ) ),
00122 mMainView, SLOT( updateConfig() ) );
00123
#if 0
00124
connect( mOptionsDialog, SIGNAL( applyClicked() ),
00125 mMainView, SLOT( updateConfig() ) );
00126 connect( mOptionsDialog, SIGNAL( okClicked() ),
00127 mMainView, SLOT( updateConfig() ) );
00128
00129 connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()),
00130 mOptionsDialog,SLOT(updateCategories()));
00131
#endif
00132
00133 QStringList modules;
00134
00135 modules.append(
"configmain.desktop" );
00136 modules.append(
"configtime.desktop" );
00137 modules.append(
"configviews.desktop" );
00138 modules.append(
"configfonts.desktop" );
00139 modules.append(
"configcolors.desktop" );
00140 modules.append(
"configprinting.desktop" );
00141 modules.append(
"configgroupscheduling.desktop" );
00142 modules.append(
"configgroupautomation.desktop" );
00143
00144
if( KOPrefs::instance()->mUseGroupwareCommunication )
00145 modules.append(
"configfreebusy.desktop" );
00146
00147
00148 QStringList::iterator mit;
00149
for ( mit = modules.begin(); mit != modules.end(); ++mit )
00150 mOptionsDialog->addModule( *mit );
00151
#endif
00152
}
00153
00154 mOptionsDialog->show();
00155 mOptionsDialog->raise();
00156 }
00157
00158
void KODialogManager::showOutgoingDialog()
00159 {
00160 createOutgoingDialog();
00161 mOutgoingDialog->show();
00162 mOutgoingDialog->raise();
00163 }
00164
00165 IncomingDialog *KODialogManager::incomingDialog()
00166 {
00167 createIncomingDialog();
00168
return mIncomingDialog;
00169 }
00170
00171
void KODialogManager::createIncomingDialog()
00172 {
00173 createOutgoingDialog();
00174
if (!mIncomingDialog) {
00175 mIncomingDialog =
new IncomingDialog(mMainView->
calendar(),mOutgoingDialog,mMainView);
00176 connect(mIncomingDialog,SIGNAL(numMessagesChanged(
int)),
00177 mMainView,SIGNAL(numIncomingChanged(
int)));
00178 connect(mIncomingDialog,SIGNAL(calendarUpdated()),
00179 mMainView,SLOT(updateView()));
00180 }
00181 }
00182
00183
void KODialogManager::showIncomingDialog()
00184 {
00185 createIncomingDialog();
00186 mIncomingDialog->show();
00187 mIncomingDialog->raise();
00188 }
00189
00190
void KODialogManager::showCategoryEditDialog()
00191 {
00192 mCategoryEditDialog->show();
00193 }
00194
00195
void KODialogManager::showSearchDialog()
00196 {
00197
if (!mSearchDialog) {
00198 mSearchDialog =
new SearchDialog(mMainView->
calendar(),mMainView);
00199 connect(mSearchDialog,SIGNAL(showIncidenceSignal(Incidence *)),
00200 mMainView,SLOT(showIncidence(Incidence *)));
00201 connect(mSearchDialog,SIGNAL(editIncidenceSignal(Incidence *)),
00202 mMainView,SLOT(editIncidence(Incidence *)));
00203 connect(mSearchDialog,SIGNAL(deleteIncidenceSignal(Incidence *)),
00204 mMainView, SLOT(deleteIncidence(Incidence *)));
00205 connect(mMainView,SIGNAL(closingDown()),mSearchDialog,SLOT(reject()));
00206 }
00207
00208 mSearchDialog->show();
00209 mSearchDialog->raise();
00210 }
00211
00212
void KODialogManager::showArchiveDialog()
00213 {
00214
#ifndef KORG_NOARCHIVE
00215
if (!mArchiveDialog) {
00216 mArchiveDialog =
new ArchiveDialog(mMainView->
calendar(),mMainView);
00217 connect(mArchiveDialog,SIGNAL(eventsDeleted()),
00218 mMainView,SLOT(updateView()));
00219 }
00220 mArchiveDialog->show();
00221 mArchiveDialog->raise();
00222
00223
00224 QApplication::restoreOverrideCursor();
00225
#endif
00226
}
00227
00228
void KODialogManager::showFilterEditDialog( QPtrList<CalFilter> *filters )
00229 {
00230
if ( !mFilterEditDialog ) {
00231 mFilterEditDialog =
new FilterEditDialog( filters, mMainView );
00232 connect( mFilterEditDialog, SIGNAL( filterChanged() ),
00233 mMainView, SLOT( filterEdited() ) );
00234 connect( mFilterEditDialog, SIGNAL( editCategories() ),
00235 mCategoryEditDialog, SLOT( show() ) );
00236 connect( mCategoryEditDialog, SIGNAL( categoryConfigChanged() ),
00237 mFilterEditDialog, SLOT( updateCategoryConfig() ) );
00238 }
00239 mFilterEditDialog->show();
00240 mFilterEditDialog->raise();
00241 }
00242
00243
void KODialogManager::showPluginDialog()
00244 {
00245
#ifndef KORG_NOPLUGINS
00246
if (!mPluginDialog) {
00247 mPluginDialog =
new PluginDialog(mMainView);
00248 connect(mPluginDialog,SIGNAL(configChanged()),
00249 mMainView,SLOT(updateConfig()));
00250 }
00251 mPluginDialog->show();
00252 mPluginDialog->raise();
00253
#endif
00254
}
00255
00256 KOEventEditor *
KODialogManager::getEventEditor()
00257 {
00258
KOEventEditor *eventEditor =
new KOEventEditor( mMainView->
calendar(),
00259 mMainView );
00260
00261 connect( eventEditor, SIGNAL( eventAdded( Event * ) ),
00262 mMainView, SLOT( eventAdded( Event * ) ) );
00263 connect( eventEditor, SIGNAL( eventChanged( Event *, Event * ) ),
00264 mMainView, SLOT( eventChanged( Event *, Event * ) ) );
00265 connect( eventEditor, SIGNAL( eventDeleted( Event * ) ),
00266 mMainView, SLOT( eventDeleted( Event * ) ) );
00267 connect( eventEditor, SIGNAL( deleteAttendee( Incidence * ) ),
00268 mMainView, SLOT( schedule_cancel( Incidence * ) ) );
00269 connect( eventEditor, SIGNAL( editCanceled( Incidence * ) ),
00270 mMainView, SLOT( editCanceled( Incidence * ) ) );
00271
00272 connect( mCategoryEditDialog, SIGNAL( categoryConfigChanged() ),
00273 eventEditor, SLOT( updateCategoryConfig() ) );
00274 connect( eventEditor, SIGNAL( editCategories() ),
00275 mCategoryEditDialog, SLOT( show() ) );
00276 connect( eventEditor, SIGNAL( dialogClose( Incidence * ) ),
00277 mMainView, SLOT( dialogClosing( Incidence * ) ) );
00278
00279 connect( mMainView, SIGNAL( closingDown() ), eventEditor, SLOT( reject() ) );
00280
00281
return eventEditor;
00282 }
00283
00284
void KODialogManager::connectTypeAhead(
KOEventEditor *editor,
00285
KOAgendaView *agenda )
00286 {
00287
if ( editor && agenda ) {
00288 agenda->
setTypeAheadReceiver( editor->
typeAheadReceiver() );
00289 connect( editor, SIGNAL( focusReceivedSignal() ),
00290 agenda, SLOT( finishTypeAhead() ) );
00291 }
00292 }
00293
00294 KOTodoEditor *
KODialogManager::getTodoEditor()
00295 {
00296
KOTodoEditor *todoEditor =
new KOTodoEditor( mMainView->
calendar(),
00297 mMainView );
00298
00299 connect( mCategoryEditDialog, SIGNAL( categoryConfigChanged() ),
00300 todoEditor, SLOT( updateCategoryConfig() ) );
00301 connect( todoEditor, SIGNAL( editCategories() ),
00302 mCategoryEditDialog, SLOT( show() ) );
00303
00304 connect( todoEditor, SIGNAL( todoAdded( Todo * ) ),
00305 mMainView, SLOT( todoAdded( Todo * ) ) );
00306 connect( todoEditor, SIGNAL( todoChanged( Todo *, Todo * ) ),
00307 mMainView, SLOT( todoChanged( Todo *, Todo * ) ) );
00308 connect( todoEditor, SIGNAL( todoDeleted() ),
00309 mMainView, SLOT( updateTodoViews() ) );
00310 connect( todoEditor, SIGNAL( dialogClose( Incidence * ) ),
00311 mMainView, SLOT( dialogClosing( Incidence * ) ) );
00312 connect( todoEditor, SIGNAL( editCanceled( Incidence * ) ),
00313 mMainView, SLOT( editCanceled( Incidence * ) ) );
00314
00315 connect( mMainView, SIGNAL( closingDown() ), todoEditor, SLOT( reject() ) );
00316
00317
return todoEditor;
00318 }
00319
00320
void KODialogManager::updateSearchDialog()
00321 {
00322
if (mSearchDialog) mSearchDialog->updateView();
00323 }
00324
00325
void KODialogManager::setDocumentId(
const QString &
id )
00326 {
00327
if (mOutgoingDialog) mOutgoingDialog->setDocumentId(
id );
00328 }