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

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

Updated patch attached.

Don.

On Monday 30 December 2002 16:59, Guenter Schwann wrote:
> On Sunday 29 December 2002 12:30, Don Sanders wrote:
> > Hi Cornelius,
> >
> > I updated the patch so it applies against HEAD and sent it to the
> > list. I really don't know if you are giving the green light to
> > commit here or not, so I'll wait for a response from you now.
>
> Can you update your patch for the current HEAD? As I commited some
> parts, it would be easier for Cornelius to have a look at the
> trickier parts (for me, the whole patch looks ok).


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

Index: Makefile.am
===================================================================
RCS file: /home/kde/kdepim/korganizer/Makefile.am,v
retrieving revision 1.201
diff -d -u -p -r1.201 Makefile.am
--- Makefile.am	25 Dec 2002 17:50:35 -0000	1.201
+++ Makefile.am	30 Dec 2002 10:48:27 -0000
@@ -66,7 +66,8 @@ libkorganizer_la_SOURCES =  outgoingdial
 	kodaymatrix.cpp docprefs.cpp statusdialog.cpp\
         kotimespanview.cpp timespanview.cpp lineview.cpp timeline.cpp \
         koglobals.cpp konewstuff.cpp savetemplatedialog.cpp \
-        kalarmdclient.cpp simplealarmclient.cpp
+        kalarmdclient.cpp simplealarmclient.cpp \
+	actionmanager.cpp
 
 METASOURCES = AUTO
 
Index: actionmanager.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/actionmanager.cpp,v
retrieving revision 1.1
diff -d -u -p -r1.1 actionmanager.cpp
--- actionmanager.cpp	28 Dec 2002 08:12:26 -0000	1.1
+++ actionmanager.cpp	30 Dec 2002 10:48:29 -0000
@@ -39,6 +39,7 @@
 #include <kxmlguiclient.h>
 #include <kwin.h>
 
+#include "alarmclient.h"
 #include "calendarview.h"
 #include "kocore.h"
 #include "kodialogmanager.h"
@@ -66,7 +67,7 @@ ActionManager::ActionManager(KXMLGUIClie
   mTempFile = 0;
   mActive = false;
   mNewStuff = 0;
-  mHtmlExportSync = false;  
+  mHtmlExportSync = false;
   mMainWindow = mainWindow;
 }
 
@@ -85,7 +86,7 @@ void ActionManager::ActionManager::init(
   windowList->addWindow(mMainWindow);
 
   initActions();
-  
+
   // set up autoSaving stuff
   mAutoSaveTimer = new QTimer(this);
   connect(mAutoSaveTimer,SIGNAL(timeout()),SLOT(checkAutoSave()));
@@ -95,10 +96,10 @@ void ActionManager::ActionManager::init(
   }
 
   setTitle();
-  
+
   connect(mCalendarView,SIGNAL(modifiedChanged(bool)),SLOT(setTitle()));
-  connect(mCalendarView,SIGNAL(configChanged()),SLOT(updateConfig()));  
-  
+  connect(mCalendarView,SIGNAL(configChanged()),SLOT(updateConfig()));
+
   connect( mCalendarView, SIGNAL( incidenceSelected( Incidence * ) ),
            this, SLOT( processIncidenceSelection( Incidence * ) ) );
 
@@ -736,8 +737,7 @@ bool ActionManager::saveURL()
     if (result != KMessageBox::Continue) return false;
 
     // Tell the alarm daemon to stop monitoring the vCalendar file
-    mAlarmDaemonIface.removeCal( mURL.url() );
-    if (!mAlarmDaemonIface.ok() ) {
+    if ( !KOGlobals::self()->alarmClient()->removeCalendar( mURL ) ) {
       kdDebug() << "KOrganizer::saveURL(): dcop send failed" << endl;
     }
 
@@ -769,8 +769,7 @@ bool ActionManager::saveURL()
 
   if (isActive()) {
     kdDebug() << "KOrganizer::saveURL(): Notify alarm daemon" << endl;
-    mAlarmDaemonIface.reloadCal("korgac",mURL.url());
-    if (!mAlarmDaemonIface.ok()) {
+    if ( !KOGlobals::self()->alarmClient()->reloadCalendar( mURL ) ) {
       kdDebug() << "KOrganizer::saveUrl(): reloadCal call failed." << endl;
     }
   }
@@ -1177,7 +1176,7 @@ void ActionManager::loadParts()
 {
   if (mPluginMenu)
       mPluginMenu->popupMenu()->clear();
-  mParts = KOCore::self()->loadParts( mMainWindow );    
+  mParts = KOCore::self()->loadParts( mMainWindow );
 }
 
 #include "actionmanager.moc"
Index: koapp.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/koapp.cpp,v
retrieving revision 1.61
diff -d -u -p -r1.61 koapp.cpp
--- koapp.cpp	29 Dec 2002 09:00:54 -0000	1.61
+++ koapp.cpp	30 Dec 2002 10:48:33 -0000
@@ -42,6 +42,7 @@
 #include "version.h"
 #include "alarmclient.h"
 #include "koglobals.h"
+#include "actionmanager.h"
 
 #include "koapp.h"
 #include "koapp.moc"
@@ -119,7 +120,7 @@ int KOrganizerApp::newInstance()
   kdDebug() << "KOApp::newInstance()" << endl;
 
   KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
-  
+
   // process command line options
   int numDays = 0;
   if (args->isSet("list")) {
@@ -134,7 +135,7 @@ int KOrganizerApp::newInstance()
   if (args->count() > 0) {
     int i;
     for(i=0;i<args->count();++i) {
-      processCalendar( args->url(i), numDays ); 
+      processCalendar( args->url(i), numDays );
     }
   } else {
     KConfig *config = KOGlobals::config();
@@ -144,9 +145,9 @@ int KOrganizerApp::newInstance()
     // Force alarm daemon to load active calendar
     KOGlobals::self()->alarmClient()->addCalendar( urlString );
 
-    processCalendar( urlString, numDays ); 
+    processCalendar( urlString, numDays );
   }
-  
+
   kdDebug() << "KOApp::newInstance() done" << endl;
   return 0;
 }
@@ -160,18 +161,17 @@ void KOrganizerApp::processCalendar( con
     if (isRestored()) {
       RESTORE(KOrganizer)
     } else {
-      KOrganizer *korg=KOrganizer::findInstance(url);
+      KOrg::MainWindow *korg=ActionManager::findInstance(url);
       if (0 == korg) {
-        korg = new KOrganizer( "KOrganizer MainWindow" ); 
-        korg->show();
-        
+        korg = new KOrganizer( "KOrganizer MainWindow" );
+        korg->tlw()->show();
+
         kdDebug() << "KOrganizerApp::processCalendar(): " << url.url() << endl;
-        
-        if (!url.isEmpty()) {
+
+        if (!url.isEmpty())
           korg->openURL(url);
-        }
       } else
-          KWin::setActiveWindow(korg->winId());
+          KWin::setActiveWindow(korg->tlw()->winId());
     }
   }
 }
Index: kocore.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/kocore.cpp,v
retrieving revision 1.15
diff -d -u -p -r1.15 kocore.cpp
--- kocore.cpp	25 Dec 2002 17:47:00 -0000	1.15
+++ kocore.cpp	30 Dec 2002 10:48:33 -0000
@@ -26,6 +26,7 @@
 #include <klibloader.h>
 #include <kdebug.h>
 #include <kconfig.h>
+#include <kxmlguifactory.h>
 
 #include <calendar/plugin.h>
 #include <korganizer/part.h>
@@ -33,6 +34,7 @@
 #include "koprefs.h"
 
 #include "kocore.h"
+#include "koglobals.h"
 
 KOCore *KOCore::mSelf = 0;
 
@@ -200,7 +202,7 @@ KOrg::Part::List KOCore::loadParts( KOrg
     if (selectedPlugins.find((*it)->desktopEntryName()) != selectedPlugins.end()) {
       KOrg::Part *part = loadPart(*it,parent);
       if ( part ) {
-        parent->guiFactory()->addClient( part );
+        parent->KOXMLGUIFactory()->addClient( part );
         parts.append( part );
       }
     }
@@ -222,7 +224,7 @@ void KOCore::unloadParts( KOrg::MainWind
 {
   KOrg::Part *part;
   for( part=parts.first(); part; part=parts.next() ) {    
-    parent->guiFactory()->removeClient( part );
+    parent->KOXMLGUIFactory()->removeClient( part );
     delete part;
   }
   parts.clear();
Index: koeventviewer.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/koeventviewer.cpp,v
retrieving revision 1.30
diff -d -u -p -r1.30 koeventviewer.cpp
--- koeventviewer.cpp	10 Dec 2002 12:05:20 -0000	1.30
+++ koeventviewer.cpp	30 Dec 2002 10:48:33 -0000
@@ -36,6 +36,7 @@
 #include "korganizer.h"
 #endif
 
+#include "actionmanager.h"
 #include "koeventviewer.h"
 #include "koeventviewer.moc"
 
@@ -80,7 +81,7 @@ void KOEventViewer::setSource(const QStr
       */
       KIconLoader* iconLoader = new KIconLoader();
       QString iconPath = iconLoader->iconPath("go",KIcon::Small);
-      KOrganizer::setStartedKAddressBook(true);
+      ActionManager::setStartedKAddressBook(true);
       tmpStr = "kaddressbook --editor-only --uid ";
       tmpStr += KProcess::quote(n.mid(6));
       KRun::runCommand(tmpStr,"KAddressBook",iconPath);
Index: koglobals.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/koglobals.cpp,v
retrieving revision 1.5
diff -d -u -p -r1.5 koglobals.cpp
--- koglobals.cpp	29 Dec 2002 09:00:54 -0000	1.5
+++ koglobals.cpp	30 Dec 2002 10:48:33 -0000
@@ -35,6 +35,8 @@
 #include "simplealarmclient.h"
 
 #include "koglobals.h"
+#include <kconfig.h>
+#include <kstandarddirs.h>
 
 class NopAlarmClient : public AlarmClient
 {
@@ -52,7 +54,7 @@ KOGlobals *KOGlobals::self()
   if (!mSelf) {
     mSelf = new KOGlobals;
   }
-  
+
   return mSelf;
 }
 
@@ -103,7 +105,7 @@ void KOGlobals::fitDialogToScreen( QWidg
   bool resized = false;
 
   int w = wid->frameSize().width();
-  int h = wid->frameSize().height();  
+  int h = wid->frameSize().height();
 
   if ( w > QApplication::desktop()->size().width() ) {
     w = QApplication::desktop()->size().width();
@@ -113,7 +115,7 @@ void KOGlobals::fitDialogToScreen( QWidg
     h = QApplication::desktop()->size().height() - 30;
     resized = true;
   }
-  
+
   if ( resized || force ) {
     wid->resize( w, h );
     wid->move( 0, 15 );
Index: koglobals.h
===================================================================
RCS file: /home/kde/kdepim/korganizer/koglobals.h,v
retrieving revision 1.8
diff -d -u -p -r1.8 koglobals.h
--- koglobals.h	29 Dec 2002 09:00:54 -0000	1.8
+++ koglobals.h	30 Dec 2002 10:48:34 -0000
@@ -32,8 +32,8 @@ class KOGlobals
 {
   public:
     static KOGlobals *self();
-  
-    enum { EVENTADDED, EVENTEDITED, EVENTDELETED };  
+
+    enum { EVENTADDED, EVENTEDITED, EVENTDELETED };
     enum { PRIORITY_MODIFIED, COMPLETION_MODIFIED, CATEGORY_MODIFIED, UNKNOWN_MODIFIED };
 
     static void fitDialogToScreen( QWidget *widget, bool force=false );
@@ -48,11 +48,11 @@ class KOGlobals
   protected:
     KOGlobals();
     ~KOGlobals();
-    
+
   private:
     static KOGlobals *mSelf;
-    
-    KCalendarSystem *mCalendarSystem;    
+
+    KCalendarSystem *mCalendarSystem;
     AlarmClient *mAlarmClient;
 };
 
Index: konewstuff.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/konewstuff.cpp,v
retrieving revision 1.4
diff -d -u -p -r1.4 konewstuff.cpp
--- konewstuff.cpp	28 Jul 2002 17:27:54 -0000	1.4
+++ konewstuff.cpp	30 Dec 2002 10:48:34 -0000
@@ -28,6 +28,7 @@
 #include <libkcal/filestorage.h>
 
 #include "korganizer.h"
+#include "calendarview.h"
 
 #include "konewstuff.h"
 
Index: korganizer.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/korganizer.cpp,v
retrieving revision 1.140
diff -d -u -p -r1.140 korganizer.cpp
--- korganizer.cpp	29 Dec 2002 09:00:54 -0000	1.140
+++ korganizer.cpp	30 Dec 2002 10:48:35 -0000
@@ -64,41 +64,33 @@
 #include "kocore.h"
 #include "konewstuff.h"
 #include "exportwebdialog.h"
+#include "actionmanager.h"
 #include "koglobals.h"
 #include "alarmclient.h"
 
 #include "korganizer.h"
-using namespace KOrg;
+using namespace KParts;
 #include "korganizer.moc"
+using namespace KOrg;
 
 
-KOWindowList *KOrganizer::windowList = 0;
-
 KOrganizer::KOrganizer( const char *name )
-  : MainWindow(name), DCOPObject("KOrganizerIface")
+  : KParts::MainWindow(0,name),
+    KOrg::MainWindow(),
+    DCOPObject("KOrganizerIface")
 {
   kdDebug() << "KOrganizer::KOrganizer()" << endl;
 
-  mTempFile = 0;
-  mActive = false;
-  mNewStuff = 0;
-
-  // add this instance of the window to the static list.
-  if (!windowList) {
-    windowList = new KOWindowList;
-    // Show tip of the day, when the first main window is shown.
-    QTimer::singleShot(0,this,SLOT(showTipOnStart()));
-  }
-  windowList->addWindow(this);
-
 //  setMinimumSize(600,400);	// make sure we don't get resized too small...
 
   mCalendarView = new CalendarView( this, "KOrganizer::CalendarView" );
   setCentralWidget(mCalendarView);
 
+  mActionManager = new ActionManager(this, mCalendarView, this, this);
+  mActionManager->init();
   initActions();
+  readSettings();
 
-  mParts = KOCore::self()->loadParts( this );
 //  initViews();
 
   statusBar()->insertItem("",ID_GENERAL,10);
@@ -113,74 +105,21 @@ KOrganizer::KOrganizer( const char *name
   statusBar()->setItemAlignment(ID_MESSAGES_OUT,AlignRight);
   connect(statusBar(),SIGNAL(pressed(int)),SLOT(statusBarPressed(int)));
 
-  readSettings();
-  mCalendarView->readSettings();
-
-  // set up autoSaving stuff
-  mAutoSaveTimer = new QTimer(this);
-  connect(mAutoSaveTimer,SIGNAL(timeout()),SLOT(checkAutoSave()));
-  if (KOPrefs::instance()->mAutoSave &&
-      KOPrefs::instance()->mAutoSaveInterval > 0) {
-    mAutoSaveTimer->start(1000*60*KOPrefs::instance()->mAutoSaveInterval);
-  }
-
-  setTitle();
-
-  connect(mCalendarView,SIGNAL(modifiedChanged(bool)),SLOT(setTitle()));
-  connect(mCalendarView,SIGNAL(configChanged()),SLOT(updateConfig()));
-
-  connect(mCalendarView,SIGNAL(numIncomingChanged(int)),
+  connect(mActionManager->view(),SIGNAL(numIncomingChanged(int)),
           SLOT(setNumIncoming(int)));
-  connect(mCalendarView,SIGNAL(numOutgoingChanged(int)),
+  connect(mActionManager->view(),SIGNAL(numOutgoingChanged(int)),
           SLOT(setNumOutgoing(int)));
 
-  connect(mCalendarView,SIGNAL(statusMessage(const QString &)),
+  connect(mActionManager->view(),SIGNAL(statusMessage(const QString &)),
           SLOT(showStatusMessage(const QString &)));
 
-  connect( mCalendarView, SIGNAL( incidenceSelected( Incidence * ) ),
-           SLOT( processIncidenceSelection( Incidence * ) ) );
-
-  processIncidenceSelection( 0 );
-
-  // Update state of paste action
-  mCalendarView->checkClipboard();
-
-  mCalendarView->lookForOutgoingMessages();
-  mCalendarView->lookForIncomingMessages();
-
-  mHtmlExportSync = false;
-
+  mActionManager->loadParts();
   kdDebug() << "KOrganizer::KOrganizer() done" << endl;
 }
 
-bool KOrganizer::startedKAddressBook = false;
-
 KOrganizer::~KOrganizer()
 {
-  kdDebug() << "~KOrganizer()" << endl;
-
-  delete mNewStuff;
-
-  // Remove Part plugins
-  KOCore::self()->unloadParts( this, mParts );
-
-  //close down KAddressBook if we started it
-  if (KOrganizer::startedKAddressBook == true)
-  {
-   kdDebug() << "Closing down kaddressbook" << endl;
-   DCOPClient *client = KApplication::kApplication()->dcopClient();
-   const QByteArray noParamData;
-   client->send("kaddressbook", "KAddressBookIface", "exit()",  noParamData);
-  }
-
-  if (mTempFile) delete mTempFile;
-
-  // Take this window out of the window list.
-  windowList->removeWindow(this);
-
-  delete mCalendarView;
-
-  kdDebug() << "~KOrganizer() done" << endl;
+  delete mActionManager;
 }
 
 
@@ -198,9 +137,7 @@ void KOrganizer::readSettings()
 
   resize(windowWidth,windowHeight);
 
-  mRecent->loadEntries(config);
-
-  mCalendarView->readSettings();
+  mActionManager->readSettings();
 
   config->sync();
 }
@@ -213,314 +150,23 @@ void KOrganizer::writeSettings()
   KConfig *config = KOGlobals::config();
 
   config->setGroup("KOrganizer Geometry");
-
   config->writeEntry("Width",width());
   config->writeEntry("Height",height());
 
-  mCalendarView->writeSettings();
-
-  config->setGroup("Settings");
-  config->writeEntry("Filter Visible",mFilterViewAction->isChecked());
-
-  mRecent->saveEntries(config);
-
+  mActionManager->writeSettings();
   saveMainWindowSettings(config);
-
   config->sync();
 }
 
 
 void KOrganizer::initActions()
 {
-  KAction *action;
-
-  // File menu.
-
-  KStdAction::openNew(this, SLOT(file_new()), actionCollection());
-  KStdAction::open(this, SLOT(file_open()), actionCollection());
-  mRecent = KStdAction::openRecent(this, SLOT(file_openRecent(const KURL&)),
-                                   actionCollection());
-  KStdAction::revert(this,SLOT(file_revert()),actionCollection());
-  KStdAction::save(this, SLOT(file_save()), actionCollection());
-  KStdAction::saveAs(this, SLOT(file_saveas()), actionCollection());
-  KStdAction::close(this, SLOT(file_close()), actionCollection());
-  (void)new KAction(i18n("&Import From Ical"), 0, this, SLOT(file_import()),
-                    actionCollection(), "import_ical");
-  (void)new KAction(i18n("&Merge Calendar..."), 0, this, SLOT(file_merge()),
-                    actionCollection(), "merge_calendar");
-  (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,
-                    this,SLOT(configureDateTime()),
-                    actionCollection(), "conf_datetime");
-
   mStatusBarAction = KStdAction::showStatusbar(this,SLOT(toggleStatusBar()),
                                                actionCollection());
 
-  mFilterViewAction = new KToggleAction(i18n("Show Filter"),0,this,
-                                        SLOT(toggleFilterView()),
-                                        actionCollection(),
-                                        "show_filter");
-
   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");
-
-  new KAction( i18n("Get Hot New Stuff..."), 0, this,
-               SLOT( downloadNewStuff() ), actionCollection(),
-               "downloadnewstuff" );
-
-  new KAction( i18n("Upload Hot New Stuff..."), 0, this,
-               SLOT( uploadNewStuff() ), actionCollection(),
-               "uploadnewstuff" );
 
   setInstance( KGlobal::instance() );
 
@@ -531,10 +177,6 @@ void KOrganizer::initActions()
 
   applyMainWindowSettings(config);
 
-  config->setGroup("Settings");
-  mFilterViewAction->setChecked(config->readBoolEntry("Filter Visible",false));
-  toggleFilterView();
-
   mStatusBarAction->setChecked(!statusBar()->isHidden());
 
   QPtrListIterator<KToolBar> it = toolBarIterator();
@@ -563,415 +205,19 @@ void KOrganizer::initViews()
 }
 #endif
 
-void KOrganizer::file_new()
-{
-  // Make new KOrganizer window containing empty calendar
-  (new KOrganizer())->show();
-}
-
-void KOrganizer::file_open()
-{
-  KURL url;
-  QString defaultPath = locateLocal("appdata", "");
-  url = KFileDialog::getOpenURL(defaultPath,i18n("*.vcs *.ics|Calendar files"),this);
-
-  if (url.isEmpty()) return;
-
-  KOrganizer *korg=KOrganizer::findInstance(url);
-  if ((0 != korg)&&(korg != this)) {
-    KWin::setActiveWindow(korg->winId());
-    return;
-  }
-
-  kdDebug() << "KOrganizer::file_open(): " << url.prettyURL() << endl;
-
-  if (!mCalendarView->isModified() && mFile.isEmpty()) {
-    openURL(url);
-  } else {
-    KOrganizer *korg = new KOrganizer;
-    if (korg->openURL(url)) {
-      korg->show();
-    } else {
-      delete korg;
-    }
-  }
-}
-
-void KOrganizer::file_openRecent(const KURL& url)
-{
-  if (!url.isEmpty()) {
-    KOrganizer *korg=KOrganizer::findInstance(url);
-    if ((0 != korg)&&(korg != this)) {
-      KWin::setActiveWindow(korg->winId());
-      return;
-    }
-    openURL(url);
-  }
-}
-
-void KOrganizer::file_import()
-{
-  // eventually, we will need a dialog box to select import type, etc.
-  // for now, hard-coded to ical file, $HOME/.calendar.
-  int retVal = -1;
-  QString progPath;
-  KTempFile tmpfn;
-
-  QString homeDir = QDir::homeDirPath() + QString::fromLatin1("/.calendar");
-
-  if (!QFile::exists(homeDir)) {
-    KMessageBox::error(this,
-		       i18n("You have no ical file in your home directory.\n"
-		            "Import cannot proceed.\n"));
-    return;
-  }
-
-  KProcess proc;
-  proc << "ical2vcal" << tmpfn.name();
-  bool success = proc.start( KProcess::Block );
-
-  if ( !success ) {
-    kdDebug() << "Error starting ical2vcal." << endl;
-    return;
-  } else {
-    retVal = proc.exitStatus();
-  }
-
-  kdDebug() << "ical2vcal return value: " << retVal << endl;
-
-  if (retVal >= 0 && retVal <= 2) {
-    // now we need to MERGE what is in the iCal to the current calendar.
-    mCalendarView->openCalendar(tmpfn.name(),1);
-    if (!retVal)
-      KMessageBox::information(this,
-			       i18n("KOrganizer succesfully imported and "
-				    "merged your .calendar file from ical "
-				    "into the currently opened calendar."));
-    else
-      KMessageBox::information(this,
-			   i18n("KOrganizer encountered some unknown fields while "
-				"parsing your .calendar ical file, and had to "
-				"discard them. Please check to see that all "
-				"your relevant data was correctly imported."),
-                                 i18n("ICal Import Successful With Warning"));
-  } else if (retVal == -1) {
-    KMessageBox::error(this,
-			 i18n("KOrganizer encountered an error parsing your "
-			      ".calendar file from ical. Import has failed."));
-  } else if (retVal == -2) {
-    KMessageBox::error(this,
-			 i18n("KOrganizer doesn't think that your .calendar "
-			      "file is a valid ical calendar. Import has failed."));
-  }
-  tmpfn.unlink();
-}
-
-void KOrganizer::file_merge()
-{
-  KURL url = KFileDialog::getOpenURL(locateLocal("appdata", ""),
-                                     i18n("*.vcs *.ics|Calendar files"),this);
-  openURL(url,true);
-}
-
-void KOrganizer::file_archive()
-{
-  mCalendarView->archiveCalendar();
-}
-
-void KOrganizer::file_revert()
-{
-  openURL(mURL);
-}
-
-void KOrganizer::file_saveas()
-{
-  KURL url = getSaveURL();
-
-  if (url.isEmpty()) return;
-
-  saveAsURL(url);
-}
-
-void KOrganizer::file_save()
-{
-  if (mURL.isEmpty()) file_saveas();
-  else saveURL();
-}
-
-void KOrganizer::file_close()
-{
-  if (!saveModifiedURL()) return;
-
-  mCalendarView->closeCalendar();
-  KIO::NetAccess::removeTempFile(mFile);
-  mURL="";
-  mFile="";
-
-  setActive(false);
-
-  setTitle();
-}
-
-void KOrganizer::file_quit()
-{
-  close();
-}
-
-
-bool KOrganizer::openURL(const KURL &url,bool merge)
-{
-  kdDebug() << "KOrganizer::openURL()" << endl;
-
-  if (url.isEmpty()) {
-    kdDebug() << "KOrganizer::openURL(): Error! Empty URL." << endl;
-    return false;
-  }
-  if (url.isMalformed()) {
-    kdDebug() << "KOrganizer::openURL(): Error! URL is malformed." << endl;
-    return false;
-  }
-
-  QString tmpFile;
-  if(KIO::NetAccess::download(url,tmpFile)) {
-    kdDebug() << "--- Downloaded to " << tmpFile << endl;
-    bool success = mCalendarView->openCalendar(tmpFile,merge);
-    if (merge) {
-      KIO::NetAccess::removeTempFile(tmpFile);
-      if (success) {
-        showStatusMessage(i18n("Merged calendar '%1'.").arg(url.prettyURL()));
-      }
-    } else {
-      if (success) {
-        KIO::NetAccess::removeTempFile(mFile);
-        mURL = url;
-        mFile = tmpFile;
-        KGlobal::config()->setGroup("General");
-        QString active = KGlobal::config()->readEntry("Active Calendar");
-        if (KURL(active) == mURL) setActive(true);
-        else setActive(false);
-        setTitle();
-        kdDebug() << "-- Add recent URL: " << url.prettyURL() << endl;
-        mRecent->addURL(url);
-        showStatusMessage(i18n("Opened calendar '%1'.").arg(mURL.prettyURL()));
-      }
-    }
-    return success;
-  } else {
-    QString msg;
-    msg = i18n("Cannot download calendar from '%1'.").arg(url.prettyURL());
-    KMessageBox::error(this,msg);
-    return false;
-  }
-}
-
-void KOrganizer::closeURL()
-{
-  kdDebug() << "KOrganizer::closeURL()" << endl;
-
-  file_close();
-}
-
-bool KOrganizer::saveURL()
-{
-  QString ext;
-
-  if (mURL.isLocalFile()) {
-    ext = mFile.right(4);
-  } else {
-    ext = mURL.filename().right(4);
-  }
-
-  if (ext == ".vcs") {
-    int result = KMessageBox::warningContinueCancel(this,
-        i18n("Your calendar will be saved in iCalendar format. Use "
-              "'Export vCalendar' to save in vCalendar format."),
-        i18n("Format Conversion"),i18n("Proceed"),"dontaskFormatConversion",
-        true);
-    if (result != KMessageBox::Continue) return false;
-
-    // Tell the alarm daemon to stop monitoring the vCalendar file
-    if ( !KOGlobals::self()->alarmClient()->removeCalendar( mURL ) ) {
-      kdDebug() << "KOrganizer::saveURL(): dcop send failed" << endl;
-    }
-
-    QString filename = mURL.fileName();
-    filename.replace(filename.length()-4,4,".ics");
-    mURL.setFileName(filename);
-    if (mURL.isLocalFile()) {
-      mFile = mURL.path();
-    }
-    writeActiveState();
-    setTitle();
-    mRecent->addURL(mURL);
-  }
-
-  if (!mCalendarView->saveCalendar(mFile)) {
-    kdDebug() << "KOrganizer::saveURL(): calendar view save failed." << endl;
-    return false;
-  } else {
-    mCalendarView->setModified( false );
-  }
-
-  if (!mURL.isLocalFile()) {
-    if (!KIO::NetAccess::upload(mFile,mURL)) {
-      QString msg = i18n("Cannot upload calendar to '%1'").arg(mURL.prettyURL());
-      KMessageBox::error(this,msg);
-      return false;
-    }
-  }
-
-  if (isActive()) {
-    kdDebug() << "KOrganizer::saveURL(): Notify alarm daemon" << endl;
-    if ( !KOGlobals::self()->alarmClient()->reloadCalendar( mURL ) ) {
-      kdDebug() << "KOrganizer::saveUrl(): reloadCal call failed." << endl;
-    }
-  }
-
-  // keep saves on a regular interval
-  if (KOPrefs::instance()->mAutoSave) {
-    mAutoSaveTimer->stop();
-    mAutoSaveTimer->start(1000*60*KOPrefs::instance()->mAutoSaveInterval);
-  }
-
-  showStatusMessage(i18n("Saved calendar '%1'.").arg(mURL.prettyURL()));
-
-  if (KOPrefs::instance()->mHtmlWithSave==true) {
-    ExportWebDialog *dlg = new ExportWebDialog(mCalendarView->calendar());
-    dlg->exportWebPage(mHtmlExportSync);
-  }
-  
-  return true;
-}
-
-bool KOrganizer::saveAsURL(const KURL &url)
-{
-  kdDebug() << "KOrganizer::saveAsURL() " << url.prettyURL() << endl;
-
-  if (url.isEmpty()) {
-    kdDebug() << "KOrganizer::saveAsURL(): Empty URL." << endl;
-    return false;
-  }
-  if (url.isMalformed()) {
-    kdDebug() << "KOrganizer::saveAsURL(): Malformed URL." << endl;
-    return false;
-  }
-
-  QString fileOrig = mFile;
-  KURL URLOrig = mURL;
-
-  KTempFile *tempFile = 0;
-  if (url.isLocalFile()) {
-    mFile = url.path();
-  } else {
-    tempFile = new KTempFile;
-    mFile = tempFile->name();
-  }
-  mURL = url;
-
-  bool success = saveURL(); // Save local file and upload local file
-  if (success) {
-    delete mTempFile;
-    mTempFile = tempFile;
-    KIO::NetAccess::removeTempFile(fileOrig);
-    KGlobal::config()->setGroup("General");
-    QString active = KGlobal::config()->readEntry("Active Calendar");
-    if (KURL(active) == mURL) {
-      setActive(true);
-//      emit calendarActivated(this);
-    } else {
-      setActive(false);
-    }
-    setTitle();
-    mRecent->addURL(mURL);
-  } else {
-    kdDebug() << "KOrganizer::saveAsURL() failed" << endl;
-    mURL = URLOrig;
-    mFile = fileOrig;
-    delete tempFile;
-  }
-
-  return success;
-}
-
-
-bool KOrganizer::saveModifiedURL()
-{
-  kdDebug() << "KOrganizer::saveModifiedURL()" << endl;
-
-  // If calendar isn't modified do nothing.
-  if (!mCalendarView->isModified()) return true;
-
-  mHtmlExportSync = true;
-  if (KOPrefs::instance()->mAutoSave && !mURL.isEmpty()) {
-    // Save automatically, when auto save is enabled.
-    return saveURL();
-  } else {
-    int result = KMessageBox::warningYesNoCancel(this,
-        i18n("The calendar has been modified.\nDo you want to save it?"),
-        QString::null,
-        KStdGuiItem::save(), KStdGuiItem::discard());
-    switch(result) {
-      case KMessageBox::Yes:
-        if (mURL.isEmpty()) {
-          KURL url = getSaveURL();
-          return saveAsURL(url);
-        } else {
-          return saveURL();
-        }
-      case KMessageBox::No:
-        return true;
-      case KMessageBox::Cancel:
-      default:
-	{
-	  mHtmlExportSync = false;
-          return false;
-	}
-    }
-  }
-}
-
-
-KURL KOrganizer::getSaveURL()
-{
-  KURL url = KFileDialog::getSaveURL(locateLocal("appdata", ""),
-                                     i18n("*.vcs *.ics|Calendar files"),this);
-
-  if (url.isEmpty()) return url;
-
-  QString filename = url.fileName(false);
-
-  QString e = filename.right(4);
-  if (e != ".vcs" && e != ".ics") {
-    // Default save format is iCalendar
-    filename += ".ics";
-#if 0
-    if (KOPrefs::instance()->mDefaultFormat == KOPrefs::FormatVCalendar) {
-      filename += ".vcs";
-    } else if (KOPrefs::instance()->mDefaultFormat == KOPrefs::FormatICalendar) {
-      filename += ".ics";
-    }
-#endif
-  }
-
-  url.setFileName(filename);
-
-  kdDebug() << "KOrganizer::getSaveURL(): url: " << url.url() << endl;
-
-  return url;
-}
-
-
 bool KOrganizer::queryClose()
 {
-  if (windowList->lastInstance() && !isActive() && !mURL.isEmpty()) {
-    int result = KMessageBox::questionYesNo(this,i18n("Do you want to make this"
+  if (ActionManager::getWindowList()->lastInstance() &&
+      !mActionManager->isActive() &&
+      !mActionManager->getCurrentURL().isEmpty()) {
+      int result = KMessageBox::questionYesNo(this,i18n("Do you want to make this"
       " calendar active?\nThis means that it is monitored for alarms and loaded"
       " as default calendar."));
-    if (result == KMessageBox::Yes) makeActive();
+      if (result == KMessageBox::Yes) mActionManager->makeActive();
   }
-
-  bool success = saveModifiedURL();
-
+  
+  bool success = mActionManager->saveModifiedURL();
+  
   // Write configuration. I don't know if it really makes sense doing it this
   // way, when having opened multiple calendars in different CalendarViews.
   writeSettings();
@@ -987,92 +233,6 @@ bool KOrganizer::queryExit()
   return true;
 }
 
-
-void KOrganizer::saveProperties(KConfig *config)
-{
-  config->writeEntry("Calendar",mURL.url());
-}
-
-void KOrganizer::readProperties(KConfig *config)
-{
-  QString calendarUrl = config->readEntry("Calendar");
-  if (!calendarUrl.isEmpty()) {
-    KURL u(calendarUrl);
-    openURL(u);
-
-    KGlobal::config()->setGroup("General");
-    QString active = KGlobal::config()->readEntry("Active Calendar");
-    if (active == calendarUrl) setActive(true);
-  }
-}
-
-
-void KOrganizer::setTitle()
-{
-//  kdDebug() << "KOrganizer::setTitle" << endl;
-
-  QString tmpStr;
-
-  if (!mURL.isEmpty()) {
-    if (mURL.isLocalFile()) tmpStr = mURL.fileName();
-    else tmpStr = mURL.prettyURL();
-  }
-  else tmpStr = i18n("New Calendar");
-
-  if (mCalendarView->isReadOnly())
-    tmpStr += " [" + i18n("read-only") + "]";
-
-  if (isActive()) tmpStr += " [" + i18n("active") + "]";
-
-  setCaption(tmpStr,!mCalendarView->isReadOnly()&&mCalendarView->isModified());
-}
-
-void KOrganizer::checkAutoSave()
-{
-  kdDebug() << "KOrganizer::checkAutoSave()" << endl;
-
-  // Don't save if auto save interval is zero
-  if (KOPrefs::instance()->mAutoSaveInterval == 0) return;
-
-  // has this calendar been saved before? If yes automatically save it.
-  if (KOPrefs::instance()->mAutoSave && !mURL.isEmpty()) {
-    saveURL();
-  }
-}
-
-
-// Configuration changed as a result of the options dialog.
-void KOrganizer::updateConfig()
-{
-  kdDebug() << "KOrganizer::updateConfig()" << endl;
-
-  if (KOPrefs::instance()->mAutoSave && !mAutoSaveTimer->isActive()) {
-    checkAutoSave();
-    if (KOPrefs::instance()->mAutoSaveInterval > 0) {
-      mAutoSaveTimer->start(1000*60*KOPrefs::instance()->mAutoSaveInterval);
-    }
-  }
-  if (!KOPrefs::instance()->mAutoSave) mAutoSaveTimer->stop();
-  mNextXDays->setText(i18n("&Next Day", "&Next %n Days", KOPrefs::instance()->mNextXDays));
-
-  KOCore::self()->reloadPlugins();
-  mParts = KOCore::self()->reloadParts( this, mParts );
-}
-
-void KOrganizer::configureDateTime()
-{
-  KProcess *proc = new KProcess;
-  *proc << "kcmshell" << "language";
-
-  connect(proc,SIGNAL(processExited(KProcess *)),
-          SLOT(configureDateTimeFinished(KProcess *)));
-
-  if (!proc->start()) {
-    KMessageBox::sorry(this,
-        i18n("Couldn't start control module for date and time format."));
-  }
-}
-
 void KOrganizer::configureToolbars()
 {
   saveMainWindowSettings( KOGlobals::config(), "MainWindow" );
@@ -1087,49 +247,7 @@ void KOrganizer::slotNewToolbarConfig() 
 {
   plugActionList("toolbartoggles",mToolBarToggles);
 
-  applyMainWindowSettings( KGlobal::config(), "MainWindow" );
-}
-
-void KOrganizer::editKeys()
-{
-  KKeyDialog::configureKeys(actionCollection(),xmlFile(),true,this);
-}
-
-void KOrganizer::showTip()
-{
-  KTipDialog::showTip(this,QString::null,true);
-}
-
-void KOrganizer::showTipOnStart()
-{
-  KTipDialog::showTip(this);
-}
-
-KOrganizer* KOrganizer::findInstance(const KURL &url)
-{
-  if (windowList)
-    return windowList->findInstance(url);
-  else
-    return 0;
-}
-
-void KOrganizer::setActive(bool active)
-{
-  if (active == mActive) return;
-
-  mActive = active;
-  setTitle();
-}
-
-void KOrganizer::makeActive()
-{
-  if (mURL.isEmpty()) {
-    KMessageBox::sorry(this,i18n("The calendar does not have a filename. "
-                                 "Please save it before activating."));
-    return;
-  }
-
-  if (!mURL.isLocalFile()) {
+  if (!mActionManager->getCurrentURL().isLocalFile()) {
     int result = KMessageBox::warningContinueCancel(this,
       i18n("Your calendar is a remote file. Activating it can cause "
            "synchronization problems leading to data loss.\n"
@@ -1139,27 +257,6 @@ void KOrganizer::makeActive()
       true);
     if (result == KMessageBox::Cancel) return;
   }
-
-  writeActiveState();
-
-  if ( !KOGlobals::self()->alarmClient()->reloadCalendar( mURL ) ) {
-    kdDebug() << "KOrganizer::makeActive(): dcop send failed" << endl;
-  }
-  setActive();
-  emit calendarActivated(this);
-}
-
-void KOrganizer::writeActiveState()
-{
-  KConfig *config(kapp->config());
-  config->setGroup("General");
-  config->writeEntry("Active Calendar",mURL.url());
-  config->sync();
-}
-
-void KOrganizer::dumpText(const QString &str)
-{
-  kdDebug() << "KOrganizer::dumpText(): " << str << endl;
 }
 
 void KOrganizer::toggleToolBars(bool toggle)
@@ -1191,12 +288,6 @@ void KOrganizer::toggleStatusBar()
      statusBar()->hide();
 }
 
-void KOrganizer::toggleFilterView()
-{
-  bool visible = mFilterViewAction->isChecked();
-  mCalendarView->showFilter(visible);
-}
-
 void KOrganizer::statusBarPressed(int id)
 {
   if (id == ID_MESSAGES_IN)
@@ -1222,89 +313,82 @@ void KOrganizer::showStatusMessage(const
   statusBar()->message(message,2000);
 }
 
-bool KOrganizer::openURL(QString url)
+bool KOrganizer::openURL(const KURL &url,bool merge)
 {
-  return openURL(KURL(url));
+  return mActionManager->openURL( url, merge );
 }
 
-bool KOrganizer::mergeURL(QString url)
+bool KOrganizer::saveURL()
 {
-  return openURL(KURL(url),true);
+  return mActionManager->saveURL();
 }
 
-bool KOrganizer::saveAsURL(QString url)
+bool KOrganizer::saveAsURL(const KURL & kurl)
 {
-  return saveAsURL(KURL(url));
+  return mActionManager->saveAsURL( kurl )  ;
 }
 
-QString KOrganizer::getCurrentURLasString() const
+KURL KOrganizer::getCurrentURL() const
 {
-  return mURL.url();
+  return mActionManager->getCurrentURL();
 }
 
-bool KOrganizer::deleteEvent(QString uid)
+void KOrganizer::saveProperties(KConfig *config)
 {
-  return mCalendarView->deleteEvent(uid);
+  return mActionManager->saveProperties(config);
 }
 
-void KOrganizer::configureDateTimeFinished(KProcess *proc)
+void KOrganizer::readProperties(KConfig *config)
 {
-  delete proc;
+  return mActionManager->readProperties(config);
 }
 
-void KOrganizer::processIncidenceSelection( Incidence *incidence )
+void KOrganizer::setActive(bool active)
 {
-//  kdDebug() << "KOrganizer::processIncidenceSelection()" << endl;
+  mActionManager->setActive(active);
+}
 
-  if ( !incidence ) {
-    enableIncidenceActions( false );
-    return;
-  }
+bool KOrganizer::deleteEvent(QString uid)
+{
+  return mActionManager->deleteEvent( uid );
+}
 
-  enableIncidenceActions( true );
+KOrg::CalendarViewBase *KOrganizer::view() const
+{
+  return mActionManager->view();
+}
 
-  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::setTitle()
+{
+  mActionManager->setTitle();
 }
 
-void KOrganizer::enableIncidenceActions( bool enabled )
+QString KOrganizer::getCurrentURLasString() const
 {
-  mShowIncidenceAction->setEnabled( enabled );
-  mEditIncidenceAction->setEnabled( enabled );
-  mDeleteIncidenceAction->setEnabled( enabled );
+  return mActionManager->getCurrentURLasString();
+}
 
-  mCutAction->setEnabled( enabled );
-  mCopyAction->setEnabled( enabled );
-  mDeleteAction->setEnabled( enabled );
-  mPublishEvent->setEnabled( enabled );
+void KOrganizer::closeURL()
+{
+  return mActionManager->closeURL();
 }
 
-void KOrganizer::downloadNewStuff()
+bool KOrganizer::openURL(QString url)
 {
-  kdDebug() << "KOrganizer::downloadNewStuff()" << endl;
+  return mActionManager->openURL( url );
+}
 
-  if ( !mNewStuff ) mNewStuff = new KONewStuff( mCalendarView );
-  mNewStuff->download();
+bool KOrganizer::mergeURL(QString url)
+{
+  return mActionManager->mergeURL( url );
 }
 
-void KOrganizer::uploadNewStuff()
+bool KOrganizer::saveAsURL(QString url)
 {
-  if ( !mNewStuff ) mNewStuff = new KONewStuff( mCalendarView );
-  mNewStuff->upload();
+  return mActionManager->saveAsURL( url );
 }
 
-QString KOrganizer::localFileName()
+QObject *KOrganizer::manager()
 {
-  return mFile;
+  return mActionManager;
 }
Index: korganizer.h
===================================================================
RCS file: /home/kde/kdepim/korganizer/korganizer.h,v
retrieving revision 1.53
diff -d -u -p -r1.53 korganizer.h
--- korganizer.h	25 Dec 2002 17:50:35 -0000	1.53
+++ korganizer.h	30 Dec 2002 10:48:35 -0000
@@ -30,23 +30,17 @@
 
 #include <qframe.h>
 #include <qlayout.h>
-#include <qwidget.h>
 #include <qptrlist.h>
-#include <qtabdialog.h>
-#include <qframe.h>
-#include <qsplitter.h>
 
 #include <ktoolbar.h>
 #include <kapplication.h>
-#include <klocale.h>
 #include <kstatusbar.h>
 #include <kmenubar.h>
-#include <kurl.h>
 
 #include <libkcal/calendar.h>
-
 #include <korganizer/mainwindow.h>
 #include <korganizer/part.h>
+#include <kparts/mainwindow.h>
 
 #include "calendarview.h"
 #include "korganizeriface.h"
@@ -56,8 +50,9 @@ class KRecentFilesAction;
 class KOWindowList;
 class KToggleAction;
 class KProcess;
-
 class KONewStuff;
+class ActionManager;
+class CalendarView;
 
 using namespace KCal;
 
@@ -65,11 +60,12 @@ using namespace KCal;
   This is the main class for KOrganizer. It extends the KDE KMainWindow.
   it provides the main view that the user sees upon startup, as well as
   menus, buttons, etc. etc.
-  
+
   @short constructs a new main window for korganizer
   @author Preston Brown
 */
-class KOrganizer : public KOrg::MainWindow, virtual public KOrganizerIface
+
+class KOrganizer : public KParts::MainWindow, virtual public KOrganizerIface, public KOrg::MainWindow
 {
     Q_OBJECT
   public:
@@ -81,27 +77,21 @@ class KOrganizer : public KOrg::MainWind
     KOrganizer( const char *name=0 );
     virtual ~KOrganizer();
 
-    KOrg::CalendarViewBase *view() const { return mCalendarView; }
+    KOrg::CalendarViewBase *view() const;
+    ActionManager *actionManager() { return mActionManager; }
 
     /**
       Open calendar file from URL. Merge into current calendar, if \a merge is
       true.
     */
     bool openURL(const KURL &url,bool merge=false);
-    /** Merge calendar file from URL to current calendar */
-    bool mergeURL(const KURL &url);
     /** Save calendar file to URL of current calendar */
     bool saveURL();
     /** Save calendar file to URL */
     bool saveAsURL(const KURL & kurl);
-    /** Save calendar if it is modified by the user. Ask user what to do. */
-    bool saveModifiedURL();
     /** Get current URL */
-    KURL getCurrentURL() const { return mURL; }
+    KURL getCurrentURL() const;
 
-    /** Is there a instance with this URL? */
-    static KOrganizer* findInstance(const KURL &url);
-    static void setStartedKAddressBook(bool tmpBool) { startedKAddressBook = tmpBool; }
     /** Open calendar file from URL */
     bool openURL(QString url);
     /** Open calendar file from URL */
@@ -115,29 +105,14 @@ class KOrganizer : public KOrg::MainWind
     /** Delete event with the given unique id from current calendar. */
     virtual bool deleteEvent(QString uid);
 
-    bool isActive() { return mActive; }
-
-    QString localFileName();
-
-  signals:
-
-    /** when change is made to options dialog, the topwidget will catch this
-     *  and emit this signal which notifies all widgets which have registered 
-     *  for notification to update their settings. */  
-    void configChanged();
+    virtual KXMLGUIFactory *KOXMLGUIFactory() { return factory(); }
+    virtual QWidget *tlw() { return this; }
+    virtual QObject *manager();
+    virtual void addPlugin( KAction* ) {}
 
-    /** emitted when the topwidget is closing down, so that any attached
-        child windows can also close. */
-    void closingDown();
-    
-    /** emitted when this calendar has been made active */
-    void calendarActivated(KOrganizer *);
-    
   public slots:
-
-    /** options dialog made a changed to the configuration. we catch this
-     *  and notify all widgets which need to update their configuration. */
-    void updateConfig();
+    /** show status message */
+    void showStatusMessage(const QString &);
 
     /** Sets the active state of the calendar belonging to this window. If a
       * calendar is active the alarm daemon checks and signals events for
@@ -146,77 +121,19 @@ class KOrganizer : public KOrg::MainWind
       */
     void setActive(bool active=true);
 
-    /** Make calendar active */
-    void makeActive();
-
-    /** show status message */
-    void showStatusMessage(const QString &);
-
   protected slots:
- 
+
     /** using the KConfig associated with the kapp variable, read in the
-     * settings from the config file. 
+     * settings from the config file.
      */
     void readSettings();
-  
+
     /** write current state to config file. */
     void writeSettings();
 
-    /** open new window */
-    void file_new();
-
-    /** open a file, load it into the calendar. */
-    void file_open();
-
-    /** open a file from the list of recent files. */
-    void file_openRecent(const KURL& url);
-
-    /** import a calendar from another program like ical. */
-    void file_import();
-
-    /** open a calendar and add the contents to the current calendar. */
-    void file_merge();
-
-    /** revert to saved */
-    void file_revert();
-
-    /** delete or archive old entries in your calendar for speed/space. */
-    void file_archive();
-
-    /** save a file with the current fileName. */
-    void file_save();
-
-    /** save a file under a (possibly) different filename. */
-    void file_saveas();
-
-    /** close a file, prompt for save if changes made. */
-    void file_close();
-
-    /** exit the program, prompt for save if files are "dirty". */
-    void file_quit();
-
-    /** Open kcontrol module for configuring date and time formats */
-    void configureDateTime();
-
     /** 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();
-    
-  protected slots:
-
     /** toggle the appearance of the tool bars. */
     void toggleToolBars(bool);
 
@@ -224,12 +141,7 @@ class KOrganizer : public KOrg::MainWind
 
     void toggleStatusBar();
 
-    void toggleFilterView();
-
     void statusBarPressed(int);
-    
-    /** called by the autoSaveTimer to automatically save the calendar */
-    void checkAutoSave();
 
     /** Sets title of window according to filename and modification state */
     void setTitle();
@@ -237,10 +149,8 @@ class KOrganizer : public KOrg::MainWind
     void setNumIncoming(int);
     void setNumOutgoing(int);
 
-    void configureDateTimeFinished(KProcess *);
-    
     void slotNewToolbarConfig();
-        
+
   protected:
     void initActions();
 //    void initViews();
@@ -253,64 +163,18 @@ class KOrganizer : public KOrg::MainWind
     void saveProperties(KConfig *);
     void readProperties(KConfig *);
 
-    /** Get URL for saving. Opens FileDialog. */
-    KURL getSaveURL();
-
-    void enableIncidenceActions( bool enable );
-
-  private slots:
-    void dumpText(const QString &);  // only for debugging purposes
-
   private:
-    void writeActiveState();
-  
     // variables
     CalendarView *mCalendarView;  // Main view widget
     KOrg::Part::List mParts; // List of parts loaded
-    KURL mURL;      // URL of calendar file
-    QString mFile;  // Local name of calendar file
-    QString mLastUrl;  // URL of last loaded calendar.
-
-    KTempFile *mTempFile;
-
-    QTimer         *mAutoSaveTimer;   // used if calendar is to be autosaved
-
-    bool mActive;  // Indicates if this calendar is active (for alarm daemon)
-
-    // list of all existing KOrganizer instances
-    static KOWindowList *windowList;
-
-    // Actions
-    KRecentFilesAction *mRecent;
 
     QPtrList<KAction> mToolBarToggles; // List of toolbar hiding toggle actions
     KToggleAction *mToolBarToggleAction;
-
     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 };
-
-    static bool startedKAddressBook; //whether we started KAddressBook ourselves
-
-    KONewStuff *mNewStuff;
-
-    // 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 -p -r1.20 korganizer_part.cpp
--- korganizer_part.cpp	12 Aug 2002 13:59:33 -0000	1.20
+++ korganizer_part.cpp	30 Dec 2002 10:48:36 -0000
@@ -21,14 +21,29 @@
     without including the source code for Qt in the source distribution.
 */
 
+#include <qapplication.h>
+#include <qfile.h>
+#include <kpopupmenu.h>
+#include <qtimer.h>
 #include <kinstance.h>
 #include <klocale.h>
 #include <kaboutdata.h>
 #include <kiconloader.h>
 #include <kaction.h>
 #include <kdebug.h>
+#include <kpopupmenu.h>
+#include <kstandarddirs.h>
+#include <dcopclient.h>
+#include <kconfig.h>
+#include <kprocess.h>
+#include <ktempfile.h>
 
 #include "calendarview.h"
+#include "actionmanager.h"
+#include "koapp.h" // for static methods
+#include "korganizer.h"
+#include "koglobals.h"
+#include "kalarmd/alarmdaemoniface_stub.h"
 
 #include "korganizer_part.h"
 
@@ -77,10 +92,10 @@ KInstance *KOrganizerFactory::instance()
     s_about = new KAboutData("korganizer", I18N_NOOP("KOrganizer"),"1.99");
     s_instance = new KInstance(s_about);
   }
-  
+
   kdDebug() << "KOrganizerFactory::instance(): Name: " <<
                s_instance->instanceName() << endl;
-  
+
   return s_instance;
 }
 
@@ -92,6 +107,7 @@ KOrganizerPart::KOrganizerPart(QWidget *
 
   // create a canvas to insert our widget
   QWidget *canvas = new QWidget(parentWidget, widgetName);
+
   canvas->setFocusPolicy(QWidget::ClickFocus);
   setWidget(canvas);
 
@@ -106,33 +122,123 @@ KOrganizerPart::KOrganizerPart(QWidget *
 
   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");
+  mam = new ActionManager( this, widget, this, this );
+  mam->init();
+  mam->readSettings();
+
+  KConfig *config = KOGlobals::config();
+  config->setGroup("General");
+  QString urlString = config->readEntry("Active Calendar");
+
+  // Force alarm daemon to load active calendar
+  if (!urlString.isEmpty()) {
+    KOrg::MainWindow *korg=ActionManager::findInstance(urlString);
+    if ((0 == korg) && (!urlString.isEmpty()))
+      mam->openURL(urlString);
+  } else {
+    QString location = locateLocal( "data", "korganizer/kontact.ics" );
+    mam->saveAsURL( location );
+    mam->makeActive();
+  }
 
   setXMLFile( "korganizer_part.rc" );
+  QTimer::singleShot(0, mam, SLOT(loadParts()));
+}
+
+void KOrganizerPart::startCompleted( KProcess* process ) {
+    delete process;
+}
+
+void KOrganizerPart::saveCalendar()
+{
+  QPtrListIterator<KMainWindow> it(*KMainWindow::memberList);
+  KMainWindow *window = 0;
+  while ((window = it.current()) != 0) {
+    ++it;
+    if (window->inherits("KOrganizer")) {
+      KOrganizer *korg = dynamic_cast<KOrganizer*>(window);
+      if (!korg->actionManager()->view()->isModified())
+	continue;
+      if (korg->actionManager()->getCurrentURL().isEmpty()) {
+	KTempFile tmp( locateLocal( "data", "korganizer/" ));
+	korg->actionManager()->saveAsURL( tmp.name() );
+      } else {
+	korg->actionManager()->saveURL();
+      }
+      window->close(true);
+    }
+  }
+
+  if (mam->view()->isModified()) {
+    if (!mam->getCurrentURL().isEmpty()) {
+      mam->saveURL();
+    } else {
+      QString location = locateLocal( "data", "korganizer/kontact.ics" );
+      mam->saveAsURL( location );
+    }
+  }
+  mam->writeSettings();
+  delete mam;
+}
+
+QWidget* KOrganizerPart::tlw()
+{
+  return widget->topLevelWidget();
+}
+
+QObject* KOrganizerPart::manager()
+{
+  return mam;
+}
+
+void KOrganizerPart::addPlugin( KAction* action)
+{
+  action->plug( mam->pluginMenu()->popupMenu() );
+}
+
+void KOrganizerPart::setActive(bool active)
+{
+  mam->setActive(active);
 }
 
+KOrg::CalendarViewBase *KOrganizerPart::view() const
+{
+  return widget;
+}
+
+bool KOrganizerPart::openURL(const KURL &url, bool merge)
+{
+  return mam->openURL( url, merge );
+}
+
+bool KOrganizerPart::saveURL()
+{
+  return mam->saveURL();
+}
+
+bool KOrganizerPart::saveAsURL(const KURL & kurl)
+{
+  return mam->saveAsURL( kurl );
+}
+
+KURL KOrganizerPart::getCurrentURL() const
+{
+  return mam->getCurrentURL();
+}
+
+void KOrganizerPart::showStatusMessage(const QString& message)
+{
+  if (!parent() || !parent()->parent())
+    return;
+  KMainWindow *mainWin = dynamic_cast<KMainWindow*>(parent()->parent()); //yuck
+  if (mainWin && mainWin->statusBar())
+      mainWin->statusBar()->message( message );
+}
+
+
 KOrganizerPart::~KOrganizerPart()
 {
+  saveCalendar();
   closeURL();
 }
 
@@ -154,3 +260,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 -p -r1.8 korganizer_part.h
--- korganizer_part.h	20 Jul 2002 14:17:30 -0000	1.8
+++ korganizer_part.h	30 Dec 2002 10:48:36 -0000
@@ -23,14 +23,18 @@
 #ifndef KORGANIZER_PART_H
 #define KORGANIZER_PART_H
 
+#include <kurl.h>
 #include <kparts/browserextension.h>
 #include <kparts/factory.h>
+#include <korganizer/mainwindow.h>
+#include <korganizer/calendarviewbase.h>
 
 class KInstance;
 class KAboutData;
 class KOrganizerBrowserExtension;
 
 class CalendarView;
+class ActionManager;
 
 class KOrganizerFactory : public KParts::Factory
 {
@@ -51,7 +55,8 @@ class KOrganizerFactory : public KParts:
     static KAboutData *s_about;
 };
 
-class KOrganizerPart: public KParts::ReadOnlyPart
+class KOrganizerPart: public KParts::ReadOnlyPart,
+		      public KOrg::MainWindow
 {
     Q_OBJECT
   public:
@@ -59,11 +64,35 @@ class KOrganizerPart: public KParts::Rea
                    QObject *parent, const char *name);
     virtual ~KOrganizerPart();
 
+    virtual KOrg::CalendarViewBase *view() const;
+
+    /** Load calendar file from URL. Merge into current calendar, if \a merge is true. */
+    virtual bool openURL(const KURL &url,bool merge=false);
+    /** Save calendar file to URL of current calendar */
+    virtual bool saveURL();
+    /** Save calendar file to URL */
+    virtual bool saveAsURL(const KURL & kurl);
+
+    /** Get current URL */
+    virtual KURL getCurrentURL() const;
+
+    virtual KXMLGUIFactory *KOXMLGUIFactory() { return factory(); }
+    virtual QWidget *tlw();
+    virtual QObject *manager();
+    virtual void addPlugin( KAction* );
+    virtual void setActive(bool active);
+    virtual void showStatusMessage(const QString& message);
+
   protected:
     virtual bool openFile();
 
+  protected slots:
+    void saveCalendar();
+    void startCompleted( KProcess* );
+
   private:
     CalendarView *widget;
+    ActionManager *mam;
     KOrganizerBrowserExtension *m_extension;
 };
 
Index: korganizerui.rc
===================================================================
RCS file: /home/kde/kdepim/korganizer/korganizerui.rc,v
retrieving revision 1.41
diff -d -u -p -r1.41 korganizerui.rc
--- korganizerui.rc	26 Oct 2002 16:08:18 -0000	1.41
+++ korganizerui.rc	30 Dec 2002 10:48:36 -0000
@@ -1,5 +1,5 @@
 <!DOCTYPE kpartgui>
-<kpartgui name="korganizer" version="20">
+<kpartgui name="korganizer" version="24">
 
   <MenuBar>
     <Menu name="file"><text>&amp;File</text>
@@ -39,7 +39,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>
Index: kowindowlist.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/kowindowlist.cpp,v
retrieving revision 1.6
diff -d -u -p -r1.6 kowindowlist.cpp
--- kowindowlist.cpp	20 Jul 2002 14:17:30 -0000	1.6
+++ kowindowlist.cpp	30 Dec 2002 10:48:37 -0000
@@ -23,6 +23,7 @@
 
 #include <kdebug.h>
 
+#include "actionmanager.h"
 #include "kowindowlist.h"
 #include "kowindowlist.moc"
 
@@ -36,14 +37,14 @@ KOWindowList::~KOWindowList()
 {
 }
 
-void KOWindowList::addWindow(KOrganizer *korg)
+void KOWindowList::addWindow(KOrg::MainWindow *korg)
 {
   mWindowList.append(korg);
-  connect(korg,SIGNAL(calendarActivated(KOrganizer *)),
-          SLOT(deactivateCalendars(KOrganizer *)));
+  connect(korg->manager(),SIGNAL(calendarActivated(KOrg::MainWindow *)),
+	  SLOT(deactivateCalendars(KOrg::MainWindow *)));
 }
 
-void KOWindowList::removeWindow(KOrganizer *korg)
+void KOWindowList::removeWindow(KOrg::MainWindow *korg)
 {
   mWindowList.removeRef(korg);
 }
@@ -54,18 +55,18 @@ bool KOWindowList::lastInstance()
   else return false;
 }
 
-KOrganizer* KOWindowList::findInstance(const KURL &url)
+KOrg::MainWindow* KOWindowList::findInstance(const KURL &url)
 {
-  KOrganizer *inst;
+  KOrg::MainWindow *inst;
   for(inst=mWindowList.first();inst;inst=mWindowList.next())
     if (inst->getCurrentURL()==url)
       return inst;
   return 0;
 }
 
-void KOWindowList::deactivateCalendars(KOrganizer *korg)
+void KOWindowList::deactivateCalendars(KOrg::MainWindow *korg)
 {
-  KOrganizer *k;
+  KOrg::MainWindow *k;
   for(k=mWindowList.first();k;k=mWindowList.next()) {
     if (k != korg) k->setActive(false);
   }
Index: kowindowlist.h
===================================================================
RCS file: /home/kde/kdepim/korganizer/kowindowlist.h,v
retrieving revision 1.6
diff -d -u -p -r1.6 kowindowlist.h
--- kowindowlist.h	20 Jul 2002 14:17:30 -0000	1.6
+++ kowindowlist.h	30 Dec 2002 10:48:37 -0000
@@ -53,19 +53,19 @@ class KOWindowList : public QObject
     bool lastInstance();
 
     /** Is there a instance with this URL? */
-    KOrganizer* findInstance(const KURL &url);
+    KOrg::MainWindow* findInstance(const KURL &url);
 
   signals:
 
   public slots:
-    void addWindow(KOrganizer *);
-    void removeWindow(KOrganizer *);
+    void addWindow(KOrg::MainWindow *);
+    void removeWindow(KOrg::MainWindow *);
     
     /** Deactivating all calendars despite the one given in the argument*/
-    void deactivateCalendars(KOrganizer *);
+    void deactivateCalendars(KOrg::MainWindow *);
     
   private:
-    QPtrList<KOrganizer> mWindowList; // list of all existing KOrganizer instances
+    QPtrList<KOrg::MainWindow> mWindowList; // list of all existing KOrganizer instances
 };
 
 #endif
Index: interfaces/korganizer/mainwindow.h
===================================================================
RCS file: /home/kde/kdepim/korganizer/interfaces/korganizer/mainwindow.h,v
retrieving revision 1.3
diff -d -u -p -r1.3 mainwindow.h
--- interfaces/korganizer/mainwindow.h	20 Sep 2001 10:10:09 -0000	1.3
+++ interfaces/korganizer/mainwindow.h	30 Dec 2002 10:48:38 -0000
@@ -21,7 +21,10 @@
 #define KORG_MAINWINDOW_H
 // $Id: mainwindow.h,v 1.3 2001/09/20 10:10:09 cschumac Exp $
 
-#include <kparts/mainwindow.h>
+#include <kxmlguiclient.h>
+#include <qwidget.h>
+class KActionCollection;
+class KAction;
 
 namespace KOrg {
 
@@ -31,10 +34,10 @@ class CalendarViewBase;
   @short interface for korganizer main window
   @author Cornelius Schumacher
 */
-class MainWindow : public KParts::MainWindow
+ class MainWindow
 {
   public:
-    MainWindow(const char *name) : KParts::MainWindow(0,name) {}
+    MainWindow() {};
     virtual ~MainWindow() {};
 
     virtual CalendarViewBase *view() const = 0;
@@ -48,6 +51,13 @@ class MainWindow : public KParts::MainWi
 
     /** Get current URL */
     virtual KURL getCurrentURL() const = 0;
+
+    virtual KXMLGUIFactory *KOXMLGUIFactory() = 0;
+    virtual QWidget *tlw() = 0;
+    virtual QObject *manager() = 0;
+    virtual void setActive(bool active) = 0;
+    virtual void showStatusMessage(const QString& message) = 0;
+    virtual void addPlugin( KAction* ) = 0;
 };
 
 }
Index: interfaces/korganizer/part.h
===================================================================
RCS file: /home/kde/kdepim/korganizer/interfaces/korganizer/part.h,v
retrieving revision 1.6
diff -d -u -p -r1.6 part.h
--- interfaces/korganizer/part.h	20 Sep 2001 10:10:09 -0000	1.6
+++ interfaces/korganizer/part.h	30 Dec 2002 10:48:38 -0000
@@ -35,7 +35,7 @@ class Part : public KParts::Part {
     typedef QPtrList<Part> List;
 
     Part(MainWindow *parent, const char *name) :
-      KParts::Part(parent,name), mMainWindow(parent) {};
+      KParts::Part(parent->tlw(),name), mMainWindow(parent) {};
 
     virtual ~Part() {};
 
Index: knewstuff/engine.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/knewstuff/engine.cpp,v
retrieving revision 1.7
diff -d -u -p -r1.7 engine.cpp
--- knewstuff/engine.cpp	29 Dec 2002 09:00:54 -0000	1.7
+++ knewstuff/engine.cpp	30 Dec 2002 10:48:38 -0000
@@ -137,7 +137,7 @@ void Engine::slotNewStuffJobResult( KIO:
           mDownloadDialog->show();
 
           mDownloadDialog->addEntry( entry );
-    
+
           kdDebug() << "KNEWSTUFF: " << entry->name() << endl;
 
           kdDebug() << "  SUMMARY: " << entry->summary() << endl;
@@ -150,7 +150,7 @@ void Engine::slotNewStuffJobResult( KIO:
       }
     }
   }
-  
+
   mNewStuffJobData.remove( job );
 
   if ( mNewStuffJobData.count() == 0 ) {
@@ -211,7 +211,7 @@ void Engine::selectUploadProvider( Provi
   }
 
   mProviderDialog->clear();
-  
+
   mProviderDialog->show();
   mProviderDialog->raise();
 
@@ -256,7 +256,7 @@ void Engine::upload( Entry *entry )
   if ( mUploadProvider->noUpload() ) {
     KURL noUploadUrl = mUploadProvider->noUploadUrl();
     if ( noUploadUrl.isEmpty() ) {
-      text.append( i18n("Please upload the files manually.") ); 
+      text.append( i18n("Please upload the files manually.") );
       KMessageBox::information( mParentWidget, text, caption );
     } else {
       int result = KMessageBox::questionYesNo( mParentWidget, text, caption,
@@ -289,7 +289,7 @@ bool Engine::createMetaFile( Entry *entr
   doc.appendChild( de );
 
   de.appendChild( entry->createDomElement( doc, de ) );
-  
+
   kdDebug() << "--DOM START--" << endl << doc.toString()
             << "--DOM_END--" << endl;
 
@@ -301,13 +301,13 @@ bool Engine::createMetaFile( Entry *entr
     mUploadMetaFile = QString::null;
     return false;
   }
-  
+
   QTextStream ts( &f );
   ts.setEncoding( QTextStream::UnicodeUTF8 );
   ts << doc.toString();
-  
+
   f.close();
-  
+
   return true;
 }
 
Index: plugins/birthdays/birthdays.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/plugins/birthdays/birthdays.cpp,v
retrieving revision 1.10
diff -d -u -p -r1.10 birthdays.cpp
--- plugins/birthdays/birthdays.cpp	8 Dec 2002 08:53:52 -0000	1.10
+++ plugins/birthdays/birthdays.cpp	30 Dec 2002 10:48:39 -0000
@@ -66,9 +66,9 @@ Birthdays::Birthdays(KOrg::MainWindow *p
 {
   setXMLFile("plugins/birthdaysui.rc");
 
-  new KAction(i18n("Import Birthdays..."), 0, this, SLOT(importBirthdays()),
-              actionCollection(), "import_birthdays");
-  mParent = parent;
+  parent->addPlugin( new KAction(i18n("Import Birthdays..."), 0, this, SLOT(importBirthdays()),
+				 actionCollection(), "import_birthdays") );
+  mParent = parent->tlw();
 }
 
 Birthdays::~Birthdays()
@@ -83,6 +83,7 @@ QString Birthdays::info()
 void Birthdays::importBirthdays()
 {
 //  kdDebug() << "import the birthdays from the addressbook" << endl;
+    qDebug( "Birthdays import" );
 
 #ifndef KORG_NOKABC
   Calendar *cal = mainWindow()->view()->calendar();
Index: plugins/exchange/exchange.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/plugins/exchange/exchange.cpp,v
retrieving revision 1.15
diff -d -u -p -r1.15 exchange.cpp
--- plugins/exchange/exchange.cpp	28 Nov 2002 22:37:41 -0000	1.15
+++ plugins/exchange/exchange.cpp	30 Dec 2002 10:48:39 -0000
@@ -68,18 +68,19 @@ Exchange::Exchange(KOrg::MainWindow *par
 
   mAccount = new KPIM::ExchangeAccount( "Calendar/Exchange Plugin" );
   mClient = new KPIM::ExchangeClient( mAccount );
-  mClient->setWindow( parent );
+  mClient->setWindow( parent->tlw() );
 
   setXMLFile("plugins/exchangeui.rc");
 
-  new KAction(i18n("Download..."), 0, this, SLOT(download()),
-              actionCollection(), "exchange_download");
+  parent->addPlugin( new KAction(i18n("Download..."), 0, this, SLOT(download()),
+              actionCollection(), "exchange_download"));
 
 //  new KAction(i18n("Test"), 0, this, SLOT(test()),
 //              actionCollection(), "exchange_test");
 
   KAction *action = new KAction(i18n("Upload Event..."), 0, this, SLOT(upload()),
                                 actionCollection(), "exchange_upload");
+  parent->addPlugin( action );
   QObject::connect(mainWindow()->view(),SIGNAL(incidenceSelected(Incidence *)),
             this, SLOT(slotIncidenceSelected(Incidence *)));
   action->setEnabled( false );
@@ -89,12 +90,13 @@ Exchange::Exchange(KOrg::MainWindow *par
 
   action = new KAction(i18n("Delete Event"), 0, this, SLOT(remove()),
                                 actionCollection(), "exchange_delete");
+  parent->addPlugin( action );
   QObject::connect(this,SIGNAL(enableIncidenceActions(bool)),
           action,SLOT(setEnabled(bool)));
   action->setEnabled( false );
 
-  new KAction(i18n("Configure..."), 0, this, SLOT(configure()),
-              actionCollection(), "exchange_configure");
+  parent->addPlugin( new KAction(i18n("Configure..."), 0, this, SLOT(configure()),
+              actionCollection(), "exchange_configure") );
 
   connect( this, SIGNAL( calendarChanged() ), mainWindow()->view(), SLOT( updateView() ) );
   connect( this, SIGNAL( calendarChanged(const QDate &, const QDate &)),
@@ -221,9 +223,9 @@ void Exchange::showError( int error, con
 
   if ( error !=  KPIM::ExchangeClient::ResultOK ) {
     if ( moreInfo.isNull() )
-      KMessageBox::error( mainWindow(), errorText, i18n( "Exchange Plugin" ) );
+      KMessageBox::error( mainWindow()->tlw(), errorText, i18n( "Exchange Plugin" ) );
     else
-      KMessageBox::detailedError( mainWindow(), errorText, moreInfo, i18n( "Exchange Plugin" ) );
+      KMessageBox::detailedError( mainWindow()->tlw(), errorText, moreInfo, i18n( "Exchange Plugin" ) );
   }
 }
 
Index: plugins/projectview/koprojectview.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/plugins/projectview/koprojectview.cpp,v
retrieving revision 1.12
diff -d -u -p -r1.12 koprojectview.cpp
--- plugins/projectview/koprojectview.cpp	29 Dec 2002 09:00:54 -0000	1.12
+++ plugins/projectview/koprojectview.cpp	30 Dec 2002 10:48:40 -0000
@@ -120,7 +120,6 @@ void KOProjectView::readSettings()
 {
   kdDebug() << "KOProjectView::readSettings()" << endl;
 
-  //KConfig *config = kapp->config();
   KConfig config( locateLocal( "config", "korganizerrc" ));
   config.setGroup("Views");
 
Index: plugins/projectview/projectview.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/plugins/projectview/projectview.cpp,v
retrieving revision 1.5
diff -d -u -p -r1.5 projectview.cpp
--- plugins/projectview/projectview.cpp	12 Mar 2002 22:03:19 -0000	1.5
+++ plugins/projectview/projectview.cpp	30 Dec 2002 10:48:40 -0000
@@ -60,8 +60,8 @@ ProjectView::ProjectView(KOrg::MainWindo
 
   setXMLFile("plugins/projectviewui.rc");
 	   
-  new KAction(i18n("Project"), 0, this, SLOT(showView()),
-              actionCollection(), "view_project");
+  parent->addPlugin( new KAction(i18n("Project"), 0, this, SLOT(showView()),
+				 actionCollection(), "view_project") );
 }
 
 ProjectView::~ProjectView()
Index: plugins/webexport/webexport.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/plugins/webexport/webexport.cpp,v
retrieving revision 1.8
diff -d -u -p -r1.8 webexport.cpp
--- plugins/webexport/webexport.cpp	12 Mar 2002 22:03:19 -0000	1.8
+++ plugins/webexport/webexport.cpp	30 Dec 2002 10:48:40 -0000
@@ -58,8 +58,8 @@ WebExport::WebExport(KOrg::MainWindow *p
 
   setXMLFile("plugins/webexportui.rc");
 	   
-  new KAction(i18n("Export Web Page.."), "webexport", 0, this, SLOT(exportWeb()),
-              actionCollection(), "export_web");
+  parent->addPlugin( new KAction(i18n("Export Web Page.."), "webexport", 0, this, SLOT(exportWeb()),
+				 actionCollection(), "export_web") );
 }
 
 WebExport::~WebExport()

_______________________________________________
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