summaryrefslogtreecommitdiffstats
path: root/kontact/plugins/korganizer
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 (patch)
tree67208f7c145782a7e90b123b982ca78d88cc2c87 /kontact/plugins/korganizer
downloadtdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.tar.gz
tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kontact/plugins/korganizer')
-rw-r--r--kontact/plugins/korganizer/Makefile.am58
-rw-r--r--kontact/plugins/korganizer/journalplugin.cpp139
-rw-r--r--kontact/plugins/korganizer/journalplugin.desktop89
-rw-r--r--kontact/plugins/korganizer/journalplugin.h63
-rw-r--r--kontact/plugins/korganizer/kcmkorgsummary.cpp200
-rw-r--r--kontact/plugins/korganizer/kcmkorgsummary.desktop125
-rw-r--r--kontact/plugins/korganizer/kcmkorgsummary.h56
-rw-r--r--kontact/plugins/korganizer/korg_uniqueapp.cpp38
-rw-r--r--kontact/plugins/korganizer/korg_uniqueapp.h37
-rw-r--r--kontact/plugins/korganizer/korganizerplugin.cpp227
-rw-r--r--kontact/plugins/korganizer/korganizerplugin.desktop101
-rw-r--r--kontact/plugins/korganizer/korganizerplugin.h75
-rw-r--r--kontact/plugins/korganizer/summarywidget.cpp313
-rw-r--r--kontact/plugins/korganizer/summarywidget.h70
-rw-r--r--kontact/plugins/korganizer/todoplugin.cpp230
-rw-r--r--kontact/plugins/korganizer/todoplugin.desktop65
-rw-r--r--kontact/plugins/korganizer/todoplugin.h68
-rw-r--r--kontact/plugins/korganizer/todosummarywidget.cpp270
-rw-r--r--kontact/plugins/korganizer/todosummarywidget.h72
19 files changed, 2296 insertions, 0 deletions
diff --git a/kontact/plugins/korganizer/Makefile.am b/kontact/plugins/korganizer/Makefile.am
new file mode 100644
index 000000000..a987e4941
--- /dev/null
+++ b/kontact/plugins/korganizer/Makefile.am
@@ -0,0 +1,58 @@
+# top_srcdir/korganizer is a hack, to get korganizeriface.h
+INCLUDES = -I$(top_srcdir)/kontact/interfaces \
+ -I$(top_srcdir)/libkdepim \
+ -I$(top_srcdir)/korganizer \
+ -I$(top_srcdir)/korganizer/interfaces \
+ -I$(top_srcdir) $(all_includes)
+
+kde_module_LTLIBRARIES = libkontact_korganizerplugin.la \
+ libkontact_todoplugin.la \
+ libkontact_journalplugin.la \
+ kcm_korgsummary.la
+
+noinst_LTLIBRARIES = libcommon.la
+libcommon_la_SOURCES = korg_uniqueapp.cpp
+
+libkontact_korganizerplugin_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkontact_korganizerplugin_la_LIBADD = libcommon.la \
+ $(top_builddir)/kontact/interfaces/libkpinterfaces.la $(LIB_KPARTS) \
+ $(top_builddir)/korganizer/libkorganizer_calendar.la
+libkontact_korganizerplugin_la_SOURCES = korganizerplugin.cpp \
+ kcalendariface.stub \
+ summarywidget.cpp \
+ korganizeriface.stub
+
+korganizeriface_DIR = $(top_srcdir)/korganizer
+korganizeriface_DCOPIDLNG = true
+
+libkontact_todoplugin_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkontact_todoplugin_la_LIBADD = libcommon.la \
+ $(top_builddir)/kontact/interfaces/libkpinterfaces.la $(LIB_KPARTS) \
+ $(top_builddir)/korganizer/libkorganizer_calendar.la \
+ $(top_builddir)/korganizer/libkorganizer.la
+libkontact_todoplugin_la_SOURCES = todoplugin.cpp \
+ kcalendariface.stub \
+ todosummarywidget.cpp \
+ korganizeriface.stub
+
+libkontact_journalplugin_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkontact_journalplugin_la_LIBADD = libcommon.la \
+ $(top_builddir)/kontact/interfaces/libkpinterfaces.la $(LIB_KPARTS) \
+ $(top_builddir)/korganizer/libkorganizer_calendar.la
+libkontact_journalplugin_la_SOURCES = journalplugin.cpp kcalendariface.stub
+
+kcm_korgsummary_la_SOURCES = kcmkorgsummary.cpp
+kcm_korgsummary_la_LDFLAGS = -module $(KDE_PLUGIN) $(KDE_RPATH) \
+ $(all_libraries) \
+ -avoid-version -no-undefined
+kcm_korgsummary_la_LIBADD = $(LIB_KDEUI)
+
+METASOURCES = AUTO
+
+kcalendariface_DIR = $(top_srcdir)/korganizer
+
+servicedir = $(kde_servicesdir)/kontact
+service_DATA = korganizerplugin.desktop todoplugin.desktop journalplugin.desktop
+
+kde_services_DATA = kcmkorgsummary.desktop
+
diff --git a/kontact/plugins/korganizer/journalplugin.cpp b/kontact/plugins/korganizer/journalplugin.cpp
new file mode 100644
index 000000000..178901b4c
--- /dev/null
+++ b/kontact/plugins/korganizer/journalplugin.cpp
@@ -0,0 +1,139 @@
+/*
+ This file is part of Kontact.
+
+ Copyright (c) 2004 Allen Winter <winter@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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 <qwidget.h>
+
+#include <kapplication.h>
+#include <kaction.h>
+#include <kdebug.h>
+#include <kgenericfactory.h>
+#include <kiconloader.h>
+#include <kmessagebox.h>
+#include <dcopclient.h>
+#include <dcopref.h>
+
+#include "core.h"
+#include "journalplugin.h"
+#include "korg_uniqueapp.h"
+
+
+typedef KGenericFactory< JournalPlugin, Kontact::Core > JournalPluginFactory;
+K_EXPORT_COMPONENT_FACTORY( libkontact_journalplugin,
+ JournalPluginFactory( "kontact_journalplugin" ) )
+
+JournalPlugin::JournalPlugin( Kontact::Core *core, const char *, const QStringList& )
+ : Kontact::Plugin( core, core, "korganizer" ),
+ mIface( 0 )
+{
+ setInstance( JournalPluginFactory::instance() );
+ instance()->iconLoader()->addAppDir("kdepim");
+
+ insertNewAction( new KAction( i18n( "New Journal..." ), "newjournal",
+ CTRL+SHIFT+Key_J, this, SLOT( slotNewJournal() ), actionCollection(),
+ "new_journal" ) );
+ insertSyncAction( new KAction( i18n( "Synchronize Journal" ), "reload",
+ 0, this, SLOT( slotSyncJournal() ), actionCollection(),
+ "journal_sync" ) );
+
+
+ mUniqueAppWatcher = new Kontact::UniqueAppWatcher(
+ new Kontact::UniqueAppHandlerFactory<KOrganizerUniqueAppHandler>(), this );
+}
+
+JournalPlugin::~JournalPlugin()
+{
+}
+
+KParts::ReadOnlyPart *JournalPlugin::createPart()
+{
+ KParts::ReadOnlyPart *part = loadPart();
+
+ if ( !part )
+ return 0;
+
+ dcopClient(); // ensure that we register to DCOP as "korganizer"
+ mIface = new KCalendarIface_stub( dcopClient(), "kontact", "CalendarIface" );
+
+ return part;
+}
+
+void JournalPlugin::select()
+{
+ interface()->showJournalView();
+}
+
+QStringList JournalPlugin::invisibleToolbarActions() const
+{
+ QStringList invisible;
+ invisible += "new_event";
+ invisible += "new_todo";
+ invisible += "new_journal";
+
+ invisible += "view_day";
+ invisible += "view_list";
+ invisible += "view_workweek";
+ invisible += "view_week";
+ invisible += "view_nextx";
+ invisible += "view_month";
+ invisible += "view_todo";
+ return invisible;
+}
+
+KCalendarIface_stub *JournalPlugin::interface()
+{
+ if ( !mIface ) {
+ part();
+ }
+ Q_ASSERT( mIface );
+ return mIface;
+}
+
+void JournalPlugin::slotNewJournal()
+{
+ interface()->openJournalEditor( "" );
+}
+
+void JournalPlugin::slotSyncJournal()
+{
+ DCOPRef ref( "kmail", "KMailICalIface" );
+ ref.send( "triggerSync", QString("Journal") );
+}
+
+bool JournalPlugin::createDCOPInterface( const QString& serviceType )
+{
+ kdDebug(5602) << k_funcinfo << serviceType << endl;
+ if ( serviceType == "DCOP/Organizer" || serviceType == "DCOP/Calendar" ) {
+ if ( part() )
+ return true;
+ }
+
+ return false;
+}
+
+bool JournalPlugin::isRunningStandalone()
+{
+ return mUniqueAppWatcher->isRunningStandalone();
+}
+
+#include "journalplugin.moc"
diff --git a/kontact/plugins/korganizer/journalplugin.desktop b/kontact/plugins/korganizer/journalplugin.desktop
new file mode 100644
index 000000000..8f33753ed
--- /dev/null
+++ b/kontact/plugins/korganizer/journalplugin.desktop
@@ -0,0 +1,89 @@
+[Desktop Entry]
+Type=Service
+Icon=kontact_journal
+ServiceTypes=Kontact/Plugin
+
+X-KDE-Library=libkontact_journalplugin
+X-KDE-KontactPluginVersion=6
+X-KDE-KontactPartLibraryName=libkorganizerpart
+X-KDE-KontactPartExecutableName=korganizer
+X-KDE-KontactPluginHasSummary=false
+
+X-KDE-PluginInfo-Website=http://korganizer.kde.org
+X-KDE-PluginInfo-Name=kontact_journalplugin
+X-KDE-PluginInfo-Version=0.1
+X-KDE-PluginInfo-License=GPL
+X-KDE-PluginInfo-EnabledByDefault=true
+
+Comment=Journal Component (KOrganizer Plugin)
+Comment[bg]=Приставка за KOrganizer
+Comment[ca]=Component de diari (endollable del KOrganizer)
+Comment[da]=Journalkomponent (KOrganizer-plugin)
+Comment[de]=Journal-Komponente (KOrganizer-Modul)
+Comment[el]=Συστατικό χρονικών (Πρόσθετο του KOrganizer)
+Comment[es]=Componente de diario (Complemento de KOrganizer)
+Comment[et]=Päevikuplugin (KOrganizer)
+Comment[fr]= Composant de journal (Module KOrganizer)
+Comment[is]=Dagbókareining (Journal KOrganizer íforrit)
+Comment[it]=Componente diario (plugin KOrganizer)
+Comment[ja]=ジャーナルコンポーネント (KOrganizer プラグイン)
+Comment[km]=សមាភាគទិនានុប្បវត្តិ (កម្មវិធី​ជំនួយ KOrganizer​)
+Comment[nds]=Daagböker-Komponent (KOrganizer-Moduul)
+Comment[nl]=Journaalcomponent (KOrganizer-plugin)
+Comment[pl]=Składnik dziennika (wtyczka Korganizer)
+Comment[ru]=Журнал (модуль KOrganizer)
+Comment[sr]=Компонента дневника (прикључак KOrganizer-а)
+Comment[sr@Latn]=Komponenta dnevnika (priključak KOrganizer-a)
+Comment[sv]=Journalkomponent (Korganizer-insticksprogram)
+Comment[tr]=Günlük Bileşeni (KOrganizer Eklentisi)
+Comment[zh_CN]=日记组件(KOrganizer 插件)
+Comment[zh_TW]=日誌組件(KOrganizer 外掛程式)
+Name=Journal
+Name[af]=Joernaal
+Name[ar]=اليومية
+Name[bg]=Дневник
+Name[br]=Deizlevr
+Name[ca]=Diari
+Name[cs]=Deník
+Name[cy]=Dyddlyfr
+Name[el]=Χρονικό
+Name[eo]=Ĵurnalo
+Name[es]=Diario
+Name[et]=Päevik
+Name[eu]=Egunkaria
+Name[fa]=نشریه
+Name[fi]=Päiväkirja
+Name[fy]=Journaal
+Name[ga]=Iris
+Name[gl]=Xornal
+Name[he]=יומן
+Name[hu]=Napló
+Name[is]=Dagbók
+Name[it]=Diario
+Name[ja]=ジャーナル
+Name[ka]=ჟურნალი
+Name[kk]=Күнделік
+Name[km]=ទិនានុប្បវត្តិ
+Name[lt]=Dienynas
+Name[ms]=Jurnal
+Name[nb]=Dagbok
+Name[nds]=Daagbook
+Name[ne]=जर्नल
+Name[nl]=Journaal
+Name[nn]=Dagbok
+Name[pl]=Dziennik
+Name[pt]=Diário
+Name[pt_BR]=Diário
+Name[ru]=Журнал
+Name[sk]=Žurnál
+Name[sl]=Dnevnik
+Name[sr]=Дневник
+Name[sr@Latn]=Dnevnik
+Name[ta]=பத்திரிகை
+Name[th]=วารสาร
+Name[tr]=Günlük
+Name[uk]=Журнал
+Name[uz]=Kundalik
+Name[uz@cyrillic]=Кундалик
+Name[zh_CN]=日记
+Name[zh_TW]=日誌
diff --git a/kontact/plugins/korganizer/journalplugin.h b/kontact/plugins/korganizer/journalplugin.h
new file mode 100644
index 000000000..668c2b289
--- /dev/null
+++ b/kontact/plugins/korganizer/journalplugin.h
@@ -0,0 +1,63 @@
+/*
+ This file is part of KDE Kontact.
+
+ Copyright (c) 2004 Allen Winter <winter@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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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.
+*/
+#ifndef KONTACT_JOURNALPLUGIN_H
+#define KONTACT_JOURNALPLUGIN_H
+
+#include <klocale.h>
+#include <kparts/part.h>
+
+#include "kcalendariface_stub.h"
+#include "plugin.h"
+#include "uniqueapphandler.h"
+
+class JournalPlugin : public Kontact::Plugin
+{
+ Q_OBJECT
+ public:
+ JournalPlugin( Kontact::Core *core, const char *name, const QStringList& );
+ ~JournalPlugin();
+
+ virtual bool createDCOPInterface( const QString& serviceType );
+ virtual bool isRunningStandalone();
+ int weight() const { return 500; }
+
+ virtual QStringList invisibleToolbarActions() const;
+
+ void select();
+
+ KCalendarIface_stub *interface();
+
+ protected:
+ KParts::ReadOnlyPart *createPart();
+
+ private slots:
+ void slotNewJournal();
+ void slotSyncJournal();
+
+ private:
+ KCalendarIface_stub *mIface;
+ Kontact::UniqueAppWatcher *mUniqueAppWatcher;
+};
+
+#endif
diff --git a/kontact/plugins/korganizer/kcmkorgsummary.cpp b/kontact/plugins/korganizer/kcmkorgsummary.cpp
new file mode 100644
index 000000000..9ab0b6838
--- /dev/null
+++ b/kontact/plugins/korganizer/kcmkorgsummary.cpp
@@ -0,0 +1,200 @@
+/*
+ This file is part of Kontact.
+ Copyright (c) 2004 Tobias Koenig <tokoe@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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 <qbuttongroup.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qradiobutton.h>
+#include <qspinbox.h>
+
+#include <kaboutdata.h>
+#include <kapplication.h>
+#include <kaccelmanager.h>
+#include <kconfig.h>
+#include <kdebug.h>
+#include <kdialogbase.h>
+#include <klocale.h>
+
+#include "kcmkorgsummary.h"
+
+#include <kdepimmacros.h>
+
+extern "C"
+{
+ KDE_EXPORT KCModule *create_korgsummary( QWidget *parent, const char * )
+ {
+ return new KCMKOrgSummary( parent, "kcmkorgsummary" );
+ }
+}
+
+KCMKOrgSummary::KCMKOrgSummary( QWidget *parent, const char *name )
+ : KCModule( parent, name )
+{
+ initGUI();
+
+ customDaysChanged( 1 );
+
+ connect( mCalendarGroup, SIGNAL( clicked( int ) ), SLOT( modified() ) );
+ connect( mCalendarGroup, SIGNAL( clicked( int ) ), SLOT( buttonClicked( int ) ) );
+ connect( mTodoGroup, SIGNAL( clicked( int ) ), SLOT( modified() ) );
+ connect( mCustomDays, SIGNAL( valueChanged( int ) ), SLOT( modified() ) );
+ connect( mCustomDays, SIGNAL( valueChanged( int ) ), SLOT( customDaysChanged( int ) ) );
+
+ KAcceleratorManager::manage( this );
+
+ load();
+
+ KAboutData *about = new KAboutData( I18N_NOOP( "kcmkorgsummary" ),
+ I18N_NOOP( "Schedule Configuration Dialog" ),
+ 0, 0, KAboutData::License_GPL,
+ I18N_NOOP( "(c) 2003 - 2004 Tobias Koenig" ) );
+
+ about->addAuthor( "Tobias Koenig", 0, "tokoe@kde.org" );
+ setAboutData( about );
+}
+
+void KCMKOrgSummary::modified()
+{
+ emit changed( true );
+}
+
+void KCMKOrgSummary::buttonClicked( int id )
+{
+ mCustomDays->setEnabled( id == 4 );
+}
+
+void KCMKOrgSummary::customDaysChanged( int value )
+{
+ mCustomDays->setSuffix( i18n( " day", " days", value ) );
+}
+
+void KCMKOrgSummary::initGUI()
+{
+ QVBoxLayout *layout = new QVBoxLayout( this, 0, KDialog::spacingHint() );
+
+ mCalendarGroup = new QButtonGroup( 0, Vertical, i18n( "Appointments" ), this );
+ QVBoxLayout *boxLayout = new QVBoxLayout( mCalendarGroup->layout(),
+ KDialog::spacingHint() );
+
+ QLabel *label = new QLabel( i18n( "How many days should the calendar show at once?" ), mCalendarGroup );
+ boxLayout->addWidget( label );
+
+ QRadioButton *button = new QRadioButton( i18n( "One day" ), mCalendarGroup );
+ boxLayout->addWidget( button );
+
+ button = new QRadioButton( i18n( "Five days" ), mCalendarGroup );
+ boxLayout->addWidget( button );
+
+ button = new QRadioButton( i18n( "One week" ), mCalendarGroup );
+ boxLayout->addWidget( button );
+
+ button = new QRadioButton( i18n( "One month" ), mCalendarGroup );
+ boxLayout->addWidget( button );
+
+ QHBoxLayout *hbox = new QHBoxLayout( boxLayout, KDialog::spacingHint() );
+
+ button = new QRadioButton( "", mCalendarGroup );
+ hbox->addWidget( button );
+
+ mCustomDays = new QSpinBox( 1, 365, 1, mCalendarGroup );
+ mCustomDays->setEnabled( false );
+ hbox->addWidget( mCustomDays );
+
+ hbox->addStretch( 1 );
+
+ layout->addWidget( mCalendarGroup );
+
+ mTodoGroup = new QButtonGroup( 2, Horizontal, i18n( "To-dos" ), this );
+ new QRadioButton( i18n( "Show all to-dos" ), mTodoGroup );
+ new QRadioButton( i18n( "Show today's to-dos only" ), mTodoGroup );
+
+ layout->addWidget( mTodoGroup );
+
+ layout->addStretch();
+}
+
+void KCMKOrgSummary::load()
+{
+ KConfig config( "kcmkorgsummaryrc" );
+
+ config.setGroup( "Calendar" );
+ int days = config.readNumEntry( "DaysToShow", 1 );
+ if ( days == 1 )
+ mCalendarGroup->setButton( 0 );
+ else if ( days == 5 )
+ mCalendarGroup->setButton( 1 );
+ else if ( days == 7 )
+ mCalendarGroup->setButton( 2 );
+ else if ( days == 31 )
+ mCalendarGroup->setButton( 3 );
+ else {
+ mCalendarGroup->setButton( 4 );
+ mCustomDays->setValue( days );
+ mCustomDays->setEnabled( true );
+ }
+
+ config.setGroup( "Todo" );
+ bool allTodos = config.readBoolEntry( "ShowAllTodos", false );
+
+ if ( allTodos )
+ mTodoGroup->setButton( 0 );
+ else
+ mTodoGroup->setButton( 1 );
+
+ emit changed( false );
+}
+
+void KCMKOrgSummary::save()
+{
+ KConfig config( "kcmkorgsummaryrc" );
+
+ config.setGroup( "Calendar" );
+
+ int days;
+ switch ( mCalendarGroup->selectedId() ) {
+ case 0: days = 1; break;
+ case 1: days = 5; break;
+ case 2: days = 7; break;
+ case 3: days = 31; break;
+ case 4:
+ default: days = mCustomDays->value(); break;
+ }
+ config.writeEntry( "DaysToShow", days );
+
+ config.setGroup( "Todo" );
+ config.writeEntry( "ShowAllTodos", mTodoGroup->selectedId() == 0 );
+
+ config.sync();
+
+ emit changed( false );
+}
+
+void KCMKOrgSummary::defaults()
+{
+ mCalendarGroup->setButton( 0 );
+ mTodoGroup->setButton( 1 );
+
+ emit changed( true );
+}
+
+#include "kcmkorgsummary.moc"
diff --git a/kontact/plugins/korganizer/kcmkorgsummary.desktop b/kontact/plugins/korganizer/kcmkorgsummary.desktop
new file mode 100644
index 000000000..2f657852e
--- /dev/null
+++ b/kontact/plugins/korganizer/kcmkorgsummary.desktop
@@ -0,0 +1,125 @@
+[Desktop Entry]
+Icon=kontact_date
+Type=Service
+ServiceTypes=KCModule
+
+X-KDE-ModuleType=Library
+X-KDE-Library=korgsummary
+X-KDE-FactoryName=korgsummary
+X-KDE-ParentApp=kontact_korganizerplugin,kontact_todoplugin
+X-KDE-ParentComponents=kontact_korganizerplugin,kontact_todoplugin
+X-KDE-CfgDlgHierarchy=KontactSummary
+
+Name=Appointment and To-do Overview
+Name[bg]=Преглед на срещи и задачи
+Name[ca]=Resum de cites i tasques pendents
+Name[da]=Oversigt over møder og gøremål
+Name[de]=Übersicht über Termine und Aufgaben
+Name[el]=Επισκόπηση ραντεβού και προς υλοποίηση εργασιών
+Name[es]=Resumen de citas y tareas pendientes
+Name[et]=Kohtumised ja ülesannete ülevaade
+Name[fr]=Aperçu des rendez-vous et des tâches
+Name[is]=Yfirlit um fundi og verkþætti
+Name[it]=Panoramica appuntamenti e cose da fare
+Name[ja]=約束と To-Do の要約
+Name[km]=ទិដ្ឋភាព​ការ​ណាត់ និង​ការងារ​ត្រូវ​ធ្វើ
+Name[nds]=Termin- un Opgaven-Översicht
+Name[nl]=Overzicht van evenementen en taken
+Name[pl]=Spotkania i zadania
+Name[ru]=Сводка встреч и задач
+Name[sr]=Преглед састанака и обавеза
+Name[sr@Latn]=Pregled sastanaka i obaveza
+Name[sv]=Översikt av möten och uppgifter
+Name[tr]=Randevulara ve Yapılacaklara Genel Bakış
+Name[zh_CN]=约会和待办概览
+Name[zh_TW]=約會與待辦事項概觀
+Comment=Appointments and To-dos Summary Setup
+Comment[af]=Afsprake en te-doen opsomming opstelling
+Comment[bg]=Приставка за обобщен преглед на срещите и задачите
+Comment[ca]=Configuració del resum de cites i tasques pendents
+Comment[cs]=Nastavení souhrnu schůzek a úkolů
+Comment[da]=Indstilling af oversigt over møder og gøremål
+Comment[de]=Einstellung der Übersicht über Termine und Aufgaben
+Comment[el]=Ρύθμιση ραντεβού και προς υλοποίηση εργασιών
+Comment[es]=Configuración del resumen de citas y de tareas pendientes
+Comment[et]=Kohtumiste ja ülesannete kokkuvõtte seadistus
+Comment[eu]=Hitzordu eta egitekoen laburpenen konfigurazioa
+Comment[fa]=برپایی خلاصۀ قرار ملاقاتها و کارهایی که باید انجام شوند
+Comment[fi]=Tapaamiset ja tehtävät -yhteenvedon asetukset
+Comment[fr]=Configuration du résumé des évènements et des tâches
+Comment[fy]=Oersichtsynstellings foar eveneminten en taken
+Comment[gl]=Configuración de sumarios de tarefas e notas
+Comment[hu]=A találkozók és feladatok áttekintőjének beállítása
+Comment[is]=Uppsetning á yfirliti yfir fundi og verkefni
+Comment[it]=Impostazioni sommario appuntamenti e cose da fare
+Comment[ja]=約束と To-Do の要約設定
+Comment[ka]=შეხვედრათა და გასაკეთებელთა რეზიუმეს დაყენება
+Comment[kk]=Кездесулер мен Жоспарлар тұжырымының баптау
+Comment[km]=រៀបចំ​សេចក្ដី​សង្ខេប​ការ​ណាត់ និង​ការងារ​ត្រូវ​ធ្វើ
+Comment[lt]=Susitikimų ir užduočių santraukos nustatymai
+Comment[mk]=Поставување на преглед за состаноци и задачи
+Comment[nb]=Oppsett av sammendraget av gjøremål og avtaler
+Comment[nds]=Termin- un Opgaven-Översicht instellen
+Comment[ne]=भेटघाट र गर्नुपर्ने कार्यहरूको सारांश सेटअप
+Comment[nl]=Overzichtsinstellingen voor evenementen en taken
+Comment[nn]=Oppsett av samandrag av avtalar og oppgåver
+Comment[pl]=Ustawienia podsumowania spotkań i zadań
+Comment[pt]=Configuração do Sumário de Compromissos e A-fazeres
+Comment[pt_BR]=Configuração do Resumo de Compromissos e Tarefas
+Comment[ru]=Настройка сводки встреч и задач
+Comment[sk]=Nastavenie súhrnu pripomienok a úloh
+Comment[sl]=Nastavitve povzetka sestankov in opravil
+Comment[sr]=Подешавање сажетка састанака и обавеза
+Comment[sr@Latn]=Podešavanje sažetka sastanaka i obaveza
+Comment[sv]=Inställning av översikt av möten och uppgifter
+Comment[tr]=Özel Günler ve Yapılacaklar Listesi Yapılandırması
+Comment[uk]=Налаштування зведення зустрічей і завдань
+Comment[zh_CN]=约会和待办摘要设置
+Comment[zh_TW]=約會與待辦事項摘要設定
+Keywords=calendar, todos, configure, settings
+Keywords[af]=calendar,todos,configure,settings
+Keywords[be]=каляндар, заданні, настроіць, настаўленні, calendar, todos, configure, settings
+Keywords[bg]=календар, задачи, организатор, calendar, todos, configure, settings
+Keywords[bs]=calendar, todos, configure, settings, kalendar, zadaci, postavke
+Keywords[ca]=calendari, pendents, configuració, arranjament
+Keywords[cs]=kalendář,úkoly,nastavit,nastavení
+Keywords[da]=kalender, gøremål, indstil, opsætning
+Keywords[de]=Kalender,Aufgaben,einstellen,Einstellungen,Einrichten
+Keywords[el]=ημερολόγιο, προς υλοποίηση, ρύθμιση, ρυθμίσεις
+Keywords[es]=calendario, tareas pendientes, configurar, opciones
+Keywords[et]=kalender, ülesanded, seadistamine, seadistused
+Keywords[eu]=egutegia, egitekoak, konfiguratu, ezarpenak
+Keywords[fa]=تقویم، کارهای انجامی، پیکربندی، تنظیمات
+Keywords[fi]=kalenteri, tehtävät, muokkaa, asetukset
+Keywords[fr]=calendrier,agenda,tâches,configurer,paramètres,paramètre
+Keywords[fy]=kalinder,aginda,taken,todo,ynstellings,konfiguraasje
+Keywords[ga]=féilire, tascanna, cumraigh, socruithe
+Keywords[gl]=calendario, pendentes, configurar, opcións
+Keywords[he]=calendar, todos, configure, settings, יומן, יומנים, משימות, מטלות, הגדרות, תצורה
+Keywords[hu]=naptár,feladatok,konfigurálás,beállítások
+Keywords[is]=dagatal, verkefni, stillingar, stilla
+Keywords[it]=calendario, cose da fare, configura, impostazioni
+Keywords[ja]=カレンダー, To-Do, 設定
+Keywords[ka]=კალენდარი,გასაკეთებლები,კონფიგურაცია,პარამეტრები
+Keywords[km]=ប្រតិទិន,ការងារ​ត្រូវ​ធ្វើ,កំណត់​រចនាសម្ព័ន្ធ,ការ​កំណត់
+Keywords[lt]=calendar, todos, configure, settings, kalendorius, darbai, konfigūruoti, nustatymai
+Keywords[ms]=kalendar, tugasan, konfigur, seting
+Keywords[nb]=kalender, gjørelister, oppsett, innstillinger
+Keywords[nds]=Kalenner,Opgaven,Opgaav,instellen,Mööt,Möten
+Keywords[ne]=क्यालेन्डर, गर्नुपर्ने कार्यहरू, कन्फिगर, सेटिङ
+Keywords[nl]=kalender,agenda,taken,todo,instellingen,configuratie
+Keywords[nn]=kalender,hugselister,oppsett,innstillingar
+Keywords[pl]=kalendarz,do zrobienia,konfiguracja,ustawienia
+Keywords[pt]=calendário, a fazer, configurar, configuração
+Keywords[pt_BR]=calendário, pendências, configurar, configurações
+Keywords[ru]=calendar,todos,configure,settings,настройка,календарь,задачи
+Keywords[sk]=kalendár,úlohy,nastavenie
+Keywords[sl]=koledar,za narediti,nastavitve,nastavi
+Keywords[sr]=calendar, todos, configure, settings, календар, послови, подеси, поставке
+Keywords[sr@Latn]=calendar, todos, configure, settings, kalendar, poslovi, podesi, postavke
+Keywords[sv]=kalender, uppgifter, anpassa, inställningar
+Keywords[ta]=நாள்காட்டி,செய்யவேண்டியவைகள்,கட்டமைப்பு,அமைவுகள்
+Keywords[tg]=calendar, todos, configure, settings,танзимот, тақвим,вазифа
+Keywords[tr]=takvim, yapılacaklar, yapılandır, yapılandırma
+Keywords[uk]=календар, завдання, налаштування, параметри
+Keywords[zh_CN]=calendar, todos, configure, settings, 日历, 待办事项, 配置, 设置
diff --git a/kontact/plugins/korganizer/kcmkorgsummary.h b/kontact/plugins/korganizer/kcmkorgsummary.h
new file mode 100644
index 000000000..cf484e56d
--- /dev/null
+++ b/kontact/plugins/korganizer/kcmkorgsummary.h
@@ -0,0 +1,56 @@
+/*
+ This file is part of Kontact.
+ Copyright (c) 2004 Tobias Koenig <tokoe@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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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.
+*/
+
+#ifndef KCMKORGSUMMARY_H
+#define KCMKORGSUMMARY_H
+
+#include <kcmodule.h>
+
+class QSpinxBox;
+class QButtonGroup;
+
+class KCMKOrgSummary : public KCModule
+{
+ Q_OBJECT
+
+ public:
+ KCMKOrgSummary( QWidget *parent = 0, const char *name = 0 );
+
+ virtual void load();
+ virtual void save();
+ virtual void defaults();
+
+ private slots:
+ void modified();
+ void buttonClicked( int );
+ void customDaysChanged( int );
+
+ private:
+ void initGUI();
+
+ QButtonGroup *mCalendarGroup;
+ QButtonGroup *mTodoGroup;
+ QSpinBox *mCustomDays;
+};
+
+#endif
diff --git a/kontact/plugins/korganizer/korg_uniqueapp.cpp b/kontact/plugins/korganizer/korg_uniqueapp.cpp
new file mode 100644
index 000000000..b70042353
--- /dev/null
+++ b/kontact/plugins/korganizer/korg_uniqueapp.cpp
@@ -0,0 +1,38 @@
+/*
+ This file is part of KDE Kontact.
+
+ Copyright (c) 2003 David Faure <faure@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "korg_uniqueapp.h"
+#include <kdebug.h>
+#include "../../korganizer/korganizer_options.h"
+
+void KOrganizerUniqueAppHandler::loadCommandLineOptions()
+{
+ KCmdLineArgs::addCmdLineOptions( korganizer_options );
+}
+
+int KOrganizerUniqueAppHandler::newInstance()
+{
+ //kdDebug(5602) << k_funcinfo << endl;
+ // Ensure part is loaded
+ (void)plugin()->part();
+ // TODO handle command line options
+ return Kontact::UniqueAppHandler::newInstance();
+}
diff --git a/kontact/plugins/korganizer/korg_uniqueapp.h b/kontact/plugins/korganizer/korg_uniqueapp.h
new file mode 100644
index 000000000..d21f8c526
--- /dev/null
+++ b/kontact/plugins/korganizer/korg_uniqueapp.h
@@ -0,0 +1,37 @@
+/*
+ This file is part of KDE Kontact.
+
+ Copyright (c) 2003 David Faure <faure@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KORG_UNIQUEAPP_H
+#define KORG_UNIQUEAPP_H
+
+#include <uniqueapphandler.h>
+
+class KOrganizerUniqueAppHandler : public Kontact::UniqueAppHandler
+{
+public:
+ KOrganizerUniqueAppHandler( Kontact::Plugin* plugin ) : Kontact::UniqueAppHandler( plugin ) {}
+ virtual void loadCommandLineOptions();
+ virtual int newInstance();
+};
+
+
+#endif /* KORG_UNIQUEAPP_H */
+
diff --git a/kontact/plugins/korganizer/korganizerplugin.cpp b/kontact/plugins/korganizer/korganizerplugin.cpp
new file mode 100644
index 000000000..7aef2e6e0
--- /dev/null
+++ b/kontact/plugins/korganizer/korganizerplugin.cpp
@@ -0,0 +1,227 @@
+/*
+ This file is part of Kontact.
+
+ Copyright (c) 2001 Matthias Hoelzer-Kluepfel <mhk@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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 <qcursor.h>
+#include <qfile.h>
+#include <qwidget.h>
+#include <qdragobject.h>
+
+#include <kapplication.h>
+#include <kabc/vcardconverter.h>
+#include <kaction.h>
+#include <dcopref.h>
+#include <kdebug.h>
+#include <kgenericfactory.h>
+#include <kiconloader.h>
+#include <kmessagebox.h>
+#include <kstandarddirs.h>
+#include <ktempfile.h>
+
+#include <dcopclient.h>
+
+#include <libkdepim/kvcarddrag.h>
+#include <libkdepim/maillistdrag.h>
+
+#include "core.h"
+#include "summarywidget.h"
+#include "korganizerplugin.h"
+#include "korg_uniqueapp.h"
+
+typedef KGenericFactory< KOrganizerPlugin, Kontact::Core > KOrganizerPluginFactory;
+K_EXPORT_COMPONENT_FACTORY( libkontact_korganizerplugin,
+ KOrganizerPluginFactory( "kontact_korganizerplugin" ) )
+
+KOrganizerPlugin::KOrganizerPlugin( Kontact::Core *core, const char *, const QStringList& )
+ : Kontact::Plugin( core, core, "korganizer" ),
+ mIface( 0 )
+{
+
+ setInstance( KOrganizerPluginFactory::instance() );
+ instance()->iconLoader()->addAppDir("kdepim");
+
+ insertNewAction( new KAction( i18n( "New Event..." ), "newappointment",
+ CTRL+SHIFT+Key_E, this, SLOT( slotNewEvent() ), actionCollection(),
+ "new_event" ) );
+
+ insertSyncAction( new KAction( i18n( "Synchronize Calendar" ), "reload",
+ 0, this, SLOT( slotSyncEvents() ), actionCollection(),
+ "korganizer_sync" ) );
+
+ mUniqueAppWatcher = new Kontact::UniqueAppWatcher(
+ new Kontact::UniqueAppHandlerFactory<KOrganizerUniqueAppHandler>(), this );
+}
+
+KOrganizerPlugin::~KOrganizerPlugin()
+{
+}
+
+Kontact::Summary *KOrganizerPlugin::createSummaryWidget( QWidget *parent )
+{
+ return new SummaryWidget( this, parent );
+}
+
+KParts::ReadOnlyPart *KOrganizerPlugin::createPart()
+{
+ KParts::ReadOnlyPart *part = loadPart();
+
+ if ( !part )
+ return 0;
+
+ mIface = new KCalendarIface_stub( dcopClient(), "kontact", "CalendarIface" );
+
+ return part;
+}
+
+QString KOrganizerPlugin::tipFile() const
+{
+ QString file = ::locate("data", "korganizer/tips");
+ return file;
+}
+
+QStringList KOrganizerPlugin::invisibleToolbarActions() const
+{
+ QStringList invisible;
+ invisible += "new_event";
+ invisible += "new_todo";
+ invisible += "new_journal";
+
+ invisible += "view_todo";
+ invisible += "view_journal";
+ return invisible;
+}
+
+void KOrganizerPlugin::select()
+{
+ interface()->showEventView();
+}
+
+KCalendarIface_stub *KOrganizerPlugin::interface()
+{
+ if ( !mIface ) {
+ part();
+ }
+ Q_ASSERT( mIface );
+ return mIface;
+}
+
+void KOrganizerPlugin::slotNewEvent()
+{
+ interface()->openEventEditor( "" );
+}
+
+void KOrganizerPlugin::slotSyncEvents()
+{
+ DCOPRef ref( "kmail", "KMailICalIface" );
+ ref.send( "triggerSync", QString("Calendar") );
+}
+
+bool KOrganizerPlugin::createDCOPInterface( const QString& serviceType )
+{
+ kdDebug(5602) << k_funcinfo << serviceType << endl;
+ if ( serviceType == "DCOP/Organizer" || serviceType == "DCOP/Calendar" ) {
+ if ( part() )
+ return true;
+ }
+
+ return false;
+}
+
+bool KOrganizerPlugin::isRunningStandalone()
+{
+ return mUniqueAppWatcher->isRunningStandalone();
+}
+
+bool KOrganizerPlugin::canDecodeDrag( QMimeSource *mimeSource )
+{
+ return QTextDrag::canDecode( mimeSource ) ||
+ KPIM::MailListDrag::canDecode( mimeSource );
+}
+
+void KOrganizerPlugin::processDropEvent( QDropEvent *event )
+{
+ QString text;
+
+ KABC::VCardConverter converter;
+ if ( KVCardDrag::canDecode( event ) && KVCardDrag::decode( event, text ) ) {
+ KABC::Addressee::List contacts = converter.parseVCards( text );
+ KABC::Addressee::List::Iterator it;
+
+ QStringList attendees;
+ for ( it = contacts.begin(); it != contacts.end(); ++it ) {
+ QString email = (*it).fullEmail();
+ if ( email.isEmpty() )
+ attendees.append( (*it).realName() + "<>" );
+ else
+ attendees.append( email );
+ }
+
+ interface()->openEventEditor( i18n( "Meeting" ), QString::null, QString::null,
+ attendees );
+ return;
+ }
+
+ if ( QTextDrag::decode( event, text ) ) {
+ kdDebug(5602) << "DROP:" << text << endl;
+ interface()->openEventEditor( text );
+ return;
+ }
+
+ KPIM::MailList mails;
+ if ( KPIM::MailListDrag::decode( event, mails ) ) {
+ if ( mails.count() != 1 ) {
+ KMessageBox::sorry( core(),
+ i18n("Drops of multiple mails are not supported." ) );
+ } else {
+ KPIM::MailSummary mail = mails.first();
+ QString txt = i18n("From: %1\nTo: %2\nSubject: %3").arg( mail.from() )
+ .arg( mail.to() ).arg( mail.subject() );
+
+ KTempFile tf;
+ tf.setAutoDelete( true );
+ QString uri = QString::fromLatin1("kmail:") + QString::number( mail.serialNumber() );
+ tf.file()->writeBlock( event->encodedData( "message/rfc822" ) );
+ tf.close();
+ interface()->openEventEditor( i18n("Mail: %1").arg( mail.subject() ), txt,
+ uri, tf.name(), QStringList(), "message/rfc822" );
+ }
+ return;
+ }
+
+ KMessageBox::sorry( core(), i18n("Cannot handle drop events of type '%1'.")
+ .arg( event->format() ) );
+}
+
+void KOrganizerPlugin::loadProfile( const QString& directory )
+{
+ DCOPRef ref( "korganizer", "KOrganizerIface" );
+ ref.send( "loadProfile", directory );
+}
+
+void KOrganizerPlugin::saveToProfile( const QString& directory ) const
+{
+ DCOPRef ref( "korganizer", "KOrganizerIface" );
+ ref.send( "saveToProfile", directory );
+}
+
+#include "korganizerplugin.moc"
diff --git a/kontact/plugins/korganizer/korganizerplugin.desktop b/kontact/plugins/korganizer/korganizerplugin.desktop
new file mode 100644
index 000000000..7a29913c1
--- /dev/null
+++ b/kontact/plugins/korganizer/korganizerplugin.desktop
@@ -0,0 +1,101 @@
+[Desktop Entry]
+Type=Service
+Icon=kontact_date
+ServiceTypes=Kontact/Plugin,KPluginInfo
+
+X-KDE-Library=libkontact_korganizerplugin
+X-KDE-KontactPluginVersion=6
+X-KDE-KontactPartLibraryName=libkorganizerpart
+X-KDE-KontactPartExecutableName=korganizer
+X-KDE-KontactPluginHasSummary=true
+
+X-KDE-PluginInfo-Website=http://korganizer.kde.org
+X-KDE-PluginInfo-Name=kontact_korganizerplugin
+X-KDE-PluginInfo-Version=0.1
+X-KDE-PluginInfo-License=GPL
+X-KDE-PluginInfo-EnabledByDefault=true
+
+Comment=Calendar Component (KOrganizer Plugin)
+Comment[bg]=Приставка за KOrganizer
+Comment[ca]=Component de calendari (endollable del KOrganizer)
+Comment[da]=Kalenderkomponent (KOrganizer-plugin)
+Comment[de]=Kalender-Komponente (KOrganizer-Modul)
+Comment[el]=Συστατικό ημερολογίου (Πρόσθετο του KOrganizer)
+Comment[es]=Componente de calendario (complemento de KOrganizer)
+Comment[et]=Kalendriplugin (KOrganizer)
+Comment[fr]= Composant de calendrier (Module KOrganizer)
+Comment[is]=Dagatalseining (KOrganizer íforrit)
+Comment[it]=Componente calendario (plugin KOrganizer)
+Comment[ja]=カレンダーコンポーネント (KOrganizer プラグイン)
+Comment[km]=សមាសភាគ​ប្រតិទិន (កម្មវិធីជំនួយ​ KOrganizer​)
+Comment[nds]=Kalenner-Komponent (KOrganizer-Moduul)
+Comment[nl]=Agendacomponent (KOrganizer-plugin)
+Comment[pl]=Składnik kalendarza (wtyczka KOrganizer)
+Comment[ru]=Календарь (модуль KOrganizer)
+Comment[sk]=Kalendárový komponent (Modeul pre KOrganizer)
+Comment[sr]=Компонента календара (прикључак KOrganizer-а)
+Comment[sr@Latn]=Komponenta kalendara (priključak KOrganizer-a)
+Comment[sv]=Kalenderkomponent (Korganizer-insticksprogram)
+Comment[tr]=Takvim Bileşeni (KOrganizer Eklentisi)
+Comment[zh_CN]=日历组件(KOrganizer 插件)
+Comment[zh_TW]=行事曆組件(KOrganizer 外掛程式)
+Name=Calendar
+Name[af]=Kalender
+Name[ar]=التقويم
+Name[be]=Каляндар
+Name[bg]=Календар
+Name[br]=Deiziadur
+Name[bs]=Kalendar
+Name[ca]=Calendari
+Name[cs]=Kalendář
+Name[cy]=Calendr
+Name[da]=Kalender
+Name[de]=Kalender
+Name[el]=Ημερολόγιο
+Name[eo]=Kalendaro
+Name[es]=Calendario
+Name[et]=Kalender
+Name[eu]=Egutegia
+Name[fa]=تقویم
+Name[fi]=Kalenteri
+Name[fr]=Calendrier
+Name[fy]=Aginda
+Name[ga]=Féilire
+Name[gl]=Calendario
+Name[he]=לוח שנה
+Name[hi]=कैलेन्डर
+Name[hu]=Naptár
+Name[is]=Dagatal
+Name[it]=Calendario
+Name[ja]=カレンダー
+Name[ka]=კალენდარი
+Name[kk]=Күнтізбе
+Name[km]=ប្រតិទិន
+Name[lt]=Kalendorius
+Name[mk]=Календар
+Name[ms]=Kalendar
+Name[nb]=Kalender
+Name[nds]=Kalenner
+Name[ne]=क्यालेन्डर
+Name[nl]=Agenda
+Name[nn]=Kalender
+Name[pa]=ਕੈਲੰਡਰ
+Name[pl]=Kalendarz
+Name[pt]=Calendário
+Name[pt_BR]=Calendário
+Name[ru]=Календарь
+Name[se]=Kaleandar
+Name[sk]=Kalendár
+Name[sl]=Koledar
+Name[sr]=Календар
+Name[sr@Latn]=Kalendar
+Name[sv]=Kalender
+Name[ta]=நாள்காட்டி
+Name[tg]=Тақвим
+Name[th]=บันทึกประจำวัน
+Name[tr]=Takvim
+Name[uk]=Календар
+Name[uz]=Kalendar
+Name[uz@cyrillic]=Календар
+Name[zh_CN]=日历
+Name[zh_TW]=行事曆
diff --git a/kontact/plugins/korganizer/korganizerplugin.h b/kontact/plugins/korganizer/korganizerplugin.h
new file mode 100644
index 000000000..df8259961
--- /dev/null
+++ b/kontact/plugins/korganizer/korganizerplugin.h
@@ -0,0 +1,75 @@
+/*
+ This file is part of KDE Kontact.
+
+ Copyright (c) 2001 Matthias Hoelzer-Kluepfel <mhk@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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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.
+*/
+
+#ifndef KORGANIZER_PLUGIN_H
+#define KORGANIZER_PLUGIN_H
+
+#include <klocale.h>
+#include <kparts/part.h>
+
+#include "kcalendariface_stub.h"
+#include "plugin.h"
+#include "uniqueapphandler.h"
+
+class KOrganizerPlugin : public Kontact::Plugin
+{
+ Q_OBJECT
+
+ public:
+ KOrganizerPlugin( Kontact::Core *core, const char *name, const QStringList& );
+ ~KOrganizerPlugin();
+
+ virtual bool createDCOPInterface( const QString& serviceType );
+ virtual bool isRunningStandalone();
+ int weight() const { return 400; }
+
+ bool canDecodeDrag( QMimeSource * );
+ void processDropEvent( QDropEvent * );
+
+ virtual Kontact::Summary *createSummaryWidget( QWidget *parent );
+
+ virtual QString tipFile() const;
+ virtual QStringList invisibleToolbarActions() const;
+
+ void select();
+
+ KCalendarIface_stub *interface();
+
+
+ void loadProfile( const QString& path );
+ void saveToProfile( const QString& path ) const;
+
+ protected:
+ KParts::ReadOnlyPart *createPart();
+
+ private slots:
+ void slotNewEvent();
+ void slotSyncEvents();
+
+ private:
+ KCalendarIface_stub *mIface;
+ Kontact::UniqueAppWatcher *mUniqueAppWatcher;
+};
+
+#endif
diff --git a/kontact/plugins/korganizer/summarywidget.cpp b/kontact/plugins/korganizer/summarywidget.cpp
new file mode 100644
index 000000000..68742248f
--- /dev/null
+++ b/kontact/plugins/korganizer/summarywidget.cpp
@@ -0,0 +1,313 @@
+/*
+ This file is part of Kontact.
+ Copyright (c) 2003 Tobias Koenig <tokoe@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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 <qcursor.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qtooltip.h>
+
+#include <kdialog.h>
+#include <kglobal.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kparts/part.h>
+#include <kpopupmenu.h>
+#include <kstandarddirs.h>
+#include <kurllabel.h>
+#include <libkcal/event.h>
+#include <libkcal/resourcecalendar.h>
+#include <libkcal/resourcelocal.h>
+#include <libkcal/incidenceformatter.h>
+#include <libkdepim/kpimprefs.h>
+
+#include "korganizeriface_stub.h"
+
+#include "core.h"
+#include "plugin.h"
+#include "korganizerplugin.h"
+
+#include "korganizer/stdcalendar.h"
+
+#include "summarywidget.h"
+
+SummaryWidget::SummaryWidget( KOrganizerPlugin *plugin, QWidget *parent,
+ const char *name )
+ : Kontact::Summary( parent, name ), mPlugin( plugin ), mCalendar( 0 )
+{
+ QVBoxLayout *mainLayout = new QVBoxLayout( this, 3, 3 );
+
+ QPixmap icon = KGlobal::iconLoader()->loadIcon( "kontact_date",
+ KIcon::Desktop, KIcon::SizeMedium );
+ QWidget *header = createHeader( this, icon, i18n( "Calendar" ) );
+ mainLayout->addWidget( header );
+
+ mLayout = new QGridLayout( mainLayout, 7, 5, 3 );
+ mLayout->setRowStretch( 6, 1 );
+
+ mCalendar = KOrg::StdCalendar::self();
+ mCalendar->load();
+
+ connect( mCalendar, SIGNAL( calendarChanged() ), SLOT( updateView() ) );
+ connect( mPlugin->core(), SIGNAL( dayChanged( const QDate& ) ),
+ SLOT( updateView() ) );
+
+ updateView();
+}
+
+SummaryWidget::~SummaryWidget()
+{
+}
+
+void SummaryWidget::updateView()
+{
+ mLabels.setAutoDelete( true );
+ mLabels.clear();
+ mLabels.setAutoDelete( false );
+
+ KIconLoader loader( "kdepim" );
+
+ KConfig config( "kcmkorgsummaryrc" );
+
+ config.setGroup( "Calendar" );
+ int days = config.readNumEntry( "DaysToShow", 1 );
+
+ QLabel *label = 0;
+ int counter = 0;
+ QPixmap pm = loader.loadIcon( "appointment", KIcon::Small );
+
+ QDate dt;
+ QDate currentDate = QDate::currentDate();
+ for ( dt=currentDate;
+ dt<=currentDate.addDays( days - 1 );
+ dt=dt.addDays(1) ) {
+
+ KCal::Event *ev;
+
+ KCal::Event::List events_orig = mCalendar->events( dt );
+ KCal::Event::List::ConstIterator it = events_orig.begin();
+
+ KCal::Event::List events;
+ events.setAutoDelete( true );
+ QDateTime qdt;
+
+ // prevent implicitely sharing while finding recurring events
+ // replacing the QDate with the currentDate
+ for ( ; it != events_orig.end(); ++it ) {
+ ev = (*it)->clone();
+ if ( ev->recursOn( dt ) ) {
+ qdt = ev->dtStart();
+ qdt.setDate( dt );
+ ev->setDtStart( qdt );
+ }
+ events.append( ev );
+ }
+
+ // sort the events for this date by summary
+ events = KCal::Calendar::sortEvents( &events,
+ KCal::EventSortSummary,
+ KCal::SortDirectionAscending );
+ // sort the events for this date by start date
+ events = KCal::Calendar::sortEvents( &events,
+ KCal::EventSortStartDate,
+ KCal::SortDirectionAscending );
+
+ for ( it=events.begin(); it!=events.end(); ++it ) {
+ ev = *it;
+
+ // Count number of days remaining in multiday event
+ int span=1; int dayof=1;
+ if ( ev->isMultiDay() ) {
+ QDate d = ev->dtStart().date();
+ if ( d < currentDate ) {
+ d = currentDate;
+ }
+ while ( d < ev->dtEnd().date() ) {
+ if ( d < dt ) {
+ dayof++;
+ }
+ span++;
+ d=d.addDays( 1 );
+ }
+ }
+
+ // If this date is part of a floating, multiday event, then we
+ // only make a print for the first day of the event.
+ if ( ev->isMultiDay() && ev->doesFloat() && dayof != 1 ) continue;
+
+ // Fill Appointment Pixmap Field
+ label = new QLabel( this );
+ label->setPixmap( pm );
+ label->setMaximumWidth( label->minimumSizeHint().width() );
+ label->setAlignment( AlignVCenter );
+ mLayout->addWidget( label, counter, 0 );
+ mLabels.append( label );
+
+ // Fill Event Date Field
+ bool makeBold = false;
+ QString datestr;
+
+ // Modify event date for printing
+ QDate sD = QDate::QDate( dt.year(), dt.month(), dt.day() );
+ if ( ( sD.month() == currentDate.month() ) &&
+ ( sD.day() == currentDate.day() ) ) {
+ datestr = i18n( "Today" );
+ makeBold = true;
+ } else if ( ( sD.month() == currentDate.addDays( 1 ).month() ) &&
+ ( sD.day() == currentDate.addDays( 1 ).day() ) ) {
+ datestr = i18n( "Tomorrow" );
+ } else {
+ datestr = KGlobal::locale()->formatDate( sD );
+ }
+
+ // Print the date span for multiday, floating events, for the
+ // first day of the event only.
+ if ( ev->isMultiDay() && ev->doesFloat() && dayof == 1 && span > 1 ) {
+ datestr = KGlobal::locale()->formatDate( ev->dtStart().date() );
+ datestr += " -\n " +
+ KGlobal::locale()->formatDate( sD.addDays( span-1 ) );
+ }
+
+ label = new QLabel( datestr, this );
+ label->setAlignment( AlignLeft | AlignVCenter );
+ if ( makeBold ) {
+ QFont font = label->font();
+ font.setBold( true );
+ label->setFont( font );
+ }
+ mLayout->addWidget( label, counter, 1 );
+ mLabels.append( label );
+
+ // Fill Event Summary Field
+ QString newtext = ev->summary();
+ if ( ev->isMultiDay() && !ev->doesFloat() ) {
+ newtext.append( QString(" (%1/%2)").arg( dayof ).arg( span ) );
+ }
+
+ KURLLabel *urlLabel = new KURLLabel( this );
+ urlLabel->setText( newtext );
+ urlLabel->setURL( ev->uid() );
+ urlLabel->installEventFilter( this );
+ urlLabel->setAlignment( urlLabel->alignment() | Qt::WordBreak );
+ mLayout->addWidget( urlLabel, counter, 2 );
+ mLabels.append( urlLabel );
+
+ connect( urlLabel, SIGNAL( leftClickedURL( const QString& ) ),
+ this, SLOT( viewEvent( const QString& ) ) );
+ connect( urlLabel, SIGNAL( rightClickedURL( const QString& ) ),
+ this, SLOT( popupMenu( const QString& ) ) );
+
+ QString tipText( KCal::IncidenceFormatter::toolTipString( ev, true ) );
+ if ( !tipText.isEmpty() ) {
+ QToolTip::add( urlLabel, tipText );
+ }
+
+ // Fill Event Time Range Field (only for non-floating Events)
+ if ( !ev->doesFloat() ) {
+ QTime sST = ev->dtStart().time();
+ QTime sET = ev->dtEnd().time();
+ if ( ev->isMultiDay() ) {
+ if ( ev->dtStart().date() < dt ) {
+ sST = QTime::QTime( 0, 0 );
+ }
+ if ( ev->dtEnd().date() > dt ) {
+ sET = QTime::QTime( 23, 59 );
+ }
+ }
+ datestr = i18n( "Time from - to", "%1 - %2" )
+ .arg( KGlobal::locale()->formatTime( sST ) )
+ .arg( KGlobal::locale()->formatTime( sET ) );
+ label = new QLabel( datestr, this );
+ label->setAlignment( AlignLeft | AlignVCenter );
+ mLayout->addWidget( label, counter, 3 );
+ mLabels.append( label );
+ }
+
+ counter++;
+ }
+ }
+
+ if ( !counter ) {
+ QLabel *noEvents = new QLabel(
+ i18n( "No appointments pending within the next day",
+ "No appointments pending within the next %n days",
+ days ), this, "nothing to see" );
+ noEvents->setAlignment( AlignHCenter | AlignVCenter );
+ mLayout->addWidget( noEvents, 0, 2 );
+ mLabels.append( noEvents );
+ }
+
+ for ( label = mLabels.first(); label; label = mLabels.next() )
+ label->show();
+}
+
+void SummaryWidget::viewEvent( const QString &uid )
+{
+ mPlugin->core()->selectPlugin( "kontact_korganizerplugin" ); //ensure loaded
+ KOrganizerIface_stub iface( "korganizer", "KOrganizerIface" );
+ iface.editIncidence( uid );
+}
+
+void SummaryWidget::removeEvent( const QString &uid )
+{
+ mPlugin->core()->selectPlugin( "kontact_korganizerplugin" ); //ensure loaded
+ KOrganizerIface_stub iface( "korganizer", "KOrganizerIface" );
+ iface.deleteIncidence( uid, false );
+}
+
+void SummaryWidget::popupMenu( const QString &uid )
+{
+ KPopupMenu popup( this );
+ QToolTip::remove( this );
+ popup.insertItem( i18n( "&Edit Appointment..." ), 0 );
+ popup.insertItem( KGlobal::iconLoader()->loadIcon( "editdelete", KIcon::Small),
+ i18n( "&Delete Appointment" ), 1 );
+
+ switch ( popup.exec( QCursor::pos() ) ) {
+ case 0:
+ viewEvent( uid );
+ break;
+ case 1:
+ removeEvent( uid );
+ break;
+ }
+}
+
+bool SummaryWidget::eventFilter( QObject *obj, QEvent* e )
+{
+ if ( obj->inherits( "KURLLabel" ) ) {
+ KURLLabel* label = static_cast<KURLLabel*>( obj );
+ if ( e->type() == QEvent::Enter )
+ emit message( i18n( "Edit Appointment: \"%1\"" ).arg( label->text() ) );
+ if ( e->type() == QEvent::Leave )
+ emit message( QString::null );
+ }
+
+ return Kontact::Summary::eventFilter( obj, e );
+}
+
+QStringList SummaryWidget::configModules() const
+{
+ return QStringList( "kcmkorgsummary.desktop" );
+}
+
+#include "summarywidget.moc"
diff --git a/kontact/plugins/korganizer/summarywidget.h b/kontact/plugins/korganizer/summarywidget.h
new file mode 100644
index 000000000..c9c572eca
--- /dev/null
+++ b/kontact/plugins/korganizer/summarywidget.h
@@ -0,0 +1,70 @@
+/*
+ This file is part of Kontact.
+ Copyright (c) 2003 Tobias Koenig <tokoe@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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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.
+*/
+
+#ifndef SUMMARYWIDGET_H
+#define SUMMARYWIDGET_H
+
+#include <qptrlist.h>
+#include <qwidget.h>
+
+#include <libkcal/calendarresources.h>
+
+#include "summary.h"
+
+class QGridLayout;
+class QLabel;
+
+class KOrganizerPlugin;
+
+class SummaryWidget : public Kontact::Summary
+{
+ Q_OBJECT
+
+ public:
+ SummaryWidget( KOrganizerPlugin *plugin, QWidget *parent,
+ const char *name = 0 );
+ ~SummaryWidget();
+
+ int summaryHeight() const { return 3; }
+ QStringList configModules() const;
+ public slots:
+ void updateSummary( bool force = false ) { Q_UNUSED( force ); updateView(); }
+
+ protected:
+ virtual bool eventFilter( QObject *obj, QEvent* e );
+
+ private slots:
+ void updateView();
+ void popupMenu( const QString &uid );
+ void viewEvent( const QString &uid );
+ void removeEvent( const QString &uid );
+
+ private:
+ KOrganizerPlugin *mPlugin;
+ QGridLayout *mLayout;
+
+ QPtrList<QLabel> mLabels;
+ KCal::CalendarResources *mCalendar;
+};
+
+#endif
diff --git a/kontact/plugins/korganizer/todoplugin.cpp b/kontact/plugins/korganizer/todoplugin.cpp
new file mode 100644
index 000000000..4cb281b84
--- /dev/null
+++ b/kontact/plugins/korganizer/todoplugin.cpp
@@ -0,0 +1,230 @@
+/*
+ This file is part of Kontact.
+
+ Copyright (c) 2003 Cornelius Schumacher <schumacher@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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 <qwidget.h>
+#include <qdragobject.h>
+#include <qfile.h>
+
+#include <kapplication.h>
+#include <kabc/vcardconverter.h>
+#include <kaction.h>
+#include <kdebug.h>
+#include <kgenericfactory.h>
+#include <kiconloader.h>
+#include <kmessagebox.h>
+#include <dcopclient.h>
+#include <dcopref.h>
+#include <ktempfile.h>
+
+#include <libkcal/calendarlocal.h>
+#include <libkcal/icaldrag.h>
+
+#include <libkdepim/maillistdrag.h>
+#include <libkdepim/kvcarddrag.h>
+#include <libkdepim/kpimprefs.h>
+
+#include "core.h"
+
+#include "todoplugin.h"
+#include "todosummarywidget.h"
+#include "korg_uniqueapp.h"
+
+typedef KGenericFactory< TodoPlugin, Kontact::Core > TodoPluginFactory;
+K_EXPORT_COMPONENT_FACTORY( libkontact_todoplugin,
+ TodoPluginFactory( "kontact_todoplugin" ) )
+
+TodoPlugin::TodoPlugin( Kontact::Core *core, const char *, const QStringList& )
+ : Kontact::Plugin( core, core, "korganizer" ),
+ mIface( 0 )
+{
+ setInstance( TodoPluginFactory::instance() );
+ instance()->iconLoader()->addAppDir("kdepim");
+
+ insertNewAction( new KAction( i18n( "New To-do..." ), "newtodo",
+ CTRL+SHIFT+Key_T, this, SLOT( slotNewTodo() ), actionCollection(),
+ "new_todo" ) );
+
+ insertSyncAction( new KAction( i18n( "Synchronize To-do List" ), "reload",
+ 0, this, SLOT( slotSyncTodos() ), actionCollection(),
+ "todo_sync" ) );
+
+ mUniqueAppWatcher = new Kontact::UniqueAppWatcher(
+ new Kontact::UniqueAppHandlerFactory<KOrganizerUniqueAppHandler>(), this );
+}
+
+TodoPlugin::~TodoPlugin()
+{
+}
+
+Kontact::Summary *TodoPlugin::createSummaryWidget( QWidget *parent )
+{
+ return new TodoSummaryWidget( this, parent );
+}
+
+KParts::ReadOnlyPart *TodoPlugin::createPart()
+{
+ KParts::ReadOnlyPart *part = loadPart();
+
+ if ( !part )
+ return 0;
+
+ dcopClient(); // ensure that we register to DCOP as "korganizer"
+ mIface = new KCalendarIface_stub( dcopClient(), "kontact", "CalendarIface" );
+
+ return part;
+}
+
+void TodoPlugin::select()
+{
+ interface()->showTodoView();
+}
+
+QStringList TodoPlugin::invisibleToolbarActions() const
+{
+ QStringList invisible;
+ invisible += "new_event";
+ invisible += "new_todo";
+ invisible += "new_journal";
+
+ invisible += "view_day";
+ invisible += "view_list";
+ invisible += "view_workweek";
+ invisible += "view_week";
+ invisible += "view_nextx";
+ invisible += "view_month";
+ invisible += "view_journal";
+ return invisible;
+}
+
+KCalendarIface_stub *TodoPlugin::interface()
+{
+ if ( !mIface ) {
+ part();
+ }
+ Q_ASSERT( mIface );
+ return mIface;
+}
+
+void TodoPlugin::slotNewTodo()
+{
+ interface()->openTodoEditor( "" );
+}
+
+void TodoPlugin::slotSyncTodos()
+{
+ DCOPRef ref( "kmail", "KMailICalIface" );
+ ref.send( "triggerSync", QString("Todo") );
+}
+
+bool TodoPlugin::createDCOPInterface( const QString& serviceType )
+{
+ kdDebug(5602) << k_funcinfo << serviceType << endl;
+ if ( serviceType == "DCOP/Organizer" || serviceType == "DCOP/Calendar" ) {
+ if ( part() )
+ return true;
+ }
+
+ return false;
+}
+
+bool TodoPlugin::canDecodeDrag( QMimeSource *mimeSource )
+{
+ return QTextDrag::canDecode( mimeSource ) ||
+ KPIM::MailListDrag::canDecode( mimeSource );
+}
+
+bool TodoPlugin::isRunningStandalone()
+{
+ return mUniqueAppWatcher->isRunningStandalone();
+}
+
+void TodoPlugin::processDropEvent( QDropEvent *event )
+{
+ QString text;
+
+ KABC::VCardConverter converter;
+ if ( KVCardDrag::canDecode( event ) && KVCardDrag::decode( event, text ) ) {
+ KABC::Addressee::List contacts = converter.parseVCards( text );
+ KABC::Addressee::List::Iterator it;
+
+ QStringList attendees;
+ for ( it = contacts.begin(); it != contacts.end(); ++it ) {
+ QString email = (*it).fullEmail();
+ if ( email.isEmpty() )
+ attendees.append( (*it).realName() + "<>" );
+ else
+ attendees.append( email );
+ }
+
+ interface()->openTodoEditor( i18n( "Meeting" ), QString::null, QString::null,
+ attendees );
+ return;
+ }
+
+ if ( KCal::ICalDrag::canDecode( event) ) {
+ KCal::CalendarLocal cal( KPimPrefs::timezone() );
+ if ( KCal::ICalDrag::decode( event, &cal ) ) {
+ KCal::Journal::List journals = cal.journals();
+ if ( !journals.isEmpty() ) {
+ event->accept();
+ KCal::Journal *j = journals.first();
+ interface()->openTodoEditor( i18n("Note: %1").arg( j->summary() ), j->description(), QString() );
+ return;
+ }
+ // else fall through to text decoding
+ }
+ }
+
+ if ( QTextDrag::decode( event, text ) ) {
+ interface()->openTodoEditor( text );
+ return;
+ }
+
+ KPIM::MailList mails;
+ if ( KPIM::MailListDrag::decode( event, mails ) ) {
+ if ( mails.count() != 1 ) {
+ KMessageBox::sorry( core(),
+ i18n("Drops of multiple mails are not supported." ) );
+ } else {
+ KPIM::MailSummary mail = mails.first();
+ QString txt = i18n("From: %1\nTo: %2\nSubject: %3").arg( mail.from() )
+ .arg( mail.to() ).arg( mail.subject() );
+
+ KTempFile tf;
+ tf.setAutoDelete( true );
+ QString uri = "kmail:" + QString::number( mail.serialNumber() ) + "/" +
+ mail.messageId();
+ tf.file()->writeBlock( event->encodedData( "message/rfc822" ) );
+ tf.close();
+ interface()->openTodoEditor( i18n("Mail: %1").arg( mail.subject() ), txt,
+ uri, tf.name(), QStringList(), "message/rfc822" );
+ }
+ return;
+ }
+
+ KMessageBox::sorry( core(), i18n("Cannot handle drop events of type '%1'.")
+ .arg( event->format() ) );
+}
+
+#include "todoplugin.moc"
diff --git a/kontact/plugins/korganizer/todoplugin.desktop b/kontact/plugins/korganizer/todoplugin.desktop
new file mode 100644
index 000000000..a571539d8
--- /dev/null
+++ b/kontact/plugins/korganizer/todoplugin.desktop
@@ -0,0 +1,65 @@
+[Desktop Entry]
+Type=Service
+Icon=kontact_todo
+ServiceTypes=Kontact/Plugin
+
+X-KDE-Library=libkontact_todoplugin
+X-KDE-KontactPluginVersion=6
+X-KDE-KontactPartLibraryName=libkorganizerpart
+X-KDE-KontactPartExecutableName=korganizer
+X-KDE-KontactPluginHasSummary=true
+
+X-KDE-PluginInfo-Website=http://korganizer.kde.org
+X-KDE-PluginInfo-Name=kontact_todoplugin
+X-KDE-PluginInfo-Version=0.1
+X-KDE-PluginInfo-License=GPL
+X-KDE-PluginInfo-EnabledByDefault=true
+
+Comment=To-do List Component (KOrganizer plugin)
+Comment[bg]=Приставка за KOrganizer
+Comment[ca]=Component de llista de pendents (endollable del KOrganizer)
+Comment[da]=Komponent til gøremålsliste (KOrganizer-plugin)
+Comment[de]=Aufgabenlisten-Komponente (KOrganizer-Modul)
+Comment[el]=Συστατικό λίστα προς υλοποίηση εργασιών (Πρόσθετο του KOrganizer)
+Comment[es]=Componente de tareas pendientes (complemento de KOrganizer)
+Comment[et]=Ülesannete nimekirja plugin (KOrganizer)
+Comment[fr]=Composant de la liste des tâches (Module KOrganizer)
+Comment[is]=Verkefnaeining (KOrganizer íforrit)
+Comment[it]=Componente elenco delle cose da fare (plugin KOrganizer)
+Comment[ja]=To-Do リストコンポーネント (KOrganizer プラグイン)
+Comment[km]=សមាសភាគ​បញ្ជី​ការងារ​ត្រូវ​ធ្វើ (កម្មវិធី​ជំនួយ KOrganizer​)
+Comment[nds]=Opgavenlist-Komponent (KOrganizer-Moduul)
+Comment[nl]=Takenlijstcomponent (KOrganizer-plugin)
+Comment[pl]=Składnik zadań (wtyczka KOrganizer)
+Comment[ru]=Задачи (модуль KOrganizer)
+Comment[sk]=Komponent zoznamu úloh (Modul pre KOrganizer)
+Comment[sr]=Прикључак листе обавеза (прикључак KOrganizer-а)
+Comment[sr@Latn]=Priključak liste obaveza (priključak KOrganizer-a)
+Comment[sv]=Uppgiftslistkomponent (Korganizer-insticksprogram)
+Comment[tr]=Yapılacak İşler Bileşeni (KOrganizer eklentisi)
+Comment[zh_CN]=待办清单组件(KOrganizer 插件)
+Comment[zh_TW]=待辦事項清單組件(KOrganizer 外掛程式)
+Name=To-do
+Name[bg]=Задачи
+Name[ca]=Pendents
+Name[da]=Gøremål
+Name[de]=Aufgaben
+Name[el]=Προς υλοποίηση εργασίες
+Name[es]=Tareas pendientes
+Name[et]=Ülesanded
+Name[fr]=Tâches
+Name[is]=Verkefni
+Name[it]=Cose da fare
+Name[ja]=To-Do
+Name[km]=​ការងារ​ត្រូវ​ធ្វើ
+Name[nds]=Opgaav
+Name[nl]=Takenlijst
+Name[pl]=Lista zadań
+Name[ru]=Задачи
+Name[sk]=Zoznam úloh
+Name[sr]=Обавезе
+Name[sr@Latn]=Obaveze
+Name[sv]=Uppgift
+Name[tr]=Yapılacak Ögeleri
+Name[zh_CN]=待办清单
+Name[zh_TW]=待辦事項
diff --git a/kontact/plugins/korganizer/todoplugin.h b/kontact/plugins/korganizer/todoplugin.h
new file mode 100644
index 000000000..ce0cb5823
--- /dev/null
+++ b/kontact/plugins/korganizer/todoplugin.h
@@ -0,0 +1,68 @@
+/*
+ This file is part of KDE Kontact.
+
+ Copyright (c) 2003 Cornelius Schumacher <schumacher@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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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.
+*/
+#ifndef KONTACT_TODOPLUGIN_H
+#define KONTACT_TODOPLUGIN_H
+
+#include <klocale.h>
+#include <kparts/part.h>
+
+#include "kcalendariface_stub.h"
+#include "plugin.h"
+#include "uniqueapphandler.h"
+
+class TodoPlugin : public Kontact::Plugin
+{
+ Q_OBJECT
+ public:
+ TodoPlugin( Kontact::Core *core, const char *name, const QStringList& );
+ ~TodoPlugin();
+
+ virtual bool createDCOPInterface( const QString& serviceType );
+ virtual bool isRunningStandalone();
+ int weight() const { return 450; }
+
+ bool canDecodeDrag( QMimeSource * );
+ void processDropEvent( QDropEvent * );
+
+ virtual QStringList invisibleToolbarActions() const;
+
+ virtual Kontact::Summary *createSummaryWidget( QWidget *parent );
+
+ void select();
+
+ KCalendarIface_stub *interface();
+
+ protected:
+ KParts::ReadOnlyPart *createPart();
+
+ private slots:
+ void slotNewTodo();
+ void slotSyncTodos();
+
+ private:
+ KCalendarIface_stub *mIface;
+ Kontact::UniqueAppWatcher *mUniqueAppWatcher;
+};
+
+#endif
diff --git a/kontact/plugins/korganizer/todosummarywidget.cpp b/kontact/plugins/korganizer/todosummarywidget.cpp
new file mode 100644
index 000000000..d52941ee4
--- /dev/null
+++ b/kontact/plugins/korganizer/todosummarywidget.cpp
@@ -0,0 +1,270 @@
+/*
+ This file is part of Kontact.
+ Copyright (c) 2003 Tobias Koenig <tokoe@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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 <qcursor.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qtooltip.h>
+
+#include <kdialog.h>
+#include <kglobal.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kparts/part.h>
+#include <kpopupmenu.h>
+#include <kstandarddirs.h>
+#include <kurllabel.h>
+#include <libkcal/resourcecalendar.h>
+#include <libkcal/resourcelocal.h>
+#include <libkcal/todo.h>
+#include <libkcal/incidenceformatter.h>
+#include <libkdepim/kpimprefs.h>
+
+#include "korganizeriface_stub.h"
+
+#include "core.h"
+#include "plugin.h"
+#include "todoplugin.h"
+
+#include "korganizer/stdcalendar.h"
+#include "korganizer/koglobals.h"
+#include "korganizer/incidencechanger.h"
+
+#include "todosummarywidget.h"
+
+TodoSummaryWidget::TodoSummaryWidget( TodoPlugin *plugin,
+ QWidget *parent, const char *name )
+ : Kontact::Summary( parent, name ), mPlugin( plugin )
+{
+ QVBoxLayout *mainLayout = new QVBoxLayout( this, 3, 3 );
+
+ QPixmap icon = KGlobal::iconLoader()->loadIcon( "kontact_todo",
+ KIcon::Desktop, KIcon::SizeMedium );
+ QWidget *header = createHeader( this, icon, i18n( "To-do" ) );
+ mainLayout->addWidget( header );
+
+ mLayout = new QGridLayout( mainLayout, 7, 4, 3 );
+ mLayout->setRowStretch( 6, 1 );
+
+ mCalendar = KOrg::StdCalendar::self();
+ mCalendar->load();
+
+ connect( mCalendar, SIGNAL( calendarChanged() ), SLOT( updateView() ) );
+ connect( mPlugin->core(), SIGNAL( dayChanged( const QDate& ) ),
+ SLOT( updateView() ) );
+
+ updateView();
+}
+
+TodoSummaryWidget::~TodoSummaryWidget()
+{
+}
+
+void TodoSummaryWidget::updateView()
+{
+ mLabels.setAutoDelete( true );
+ mLabels.clear();
+ mLabels.setAutoDelete( false );
+
+ KConfig config( "kcmkorgsummaryrc" );
+ config.setGroup( "Todo" );
+ bool showAllTodos = config.readBoolEntry( "ShowAllTodos", false );
+
+ KIconLoader loader( "kdepim" );
+
+ QLabel *label = 0;
+ int counter = 0;
+
+ QDate currentDate = QDate::currentDate();
+ KCal::Todo::List todos = mCalendar->todos();
+ if ( todos.count() > 0 ) {
+ QPixmap pm = loader.loadIcon( "todo", KIcon::Small );
+ KCal::Todo::List::ConstIterator it;
+ for ( it = todos.begin(); it != todos.end(); ++it ) {
+ KCal::Todo *todo = *it;
+
+ bool accepted = false;
+ QString stateText;
+
+ // show all incomplete todos
+ if ( showAllTodos && !todo->isCompleted())
+ accepted = true;
+
+ // show uncomplete todos from the last days
+ if ( todo->hasDueDate() && !todo->isCompleted() &&
+ todo->dtDue().date() < currentDate ) {
+ accepted = true;
+ stateText = i18n( "overdue" );
+ }
+
+ // show todos which started somewhere in the past and has to be finished in future
+ if ( todo->hasStartDate() && todo->hasDueDate() &&
+ todo->dtStart().date() < currentDate &&
+ currentDate < todo->dtDue().date() ) {
+ accepted = true;
+ stateText = i18n( "in progress" );
+ }
+
+ // all todos which start today
+ if ( todo->hasStartDate() && todo->dtStart().date() == currentDate ) {
+ accepted = true;
+ stateText = i18n( "starts today" );
+ }
+
+ // all todos which end today
+ if ( todo->hasDueDate() && todo->dtDue().date() == currentDate ) {
+ accepted = true;
+ stateText = i18n( "ends today" );
+ }
+
+ if ( !accepted )
+ continue;
+
+ label = new QLabel( this );
+ label->setPixmap( pm );
+ label->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Maximum );
+ mLayout->addWidget( label, counter, 0 );
+ mLabels.append( label );
+
+ label = new QLabel( QString::number( todo->percentComplete() ) + "%", this );
+ label->setAlignment( AlignHCenter | AlignVCenter );
+ label->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Maximum );
+ mLayout->addWidget( label, counter, 1 );
+ mLabels.append( label );
+
+ QString sSummary = todo->summary();
+ if ( todo->relatedTo() ) { // show parent only, not entire ancestry
+ sSummary = todo->relatedTo()->summary() + ":" + todo->summary();
+ }
+ KURLLabel *urlLabel = new KURLLabel( this );
+ urlLabel->setText( sSummary );
+ urlLabel->setURL( todo->uid() );
+ urlLabel->installEventFilter( this );
+ urlLabel->setTextFormat( Qt::RichText );
+ mLayout->addWidget( urlLabel, counter, 2 );
+ mLabels.append( urlLabel );
+
+ connect( urlLabel, SIGNAL( leftClickedURL( const QString& ) ),
+ this, SLOT( viewTodo( const QString& ) ) );
+ connect( urlLabel, SIGNAL( rightClickedURL( const QString& ) ),
+ this, SLOT( popupMenu( const QString& ) ) );
+
+ QString tipText( KCal::IncidenceFormatter::toolTipString( todo, true ) );
+ if ( !tipText.isEmpty() ) {
+ QToolTip::add( urlLabel, tipText );
+ }
+
+ label = new QLabel( stateText, this );
+ label->setAlignment( AlignLeft | AlignVCenter );
+ label->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Maximum );
+ mLayout->addWidget( label, counter, 3 );
+ mLabels.append( label );
+
+ counter++;
+ }
+ }
+
+ if ( counter == 0 ) {
+ QLabel *noTodos = new QLabel( i18n( "No to-dos pending" ), this );
+ noTodos->setAlignment( AlignHCenter | AlignVCenter );
+ mLayout->addWidget( noTodos, 0, 1 );
+ mLabels.append( noTodos );
+ }
+
+ for ( label = mLabels.first(); label; label = mLabels.next() )
+ label->show();
+}
+
+void TodoSummaryWidget::viewTodo( const QString &uid )
+{
+ mPlugin->core()->selectPlugin( "kontact_todoplugin" );//ensure loaded
+ KOrganizerIface_stub iface( "korganizer", "KOrganizerIface" );
+ iface.editIncidence( uid );
+}
+
+void TodoSummaryWidget::removeTodo( const QString &uid )
+{
+ mPlugin->core()->selectPlugin( "kontact_todoplugin" );//ensure loaded
+ KOrganizerIface_stub iface( "korganizer", "KOrganizerIface" );
+ iface.deleteIncidence( uid, false );
+}
+
+void TodoSummaryWidget::completeTodo( const QString &uid )
+{
+ KCal::Todo *todo = mCalendar->todo( uid );
+ IncidenceChanger *changer = new IncidenceChanger( mCalendar, this );
+ if ( !todo->isReadOnly() && changer->beginChange( todo ) ) {
+ KCal::Todo *oldTodo = todo->clone();
+ todo->setCompleted( QDateTime::currentDateTime() );
+ changer->changeIncidence( oldTodo, todo, KOGlobals::COMPLETION_MODIFIED );
+ changer->endChange( todo );
+ delete oldTodo;
+ updateView();
+ }
+}
+
+void TodoSummaryWidget::popupMenu( const QString &uid )
+{
+ KPopupMenu popup( this );
+ QToolTip::remove( this );
+ popup.insertItem( i18n( "&Edit To-do..." ), 0 );
+ popup.insertItem( KGlobal::iconLoader()->loadIcon( "editdelete", KIcon::Small),
+ i18n( "&Delete To-do" ), 1 );
+ KCal::Todo *todo = mCalendar->todo( uid );
+ if ( !todo->isCompleted() ) {
+ popup.insertItem( KGlobal::iconLoader()->loadIcon( "checkedbox", KIcon::Small),
+ i18n( "&Mark To-do Completed" ), 2 );
+ }
+
+ switch ( popup.exec( QCursor::pos() ) ) {
+ case 0:
+ viewTodo( uid );
+ break;
+ case 1:
+ removeTodo( uid );
+ break;
+ case 2:
+ completeTodo( uid );
+ break;
+ }
+}
+
+bool TodoSummaryWidget::eventFilter( QObject *obj, QEvent* e )
+{
+ if ( obj->inherits( "KURLLabel" ) ) {
+ KURLLabel* label = static_cast<KURLLabel*>( obj );
+ if ( e->type() == QEvent::Enter )
+ emit message( i18n( "Edit To-do: \"%1\"" ).arg( label->text() ) );
+ if ( e->type() == QEvent::Leave )
+ emit message( QString::null );
+ }
+
+ return Kontact::Summary::eventFilter( obj, e );
+}
+
+QStringList TodoSummaryWidget::configModules() const
+{
+ return QStringList( "kcmtodosummary.desktop" );
+}
+
+#include "todosummarywidget.moc"
diff --git a/kontact/plugins/korganizer/todosummarywidget.h b/kontact/plugins/korganizer/todosummarywidget.h
new file mode 100644
index 000000000..d5aca429e
--- /dev/null
+++ b/kontact/plugins/korganizer/todosummarywidget.h
@@ -0,0 +1,72 @@
+/*
+ This file is part of Kontact.
+ Copyright (c) 2003 Tobias Koenig <tokoe@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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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.
+*/
+
+#ifndef TODO_SUMMARYWIDGET_H
+#define TODO_SUMMARYWIDGET_H
+
+#include <qptrlist.h>
+#include <qwidget.h>
+
+#include <libkcal/calendarresources.h>
+
+#include "summary.h"
+
+class QGridLayout;
+class QLabel;
+
+class TodoPlugin;
+
+class TodoSummaryWidget : public Kontact::Summary
+{
+ Q_OBJECT
+
+ public:
+ TodoSummaryWidget( TodoPlugin *plugin, QWidget *parent,
+ const char *name = 0 );
+ ~TodoSummaryWidget();
+
+ int summaryHeight() const { return 3; }
+ QStringList configModules() const;
+
+ public slots:
+ void updateSummary( bool force = false ) { Q_UNUSED( force ); updateView(); }
+
+ protected:
+ virtual bool eventFilter( QObject *obj, QEvent* e );
+
+ private slots:
+ void updateView();
+ void popupMenu( const QString &uid );
+ void viewTodo( const QString &uid );
+ void removeTodo( const QString &uid );
+ void completeTodo( const QString &uid );
+
+ private:
+ TodoPlugin *mPlugin;
+ QGridLayout *mLayout;
+
+ QPtrList<QLabel> mLabels;
+ KCal::CalendarResources *mCalendar;
+};
+
+#endif