[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-pim
Subject:    Re: [Kde-pim] Kontact/Kaplan release report
From:       Don Sanders <sanders () kde ! org>
Date:       2002-12-19 7:08:38
[Download RAW message or body]

Just another status report (mainly intended for Cornelius).

The KMail (Cool) and KAddressBook parts are working well. I've 
addressed the KOrganizer concerns discussed previouly in the attached 
diff and files, but I've encountered new problems.

1) KOrganizer Plugins need work, plugins take a MainWindow parameter, 
I have to change this so that the MainWindow and KOrganizerPart both 
inherent from a new interface and have the plugins use this interface 
instead a MainWindow.

2) I guess Plugins shouldn't access koglobals (or can they?) so I 
have to create a KConfig object for each one rather than using a 
koglobals replacement for kapp->config (not really a bug just not very 
optimized)

3) There's the KStdAction problem, maybe they are a 
problem because you can't have multiple actions with the same name in 
an actionCollection (have yet to verify this). So I have to 
convert KStdActions to KActions, haven't done print preview and find 
yet.

4)  I have the KOrganizer KPart automatically save and load to a 
kontact.ics file. I wonder if I can get the last opened CalendarView 
file somehow and use that instead (if it exists). Not really a big 
problem if the user can open their current calendar file which is 
something I discuss in point 5).

5) There are quite a few actions in KOrganizer that I would like to 
move into the ActionManager, these have to deal with loading, saving, 
importing and exporting calendar files. I need to understand what the 
alarmdaemon and active calendar are about before I do that.

6) I guess the File->AddressBook action is obsolete, considering that 
you can just click on the addressbook icon instead. I will remove it 
from the korganizer_part .rc file.

I'm not feeling that well at the moment (have a bad flu or maybe 
contracted malaria) so I guess it will take another couple days to 
get these sorted out. Then I will integrate outstanding fixes to the 
3_1_BRANCH, and then change kaplan so that it creates a kontact 
target. I also might restabalize the KMail make_it_cool branch and 
make another release but then I guess I'm ready for other people to 
try out Kontact.

I don't feel like posting the KAddressBook changes yet, I should move 
the kapp->config replacement into a singleton first.

Don.

On Monday 16 December 2002 22:40, Cornelius Schumacher wrote:
> On Monday 16 December 2002 13:27, Don Sanders wrote:
> > On Monday 16 December 2002 19:46, Cornelius Schumacher wrote:
> > > On Monday 16 December 2002 09:23, Don Sanders wrote:
> > > > BTW I did some further work on kontact/kaplan last night, now
> > > > KAddressBook is working very well, I actually think it works
> > > > even better inside of kontact/kaplan than it does as a
> > > > standalone app.
> > > >
> > > > But it looks like it will take me another 3-4 days (or rather
> > > > nights after work) to get KOrganizer working well.
> > >
> > > The part currently is missing a lot of actions which are needed
> > > in Kaplan/Kontact. I think it would be best to factor out the
> > > action creating code to an own class which is used by both the
> > > main window and the part. This minimises code duplication.
> >
> > I'm pretty sure I know exactly what you are talking about so you
> > are suggesting something like ActionManager in KAddressBook?
>
> Yes.
>
> > The other problems are
> > 1) In korganizer.cpp there's a queryClose, but there's nothing
> > like that in korganizer_part.cpp so when I exit Kontact I'm not
> > prompted to save the current document. I guess for now in
> > korganizer_part.cpp I would like to just save the current
> > document and even just use a default name if no name has been
> > given yet.
>
> It might make sense to move away from the document centric model
> for KOrganizer embedded in Kaplan, so that using a default name and
> just saving would be ok. That would also be more consistent with
> KAddressBook.
>
> The queryClose of the Kaplan main window should probably call
> equivalents of the queryClose functions for all loaded parts or
> something like that.
>
> > 2) Is there some global object (like KMKernel in KMail) in
> > KOrganizer? I need somewhere to put a KConfig instead of using
> > kapp->config().
>
> There is KOGlobals.
>
> > > > Then I will release what I've done (as Kontact) and work on
> > > > creating diffs that are appropriate to applying to
> > > > KAddressBook and KOrganizer in cvs, and writing a mail
> > > > describing the changes in the diff.
> > >
> > > This sounds great. I'm looking forward to your patches.
> >
> > I just warn you at the moment the patches are pretty rough, but
> > they can be cleaned up before they are committed to cvs.
>
> I have no problem with some rough edges in the HEAD branch. It's a
> development branch after all.

["korganizer.diff" (text/x-diff)]

? actionmanager.h
? actionmanager.cpp
Index: Makefile.am
===================================================================
RCS file: /home/kde/kdepim/korganizer/Makefile.am,v
retrieving revision 1.199
diff -d -u -b -p -r1.199 Makefile.am
--- Makefile.am	15 Oct 2002 01:16:21 -0000	1.199
+++ Makefile.am	19 Dec 2002 05:31:06 -0000
@@ -65,7 +65,8 @@ libkorganizer_la_SOURCES =  outgoingdial
         kocore.cpp plugindialog.cpp mailscheduler.cpp \
 	kodaymatrix.cpp docprefs.cpp statusdialog.cpp\
         kotimespanview.cpp timespanview.cpp lineview.cpp timeline.cpp \
-        koglobals.cpp konewstuff.cpp savetemplatedialog.cpp
+        koglobals.cpp konewstuff.cpp savetemplatedialog.cpp \
+	actionmanager.cpp
 
 METASOURCES = AUTO
 
Index: calendarview.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/calendarview.cpp,v
retrieving revision 1.167
diff -d -u -b -p -r1.167 calendarview.cpp
Index: koglobals.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/koglobals.cpp,v
retrieving revision 1.2
diff -d -u -b -p -r1.2 koglobals.cpp
--- koglobals.cpp	7 Apr 2002 23:06:42 -0000	1.2
+++ koglobals.cpp	19 Dec 2002 05:31:08 -0000
@@ -3,6 +3,8 @@
 #include <kdebug.h>
 
 #include "koglobals.h"
+#include <kconfig.h>
+#include <kstandarddirs.h>
 
 void KOGlobals::fitDialogToScreen( QWidget *wid, bool force )
 {
@@ -25,4 +27,12 @@ void KOGlobals::fitDialogToScreen( QWidg
     wid->move( 0, 15 );
     if ( force ) wid->setFixedSize( w, h );
   }
+}
+
+KConfig* KOGlobals::config()
+{
+    static KConfig *mConfig = 0;
+    if (!mConfig)
+	mConfig = new KConfig( locateLocal( "config", "korganizerrc" ) );
+    return mConfig;    
 }
Index: koglobals.h
===================================================================
RCS file: /home/kde/kdepim/korganizer/koglobals.h,v
retrieving revision 1.5
diff -d -u -b -p -r1.5 koglobals.h
--- koglobals.h	8 Jul 2002 14:18:37 -0000	1.5
+++ koglobals.h	19 Dec 2002 05:31:09 -0000
@@ -1,6 +1,8 @@
 #ifndef KORG_GLOBALS_H
 #define KORG_GLOBALS_H
 
+class KConfig;
+
 class KOGlobals
 {
   public:
@@ -8,6 +10,7 @@ class KOGlobals
     enum { PRIORITY_MODIFIED, COMPLETION_MODIFIED, CATEGORY_MODIFIED, \
UNKNOWN_MODIFIED };  
     static void fitDialogToScreen( QWidget *widget, bool force=false );
+    static KConfig *config();
 };
 
 #endif
Index: korganizer.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/korganizer.cpp,v
retrieving revision 1.138
diff -d -u -b -p -r1.138 korganizer.cpp
--- korganizer.cpp	26 Oct 2002 16:08:18 -0000	1.138
+++ korganizer.cpp	19 Dec 2002 05:31:10 -0000
@@ -64,6 +64,8 @@
 #include "kocore.h"
 #include "konewstuff.h"
 #include "exportwebdialog.h"
+#include "actionmanager.h"
+#include "koglobals.h"
 
 #include "korganizer.h"
 using namespace KOrg;
@@ -113,7 +115,7 @@ KOrganizer::KOrganizer( const char *name
   connect(statusBar(),SIGNAL(pressed(int)),SLOT(statusBarPressed(int)));
 
   readSettings();
-  mCalendarView->readSettings();
+//redundant  mCalendarView->readSettings();
 
   // set up autoSaving stuff
   mAutoSaveTimer = new QTimer(this);
@@ -137,9 +139,9 @@ KOrganizer::KOrganizer( const char *name
           SLOT(showStatusMessage(const QString &)));
 
   connect( mCalendarView, SIGNAL( incidenceSelected( Incidence * ) ),
-           SLOT( processIncidenceSelection( Incidence * ) ) );
+           mActionManager, SLOT( processIncidenceSelection( Incidence * ) ) );
 
-  processIncidenceSelection( 0 );
+  mActionManager->processIncidenceSelection( 0 );
 
   // Update state of paste action
   mCalendarView->checkClipboard();
@@ -188,7 +190,7 @@ void KOrganizer::readSettings()
   // read settings from the KConfig, supplying reasonable
   // defaults where none are to be found
 
-  KConfig *config = kapp->config();
+  KConfig *config = KOGlobals::config();
 
   config->setGroup("KOrganizer Geometry");
 
@@ -209,7 +211,7 @@ void KOrganizer::writeSettings()
 {
   kdDebug() << "KOrganizer::writeSettings" << endl;
 
-  KConfig *config = kapp->config();
+  KConfig *config = KOGlobals::config();
 
   config->setGroup("KOrganizer Geometry");
 
@@ -231,8 +233,6 @@ void KOrganizer::writeSettings()
 
 void KOrganizer::initActions()
 {
-  KAction *action;
-
   // File menu.
 
   KStdAction::openNew(this, SLOT(file_new()), actionCollection());
@@ -250,229 +250,10 @@ void KOrganizer::initActions()
   (void)new KAction(i18n("Archive Old Entries..."), 0, this, SLOT(file_archive()),
                     actionCollection(), "file_archive");
 
-  (void)new KAction(i18n("iCalendar..."), 0,
-                    mCalendarView, SLOT(exportICalendar()),
-                    actionCollection(), "export_icalendar");
-  (void)new KAction(i18n("vCalendar..."), 0,
-                    mCalendarView, SLOT(exportVCalendar()),
-                    actionCollection(), "export_vcalendar");
-
-// This is now done by KPrinter::setup().
-#if 0
-  (void)new KAction(i18n("Print Setup..."), 0,
-                    mCalendarView, SLOT(printSetup()),
-                    actionCollection(), "print_setup");
-#endif
-
-  KStdAction::print(mCalendarView, SLOT(print()), actionCollection());
-#if 1
-  KStdAction::printPreview(mCalendarView, SLOT(printPreview()),
-                           actionCollection());
-#endif
   (void)new KAction(i18n("Make Active"),0,this,SLOT(makeActive()),
                     actionCollection(),"make_active");
   KStdAction::quit(this, SLOT(close()), actionCollection());
 
-
-  new KAction( i18n("delete completed To-Dos","Purge Completed"), 0,
-               mCalendarView, SLOT( purgeCompleted() ), actionCollection(),
-               "purge_completed" );
-
-  // edit menu
-
-  mCutAction = KStdAction::cut(mCalendarView,SLOT(edit_cut()),
-                               actionCollection());
-
-  mCopyAction = KStdAction::copy(mCalendarView,SLOT(edit_copy()),
-                                 actionCollection());
-
-  action = KStdAction::paste(mCalendarView,SLOT(edit_paste()),
-                             actionCollection());
-  action->setEnabled( false );
-  connect( mCalendarView, SIGNAL( pasteEnabled( bool ) ),
-           action, SLOT( setEnabled( bool ) ) );
-
-  mDeleteAction = new KAction(i18n("&Delete"),"editdelete",0,
-                              mCalendarView,SLOT(appointment_delete()),
-                              actionCollection(), "edit_delete");
-
-  KStdAction::find(mCalendarView->dialogManager(), SLOT(showSearchDialog()),
-                   actionCollection());
-
-
-  // view menu
-
-  (void)new KAction(i18n("What's &Next"), "whatsnext", 0,
-                    mCalendarView->viewManager(), SLOT(showWhatsNextView()),
-                    actionCollection(), "view_whatsnext");
-  (void)new KAction(i18n("&List"), "list", 0,
-                    mCalendarView->viewManager(), SLOT(showListView()),
-                    actionCollection(), "view_list");
-  (void)new KAction(i18n("&Day"), "1day", 0,
-                    mCalendarView->viewManager(), SLOT(showDayView()),
-                    actionCollection(), "view_day");
-  (void)new KAction(i18n("W&ork Week"), "5days", 0,
-                    mCalendarView->viewManager(), SLOT(showWorkWeekView()),
-                    actionCollection(), "view_workweek");
-  (void)new KAction(i18n("&Week"), "7days", 0,
-                    mCalendarView->viewManager(), SLOT(showWeekView()),
-                    actionCollection(), "view_week");
-  mNextXDays = new KAction("", "xdays", 0,mCalendarView->viewManager(),
-                    SLOT(showNextXView()),actionCollection(), "view_nextx");
-  mNextXDays->setText(i18n("&Next Day", "&Next %n Days", \
                KOPrefs::instance()->mNextXDays));
-  (void)new KAction(i18n("&Month"), "month", 0,
-                    mCalendarView->viewManager(), SLOT(showMonthView()),
-                    actionCollection(), "view_month");
-  (void)new KAction(i18n("&To-Do List"), "todo", 0,
-                    mCalendarView->viewManager(), SLOT(showTodoView()),
-                    actionCollection(), "view_todo");
-  (void)new KAction(i18n("&Journal"), "journal", 0,
-                    mCalendarView->viewManager(), SLOT(showJournalView()),
-                    actionCollection(), "view_journal");
-  (void)new KAction(i18n("&Time Span"), "timespan", 0,
-                    mCalendarView->viewManager(), SLOT(showTimeSpanView()),
-                    actionCollection(), "view_timespan");
-  (void)new KAction(i18n("&Update"), 0,
-                    mCalendarView, SLOT(update()),
-                    actionCollection(), "update");
-
-  // actions menu
-
-  (void)new KAction(i18n("New E&vent..."), "appointment", 0,
-                    mCalendarView,SLOT( newEvent() ),
-                    actionCollection(), "new_event");
-  (void)new KAction(i18n("New &To-Do..."), "newtodo", 0,
-                    mCalendarView,SLOT(newTodo()),
-                    actionCollection(), "new_todo");
-  action = new KAction(i18n("New Su&b-To-Do..."), 0,
-                    mCalendarView,SLOT(newSubTodo()),
-                    actionCollection(), "new_subtodo");
-  action->setEnabled(false);
-  connect(mCalendarView,SIGNAL(todoSelected(bool)),
-          action,SLOT(setEnabled(bool)));
-
-  mShowIncidenceAction = new KAction(i18n("&Show"), 0,
-                         mCalendarView,SLOT(showIncidence()),
-                         actionCollection(), "show_incidence");
-  mEditIncidenceAction = new KAction(i18n("&Edit..."), 0,
-                         mCalendarView,SLOT(editIncidence()),
-                         actionCollection(), "edit_incidence");
-  mDeleteIncidenceAction = new KAction(i18n("&Delete"), 0,
-                         mCalendarView,SLOT(deleteIncidence()),
-                         actionCollection(), "delete_incidence");
-
-#if 0
-  action = new KAction(i18n("T&ake over Event"), 0,
-                       mCalendarView,SLOT(takeOverEvent()),
-                       actionCollection(), "takeover_event");
-  connect(mCalendarView,SIGNAL(eventsSelected(bool)),
-          action,SLOT(setEnabled(bool)));
-  (void)new KAction(i18n("T&ake over Calendar"), 0,
-                    mCalendarView,SLOT(takeOverCalendar()),
-                    actionCollection(), "takeover_calendar");
-
-  action = new KAction(i18n("&Mail Appointment"), "mail_generic", 0,
-                    mCalendarView,SLOT(action_mail()),
-                    actionCollection(), "mail_appointment");
-  connect(mCalendarView,SIGNAL(eventsSelected(bool)),
-          action,SLOT(setEnabled(bool)));
-#endif
-
-  action = new KAction(i18n("&Make Sub-To-Do Independent"), 0,
-                    mCalendarView,SLOT(todo_unsub()),
-                    actionCollection(), "unsub_todo");
-  action->setEnabled(false);
-  connect(mCalendarView,SIGNAL(todoSelected(bool)),
-          action,SLOT(setEnabled(bool)));
-
-  // Schedule menu.
-
-  (void)new KAction(i18n("Outgoing Messages"),0,
-                    mCalendarView->dialogManager(),SLOT(showOutgoingDialog()),
-                    actionCollection(),"outgoing");
-  (void)new KAction(i18n("Incoming Messages"),0,
-                    mCalendarView->dialogManager(),SLOT(showIncomingDialog()),
-                    actionCollection(),"incoming");
-  mPublishEvent = new KAction(i18n("Publish..."),"mail_send",0,
-                       mCalendarView,SLOT(schedule_publish()),
-                       actionCollection(),"publish");
-  mPublishEvent->setEnabled(false);
-  action = new KAction(i18n("Request"),"mail_generic",0,
-                       mCalendarView,SLOT(schedule_request()),
-                       actionCollection(),"request");
-  action->setEnabled(false);
-  connect(mCalendarView,SIGNAL(organizerEventsSelected(bool)),
-          action,SLOT(setEnabled(bool)));
-  action = new KAction(i18n("Refresh"),0,
-                       mCalendarView,SLOT(schedule_refresh()),
-                       actionCollection(),"refresh");
-  action->setEnabled(false);
-  connect(mCalendarView,SIGNAL(groupEventsSelected(bool)),
-          action,SLOT(setEnabled(bool)));
-  action = new KAction(i18n("Cancel"),0,
-                       mCalendarView,SLOT(schedule_cancel()),
-                       actionCollection(),"cancel");
-  action->setEnabled(false);
-  connect(mCalendarView,SIGNAL(organizerEventsSelected(bool)),
-          action,SLOT(setEnabled(bool)));
-/*  action = new KAction(i18n("Add"),0,
-                       mCalendarView,SLOT(schedule_add()),
-                       actionCollection(),"add");
-  connect(mCalendarView,SIGNAL(eventsSelected(bool)),
-          action,SLOT(setEnabled(bool)));
-*/  action = new KAction(i18n("Reply"),"mail_reply",0,
-                       mCalendarView,SLOT(schedule_reply()),
-                       actionCollection(),"reply");
-  action->setEnabled(false);
-  connect(mCalendarView,SIGNAL(groupEventsSelected(bool)),
-          action,SLOT(setEnabled(bool)));
-  action = new KAction(i18n("counter proposal","Counter"),0,
-                       mCalendarView,SLOT(schedule_counter()),
-                       actionCollection(),"counter");
-  action->setEnabled(false);
-  connect(mCalendarView,SIGNAL(groupEventsSelected(bool)),
-          action,SLOT(setEnabled(bool)));
-  action = new KAction(i18n("Publish Free Busy Information"),0,
-                       mCalendarView,SLOT(schedule_publish_freebusy()),
-                       actionCollection(),"publish_freebusy");
-  action->setEnabled(true);
-/*  action = new KAction(i18n("Decline Counter"),0,
-                       mCalendarView,SLOT(schedule_declinecounter()),
-                       actionCollection(),"declinecounter");
-  connect(mCalendarView,SIGNAL(eventsSelected(bool)),
-          action,SLOT(setEnabled(bool)));
-*/
-  action = new KAction(i18n("Addressbook"),"contents",0,
-                       mCalendarView,SLOT(openAddressbook()),
-                       actionCollection(),"addressbook");
-
-  // Navigation menu
-  bool isRTL = QApplication::reverseLayout();
-
-  (void)new KAction(i18n("Go to &Today"), "today", 0,
-                    mCalendarView,SLOT(goToday()),
-                    actionCollection(), "go_today");
-  action = new KAction(i18n("Go &Backward"), isRTL ? "1rightarrow" : "1leftarrow", \
                0,
-                       mCalendarView,SLOT(goPrevious()),
-                       actionCollection(), "go_previous");
-
-// Changing the action text by setText makes the toolbar button disappear.
-// This has to be fixed first, before the connects below can be reenabled.
-/*
-  connect(mCalendarView,SIGNAL(changeNavStringPrev(const QString &)),
-          action,SLOT(setText(const QString &)));
-  connect(mCalendarView,SIGNAL(changeNavStringPrev(const QString &)),
-          this,SLOT(dumpText(const QString &)));
-*/
-  action = new KAction(i18n("Go &Forward"), isRTL ? "1leftarrow" : "1rightarrow", 0,
-                       mCalendarView,SLOT(goNext()),
-                       actionCollection(), "go_next");
-/*
-  connect(mCalendarView,SIGNAL(changeNavStringNext(const QString &)),
-          action,SLOT(setText(const QString &)));
-*/
-
-
   // Settings menu.
 
   (void)new KAction(i18n("Configure &Date && Time..."), 0,
@@ -489,26 +270,6 @@ void KOrganizer::initActions()
 
   KStdAction::configureToolbars(this, SLOT(configureToolbars()),
                                 actionCollection());
-  KStdAction::preferences(mCalendarView, SLOT(edit_options()),
-                          actionCollection());
-  KStdAction::keyBindings(this, SLOT(editKeys()), actionCollection());
-
-  (void)new KAction(i18n("Edit C&ategories..."), 0,
-                    mCalendarView->dialogManager(),
-                    SLOT(showCategoryEditDialog()),
-                    actionCollection(),"edit_categories");
-  (void)new KAction(i18n("Edit &Filters..."), 0,
-                    mCalendarView,SLOT(editFilters()),
-                    actionCollection(),"edit_filters");
-  (void)new KAction(i18n("Configure &Plugins..."), 0,
-                    mCalendarView->dialogManager(),SLOT(showPluginDialog()),
-                    actionCollection(),"configure_plugins");
-
-#if 0
-  (void)new KAction(i18n("Show Intro Page"), 0,
-                    mCalendarView,SLOT(showIntro()),
-                    actionCollection(),"show_intro");
-#endif
 
   (void)new KAction(i18n("&Tip of the Day"), 0,
                     this, SLOT(showTip()), actionCollection(), "help_tipofday");
@@ -521,12 +282,14 @@ void KOrganizer::initActions()
                SLOT( uploadNewStuff() ), actionCollection(),
                "uploadnewstuff" );
 
+  mActionManager = new ActionManager(this, mCalendarView, this);
+
   setInstance( KGlobal::instance() );
 
   setXMLFile("korganizerui.rc");
   createGUI(0);
 
-  KConfig *config = kapp->config();
+  KConfig *config = KOGlobals::config();
 
   applyMainWindowSettings(config);
 
@@ -1054,7 +817,7 @@ void KOrganizer::updateConfig()
     }
   }
   if (!KOPrefs::instance()->mAutoSave) mAutoSaveTimer->stop();
-  mNextXDays->setText(i18n("&Next Day", "&Next %n Days", \
KOPrefs::instance()->mNextXDays)); +  \
mActionManager->nextXDays()->setText(i18n("&Next Day", "&Next %n Days", \
KOPrefs::instance()->mNextXDays));  
   KOCore::self()->reloadPlugins();
   mParts = KOCore::self()->reloadParts( this, mParts );
@@ -1091,11 +854,6 @@ void KOrganizer::slotNewToolbarConfig() 
   applyMainWindowSettings( KGlobal::config(), "MainWindow" );
 }
 
-void KOrganizer::editKeys()
-{
-  KKeyDialog::configureKeys(actionCollection(),xmlFile(),true,this);
-}
-
 void KOrganizer::showTip()
 {
   KTipDialog::showTip(this,QString::null,true);
@@ -1153,7 +911,7 @@ void KOrganizer::makeActive()
 
 void KOrganizer::writeActiveState()
 {
-  KConfig *config(kapp->config());
+  KConfig *config = KOGlobals::config();
   config->setGroup("General");
   config->writeEntry("Active Calendar",mURL.url());
   config->sync();
@@ -1252,44 +1010,6 @@ bool KOrganizer::deleteEvent(QString uid
 void KOrganizer::configureDateTimeFinished(KProcess *proc)
 {
   delete proc;
-}
-
-void KOrganizer::processIncidenceSelection( Incidence *incidence )
-{
-//  kdDebug() << "KOrganizer::processIncidenceSelection()" << endl;
-
-  if ( !incidence ) {
-    enableIncidenceActions( false );
-    return;
-  }
-
-  enableIncidenceActions( true );
-
-  if ( incidence->type() == "Event" ) {
-    mShowIncidenceAction->setText( i18n("&Show Event") );
-    mEditIncidenceAction->setText( i18n("&Edit Event...") );
-    mDeleteIncidenceAction->setText( i18n("&Delete Event") );
-  } else if ( incidence->type() == "Todo" ) {
-    mShowIncidenceAction->setText( i18n("&Show To-Do") );
-    mEditIncidenceAction->setText( i18n("&Edit To-Do...") );
-    mDeleteIncidenceAction->setText( i18n("&Delete To-Do") );
-  } else {
-    mShowIncidenceAction->setText( i18n("&Show") );
-    mShowIncidenceAction->setText( i18n("&Edit...") );
-    mShowIncidenceAction->setText( i18n("&Delete") );
- }
-}
-
-void KOrganizer::enableIncidenceActions( bool enabled )
-{
-  mShowIncidenceAction->setEnabled( enabled );
-  mEditIncidenceAction->setEnabled( enabled );
-  mDeleteIncidenceAction->setEnabled( enabled );
-
-  mCutAction->setEnabled( enabled );
-  mCopyAction->setEnabled( enabled );
-  mDeleteAction->setEnabled( enabled );
-  mPublishEvent->setEnabled( enabled );
 }
 
 void KOrganizer::downloadNewStuff()
Index: korganizer.h
===================================================================
RCS file: /home/kde/kdepim/korganizer/korganizer.h,v
retrieving revision 1.52
diff -d -u -b -p -r1.52 korganizer.h
--- korganizer.h	12 Sep 2002 21:44:07 -0000	1.52
+++ korganizer.h	19 Dec 2002 05:31:10 -0000
@@ -58,8 +58,8 @@ class KRecentFilesAction;
 class KOWindowList;
 class KToggleAction;
 class KProcess;
-
 class KONewStuff;
+class ActionManager;
 
 using namespace KCal;
 
@@ -203,17 +203,12 @@ class KOrganizer : public KOrg::MainWind
     /** Open toolbar configuration dialog */
     void configureToolbars();
 
-    /** Configure key bindings */
-    void editKeys();
-    
     /** Show tip of the day */
     void showTip();
     
     /** Show tip of the day */
     void showTipOnStart();
     
-    void processIncidenceSelection( Incidence * );
-    
     void downloadNewStuff();
     void uploadNewStuff();
     
@@ -258,8 +253,6 @@ class KOrganizer : public KOrg::MainWind
     /** Get URL for saving. Opens FileDialog. */
     KURL getSaveURL();
 
-    void enableIncidenceActions( bool enable );
-
   private slots:
     void dumpText(const QString &);  // only for debugging purposes
 
@@ -291,18 +284,6 @@ class KOrganizer : public KOrg::MainWind
     KToggleAction *mStatusBarAction;
     KToggleAction *mFilterViewAction;
 
-    KAction *mShowIncidenceAction;
-    KAction *mEditIncidenceAction;
-    KAction *mDeleteIncidenceAction;
-
-    KAction *mCutAction;
-    KAction *mCopyAction;
-    KAction *mDeleteAction;
-    
-    KAction *mNextXDays;
-
-    KAction *mPublishEvent;
-
     // status bar ids
     enum { ID_HISTORY, ID_GENERAL, ID_ACTIVE, ID_MESSAGES_IN, ID_MESSAGES_OUT };
 
@@ -315,6 +296,7 @@ class KOrganizer : public KOrg::MainWind
     // if true then the html-export at savetime is synchonous (blocking)
     // this is needed when saving while quiting
     bool mHtmlExportSync;
+    ActionManager *mActionManager;
 };
 
 #endif
Index: korganizer_part.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/korganizer_part.cpp,v
retrieving revision 1.20
diff -d -u -b -p -r1.20 korganizer_part.cpp
--- korganizer_part.cpp	12 Aug 2002 13:59:33 -0000	1.20
+++ korganizer_part.cpp	19 Dec 2002 05:31:10 -0000
@@ -21,14 +21,18 @@
     without including the source code for Qt in the source distribution.
 */
 
+#include <qapplication.h>
+#include <qfile.h>
 #include <kinstance.h>
 #include <klocale.h>
 #include <kaboutdata.h>
 #include <kiconloader.h>
 #include <kaction.h>
 #include <kdebug.h>
+#include <kstandarddirs.h>
 
 #include "calendarview.h"
+#include "actionmanager.h"
 
 #include "korganizer_part.h"
 
@@ -102,35 +106,33 @@ KOrganizerPart::KOrganizerPart(QWidget *
   KGlobal::iconLoader()->addAppDir("korganizer");
 
   widget = new CalendarView(canvas);
+  connect( qApp, SIGNAL( aboutToQuit() ), this, SLOT( saveCalendar() ) );
+  QString location = locateLocal("appdata", "kontact.ics");
+  if (QFile::exists(location))
+      if(!widget->openCalendar(location))
+	  kdDebug() << "KOrganizer::saveURL(): calendar view save failed." << endl;     
   topLayout->addWidget(widget);
 
   widget->show();
 
-  (void)new KAction(i18n("&List"), "list", 0,
-                    widget, SLOT(showListView()),
-                    actionCollection(), "view_list");
-  (void)new KAction(i18n("&Day"), "1day", 0,
-                    widget, SLOT(showDayView()),
-                    actionCollection(), "view_day");
-  (void)new KAction(i18n("W&ork Week"), "5days", 0,
-                    widget, SLOT(showWorkWeekView()),
-                    actionCollection(), "view_workweek");
-  (void)new KAction(i18n("&Week"), "7days", 0,
-                    widget, SLOT(showWeekView()),
-                    actionCollection(), "view_week");
-  (void)new KAction(i18n("&Next X Days"), "nextXdays", 0,
-                    widget, SLOT(showNextXView()),
-                    actionCollection(), "view_nextx");
-  (void)new KAction(i18n("&Month"), "month", 0,
-                    widget, SLOT(showMonthView()),
-                    actionCollection(), "view_month");
-  (void)new KAction(i18n("&To-Do List"), "todo", 0,
-                    widget, SLOT(view_todolist()),
-                    actionCollection(), "view_todo");
+  ActionManager *am = new ActionManager( this, widget, this );
+  widget->readSettings();
+  am->processIncidenceSelection( 0 );
+  widget->checkClipboard();
+  widget->lookForOutgoingMessages();
+  widget->lookForIncomingMessages();
 
   setXMLFile( "korganizer_part.rc" );
 }
 
+void KOrganizerPart::saveCalendar()
+{
+  QString location = locateLocal("appdata", "kontact.ics");
+  if(!widget->saveCalendar(location))
+      kdDebug() << "KOrganizer::saveURL(): calendar view open failed." << endl;
+  widget->writeSettings();
+}
+
 KOrganizerPart::~KOrganizerPart()
 {
   closeURL();
@@ -154,3 +156,5 @@ KOrganizerBrowserExtension::~KOrganizerB
 
 using namespace KParts;
 #include "korganizer_part.moc"
+
+
Index: korganizer_part.h
===================================================================
RCS file: /home/kde/kdepim/korganizer/korganizer_part.h,v
retrieving revision 1.8
diff -d -u -b -p -r1.8 korganizer_part.h
--- korganizer_part.h	20 Jul 2002 14:17:30 -0000	1.8
+++ korganizer_part.h	19 Dec 2002 05:31:10 -0000
@@ -62,6 +62,9 @@ class KOrganizerPart: public KParts::Rea
   protected:
     virtual bool openFile();
 
+  protected slots:
+    void saveCalendar();
+
   private:
     CalendarView *widget;
     KOrganizerBrowserExtension *m_extension;
Index: korganizer_part.rc
===================================================================
RCS file: /home/kde/kdepim/korganizer/korganizer_part.rc,v
retrieving revision 1.1
diff -d -u -b -p -r1.1 korganizer_part.rc
--- korganizer_part.rc	22 Apr 2000 11:11:53 -0000	1.1
+++ korganizer_part.rc	19 Dec 2002 05:31:10 -0000
@@ -1,24 +1,122 @@
 <!DOCTYPE kpartgui>
-<kpartgui name="korganizer">
+<kpartgui name="korganizer" version="23">
 
   <MenuBar>
+    <Menu name="file"><text>&amp;File</text>
+      <Action name="print_setup" append="print_merge"/>
+      <Action name="korganizer_print"/>
+      <Separator/>
+      <Menu name="import"><text>Import</text>
+        <Merge/>
+        <Action name="import_ical"/>
+      </Menu>
+      <Action name="merge_calendar"/>
+      <Action name="file_archive"/>
+      <Menu name="export"><text>Export</text>
+        <Merge/>
+        <Separator/>
+        <Action name="export_icalendar"/>
+        <Action name="export_vcalendar"/>
+      </Menu>
+      <Separator/>
+      <Action name="addressbook"/>
+      <Action name="purge_completed"/>
+      <Separator/>
+      <Action name="make_active"/>
+    </Menu>
+    <Menu name="edit"><text>&amp;Edit</text>
+      <Action name="korganizer_cut"/>
+      <Action name="korganizer_copy"/>
+      <Action name="korganizer_paste"/>
+      <Action name="edit_delete" append="edit_paste_merge"/>
+    </Menu>
     <Menu name="view"><text>&amp;View</text>
+      <Action name="view_whatsnext"/>
+      <Separator/>
       <Action name="view_list"/>
       <Action name="view_day"/>
       <Action name="view_workweek"/>
       <Action name="view_week"/>
+      <Action name="view_nextx"/>
       <Action name="view_month"/>
       <Action name="view_todo"/>
+      <Action name="view_journal"/>
+      <Separator/>
+      <Action name="update"/>
+    </Menu>
+    <Menu name="go_document"><text>&amp;Go</text>
+      <Action name="go_today"/>
+    </Menu>
+    <Menu name="actions"><text>&amp;Actions</text>
+      <Action name="new_event"/>
+      <Action name="new_todo"/>
+      <Action name="new_subtodo"/>
+      <Separator/>
+      <Action name="show_incidence"/>
+      <Action name="edit_incidence"/>
+      <Action name="delete_incidence"/>
+      <Action name="mail_appointment"/>
+      <Separator/>
+      <Action name="show_todo"/>
+      <Action name="edit_todo"/>
+      <Action name="delete_todo"/>
+      <Action name="unsub_todo"/>
+    </Menu>
+    <Menu name="schedule"><text>S&amp;chedule</text>
+      <Action name="outgoing"/>
+      <Action name="incoming"/>
+      <Separator/>
+      <Action name="publish"/>
+      <Action name="request"/>
+      <Action name="refresh"/>
+      <Action name="cancel"/>
+      <Action name="reply"/>
+      <Action name="counter"/>
+      <Action name="publish_freebusy"/>
+    </Menu>
+    <Menu name="settings"><text>&amp;Settings</text>
+      <Actionlist name="toolbartoggles" append="show_merge"/>
+      <Action name="show_filter" append="show_merge"/>
+      <Action name="conf_datetime" append="save_merge"/>
+      <Action name="configure_plugins" append="save_merge"/>
+      <Action name="edit_filters" append="save_merge"/>
+      <Action name="edit_categories" append="save_merge"/>
+      <Action name="korganizer_configure"/>
+      <Action name="korganizer_configure_shortcuts"/>
+    </Menu>
+    <Menu name="help"><text>&amp;Help</text>
+      <Action name="show_intro"/>
+      <Action name="help_tipofday"/>
+      <Separator/>
+      <Action name="downloadnewstuff"/>
+      <Action name="uploadnewstuff"/>
     </Menu>
   </MenuBar>
 
-  <ToolBar>
+  <ToolBar name="mainToolBar"><text>Main</text>
+    <Action name="go_today"/>
+    <Action name="mail_appointment"/>
+    <Action name="new_event"/>
+    <Action name="new_todo"/>
+  </ToolBar>
+
+  <ToolBar name="korganizer_toolbar"><text>Views</text>
+    <Action name="view_whatsnext"/>
     <Action name="view_list"/>
     <Action name="view_day"/>
     <Action name="view_workweek"/>
     <Action name="view_week"/>
+    <Action name="view_nextx"/>
     <Action name="view_month"/>
     <Action name="view_todo"/>
+    <Action name="view_journal"/>
+  </ToolBar>
+
+  <ToolBar name="schedule_toolbar"><text>Schedule</text>
+    <Action name="publish"/>
+    <Action name="request"/>
+    <Action name="reply"/>
+    <Action name="addressbook"/>
   </ToolBar>
     
 </kpartgui>
Index: korganizerui.rc
===================================================================
RCS file: /home/kde/kdepim/korganizer/korganizerui.rc,v
retrieving revision 1.41
diff -d -u -b -p -r1.41 korganizerui.rc
--- korganizerui.rc	26 Oct 2002 16:08:18 -0000	1.41
+++ korganizerui.rc	19 Dec 2002 05:31:11 -0000
@@ -1,9 +1,11 @@
 <!DOCTYPE kpartgui>
-<kpartgui name="korganizer" version="20">
+<kpartgui name="korganizer" version="23">
 
   <MenuBar>
     <Menu name="file"><text>&amp;File</text>
       <Action name="print_setup" append="print_merge"/>
+      <Action name="korganizer_print"/>
+      <Separator/>
       <Menu name="import"><text>Import</text>
         <Merge/>
         <Action name="import_ical"/>
@@ -23,6 +25,9 @@
       <Action name="make_active"/>
     </Menu>
     <Menu name="edit"><text>&amp;Edit</text>
+      <Action name="korganizer_cut"/>
+      <Action name="korganizer_copy"/>
+      <Action name="korganizer_paste"/>
       <Action name="edit_delete" append="edit_paste_merge"/>
     </Menu>
     <Menu name="view"><text>&amp;View</text>
@@ -39,7 +44,7 @@
       <Separator/>
       <Action name="update"/>
     </Menu>
-    <Menu name="go_document">
+    <Menu name="go_document"><text>&amp;Go</text>
       <Action name="go_today"/>
     </Menu>
     <Menu name="actions"><text>&amp;Actions</text>
@@ -76,6 +81,8 @@
       <Action name="configure_plugins" append="save_merge"/>
       <Action name="edit_filters" append="save_merge"/>
       <Action name="edit_categories" append="save_merge"/>
+      <Action name="korganizer_configure"/>
+      <Action name="korganizer_configure_shortcuts"/>
     </Menu>
     <Menu name="help"><text>&amp;Help</text>
       <Action name="show_intro"/>
Index: koviewmanager.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/koviewmanager.cpp,v
retrieving revision 1.25
diff -d -u -b -p -r1.25 koviewmanager.cpp
Index: plugins/holidays/configdialog.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/plugins/holidays/configdialog.cpp,v
retrieving revision 1.5
diff -d -u -b -p -r1.5 configdialog.cpp
--- plugins/holidays/configdialog.cpp	12 Aug 2002 13:59:33 -0000	1.5
+++ plugins/holidays/configdialog.cpp	19 Dec 2002 05:31:12 -0000
@@ -56,8 +56,9 @@ ConfigDialog::~ConfigDialog()
 
 void ConfigDialog::load()
 {
-  kapp->config()->setGroup("Calendar/Holiday Plugin");
-  QString currentHoliday = kapp->config()->readEntry("Holidays");
+  KConfig config( locateLocal( "config", "korganizerrc" ));
+  config.setGroup("Calendar/Holiday Plugin");
+  QString currentHoliday = config.readEntry("Holidays");
   QString currentHolidayName;
 
   QStringList holidayList;
@@ -95,10 +96,11 @@ void ConfigDialog::load()
 void ConfigDialog::save()
 {
   QString currentHoliday = mCountryMap[mHolidayCombo->currentText()];
+  KConfig config( locateLocal( "config", "korganizerrc" ));
 
-  kapp->config()->setGroup("Calendar/Holiday Plugin");
-  kapp->config()->writeEntry("Holidays",currentHoliday);
-  kapp->config()->sync();
+  config.setGroup("Calendar/Holiday Plugin");
+  config.writeEntry("Holidays",currentHoliday);
+  config.sync();
 }
 
 void ConfigDialog::slotOk()
Index: plugins/holidays/holidays.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/plugins/holidays/holidays.cpp,v
retrieving revision 1.5
diff -d -u -b -p -r1.5 holidays.cpp
--- plugins/holidays/holidays.cpp	2 Apr 2002 11:15:06 -0000	1.5
+++ plugins/holidays/holidays.cpp	19 Dec 2002 05:31:12 -0000
@@ -55,8 +55,9 @@ extern "C" {
 
 Holidays::Holidays()
 {
-  kapp->config()->setGroup("Calendar/Holiday Plugin");
-  QString holiday = kapp->config()->readEntry("Holidays");
+  KConfig config( locateLocal( "config", "korganizerrc" ));    
+  config.setGroup("Calendar/Holiday Plugin");
+  QString holiday = config.readEntry("Holidays");
 
   mHolidayFile = locate("appdata","holiday_" + holiday);
 
Index: plugins/projectview/koprojectview.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/plugins/projectview/koprojectview.cpp,v
retrieving revision 1.11
diff -d -u -b -p -r1.11 koprojectview.cpp
--- plugins/projectview/koprojectview.cpp	20 Jul 2002 17:40:33 -0000	1.11
+++ plugins/projectview/koprojectview.cpp	19 Dec 2002 05:31:13 -0000
@@ -37,6 +37,7 @@
 #include <kiconloader.h>
 #include <kmessagebox.h>
 #include <kconfig.h>
+#include <kstandarddirs.h>
 
 #include <libkcal/vcaldrag.h>
 
@@ -119,11 +120,10 @@ void KOProjectView::readSettings()
 {
   kdDebug() << "KOProjectView::readSettings()" << endl;
 
-  KConfig *config = kapp->config();
-
-  config->setGroup("Views");
+  KConfig config( locateLocal( "config", "korganizerrc" ));    
+  config.setGroup("Views");
 
-  QValueList<int> sizes = config->readIntListEntry("Separator ProjectView");
+  QValueList<int> sizes = config.readIntListEntry("Separator ProjectView");
   if (sizes.count() == 2) {
     mGantt->splitter()->setSizes(sizes);
   }


["actionmanager.cpp" (text/x-c++src)]

/*
  This file is part of KOrganizer.
  Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
  Copyright (c) 2002 Don Sanders <sanders@kde.org>
  
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

  As a special exception, permission is given to link this program
  with any edition of Qt, and distribute the resulting executable,
  without including the source code for Qt in the source distribution.
*/

#include "actionmanager.h"

#include <qapplication.h>

#include <kaction.h>
#include <kkeydialog.h>
#include <kxmlguiclient.h>

#include "calendarview.h"
#include "kodialogmanager.h"
#include "koprefs.h"
#include "koviewmanager.h"

ActionManager::ActionManager(KXMLGUIClient *client, CalendarView *widget,
                             QObject *parent)
    : QObject(parent)
{
    mGUIClient = client;
    mACollection = mGUIClient->actionCollection();
    mCalendarView = widget;

    initActions();
}

ActionManager::~ActionManager()
{
}

void ActionManager::initActions()
{
  KAction *action;
    
  (void)new KAction(i18n("iCalendar..."), 0,
                    mCalendarView, SLOT(exportICalendar()),
                    mACollection, "export_icalendar");
  (void)new KAction(i18n("vCalendar..."), 0,
                    mCalendarView, SLOT(exportVCalendar()),
                    mACollection, "export_vcalendar");

// This is now done by KPrinter::setup().
#if 0
  (void)new KAction(i18n("Print Setup..."), 0,
                    mCalendarView, SLOT(printSetup()),
                    mACollection, "print_setup");
#endif

  new KAction(i18n("&Print"), "fileprint", CTRL+Key_P, mCalendarView,
	      SLOT(print()), mACollection, "korganizer_print" );
//  KStdAction::print(mCalendarView, SLOT(print()), mACollection);
  
#if 1
  KStdAction::printPreview(mCalendarView, SLOT(printPreview()),
                           mACollection);
#endif

  new KAction( i18n("delete completed To-Dos","Purge Completed"), 0,
               mCalendarView, SLOT( purgeCompleted() ), mACollection,
               "purge_completed" );

  // edit menu

  mCutAction = new KAction(i18n("Cu&t"), "editcut", CTRL+Key_X, mCalendarView,
			   SLOT(edit_cut()), mACollection, "korganizer_cut");
  mCopyAction = new KAction(i18n("&Copy"), "editcopy", CTRL+Key_C, mCalendarView,
			    SLOT(edit_copy()), mACollection, "korganizer_copy");
  action = new KAction(i18n("&Paste"), "editpaste", CTRL+Key_V, mCalendarView,
			     SLOT(edit_paste()), mACollection, "korganizer_paste");
/*
  mCutAction = KStdAction::cut(mCalendarView,SLOT(edit_cut()),
                               mACollection);

  mCopyAction = KStdAction::copy(mCalendarView,SLOT(edit_copy()),
                                 mACollection);

  action = KStdAction::paste(mCalendarView,SLOT(edit_paste()),
                             mACollection);
*/
  action->setEnabled( false );
  connect( mCalendarView, SIGNAL( pasteEnabled( bool ) ),
           action, SLOT( setEnabled( bool ) ) );

  mDeleteAction = new KAction(i18n("&Delete"),"editdelete",0,
                              mCalendarView,SLOT(appointment_delete()),
                              mACollection, "edit_delete");

  KStdAction::find(mCalendarView->dialogManager(), SLOT(showSearchDialog()),
                   mACollection);

  // view menu

  (void)new KAction(i18n("What's &Next"), "whatsnext", 0,
                    mCalendarView->viewManager(), SLOT(showWhatsNextView()),
                    mACollection, "view_whatsnext");
  (void)new KAction(i18n("&List"), "list", 0,
                    mCalendarView->viewManager(), SLOT(showListView()),
                    mACollection, "view_list");
  (void)new KAction(i18n("&Day"), "1day", 0,
                    mCalendarView->viewManager(), SLOT(showDayView()),
                    mACollection, "view_day");
  (void)new KAction(i18n("W&ork Week"), "5days", 0,
                    mCalendarView->viewManager(), SLOT(showWorkWeekView()),
                    mACollection, "view_workweek");
  (void)new KAction(i18n("&Week"), "7days", 0,
                    mCalendarView->viewManager(), SLOT(showWeekView()),
                    mACollection, "view_week");
  mNextXDays = new KAction("", "xdays", 0,mCalendarView->viewManager(),
                    SLOT(showNextXView()),mACollection, "view_nextx");
  mNextXDays->setText(i18n("&Next Day", "&Next %n Days", KOPrefs::instance()->mNextXDays));
  (void)new KAction(i18n("&Month"), "month", 0,
                    mCalendarView->viewManager(), SLOT(showMonthView()),
                    mACollection, "view_month");
  (void)new KAction(i18n("&To-Do List"), "todo", 0,
                    mCalendarView->viewManager(), SLOT(showTodoView()),
                    mACollection, "view_todo");
  (void)new KAction(i18n("&Journal"), "journal", 0,
                    mCalendarView->viewManager(), SLOT(showJournalView()),
                    mACollection, "view_journal");
  (void)new KAction(i18n("&Time Span"), "timespan", 0,
                    mCalendarView->viewManager(), SLOT(showTimeSpanView()),
                    mACollection, "view_timespan");
  (void)new KAction(i18n("&Update"), 0,
                    mCalendarView, SLOT(update()),
                    mACollection, "update");

  // actions menu

  (void)new KAction(i18n("New E&vent..."), "appointment", 0,
                    mCalendarView,SLOT( newEvent() ),
                    mACollection, "new_event");
  (void)new KAction(i18n("New &To-Do..."), "newtodo", 0,
                    mCalendarView,SLOT(newTodo()),
                    mACollection, "new_todo");
  action = new KAction(i18n("New Su&b-To-Do..."), 0,
                    mCalendarView,SLOT(newSubTodo()),
                    mACollection, "new_subtodo");
  action->setEnabled(false);
  connect(mCalendarView,SIGNAL(todoSelected(bool)),
          action,SLOT(setEnabled(bool)));

  mShowIncidenceAction = new KAction(i18n("&Show"), 0,
                         mCalendarView,SLOT(showIncidence()),
                         mACollection, "show_incidence");
  mEditIncidenceAction = new KAction(i18n("&Edit..."), 0,
                         mCalendarView,SLOT(editIncidence()),
                         mACollection, "edit_incidence");
  mDeleteIncidenceAction = new KAction(i18n("&Delete"), 0,
                         mCalendarView,SLOT(deleteIncidence()),
                         mACollection, "delete_incidence");

#if 0
  action = new KAction(i18n("T&ake over Event"), 0,
                       mCalendarView,SLOT(takeOverEvent()),
                       mACollection, "takeover_event");
  connect(mCalendarView,SIGNAL(eventsSelected(bool)),
          action,SLOT(setEnabled(bool)));
  (void)new KAction(i18n("T&ake over Calendar"), 0,
                    mCalendarView,SLOT(takeOverCalendar()),
                    mACollection, "takeover_calendar");

  action = new KAction(i18n("&Mail Appointment"), "mail_generic", 0,
                    mCalendarView,SLOT(action_mail()),
                    mACollection, "mail_appointment");
  connect(mCalendarView,SIGNAL(eventsSelected(bool)),
          action,SLOT(setEnabled(bool)));
#endif

  action = new KAction(i18n("&Make Sub-To-Do Independent"), 0,
                    mCalendarView,SLOT(todo_unsub()),
                    mACollection, "unsub_todo");
  action->setEnabled(false);
  connect(mCalendarView,SIGNAL(todoSelected(bool)),
          action,SLOT(setEnabled(bool)));

  // Schedule menu.

  (void)new KAction(i18n("Outgoing Messages"),0,
                    mCalendarView->dialogManager(),SLOT(showOutgoingDialog()),
                    mACollection,"outgoing");
  (void)new KAction(i18n("Incoming Messages"),0,
                    mCalendarView->dialogManager(),SLOT(showIncomingDialog()),
                    mACollection,"incoming");
  mPublishEvent = new KAction(i18n("Publish..."),"mail_send",0,
                       mCalendarView,SLOT(schedule_publish()),
                       mACollection,"publish");
  mPublishEvent->setEnabled(false);
  action = new KAction(i18n("Request"),"mail_generic",0,
                       mCalendarView,SLOT(schedule_request()),
                       mACollection,"request");
  action->setEnabled(false);
  connect(mCalendarView,SIGNAL(organizerEventsSelected(bool)),
          action,SLOT(setEnabled(bool)));
  action = new KAction(i18n("Refresh"),0,
                       mCalendarView,SLOT(schedule_refresh()),
                       mACollection,"refresh");
  action->setEnabled(false);
  connect(mCalendarView,SIGNAL(groupEventsSelected(bool)),
          action,SLOT(setEnabled(bool)));
  action = new KAction(i18n("Cancel"),0,
                       mCalendarView,SLOT(schedule_cancel()),
                       mACollection,"cancel");
  action->setEnabled(false);
  connect(mCalendarView,SIGNAL(organizerEventsSelected(bool)),
          action,SLOT(setEnabled(bool)));
/*  action = new KAction(i18n("Add"),0,
                       mCalendarView,SLOT(schedule_add()),
                       mACollection,"add");
  connect(mCalendarView,SIGNAL(eventsSelected(bool)),
          action,SLOT(setEnabled(bool)));
*/  action = new KAction(i18n("Reply"),"mail_reply",0,
                       mCalendarView,SLOT(schedule_reply()),
                       mACollection,"reply");
  action->setEnabled(false);
  connect(mCalendarView,SIGNAL(groupEventsSelected(bool)),
          action,SLOT(setEnabled(bool)));
  action = new KAction(i18n("counter proposal","Counter"),0,
                       mCalendarView,SLOT(schedule_counter()),
                       mACollection,"counter");
  action->setEnabled(false);
  connect(mCalendarView,SIGNAL(groupEventsSelected(bool)),
          action,SLOT(setEnabled(bool)));
  action = new KAction(i18n("Publish Free Busy Information"),0,
                       mCalendarView,SLOT(schedule_publish_freebusy()),
                       mACollection,"publish_freebusy");
  action->setEnabled(true);
/*  action = new KAction(i18n("Decline Counter"),0,
                       mCalendarView,SLOT(schedule_declinecounter()),
                       mACollection,"declinecounter");
  connect(mCalendarView,SIGNAL(eventsSelected(bool)),
          action,SLOT(setEnabled(bool)));
*/
  action = new KAction(i18n("Addressbook"),"contents",0,
                       mCalendarView,SLOT(openAddressbook()),
                       mACollection,"addressbook");

  // Navigation menu
  bool isRTL = QApplication::reverseLayout();

  (void)new KAction(i18n("Go to &Today"), "today", 0,
                    mCalendarView,SLOT(goToday()),
                    mACollection, "go_today");
  action = new KAction(i18n("Go &Backward"), isRTL ? "1rightarrow" : "1leftarrow", 0,
                       mCalendarView,SLOT(goPrevious()),
                       mACollection, "go_previous");

// Changing the action text by setText makes the toolbar button disappear.
// This has to be fixed first, before the connects below can be reenabled.
/*
  connect(mCalendarView,SIGNAL(changeNavStringPrev(const QString &)),
          action,SLOT(setText(const QString &)));
  connect(mCalendarView,SIGNAL(changeNavStringPrev(const QString &)),
          this,SLOT(dumpText(const QString &)));
*/
  action = new KAction(i18n("Go &Forward"), isRTL ? "1leftarrow" : "1rightarrow", 0,
                       mCalendarView,SLOT(goNext()),
                       mACollection, "go_next");
/*
  connect(mCalendarView,SIGNAL(changeNavStringNext(const QString &)),
          action,SLOT(setText(const QString &)));
*/
  
    new KAction( i18n("&Configure KOrganizer..."),
		 "configure", 0, mCalendarView,
		 SLOT(edit_options()), mACollection,
		 "korganizer_configure" );
    new KAction( i18n("Configure S&hortcuts..."),
		 "configure_shortcuts", 0, this,
		 SLOT(keyBindings()), mACollection,
		 "korganizer_configure_shortcuts" );
/*
    KStdAction::preferences(mCalendarView, SLOT(edit_options()),
                          mACollection);
    KStdAction::keyBindings(this, SLOT(keyBindings()), mACollection);
*/
  
  (void)new KAction(i18n("Edit C&ategories..."), 0,
                    mCalendarView->dialogManager(),
                    SLOT(showCategoryEditDialog()),
                    mACollection,"edit_categories");
  (void)new KAction(i18n("Edit &Filters..."), 0,
                    mCalendarView,SLOT(editFilters()),
                    mACollection,"edit_filters");
  (void)new KAction(i18n("Configure &Plugins..."), 0,
                    mCalendarView->dialogManager(),SLOT(showPluginDialog()),
                    mACollection,"configure_plugins");

#if 0
  (void)new KAction(i18n("Show Intro Page"), 0,
                    mCalendarView,SLOT(showIntro()),
                    actionCollection(),"show_intro");
#endif
}

void ActionManager::processIncidenceSelection( Incidence *incidence )
{
//  kdDebug() << "KOrganizer::processIncidenceSelection()" << endl;

  if ( !incidence ) {
    enableIncidenceActions( false );
    return;
  }

  enableIncidenceActions( true );

  if ( incidence->type() == "Event" ) {
    mShowIncidenceAction->setText( i18n("&Show Event") );
    mEditIncidenceAction->setText( i18n("&Edit Event...") );
    mDeleteIncidenceAction->setText( i18n("&Delete Event") );
  } else if ( incidence->type() == "Todo" ) {
    mShowIncidenceAction->setText( i18n("&Show To-Do") );
    mEditIncidenceAction->setText( i18n("&Edit To-Do...") );
    mDeleteIncidenceAction->setText( i18n("&Delete To-Do") );
  } else {
    mShowIncidenceAction->setText( i18n("&Show") );
    mShowIncidenceAction->setText( i18n("&Edit...") );
    mShowIncidenceAction->setText( i18n("&Delete") );
 }
}

void ActionManager::enableIncidenceActions( bool enabled )
{
  mShowIncidenceAction->setEnabled( enabled );
  mEditIncidenceAction->setEnabled( enabled );
  mDeleteIncidenceAction->setEnabled( enabled );

  mCutAction->setEnabled( enabled );
  mCopyAction->setEnabled( enabled );
  mDeleteAction->setEnabled( enabled );
  mPublishEvent->setEnabled( enabled );
}

void ActionManager::keyBindings()
{
//  KKeyDialog::configureKeys(mACollection(),xmlFile(),true,this);   
  KKeyDialog::configure( mACollection, true );
}

#include "actionmanager.moc"

["actionmanager.h" (text/x-chdr)]

#ifndef ACTIONMANAGER_H
#define ACTIONMANAGER_H

/*
    This file is part of KOrganizer.
    Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
    Copyright (c) 2002 Don Sanders <sanders@kde.org>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

    As a special exception, permission is given to link this program
    with any edition of Qt, and distribute the resulting executable,
    without including the source code for Qt in the source distribution.
*/

#include <qobject.h>
#include <libkcal/calendar.h>

class KAction;
class KXMLGUIClient;
class KActionCollection;
class CalendarView;

using namespace KCal;

/** The ActionManager creates all the actions in KOrganizer. This class
* is shared between the main application and the part so all common
* actions are in one location.
*/
class ActionManager : public QObject
{
  Q_OBJECT

  public:
    ActionManager(KXMLGUIClient *client, CalendarView *widget,
                  QObject *parent);
    ~ActionManager();

    KAction *nextXDays() { return mNextXDays; }

  signals:
    /** Announce filter selection changes. */
    void filterActivated(int);

  public slots:
    void processIncidenceSelection( Incidence * );
    void keyBindings();

  private:
    /** Create all the actions. */
    void initActions();
    void enableIncidenceActions( bool enable );

    KAction *mShowIncidenceAction;
    KAction *mEditIncidenceAction;
    KAction *mDeleteIncidenceAction;

    KAction *mCutAction;
    KAction *mCopyAction;
    KAction *mDeleteAction;

    KAction *mNextXDays;

    KAction *mPublishEvent;

    KXMLGUIClient *mGUIClient;
    KActionCollection *mACollection;
    CalendarView *mCalendarView;
};

#endif

_______________________________________________
kde-pim mailing list
kde-pim@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic