diff options
Diffstat (limited to 'korganizer/plugins')
71 files changed, 6504 insertions, 0 deletions
diff --git a/korganizer/plugins/Makefile.am b/korganizer/plugins/Makefile.am new file mode 100644 index 000000000..58cf02ea0 --- /dev/null +++ b/korganizer/plugins/Makefile.am @@ -0,0 +1,6 @@ +if include_exchange_SUBDIR +exchange_SUBDIR=exchange +endif + +SUBDIRS=datenums hebrew printing $(exchange_SUBDIR) + diff --git a/korganizer/plugins/datenums/Makefile.am b/korganizer/plugins/datenums/Makefile.am new file mode 100644 index 000000000..8081a5645 --- /dev/null +++ b/korganizer/plugins/datenums/Makefile.am @@ -0,0 +1,14 @@ +INCLUDES = -I$(top_srcdir)/korganizer/interfaces -I$(top_srcdir)/korganizer $(all_includes) + +kde_module_LTLIBRARIES = libkorg_datenums.la + +libkorg_datenums_la_SOURCES = configdialog.cpp datenums.cpp +libkorg_datenums_la_LDFLAGS = -module $(KDE_PLUGIN) $(KDE_RPATH) $(all_libraries) +libkorg_datenums_la_LIBADD = $(top_builddir)/korganizer/libkorganizer.la $(LIB_KDEUI) + +noinst_HEADERS = datenums.h + +servicedir = $(kde_servicesdir)/korganizer +service_DATA = datenums.desktop + +METASOURCES = AUTO diff --git a/korganizer/plugins/datenums/configdialog.cpp b/korganizer/plugins/datenums/configdialog.cpp new file mode 100644 index 000000000..d26a1fd86 --- /dev/null +++ b/korganizer/plugins/datenums/configdialog.cpp @@ -0,0 +1,80 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> + Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com> + + 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. +*/ + +#include <qlayout.h> +#include <qlabel.h> +#include <qvbuttongroup.h> +#include <qradiobutton.h> + +#include <klocale.h> +#include <kmessagebox.h> +#include <kapplication.h> +#include <kglobal.h> +#include <kconfig.h> +#include <kstandarddirs.h> +#include <ksimpleconfig.h> + +#include "configdialog.h" +#include "configdialog.moc" + +ConfigDialog::ConfigDialog(QWidget *parent) + : KDialogBase(Plain,i18n("Configure Day Numbers"),Ok|Cancel,Ok,parent) +{ + QFrame *topFrame = plainPage(); + QVBoxLayout *topLayout = new QVBoxLayout(topFrame,0,spacingHint()); + +// QLabel *label = new QLabel(i18n("Show date numbers:"),topFrame); +// topLayout->addWidget(label); + mDayNumGroup = new QVButtonGroup( i18n("Show Date Number"), topFrame ); + topLayout->addWidget( mDayNumGroup ); + + new QRadioButton( i18n("Show day number"), mDayNumGroup ); + new QRadioButton( i18n("Show days to end of year"), mDayNumGroup ); + new QRadioButton( i18n("Show both"), mDayNumGroup ); + + load(); +} + +ConfigDialog::~ConfigDialog() +{ +} + +void ConfigDialog::load() +{ + KConfig config( "korganizerrc", true, false); // Open read-only, no kdeglobals + config.setGroup("Calendar/DateNum Plugin"); + int datenum = config.readNumEntry( "ShowDayNumbers", 0 ); + mDayNumGroup->setButton( datenum ); +} + +void ConfigDialog::save() +{ + KConfig config( "korganizerrc", false, false); // Open read-write, no kdeglobals + config.setGroup("Calendar/DateNum Plugin"); + config.writeEntry("ShowDayNumbers", mDayNumGroup->selectedId() ); + config.sync(); +} + +void ConfigDialog::slotOk() +{ + save(); + + accept(); +} diff --git a/korganizer/plugins/datenums/configdialog.h b/korganizer/plugins/datenums/configdialog.h new file mode 100644 index 000000000..15efaf049 --- /dev/null +++ b/korganizer/plugins/datenums/configdialog.h @@ -0,0 +1,44 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2001 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. +*/ +#ifndef CONFIGDIALOG_H +#define CONFIGDIALOG_H + +#include <kdialogbase.h> + +class QButtonGroup; + +class ConfigDialog : public KDialogBase +{ + Q_OBJECT + public: + ConfigDialog(QWidget *parent=0); + virtual ~ConfigDialog(); + + protected: + void load(); + void save(); + + protected slots: + void slotOk(); + + private: + QButtonGroup *mDayNumGroup; +}; + +#endif diff --git a/korganizer/plugins/datenums/datenums.cpp b/korganizer/plugins/datenums/datenums.cpp new file mode 100644 index 000000000..a849f39f3 --- /dev/null +++ b/korganizer/plugins/datenums/datenums.cpp @@ -0,0 +1,72 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2001 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. +*/ + +#include "datenums.h" +#include "koglobals.h" +#include <kconfig.h> +#include <kstandarddirs.h> + +#include "configdialog.h" +#include <kcalendarsystem.h> + +class DatenumsFactory : public CalendarDecorationFactory { + public: + CalendarDecoration *create() { return new Datenums; } +}; + +K_EXPORT_COMPONENT_FACTORY( libkorg_datenums, DatenumsFactory ) + + +Datenums::Datenums() +{ + KConfig config( "korganizerrc", true, false); // Open read-only, no kdeglobals + config.setGroup("Calendar/DateNum Plugin"); + mDateNum = config.readNumEntry( "ShowDayNumbers", 0 ); +} + +void Datenums::configure(QWidget *parent) +{ + ConfigDialog *dlg = new ConfigDialog(parent); + dlg->exec(); + delete dlg; +} + + +QString Datenums::shortText(const QDate &date) +{ + int doy = KOGlobals::self()->calendarSystem()->dayOfYear(date); + switch (mDateNum) { + case 1: // only days until end of year + return QString::number( KOGlobals::self()->calendarSystem()->daysInYear(date) - doy ); + break; + case 2: // both day of year and days till end of year + return i18n("dayOfYear / daysTillEndOfYear", "%1 / %2").arg( doy ) + .arg(KOGlobals::self()->calendarSystem()->daysInYear(date) - doy); + break; + case 0: // only day of year + default: + return QString::number( doy ); + } + return QString::number( doy ); +} + +QString Datenums::info() +{ + return i18n("This plugin provides numbers of days and weeks."); +} diff --git a/korganizer/plugins/datenums/datenums.desktop b/korganizer/plugins/datenums/datenums.desktop new file mode 100644 index 000000000..b5010edc9 --- /dev/null +++ b/korganizer/plugins/datenums/datenums.desktop @@ -0,0 +1,99 @@ +[Desktop Entry] +X-KDE-Library=libkorg_datenums +Name=Date Numbers Plugin for Calendars +Name[af]=Dag nommer inprop module vir kalenders +Name[ar]=قابس أرقام التاريخ للتقويم +Name[bg]=Приставка на календара за дати +Name[bs]=Dodatak za kalendar - brojevi datuma +Name[ca]=Endollable de números de data per als calendaris +Name[cs]=Modul pro očíslování dat v kalendáři +Name[da]=Datonumre-plugin for kalendere +Name[de]=Kalendertag-Modul für Kalender +Name[el]=Πρόσθετο αριθμού ημερών για Ημερολόγια +Name[eo]=Datnumera kromaĵo por Kalendaro +Name[es]=Accesorio de números de fecha para calendarios +Name[et]=Kuupäeva nummerdamise plugin kalendritele +Name[eu]=Egutegientzako data zenbakiak +Name[fa]=وصلۀ عدد تاریخ برای تقویمها +Name[fi]=Päivämääräliitännäinen kalentereihin +Name[fr]=Module de numérotation des jours +Name[fy]=Datumgetallenplugin foar aginda's +Name[gl]=Engadido para Números dos Días nos Calendarios +Name[he]=תוסף מספרי תאריכים ללוחות שנה +Name[hu]=Dátumkezelő bővítőmodul naptárakhoz +Name[is]=Íforrit fyrir númer dags á dagatali +Name[it]=Plugin delle date per i calendari +Name[ja]=日数表示カレンダープラグイン +Name[ka]=თარიღის რიცხვების მოდული კალენდრებისათვის +Name[kk]=Күнтізбедегі күн нөмірінің модулі +Name[km]=កម្មវិធីជំនួយលេខកាលបរិច្ឆេទសម្រាប់ប្រតិទិន +Name[lt]=Datų numerių priedas kalendoriams +Name[ms]=Plugin Bilangan Tarikh untuk Kalendar +Name[nb]=Datonummer programtillegg for Kalender +Name[nds]=Kalennerdag-Moduul för Kalenners +Name[ne]=क्यालेन्डरका लागि मिति सङ्ख्या प्लगइन +Name[nl]=Datumgetallenplugin voor agenda's +Name[nn]=Datonummer programtillegg for Kalender +Name[pl]=Wtyczka numerów dni dla Kalendarzy +Name[pt]='plugin' de Números de Datas para Calendários +Name[pt_BR]=Plugin-de Números e Datas para Calendários +Name[ru]=Даты календаря +Name[sk]=Modul dátumov pre kalendáre +Name[sl]=Datumski vstavek za koledarje +Name[sr]=Прикључак календара за бројеве датума +Name[sr@Latn]=Priključak kalendara za brojeve datuma +Name[sv]=Datuminsticksprogram för kalendrar +Name[ta]=நாள்காட்டிகளுக்கான தேதி எண்களின் சொருகுப்பொருள் +Name[tg]=Санаҳои тақвим +Name[tr]=Takvimler için Tarih Rakamları Eklentisi +Name[uk]=Втулок дат для календарів +Name[zh_CN]=日历的日期数字插件 +Name[zh_TW]=行事曆日期數字外掛程式 +Comment=For each day this plugin shows its daynumber of the year at the top of the agenda view. For example, February 1 is day 32 of the year. +Comment[af]=Die inprop module vertoon die dag nommer van die jaar bo aan die agenda aansig. Bv: 1 Februarie is dag 32 van die jaar. +Comment[bg]=Приставката служи за показване на деня от началото на годината. Примерно, 1-ви февруари е 32-ия ден от годината. +Comment[ca]=Per cada dia, aquest endollable mostra el número de dia de l'any al capdamunt de la vista d'agenda. Per exemple, 1 de Febrer és el dia 32 de l'any. +Comment[cs]=tento modul pro každý den zobrazuje pořadí dne v roce na vrcholu pohledu. Např. 1. únor je 32 druhý den v roce. +Comment[da]=For hver dag viser dette plugin nummeret for dagen i året for oven i agendavisningen. For eksempel er 1. februar 1 is den 32. dag i året. +Comment[de]=Für jeden Tag des Jahres wird mit diesem Modul der Kalendertag oben in der Tagesansicht angezeigt. Der 1. Februar ist beispielsweise der 32. Kalendertag des Jahres. +Comment[el]=Για κάθε μέρα, αυτό το πρόσθετο εμφανίζει τον αύξοντα αριθμό της ημέρας του έτους στην προβολή προγράμματος εργασίας. Για παράδειγμα, η 1ι Φεβρουαρίου είναι η ημέρα 32 του έτους. +Comment[es]=Para cada día, esta extensión mostrará el número del día en el año en la parte superior de la vista de la agenda. Por ejemplo, el 1 de febrero es el día número 32 del año. +Comment[et]=See plugin näitab iga päevakavavaate ülaosas iga päeva järjekorranumbrit aastas. Näiteks 1. veebruar on aasta 32. päev. +Comment[eu]=Egun bakoitzeko, plugin honek bere urteko egun-zenbakia erakutsiko du agenda ikuspegiaren goiko aldean. Adibidez, Otsailak 1 urtearen 32. eguna da. +Comment[fa]=در هر روز، این وصله عدد مربوط به روز سال را در بالای نمای agenda نمایش میدهد. مثلاً ۱ فوریه، سی و دومین روز سال میباشد. +Comment[fi]=Tämä liitännäinen näyttää jokaisen päivän järjestysnumeron vuoden alusta agendanäkymässä. Esimerkiksi helmikuun ensimmäinen päivä on vuoden 32. päivä. +Comment[fr]=Pour chaque jour, ce module montre le numéro du jour en haut de la vue agenda. Par exemple, le 1er février est le 32ème jour de l'année. +Comment[fy]=Dizze plugin soarget derfoar dat it nûmer fan de dei boppe de agindawerjefte setten wurdt. Bygelyks, by 1 february heard deinûmer 32. +Comment[gl]=Este engadido amosa cada día o número de día anual na vista superior da axenda. Por exemplo, o 1 de febreiro é o día 32 do ano. +Comment[hu]=Megjeleníti az év elejétől eltelt napok számát az áttekintő nézet tetején. Például február elseje az év 32. napja. +Comment[is]=Þetta íforrit sýnir efst í fundarskránni númer hvers dags í árinu. T.d. er 1. febrúar 32. dagurinn í árinu. +Comment[it]=Per ciascun giorno, questo plugin mostra la data giuliana (numero progressivo a partire dal primo gennaio dell'anno corrente). Per esempio al primo di febbraio corrisponde il numero 32. +Comment[ja]=このプラグインは予定表ビューの上に、それぞれの日がその年の何日目であるかを表示します。例えば、2 月 1 日はその年の 32 日目です。 +Comment[ka]= გეგმის ზედა ხედში ეს მოდული თვითეული დღისათვის აჩვენებს მის დღის ნომერს ამ წლისათვის . მაგალითად,1 თებერვალი წლის 32-ე დღეა. +Comment[kk]=Бұл модуль күн тәртібі бетінің жоғарында жыл басынан өткен күндер санын көрсетеді. Мысалы, 1-ақпан жылдың 32-күні. +Comment[km]=សម្រាប់ថ្ងៃនីមួយៗ កម្មវិធីជំនួយនេះនឹងបង្ហាញលេខថ្ងៃនៃឆ្នាំ នៅផ្នែកខាងលើនៃទិដ្ឋភាពរបៀបវារៈ ។ ឧទាហរណ៍ ថ្ងៃទី ១ ខែ កុម្ភៈ នឹងត្រូវជាថ្ងៃទី ៣២ នៃឆ្នាំ ។ +Comment[lt]=Kiekvienai dienai šis priedas rodo metų dienos numerį tvarkyklės viršuje. Pvz., Vasario 1 yra32 metų diena. +Comment[ms]=Setiap hari plugin ini memaparkan bilangan hari tahun tersebut di atas paparan agenda. Contohnya , 1 Februari adalah hari ke 32 bagi tahun tersebut. +Comment[nb]=For hver dag viser dette programtillegget dagens nummer i året øverst på dagsvisningen. 1. februar er f.eks. dag nr. 32 i året. +Comment[nds]=Dit Moduul wiest för elkeen Dag sien Nummer in't Johr baven de Dagansicht. De 1. Februor is t.B. de 32. Dag vun't Johr. +Comment[ne]=प्रत्येक दिनका लागि यो प्लगइनले एजेन्डा दृश्यको माथि यस वर्षको दिन नम्बर देखाउछ । उदारणका लागि, फेब्रुवरी १ वर्षको बत्तिसौ दिन हो । +Comment[nl]=Deze plugin zorgt ervoor dat het dagnummer boven de agendaweergave wordt geplaatst. Bijvoorbeeld, bij 1 februari hoort dagnummer 32. +Comment[nn]=For kvar dag vil dette programtillegget visa nummeret til denne dagen i året øvst i tidsplanen. 1. februar vil til dømes visast som dag 32. +Comment[pl]=Ta wtyczka dla każdego dnia pokazuje jego numer kolejny w roku, na szczycie widoku planu. Na przykład, 1 luty to 32 dzień roku. +Comment[pt]=Para cada dia, este 'plugin' mostra o seu número de dia do ano no topo da agenda. Por exemplo, o dia 1 de Fevereiro é o dia 32 do ano. +Comment[pt_BR]=Para cada dia, esse plug-in mostra o número do dia no topo da visão de agenda. Por exemplo, 1º de fevereiro é o dia 32 do ano. +Comment[ru]=Этот модуль показывает номер дня в году для каждой даты. Например, для 1 февраля будет показан номер 32. +Comment[sk]=Tento modul pre každý deň zobrazí jeho číslo dňa v roku navrchu pohľadu agendy. Napríklad 1. február je deň číslo 32 v roku. +Comment[sl]=Za vsak dan ta vstavek prikazuje številko dneva v letu na vrhu praikaza agende. Npr., 1. februar je 32. dan v letu. +Comment[sr]=За сваки датум овај прикључак приказује његов број дана у години на врху приказа распореда. На пример, 1. фебруар је 32. дан у години. +Comment[sr@Latn]=Za svaki datum ovaj priključak prikazuje njegov broj dana u godini na vrhu prikaza rasporeda. Na primer, 1. februar je 32. dan u godini. +Comment[sv]=Insticksprogrammet visar dagens nummer under året för varje dag längst upp i agendavyn. Till exempel är 1:a februari den 32:e dagen under året. +Comment[ta]=ஒவ்வோரு நாளும் நிகழ்ச்சி நிரல் காட்சியின் மேற்புறத்தில் வருடத்தின் நாளின் எண்ணை இந்த சொருகுப்பொருள் காட்டுகிறது. உதாரணமாக, பிப்ரவரி 1 வருடத்தின் 32வது நாள் +Comment[tr]=Bu eklenti, her gün için tarih bilgisini gün sayısı olarak ajanda görünümünün yukarısında gösterir. Örneğin, 1 Şubat yılın 32. günüdür. +Comment[uk]=Цей втулок показує зверху перегляду щоденника номер для кожного дня року. Наприклад, 1-го лютого - це 32 день року. +Comment[zh_CN]=此插件可对每天在议事日程视图中上方显示该日在一年中的序号。例如,2月1日是一年的第32天。 +Comment[zh_TW]=對每一天,此外掛程式會顯示這是一年中的第幾天。 +Type=Service +ServiceTypes=Calendar/Plugin,Calendar/Decoration +X-KDE-KOrganizer-HasSettings=true +X-KDE-PluginInterfaceVersion=2 diff --git a/korganizer/plugins/datenums/datenums.h b/korganizer/plugins/datenums/datenums.h new file mode 100644 index 000000000..af3e46473 --- /dev/null +++ b/korganizer/plugins/datenums/datenums.h @@ -0,0 +1,41 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2001 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. +*/ +#ifndef KORG_DATENUMS_H +#define KORG_DATENUMS_H + +#include <qstring.h> + +#include <calendar/calendardecoration.h> + +using namespace KOrg; + +class Datenums : public CalendarDecoration { + public: + Datenums(); + ~Datenums() {} + + void configure(QWidget *parent); + QString shortText(const QDate &); + + QString info(); + protected: + int mDateNum; +}; + +#endif diff --git a/korganizer/plugins/exchange/Makefile.am b/korganizer/plugins/exchange/Makefile.am new file mode 100644 index 000000000..39290aadd --- /dev/null +++ b/korganizer/plugins/exchange/Makefile.am @@ -0,0 +1,27 @@ +# $Id$ + +SUBDIRS= + +METASOURCES = AUTO + +INCLUDES = -I$(top_srcdir)/korganizer/interfaces \ + -I$(top_srcdir)/libkpimexchange/core -I$(top_builddir)/libkpimexchange/core \ + -I$(top_srcdir) \ + $(all_includes) + +kde_module_LTLIBRARIES = libkorg_exchange.la + +libkorg_exchange_la_SOURCES = exchange.cpp exchangedialog.cpp exchangeconfig.cpp +libkorg_exchange_la_LDFLAGS = -module $(KDE_PLUGIN) $(KDE_RPATH) $(all_libraries) +libkorg_exchange_la_LIBADD = $(top_builddir)/korganizer/libkorganizer.la \ + $(top_builddir)/libkpimexchange/libkpimexchange.la \ + $(LIB_KDEUI) $(LIB_KPARTS) + +noinst_HEADERS = exchange.h exchangedialog.h exchangeconfig.h + +servicedir = $(kde_servicesdir)/korganizer +service_DATA = exchange.desktop + +rcdir = $(kde_datadir)/korganizer/plugins +rc_DATA = exchangeui.rc + diff --git a/korganizer/plugins/exchange/exchange.cpp b/korganizer/plugins/exchange/exchange.cpp new file mode 100644 index 000000000..86377f046 --- /dev/null +++ b/korganizer/plugins/exchange/exchange.cpp @@ -0,0 +1,238 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.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. +*/ + +#include <qfile.h> + +#include <kapplication.h> +#include <kconfig.h> +#include <kstandarddirs.h> + +#include <kurl.h> +#include <kdebug.h> + +#include <kmessagebox.h> +#include <klocale.h> +#include <kaction.h> +#include <kglobal.h> + +#include "korganizer/korganizer.h" +#include "korganizer/calendarview.h" + +#include <exchangeclient.h> +#include <exchangeaccount.h> + +#include "exchange.h" +#include "exchangedialog.h" +#include "exchangeconfig.h" + + +using namespace KCal; // Needed for connecting slots + +class ExchangeFactory : public KOrg::PartFactory { + public: + KOrg::Part *create(KOrg::MainWindow *parent, const char *name) + { + kdDebug(5850) << "Registering Exchange Plugin...\n"; + KGlobal::locale()->insertCatalogue("libkpimexchange"); + return new Exchange(parent,name); + } +}; + +K_EXPORT_COMPONENT_FACTORY( libkorg_exchange, ExchangeFactory ) + +Exchange::Exchange(KOrg::MainWindow *parent, const char *name) : + KOrg::Part(parent,name) +{ + setInstance( new KInstance( "korganizer" ) ); + + kdDebug(5850) << "Creating Exchange Plugin...\n"; + + mAccount = new KPIM::ExchangeAccount( "Calendar/Exchange Plugin" ); + mClient = new KPIM::ExchangeClient( mAccount ); + mClient->setWindow( parent->topLevelWidget() ); + + setXMLFile("plugins/exchangeui.rc"); + + new KAction(i18n("&Download..."), 0, this, SLOT(download()), + actionCollection(), "exchange_download"); + + KAction *action = new KAction(i18n("&Upload Event..."), 0, this, SLOT(upload()), + actionCollection(), "exchange_upload"); + QObject::connect(mainWindow()->view(),SIGNAL(incidenceSelected(Incidence *)), + this, SLOT(slotIncidenceSelected(Incidence *))); + action->setEnabled( false ); + QObject::connect(this,SIGNAL(enableIncidenceActions(bool)), + action,SLOT(setEnabled(bool))); + + action = new KAction(i18n("De&lete Event"), 0, this, SLOT(remove()), + actionCollection(), "exchange_delete"); + QObject::connect(this,SIGNAL(enableIncidenceActions(bool)), + action,SLOT(setEnabled(bool))); + action->setEnabled( false ); + + 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 &)), + mainWindow()->view(), SLOT(updateView(const QDate &, const QDate &)) ); +} + +Exchange::~Exchange() +{ + kdDebug(5850) << "Exchange Plugin destructor" << endl; +} + +QString Exchange::info() +{ + return i18n("This plugin imports and export calendar events from/to a Microsoft Exchange 2000 Server."); +} + +QString Exchange::shortInfo() +{ + return i18n("Exchange Plugin"); +} + +void Exchange::slotIncidenceSelected( Incidence *incidence ) +{ + emit enableIncidenceActions( incidence != 0 ); +} + +void Exchange::download() +{ + ExchangeDialog dialog( mainWindow()->view()->startDate(), mainWindow()->view()->endDate() ); + + if (dialog.exec() != QDialog::Accepted ) + return; + + QDate start = dialog.m_start->date(); + QDate end = dialog.m_end->date(); + + KCal::Calendar* calendar = mainWindow()->view()->calendar(); + + int result = mClient->downloadSynchronous(calendar, start, end, true ); + + if ( result == KPIM::ExchangeClient::ResultOK ) + emit calendarChanged(); + else + showError( result, mClient->detailedErrorString() ); + +} + +void Exchange::upload() +{ + kdDebug(5850) << "Called Exchange::upload()" << endl; + + Event* event = dynamic_cast<Event *> ( mainWindow()->view()->currentSelection() ); + if ( ! event ) + { + KMessageBox::information( 0L, i18n("Please select an appointment."), i18n("Exchange Plugin") ); + return; + } + if ( KMessageBox::warningContinueCancel( 0L, i18n("Exchange Upload is EXPERIMENTAL, you may lose data on this appointment!"), i18n("Exchange Plugin"), i18n("&Upload") ) + == KMessageBox::Continue ) { + kdDebug(5850) << "Trying to add appointment " << event->summary() << endl; + int result = mClient->uploadSynchronous( event ); + if ( result != KPIM::ExchangeClient::ResultOK ) + showError( result, mClient->detailedErrorString() ); + } +} + +void Exchange::remove() +{ + kdDebug(5850) << "Called Exchange::remove()" << endl; + + Event* event = dynamic_cast<Event *> ( mainWindow()->view()->currentSelection() ); + if ( ! event ) + { + KMessageBox::information( 0L, i18n("Please select an appointment."), i18n("Exchange Plugin") ); + return; + } + + if ( KMessageBox::warningContinueCancel( 0L, i18n("Exchange Delete is EXPERIMENTAL, if this is a recurring event it will delete all instances!"), i18n("Exchange Plugin"), KGuiItem(i18n("&Delete"),"editdelete") ) + == KMessageBox::Continue ) { + kdDebug(5850) << "Trying to delete appointment " << event->summary() << endl; + int result = mClient->removeSynchronous( event ); + + if ( result == KPIM::ExchangeClient::ResultOK ) { + mainWindow()->view()->calendar()->deleteEvent( event ); + emit calendarChanged(); + } else + showError( result, mClient->detailedErrorString() ); + } +} + +void Exchange::configure() +{ + kdDebug(5850) << "Exchange::configure" << endl; + ExchangeConfig dialog( mAccount ); + + if (dialog.exec() == QDialog::Accepted ) + mAccount->save( "Calendar/Exchange Plugin" ); +} + +void Exchange::showError( int error, const QString& moreInfo /* = QString::null */ ) +{ + QString errorText; + switch( error ) { + case KPIM::ExchangeClient::ResultOK: + errorText = i18n( "No Error" ); + break; + case KPIM::ExchangeClient::CommunicationError: + errorText = i18n( "The Exchange server could not be reached or returned an error." ); + break; + case KPIM::ExchangeClient::ServerResponseError: + errorText = i18n( "Server response could not be interpreted." ); + break; + case KPIM::ExchangeClient::IllegalAppointmentError: + errorText = i18n( "Appointment data could not be interpreted." ); + break; + case KPIM::ExchangeClient::NonEventError: + errorText = i18n( "This should not happen: trying to upload wrong type of event." ); + break; + case KPIM::ExchangeClient::EventWriteError: + errorText = i18n( "An error occurred trying to write an appointment to the server." ); + break; + case KPIM::ExchangeClient::DeleteUnknownEventError: + errorText = i18n( "Trying to delete an event that is not present on the server." ); + break; + case KPIM::ExchangeClient::UnknownError: + default: + errorText = i18n( "Unknown Error" ); + } + + if ( error != KPIM::ExchangeClient::ResultOK ) { + if ( moreInfo.isNull() ) + KMessageBox::error( mainWindow()->topLevelWidget(), errorText, i18n( "Exchange Plugin" ) ); + else + KMessageBox::detailedError( mainWindow()->topLevelWidget(), errorText, moreInfo, i18n( "Exchange Plugin" ) ); + } +} + +void Exchange::test() +{ + kdDebug(5850) << "Entering test()" << endl; + mClient->test(); +} + +void Exchange::test2() +{ + kdDebug(5850) << "Entering test2()" << endl; +} +#include "exchange.moc" diff --git a/korganizer/plugins/exchange/exchange.desktop b/korganizer/plugins/exchange/exchange.desktop new file mode 100644 index 000000000..121bf9863 --- /dev/null +++ b/korganizer/plugins/exchange/exchange.desktop @@ -0,0 +1,101 @@ +[Desktop Entry] +X-KDE-Library=libkorg_exchange +Name=Microsoft Exchange 2000 Plugin for KOrganizer +Name[af]=Microsoft Exchange 2000 inprop module vir KOrganizer +Name[be]=Дапаўненне K Арганізатара "Microsoft Exchange 2000" +Name[bg]=Приставка на организатора за връзка с Microsoft Exchange 2000 +Name[bs]=Microsoft Exchange 2000 dodatak za KOrganizer +Name[ca]=Endollable Microsoft Exchange 2000 per a KOrganizer +Name[cs]=Modul Microsoft Exchange 2000 pro KOrganizer +Name[da]=Microsoft Exchange 2000-plugin for KOrganizer +Name[de]=Microsoft Exchange 2000-Modul für KOrganizer +Name[el]=Πρόσθετο Microsoft Exchange 2000 του KOrganizer +Name[eo]=Microsoft Exchange 2000-kromaĵo por Organizilo +Name[es]=Accesorio de Microsoft Exchange 2000 para KOrganizer +Name[et]=Microsoft Exchange 2000 plugin KOrganizeri jaoks +Name[eu]=KOrganizer-en Microsoft Exchange 2000 plugin-a +Name[fa]=وصلۀ Microsoft Exchange ۲۰۰۰ برای KOrganizer +Name[fi]=KOrganizerin Microsoft Exchange 2000 -liitännäinen +Name[fr]=Module Microsoft Exchange 2000 pour KOrganizer +Name[fy]=Microsoft Exchange 2000 plugin foar KOrganizer +Name[ga]=Breiseán Microsoft Exchange 2000 le haghaidh KOrganizer +Name[gl]=Extensión de Microsoft Exchange 2000 para KOrganizer +Name[hu]=Microsoft Exchange 2000-bővítőmodul a KOrganizerhez +Name[is]=Microsoft Exchange 2000 íforrit fyrir KOrganizer +Name[it]=Plugin Microsoft Exchange 2000 per KOrganizer +Name[ja]=KOrganizer の Microsoft Exchange 2000 プラグイン +Name[ka]=Microsoft Exchange 2000-ის მოდული KOrganizer-სთვის +Name[kk]=KOrganizer-дің Microsoft Exchange 2000 модулі +Name[km]=កម្មវិធីជំនួយម៉ៃក្រូសូហ្វ Exchange ២០០០ សម្រាប់ KOrganizer +Name[lt]=Microsoft Exchange 2000 priedas, skirtas KOrganizer +Name[mk]=Приклучок за КОрганизатор за Microsoft Exchange 2000 +Name[ms]=PLugin Microsoft Exchange 2000 untuk KOrganizer +Name[nb]=Microsoft Exchange 2000 programtillegg for KOrganizer +Name[nds]=MSExchange2000-Moduul för KOrganizer +Name[ne]=केडीई आयोजकका लागि माइक्रोसफ्ट एक्सचेन्ज 2000 +Name[nl]=Microsoft Exchange 2000 plugin voor KOrganizer +Name[nn]=Microsoft Exchange 2000 programtillegg for KOrganizer +Name[pl]=Wtyczka Microsoft Exchange 2000 dla Organizatora +Name[pt]='Plugin' do Microsoft Exchange 2000 para o KOrganizer +Name[pt_BR]=Plug-in do Microsoft Exchange 2000 para o KOrganizer +Name[ru]=Доступ к Microsoft Exchange 2000 +Name[sk]=KOrganizer modul pre Microsoft Exchange 2000 +Name[sl]=Vstavek za Microsoft Exchange 2000 za KOrganizer +Name[sr]=Прикључак KOrganizer-а за Microsoft Exchange 2000 +Name[sr@Latn]=Priključak KOrganizer-a za Microsoft Exchange 2000 +Name[sv]=Microsoft Exchange 2000-insticksprogram för Korganizer +Name[ta]=கேஅமைப்பாளருக்கான மைக்ரோசாஃப்ட் எக்ஸ்சேன்ஜ் 2000 சொருகுப்பொருள் +Name[tg]=Дастрасӣ ба Microsoft Exchange 2000 +Name[tr]=KOrganizer için Microsoft Exchange 2000 Eklentisi +Name[uk]=Втулок Microsoft Exchange 2000 для KOrganizer +Name[zh_CN]=KOrganizer 的 Microsoft Exchange 2000 插件 +Name[zh_TW]=KOrganizer 的 Microsoft Exchange 2000 外掛程式 +Comment=This plugin allows korganizer users to work with Microsoft Exchange 2000 groupware servers. +Comment[af]=Hierdie inprop module maak dit vir korganizer gebruikers moontlik om met Microsoft Exchange 2000 bedieners te praat. +Comment[bg]=Приставката служи за връзка на Korganizer със сървъра Microsoft Exchange 2000 groupware. +Comment[ca]=Aquest endollable permet als usuaris de korganizer treballar amb servidors groupware Microsoft Exchange 2000. +Comment[cs]=tento modul umožňuje pracovat uživatelům korganizeru s Microsoft Exchange 2000 groupware servery. +Comment[da]=Dette plugin tillader brugere af korganizer at arbejde med Microsoft Exchange 2000 groupware servere. +Comment[de]=Mit diesem Modul kann KOrganizer mit Microsoft Exchange 2000 Groupware-Servern zusammenarbeiten. +Comment[el]=Αυτό το πρόσθετο επιτρέπει στους χρήστες του korganizer να δουλεύουν με εξυπηρετητές groupware του Microsoft Exchange 2000. +Comment[es]=Esta extensión permite que los usuarios de korganizer trabajen con servidores de groupware de Microsoft Exchange 2000. +Comment[et]=See plugin võimaldab KOrganizeri kasutajatel pruukida Microsoft Exchange 2000 grupitööservereid. +Comment[eu]=Plugin honek korganizer-en erabiltzaileei Microsoft Exchange 2000 groupware zerbitzariekin lan egiteko aukera ematen die. +Comment[fa]=این وصله به کاربران korganizer اجازه میدهد که با کارسازهای Microsoft Exchange 2000 groupware کار کند. +Comment[fi]=Tämä liitännäinen mahdollistaa KOrganizer-käyttäjien työskentelemisen Microsoft Exchange 2000 -ryhmätyöpalvelimien kanssa. +Comment[fr]=Ce module permet à KOrganizer de fonctionner avec Microsoft Exchange 2000 +Comment[fy]=Dizze plugin makket it mooglik om Microsoft Exchange 2000 te brûken yn KOrganizer. +Comment[gl]=Este engadido permite que os usuarios de korganizer traballen con servidores de traballo en grupo Microsoft Exchange 2000 +Comment[hu]=Ez a modul lehetővé teszi KOrganizer-felhasználóknak Microsoft Exchange 2000-kiszolgálón tárolt csoportmunka-adatok elérését. +Comment[is]=Þetta íforrit gerir KOrganizer kleyft að vinna með Microsoft Exchange 2000 hópvinnuþjónum. +Comment[it]=Questo plugin permette agli utenti di korganizer di lavorare con i server groupware Microsoft Exchange 2000. +Comment[ja]=このプラグインにより、korganizer のユーザが Microsoft Exchange 2000 グループウェアサーバと同期できるようになります。 +Comment[ka]=ეს მოდული korganizer-ის მომხმარებლებს საშუალებას აძლევს იმუშაონ Microsoft Exchange 2000 ჯგუფურ სერვერებთან. +Comment[kk]=Бұл модуль korganizer-мен MS Exchange 2000 біріккен жұмыс сервермен істеуге мүмкіндік береді. +Comment[km]=កម្មវិធីជំនួយនេះអនុញ្ញាតឲ្យអ្នកប្រើរបស់ korganizer ធ្វើការជាមួយម៉ាស៊ីនបម្រើកម្មវិធីពហុអ្នកប្រើរបស់ម៉ៃក្រូសូហ្វ Exchange ២០០០ ។ +Comment[lt]=Šis priedas leidžia korganizer dirbti su Microsoft Exchange 2000 groupware serveriais. +Comment[mk]=Овој приклучок им овозможува на корисниците на КОрганизатор да работат со groupware-серверите на Microsoft Exchange 2000. +Comment[ms]=Plugin ini membenarkan pengguna korganizer bekerja bersama pelayan groupware Microsoft Exchange 2000. +Comment[nb]=Med dette programtillegget kan korganizer-brukere arbeide med gruppevare-tjenere fra Microsoft Exchange 2000.i +Comment[nds]=Över dit Moduul köönt KOrganizer-Brukers mit Groupware-Servers för MSExchange-2000 arbeiden. +Comment[ne]=यो प्लगइनले माइक्रोसफ्ट एक्सचेन्ज 2000 ग्रुपवेयर सर्भरमा केडीई आयोजकलाई कार्य गर्न अनुमति दिन्छ । +Comment[nl]=Deze plugin maakt het mogelijk om Microsoft Exchange 2000 te gebruiken in KOrganizer. +Comment[nn]=Dette programtillegget lèt KOrganizer-brukarar arbeida saman med Microsoft Exchange 2000-gruppevaretenarar. +Comment[pl]=Ta wtyczka pozwala KOrganizerowi współpracować z serwerami pracy grupowej Microsoft Exchange. +Comment[pt]=Este 'plugin' permite aos utilizadores do KOrganizer lidarem com servidores de 'groupware' do Microsoft Exchange 2000. +Comment[pt_BR]=Esse plug-in permite que o KOrganizer conecte-se à servidores groupware Microsoft Exchance 2000 +Comment[ru]=Этот модуль позволяет пользователям органайзера работать с серверами совместной работы Microsoft Exchange 2000. +Comment[sk]=Tento modul umožní, aby korganizer užívatelia pracovali s Microsoft Exchange 2000 groupware servermi. +Comment[sl]=Ta vstavke omogoča uporabnikom KOrganizerja delo s strežniki Microsoft Exchange 2000. +Comment[sr]=Овај прикључак омогућава корисницима KOrganizer-а да раде са Microsoft-овим Exchange 2000 groupware серверима. +Comment[sr@Latn]=Ovaj priključak omogućava korisnicima KOrganizer-a da rade sa Microsoft-ovim Exchange 2000 groupware serverima. +Comment[sv]=Insticksprogrammet gör det möjligt för användare av Korganizer att arbeta med Microsoft Exchange 2000 grupprogramservrar. +Comment[ta]=இந்த சொருகுப்பொருள் korganizer பயனர்களை மைக்ரோசாப்ட் எக்ஸ்சேஞ்ச் 2000 குழுவாரி சேவகன்களில் பணி செய்ய அனுமதிக்கிறது. +Comment[tr]=Bu eklenti KOrganizer kullanıcılarının Microsoft Exchange 2000 sunucuları ile çalışabilmelerini sağlar. +Comment[uk]=Цей втулок дозволяє користувачам korganizer працювати з серверами групової роботи Microsoft Exchange 2000. +Comment[zh_CN]=此插件允许 KOrganizer 用户与 Microsoft Exchange 2000 群件服务器协同工作。 +Comment[zh_TW]=這個外掛程式允許 KOrganizer 使用者與 Microsoft Exchange 2000 群組伺服器一起工作。 +Type=Service +ServiceTypes=KOrganizer/Part +X-KDE-KOrganizer-HasSettings=false +X-KDE-PluginInterfaceVersion=2 diff --git a/korganizer/plugins/exchange/exchange.h b/korganizer/plugins/exchange/exchange.h new file mode 100644 index 000000000..a145bd12f --- /dev/null +++ b/korganizer/plugins/exchange/exchange.h @@ -0,0 +1,68 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.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. +*/ +#ifndef KORG_EXCHANGE_H +#define KORG_EXCHANGE_H + +#include <qstring.h> +#include <qdatetime.h> + +#include <korganizer/part.h> + +#include <libkcal/incidence.h> +#include <libkcal/event.h> + +#include <exchangeaccount.h> +#include <exchangeclient.h> + +// using namespace KOrg; +using namespace KCal; + +class Exchange : public KOrg::Part { + Q_OBJECT + public: + Exchange( KOrg::MainWindow *, const char *name ); + ~Exchange(); + + QString info(); + // This method is used for the category of the key bindings + QString shortInfo(); + + signals: + void enableIncidenceActions( bool ); + void calendarChanged(); + void calendarChanged(const QDate&start,const QDate&end); + + private slots: + void download(); + void upload(); + void remove(); + void configure(); + void test(); + void slotIncidenceSelected( Incidence * ); + + private: + void test2(); + void showError( int error, const QString& moreInfo = QString::null ); + + KPIM::ExchangeClient *mClient; + KPIM::ExchangeAccount* mAccount; +}; + +#endif + diff --git a/korganizer/plugins/exchange/exchangeconfig.cpp b/korganizer/plugins/exchange/exchangeconfig.cpp new file mode 100644 index 000000000..e75265caa --- /dev/null +++ b/korganizer/plugins/exchange/exchangeconfig.cpp @@ -0,0 +1,135 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.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. +*/ + +#include <qlayout.h> +#include <qlabel.h> +#include <qcombobox.h> + +#include <kapplication.h> +#include <kconfig.h> +#include <klocale.h> +#include <kdebug.h> +#include <kmessagebox.h> + +#include <exchangeaccount.h> + +#include "exchangeconfig.h" + +ExchangeConfig::ExchangeConfig( KPIM::ExchangeAccount* account, QWidget* parent ) + : KDialogBase(Plain,i18n("Exchange Plugin"),Ok|Cancel,Ok,parent) +{ + mAccount = account; + + kdDebug(5850) << "Creating ExchangeConfig with account: " << + account->host() << ":" << account->account() << endl; + + QFrame *topFrame = plainPage(); + QGridLayout *topLayout = new QGridLayout( topFrame, 5, 3, 3 ); + + m_host = new KLineEdit( mAccount->host(), topFrame ); + topLayout->addWidget( new QLabel( i18n( "Exchange server:" ), topFrame ), 0, 0 ); + topLayout->addWidget( m_host, 0, 1 ); + + m_port = new KLineEdit( mAccount->port(), topFrame ); + topLayout->addWidget( new QLabel( i18n( "Port:" ), topFrame ), 1, 0 ); + topLayout->addWidget( m_port, 1, 1 ); + + m_user = new KLineEdit( mAccount->account(), topFrame ); + topLayout->addWidget( new QLabel( i18n( "User:" ), topFrame ), 2, 0 ); + topLayout->addWidget( m_user, 2, 1 ); + connect( m_user, SIGNAL(textChanged(const QString&)), this, SLOT(slotUserChanged(const QString&)) ); + + m_password = new KLineEdit( mAccount->password(), topFrame ); + topLayout->addWidget( new QLabel( i18n( "Password:" ), topFrame ), 3, 0 ); + topLayout->addWidget( m_password, 3, 1 ); + m_password->setEchoMode( QLineEdit::Password ); + + m_autoMailbox = new QCheckBox( i18n( "Determine mailbox automatically" ), topFrame ); + topLayout->addMultiCellWidget( m_autoMailbox, 4, 4, 0, 1 ); + connect( m_autoMailbox, SIGNAL(toggled(bool)), this, SLOT(slotToggleAuto(bool)) ); + + m_mailbox= new KLineEdit( mAccount->mailbox(), topFrame ); + topLayout->addWidget( new QLabel( i18n( "Mailbox URL:" ), topFrame ), 5, 0 ); + topLayout->addWidget( m_mailbox, 5, 1 ); + + m_tryFindMailbox = new QPushButton( "&Find", topFrame ); + topLayout->addWidget( m_tryFindMailbox, 5, 2 ); + connect( m_tryFindMailbox, SIGNAL(clicked()), this, SLOT(slotFindClicked()) ); + + kapp->config()->setGroup( "Calendar/Exchange Plugin" ); + bool autoChecked = kapp->config()->readBoolEntry( "auto-mailbox", true ); + m_autoMailbox->setChecked( autoChecked ); +} + +ExchangeConfig::~ExchangeConfig() +{ +} + +void ExchangeConfig::slotToggleAuto( bool on ) +{ + m_mailbox->setEnabled( ! on ); +// m_tryFindMailbox->setEnabled( ! on ); +// if ( on ) { +// m_mailbox->setText( "webdav://" + m_host->text() + "/exchange/" + m_user->text() ); +// } +} + +void ExchangeConfig::slotUserChanged( const QString& /*text*/ ) +{ +// if ( m_mailboxEqualsUser->isChecked() ) { +// m_mailbox->setText( "webdav://" + m_host->text() + "/exchange/" + text ); +// } +} + +void ExchangeConfig::slotOk() +{ + if ( m_autoMailbox->isChecked() ) { + QString mailbox = mAccount->tryFindMailbox( m_host->text(), m_port->text(), m_user->text(), m_password->text() ); + if ( mailbox.isNull() ) { + kdWarning() << "Could not find Exchange mailbox URL, incomplete settings!"<< endl; + KMessageBox::sorry( this, "Could not determine mailbox URL" ); + return; // Do not accept + } else { + mAccount->setMailbox( mailbox ); + } + } else { + mAccount->setMailbox( m_mailbox->text() ); + } + mAccount->setHost( m_host->text() ); + mAccount->setPort( m_port->text() ); + mAccount->setAccount( m_user->text() ); + mAccount->setPassword( m_password->text() ); + + kapp->config()->setGroup( "Calendar/Exchange Plugin" ); + kapp->config()->writeEntry( "auto-mailbox", m_autoMailbox->isChecked() ); + + accept(); +} + +void ExchangeConfig::slotFindClicked() +{ + QString mailbox = mAccount->tryFindMailbox( m_host->text(), m_port->text(), m_user->text(), m_password->text() ); + if ( mailbox.isNull() ) { + KMessageBox::sorry( this, "Could not determine mailbox URL" ); + } else { + m_mailbox->setText( mailbox ); + } +} + +#include "exchangeconfig.moc" diff --git a/korganizer/plugins/exchange/exchangeconfig.h b/korganizer/plugins/exchange/exchangeconfig.h new file mode 100644 index 000000000..ba974ba26 --- /dev/null +++ b/korganizer/plugins/exchange/exchangeconfig.h @@ -0,0 +1,60 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.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. +*/ +#ifndef EXCHANGECONFIG_H +#define EXCHANGECONFIG_H + +#include <qcheckbox.h> +#include <qpushbutton.h> +#include <kdialogbase.h> +#include <klineedit.h> +//#include <kpassdlg.h> + +#include <exchangeaccount.h> + +class ExchangeConfig : public KDialogBase +{ + Q_OBJECT + public: + ExchangeConfig(KPIM::ExchangeAccount* account, QWidget *parent=0); + virtual ~ExchangeConfig(); + +// protected: +// void load(); +// void save(); + + protected slots: + void slotToggleAuto( bool on ); + void slotUserChanged( const QString& text ); + void slotFindClicked(); + void slotOk(); + + private: + public: + KPIM::ExchangeAccount* mAccount; + KLineEdit *m_host; + KLineEdit *m_port; + KLineEdit *m_user; + QCheckBox *m_autoMailbox; + KLineEdit *m_mailbox; + QPushButton* m_tryFindMailbox; + KLineEdit *m_password; +}; + +#endif + diff --git a/korganizer/plugins/exchange/exchangedialog.cpp b/korganizer/plugins/exchange/exchangedialog.cpp new file mode 100644 index 000000000..249b07a91 --- /dev/null +++ b/korganizer/plugins/exchange/exchangedialog.cpp @@ -0,0 +1,58 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.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. +*/ + +#include <qlayout.h> +#include <qlabel.h> +#include <qcombobox.h> + +#include <klocale.h> +#include <kmessagebox.h> +#include <kapplication.h> +#include <kglobal.h> +#include <kstandarddirs.h> +#include <ksimpleconfig.h> + +#include "exchangedialog.h" + +ExchangeDialog::ExchangeDialog( const QDate &_start, const QDate &_end, QWidget *parent) + : KDialogBase(Plain,i18n("Exchange Plugin"),Ok|Cancel,Ok,parent) +{ + QFrame *topFrame = plainPage(); + QGridLayout *topLayout = new QGridLayout( topFrame, 2, 2, 3 ); + + QLabel *label = new QLabel(i18n("Start date:"),topFrame); + topLayout->addWidget(label, 0, 0); + + m_start = new KDateWidget( _start, topFrame ); + topLayout->addWidget( m_start, 0, 1 ); + + m_end = new KDateWidget( _end, topFrame ); + topLayout->addWidget( new QLabel( i18n( "End date:" ), topFrame ), 1, 0 ); + topLayout->addWidget( m_end, 1, 1 ); +} + +ExchangeDialog::~ExchangeDialog() +{ +} + +void ExchangeDialog::slotOk() +{ + accept(); +} +#include "exchangedialog.moc" diff --git a/korganizer/plugins/exchange/exchangedialog.h b/korganizer/plugins/exchange/exchangedialog.h new file mode 100644 index 000000000..440d48fd9 --- /dev/null +++ b/korganizer/plugins/exchange/exchangedialog.h @@ -0,0 +1,43 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.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. +*/ +#ifndef EXCHANGEDIALOG_H +#define EXCHANGEDIALOG_H + +#include <kdialogbase.h> +#include <kdatewidget.h> + +class QComboBox; + +class ExchangeDialog : public KDialogBase +{ + Q_OBJECT + public: + ExchangeDialog( const QDate &start, const QDate &end, QWidget *parent=0); + virtual ~ExchangeDialog(); + + protected slots: + void slotOk(); + + private: + public: + KDateWidget *m_start; + KDateWidget *m_end; +}; + +#endif diff --git a/korganizer/plugins/exchange/exchangeui.rc b/korganizer/plugins/exchange/exchangeui.rc new file mode 100644 index 000000000..b1caad16b --- /dev/null +++ b/korganizer/plugins/exchange/exchangeui.rc @@ -0,0 +1,13 @@ +<!DOCTYPE kpartgui> +<kpartgui name="exchange" version="1"> + + <MenuBar> + <Menu name="exchange"><text>Exchange</text> + <Action name="exchange_download" /> + <Action name="exchange_upload" /> + <Action name="exchange_delete" /> + <Action name="exchange_configure" /> + </Menu> + </MenuBar> + +</kpartgui> diff --git a/korganizer/plugins/hebrew/Makefile.am b/korganizer/plugins/hebrew/Makefile.am new file mode 100644 index 000000000..4f48cc58b --- /dev/null +++ b/korganizer/plugins/hebrew/Makefile.am @@ -0,0 +1,16 @@ +# $Id$ + +METASOURCES = AUTO + +INCLUDES = -I$(top_srcdir)/korganizer/interfaces $(all_includes) + +kde_module_LTLIBRARIES = libkorg_hebrew.la + +libkorg_hebrew_la_SOURCES = hebrew.cpp configdialog.cpp holiday.cpp parsha.cpp converter.cpp +libkorg_hebrew_la_LDFLAGS = -module $(KDE_PLUGIN) $(KDE_RPATH) $(all_libraries) +libkorg_hebrew_la_LIBADD = $(LIB_KDECORE) $(LIB_KDEUI) + +noinst_HEADERS = hebrew.h configdialog.h parsha.h converter.h holiday.h + +servicedir = $(kde_servicesdir)/korganizer +service_DATA = hebrew.desktop diff --git a/korganizer/plugins/hebrew/README b/korganizer/plugins/hebrew/README new file mode 100644 index 000000000..297df67fb --- /dev/null +++ b/korganizer/plugins/hebrew/README @@ -0,0 +1,12 @@ +Jewish calendar plugin for KOrganizer, by Jonathan Singer <jsinger@leeta.net> + +Note that it only applies to modern (Gregorian) dates, as KDE/Qt does not +support Julian dates. See my KLuach application <http://www.leeta.net/kluach> +if you want to look up historical dates. + +TRANSLATORS! The weird-looking text strings are the names of Jewish months, +holidays and whatnot. They aren't translateable (although European or Near +Eastern languages may spell them differently) and should usually just be changed +into local characters with the same sound. "I" and "II" are Roman numerals. + +Date routines from Jewish Calendar by Frank Yellin diff --git a/korganizer/plugins/hebrew/configdialog.cpp b/korganizer/plugins/hebrew/configdialog.cpp new file mode 100644 index 000000000..aad50a680 --- /dev/null +++ b/korganizer/plugins/hebrew/configdialog.cpp @@ -0,0 +1,91 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2003 Jonathan Singer <jsinger@leeta.net> + + 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. +*/ +#include "configdialog.h" +#include "configdialog.moc" +#include <klocale.h> +#include <qlayout.h> +#include <kapplication.h> +#include <kglobal.h> +#include <kconfig.h> +#include <kstandarddirs.h> +#include <ksimpleconfig.h> + +ConfigDialog::ConfigDialog(QWidget * parent):KDialogBase(Plain, i18n("Configure Holidays"), Ok|Cancel, Ok, + parent) +{ + QFrame *topFrame = plainPage(); + QVBoxLayout *topLayout = + new QVBoxLayout(topFrame, 0, spacingHint()); + + israel_box = new QCheckBox(topFrame); + israel_box->setText(i18n("Use Israeli holidays")); + topLayout->addWidget(israel_box); + + parsha_box = new QCheckBox(topFrame); + parsha_box->setText(i18n("Show weekly parsha")); + topLayout->addWidget(parsha_box); + + omer_box = new QCheckBox(topFrame); + omer_box->setText(i18n("Show day of Omer")); + topLayout->addWidget(omer_box); + + chol_box = new QCheckBox(topFrame); + chol_box->setText(i18n("Show Chol HaMoed")); + topLayout->addWidget(chol_box); + + load(); +} + +ConfigDialog::~ConfigDialog() +{ +} + +void ConfigDialog::load() +{ + KConfig config("korganizerrc", true, false); // Open read-only, no kdeglobals + + config.setGroup("Calendar/Hebrew Calendar Plugin"); + israel_box->setChecked(config. + readBoolEntry("Israel", + (KGlobal::locale()-> + country() == ".il"))); + parsha_box->setChecked(config.readBoolEntry("Parsha", true)); + chol_box->setChecked(config.readBoolEntry("Chol_HaMoed", true)); + omer_box->setChecked(config.readBoolEntry("Omer", true)); + +} + +void ConfigDialog::save() +{ + KConfig config("korganizerrc", false, false); // Open read-write, no kdeglobals + + config.setGroup("Calendar/Hebrew Calendar Plugin"); + config.writeEntry("Israel", israel_box->isChecked()); + config.writeEntry("Parsha", parsha_box->isChecked()); + config.writeEntry("Chol_HaMoed", chol_box->isChecked()); + config.writeEntry("Omer", omer_box->isChecked()); + config.sync(); +} + +void ConfigDialog::slotOk() +{ + save(); + + accept(); +} diff --git a/korganizer/plugins/hebrew/configdialog.h b/korganizer/plugins/hebrew/configdialog.h new file mode 100644 index 000000000..1d0d18115 --- /dev/null +++ b/korganizer/plugins/hebrew/configdialog.h @@ -0,0 +1,49 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2003 Jonathan Singer <jsinger@leeta.net> + + 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. +*/ +#ifndef CONFIGDIALOG_H +#define CONFIGDIALOG_H + +#include <kdialogbase.h> +#include <qcheckbox.h> + +/** +@author Jonathan Singer +*/ +class ConfigDialog:public KDialogBase +{ +Q_OBJECT public: + + ConfigDialog(QWidget * parent = 0); + virtual ~ ConfigDialog(); + +protected: + void load(); + void save(); + + protected slots: void slotOk(); + +private: + QCheckBox * omer_box; + QCheckBox *parsha_box; + QCheckBox *israel_box; + QCheckBox *chol_box; + +}; + +#endif diff --git a/korganizer/plugins/hebrew/converter.cpp b/korganizer/plugins/hebrew/converter.cpp new file mode 100644 index 000000000..1381292e6 --- /dev/null +++ b/korganizer/plugins/hebrew/converter.cpp @@ -0,0 +1,345 @@ +/*************************************************************************** + * Copyright (C) 2003 by Jonathan Singer * + * jsinger@leeta.net * + * Calendar routines from Hebrew Calendar by Frank Yellin * + * * + * 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. * + ***************************************************************************/ +#include "converter.h" +#include <klocale.h> + +Converter::Converter() +{ + +} + +Converter::~Converter() +{ +} + +long Converter::absolute_from_gregorian(int year, int month, int day) +{ + int xyear, day_number; + + xyear = year - 1; + day_number = day + 31 * (month - 1); + if (month > 2) + { + day_number -= (23 + (4 * month)) / 10; + if (gregorian_leap_year_p(year)) + day_number++; + } + return day_number + /* the day number within the current year */ + 365L * xyear + /* days in prior years */ + (xyear / 4) + /* Julian leap years */ + (-(xyear / 100)) + /* deduct century years */ + (xyear / 400); /* add Gregorian leap years */ +} + +/* Given a Hebrew date, calculate the number of days since + * January 0, 0001, Gregorian + */ +long Converter::absolute_from_hebrew(int year, int month, int day) +{ + long sum = day + hebrew_elapsed_days(year) - 1373429L; + int i; + + if (month < 7) + { + int months = hebrew_months_in_year(year); + + for (i = 7; i <= months; ++i) + sum += hebrew_month_length(year, i); + for (i = 1; i < month; ++i) + sum += hebrew_month_length(year, i); + } + else + { + for (i = 7; i < month; ++i) + sum += hebrew_month_length(year, i); + } + return sum; +} + +/* Given an absolute date, calculate the gregorian date */ +void + Converter::gregorian_from_absolute(long date, int *yearp, + int *monthp, int *dayp) +{ + int year, month, day; + + for (year = date / 366; + date >= absolute_from_gregorian(year + 1, 1, 1); ++year) ; + for (month = 1; + (month <= 11) + && (date >= absolute_from_gregorian(year, 1 + month, 1)); + ++month ) ; + day = 1 + date - absolute_from_gregorian(year, month, 1); + *yearp = year; + *monthp = month; + *dayp = day; +} + +/* Given an absolute date, calculate the Hebrew date */ +void + Converter::hebrew_from_absolute(long date, int *yearp, int *monthp, + int *dayp) +{ + int year, month, day, gyear, gmonth, gday, months; + + gregorian_from_absolute(date, &gyear, &gmonth, &gday); + year = gyear + 3760; + while (date >= absolute_from_hebrew(1 + year, 7, 1)) + year++; + months = hebrew_months_in_year(year); + for (month = 7; + date > absolute_from_hebrew(year, month, + hebrew_month_length(year, month)); + month = 1 + (month % months)) ; + day = 1 + date - absolute_from_hebrew(year, month, 1); + *yearp = year; + *monthp = month; + *dayp = day; +} + +/* Number of months in a Hebrew year */ +int Converter::hebrew_months_in_year(int year) +{ + if (hebrew_leap_year_p(year)) + return 13; + else + return 12; +} + +enum +{ Nissan = + 1, Iyar, Sivan, Tamuz, Ab, Elul, Tishrei, Cheshvan, Kislev, Tevet, + Shvat, Adar, AdarII, AdarI = 12 +}; + +enum +{ January = + 1, February, March, April, May, June, July, August, September, + October, November, December +}; + +/* Number of days in a Hebrew month */ +int Converter::hebrew_month_length(int year, int month) +{ + switch (month) + { + case Tishrei: + case Shvat: + case Nissan: + case Sivan: + case Ab: + return 30; + + case Tevet: + case Iyar: + case Tamuz: + case Elul: + case AdarII: + return 29; + + case Cheshvan: + // 29 days, unless it's a long year. + if ((hebrew_year_length(year) % 10) == 5) + return 30; + else + return 29; + + case Kislev: + // 30 days, unless it's a short year. + if ((hebrew_year_length(year) % 10) == 3) + return 29; + else + return 30; + + case Adar: + // Adar (non-leap year) has 29 days. Adar I has 30 days. + if (hebrew_leap_year_p(year)) + return 30; + else + return 29; + + default: + return 0; + } +} + +/* Number of days in a Julian or gregorian month */ +int + Converter::secular_month_length(int year, + int month /*, bool julianp */ ) +{ + switch (month) + { + case January: + case March: + case May: + case July: + case August: + case October: + case December: + return 31; + case April: + case June: + case September: + case November: + return 30; + case February: + if (gregorian_leap_year_p(year)) + return 29; + else + return 28; + default: + return 0; + } +} + +/* Is it a Leap year in the gregorian calendar */ +bool Converter::gregorian_leap_year_p(int year) +{ + if ((year % 4) != 0) + return 0; + if ((year % 400) == 0) + return 1; + if ((year % 100) == 0) + return 0; + return 1; +} + +/* Is it a leap year in the Jewish Calendar */ +bool Converter::hebrew_leap_year_p(int year) +{ + switch (year % 19) + { + case 0: + case 3: + case 6: + case 8: + case 11: + case 14: + case 17: + return 1; + default: + return 0; + } +} + +/* Return the number of days from 1 Tishrei 0001 to the beginning of the given year. + * Since this routine gets called frequently with the same year arguments, we cache + * the most recent values. + */ +#define MEMORY 5 +long Converter::hebrew_elapsed_days(int year) +{ + static int saved_year[MEMORY] = { -1, -1, -1, -1, -1 }; + static long saved_value[MEMORY]; + int i; + + for (i = 0; i < MEMORY; ++i) + if (year == saved_year[i]) + return saved_value[i]; + for (i = 0; i < MEMORY-1; ++i) { + saved_year[i] = saved_year[1 + i]; + saved_value[i] = saved_value[1 + i]; + } + saved_year[MEMORY - 1] = year; + saved_value[MEMORY - 1] = hebrew_elapsed_days2(year); + return saved_value[MEMORY - 1]; +} + +long Converter::hebrew_elapsed_days2(int year) +{ + long prev_year = year - 1; + long months_elapsed = 235L * (prev_year / 19) /* months in complete cycles so far */ + + 12L * (prev_year % 19) /* regular months in this cycle */ + + (((prev_year % 19) * 7 + 1) / 19); /* leap months this cycle */ + long parts_elapsed = 5604 + 13753 * months_elapsed; + long day = 1 + 29 * months_elapsed + parts_elapsed / 25920; + long parts = parts_elapsed % 25920; + int weekday = (day % 7); + long alt_day = ((parts >= 19440) + || (weekday == 2 && (parts >= 9924) + && !hebrew_leap_year_p(year)) || (weekday == 1 + && (parts >= + 16789) + && + hebrew_leap_year_p + (prev_year))) + ? day + 1 : day; + switch (alt_day % 7) + { + case 0: + case 3: + case 5: + return 1 + alt_day; + default: + return alt_day; + } +} + +/* Number of days in the given Hebrew year */ +int Converter::hebrew_year_length(int year) +{ + return hebrew_elapsed_days(1 + year) - hebrew_elapsed_days(year); +} + +/* Fill in the DateResult structure based on the given secular date */ +void + Converter::SecularToHebrewConversion(int syear, int smonth, + int sday, + struct DateResult *result) +{ + int hyear, hmonth, hday; + long absolute; + + absolute = absolute_from_gregorian(syear, smonth, sday); + + hebrew_from_absolute(absolute, &hyear, &hmonth, &hday); + + result->year = hyear; + result->month = hmonth; + result->day = hday; + finish_up(absolute, hyear, hmonth, syear, smonth, result); +} + +/* Fill in the DateResult structure based on the given Hebrew date */ +void + Converter::HebrewToSecularConversion(int hyear, int hmonth, + int hday, + struct DateResult *result) +{ + int syear, smonth, sday; + long absolute; + + absolute = absolute_from_hebrew(hyear, hmonth, hday); + gregorian_from_absolute(absolute, &syear, &smonth, &sday); + result->year = hyear; + result->month = hmonth; + result->day = hday; + finish_up(absolute, hyear, hmonth, syear, smonth, result); +} + +/* This is common code for filling up the DateResult structure */ +void + Converter::finish_up(long absolute, int hyear, int hmonth, + int syear, int smonth, + struct DateResult *result) +{ + result->hebrew_month_length = hebrew_month_length(hyear, hmonth); + result->secular_month_length = secular_month_length(syear, smonth); + result->hebrew_leap_year_p = hebrew_leap_year_p(hyear); + result->secular_leap_year_p = gregorian_leap_year_p(syear); + result->kvia = (hebrew_year_length(hyear) % 10) - 3; + // absolute is -1 on 1/1/0001 Julian + result->day_of_week = (7 + absolute) % 7; + result->hebrew_day_number = + absolute - absolute_from_hebrew(hyear, 7, 1) + 1; + +} diff --git a/korganizer/plugins/hebrew/converter.h b/korganizer/plugins/hebrew/converter.h new file mode 100644 index 000000000..8a3bc8baf --- /dev/null +++ b/korganizer/plugins/hebrew/converter.h @@ -0,0 +1,75 @@ +/*************************************************************************** + * Copyright (C) 2003 by Jonathan Singer * + * jsinger@leeta.net * + * Calendar routines from Hebrew Calendar by Frank Yellin * + * * + * 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. * + ***************************************************************************/ +#ifndef CONVERTER_H +#define CONVERTER_H + +#include <qstring.h> +#include <qstringlist.h> + +struct DateResult +{ + int year; + int month; + int day; + int day_of_week; + + int hebrew_month_length, secular_month_length; + bool hebrew_leap_year_p, secular_leap_year_p; + int kvia; + int hebrew_day_number; +}; + +/** +@author Jonathan Singer +*/ +class Converter +{ +public: + + Converter(); + ~Converter(); + + static bool hebrew_leap_year_p(int year); + static bool gregorian_leap_year_p(int year); + + static long absolute_from_gregorian(int year, int month, int day); + static long absolute_from_hebrew(int year, int month, int day); + + static void gregorian_from_absolute(long date, int *yearp, + int *monthp, int *dayp); + static void hebrew_from_absolute(long date, int *yearp, int *monthp, + int *dayp); + + static int hebrew_months_in_year(int year); + static int hebrew_month_length(int year, int month); + static int secular_month_length(int year, int month); + + static long hebrew_elapsed_days(int year); + static long hebrew_elapsed_days2(int year); + static int hebrew_year_length(int year); + + static void finish_up(long absolute, int hyear, int hmonth, + int syear, int smonth, + struct DateResult *result); + + static void SecularToHebrewConversion(int year, int month, int day, + struct DateResult *result); + static void HebrewToSecularConversion(int year, int month, int day, + struct DateResult *result); + +private: + + static QStringList HebrewMonthNames; + static QStringList SecularMonthNames; + +}; + +#endif diff --git a/korganizer/plugins/hebrew/hebrew.cpp b/korganizer/plugins/hebrew/hebrew.cpp new file mode 100644 index 000000000..4c557d00d --- /dev/null +++ b/korganizer/plugins/hebrew/hebrew.cpp @@ -0,0 +1,112 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2003 Jonathan Singer <jsinger@leeta.net> + + 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. +*/ + +#include <kglobal.h> +#include <kconfig.h> +#include <kstandarddirs.h> +#include <ksimpleconfig.h> +#include <kcalendarsystem.h> +#include <kcalendarsystemfactory.h> +#include "hebrew.h" +#include "configdialog.h" +#include "parsha.h" +#include "converter.h" +#include "holiday.h" + +bool Hebrew::IsraelP; + +class HebrewFactory:public CalendarDecorationFactory +{ +public: + CalendarDecoration * create() + { + return new Hebrew; + } +}; + +K_EXPORT_COMPONENT_FACTORY( libkorg_hebrew, HebrewFactory ) + + +QString Hebrew::shortText(const QDate & date) +{ + + KConfig config("korganizerrc", true, false); // Open read-only, no kdeglobals + + config.setGroup("Calendar/Hebrew Calendar Plugin"); + IsraelP = + config.readBoolEntry("Israel", + (KGlobal::locale()->country() == ".il")); + Holiday::ParshaP = config.readBoolEntry("Parsha", true); + Holiday::CholP = config.readBoolEntry("Chol_HaMoed", true); + Holiday::OmerP = config.readBoolEntry("Omer", true); + QString *label_text = new QString(); + + int day = date.day(); + int month = date.month(); + int year = date.year(); + + // core calculations!! + struct DateResult result; + + Converter::SecularToHebrewConversion(year, month, day, /*0, */ + &result); + int hebrew_day = result.day; + int hebrew_month = result.month; + int hebrew_year = result.year; + int hebrew_day_of_week = result.day_of_week; + bool hebrew_leap_year_p = result.hebrew_leap_year_p; + int hebrew_kvia = result.kvia; + int hebrew_day_number = result.hebrew_day_number; + + QStringList holidays = + Holiday::FindHoliday(hebrew_month, hebrew_day, + hebrew_day_of_week + 1, hebrew_kvia, + hebrew_leap_year_p, IsraelP, + hebrew_day_number, hebrew_year); + + KCalendarSystem *cal = KCalendarSystemFactory::create("hebrew"); + *label_text = QString("%1 %2").arg(cal->dayString(date, false)) + .arg(cal->monthName(date)); + + if (holidays.count()) + { + int count = holidays.count(); + + for (int h = 0; h <= count; ++h) + { + *label_text += "\n" + holidays[h]; + } + } + + return *label_text; +} + +QString Hebrew::info() +{ + return + i18n("This plugin provides the date in the Jewish calendar."); +} + +void Hebrew::configure(QWidget * parent) +{ + ConfigDialog *dlg = new ConfigDialog(parent); //parent? + + dlg->exec(); + delete dlg; +} diff --git a/korganizer/plugins/hebrew/hebrew.desktop b/korganizer/plugins/hebrew/hebrew.desktop new file mode 100644 index 000000000..86c88328d --- /dev/null +++ b/korganizer/plugins/hebrew/hebrew.desktop @@ -0,0 +1,101 @@ +[Desktop Entry] +X-KDE-Library=libkorg_hebrew +Name=Jewish Calendar Plugin +Name[af]=Joodse kalender inprop module +Name[bg]=Приставка за еврейския календар +Name[br]=Lugent deiziadur yudev +Name[bs]=Dodatak za hebrejski kalendar +Name[ca]=Endollable de calendari jueu +Name[cs]=Modul židovského kalendáře +Name[da]=Jødisk kalender-plugin +Name[de]=Modul für jüdischen Kalender +Name[el]=Πρόσθετο εβραϊκού ημερολογίου +Name[eo]=Judkalendar-kromaĵo +Name[es]=Accesorio de calendario judío +Name[et]=Juudi kalendri plugin +Name[eu]=Egutegi judutar plugin-a +Name[fa]=وصلۀ تقویم یهودی +Name[fi]=Juutalaisen kalenterin laajennus +Name[fr]=Module de prise en charge du calendrier juif +Name[fy]=Joadske kalenderplugin +Name[gl]=Extensión para Calendario Xudeu +Name[hu]=Bővítőmodul a zsidó naptár kezeléséhez +Name[is]=Gyðinga dagatalsíforrit +Name[it]=Plugin calendario ebraico +Name[ja]=ユダヤ歴カレンダープラグイン +Name[ka]=ებრაული კალენდრის მოდული +Name[kk]=Яһуди күнтізбесінің модулі +Name[km]=កម្មវិធីជំនួយប្រតិទិន Jewish +Name[lt]=Žydų kalendoriaus priedas +Name[mk]=Приклучок за еврејски календар +Name[ms]=PLugin Kalender Yahudi +Name[nb]=Programtillegg for jødisk kalender +Name[nds]=Moduul för juudschen Kalenner +Name[ne]=यहूदि क्यालेन्डर प्लगइन +Name[nl]=Joodse kalenderplugin +Name[nn]=Programtillegg for jødisk kalender +Name[pl]=Wtyczka kalendarza żydowskiego +Name[pt]='Plugin' do Calendário Judeu +Name[pt_BR]=Plug-in de Calendário Judaico +Name[ru]=Еврейский календарь +Name[sk]=Modul Židovského kalendára +Name[sl]=Vstavek za židovski koledar +Name[sr]=Прикључак календара за јеврејски календар +Name[sr@Latn]=Priključak kalendara za jevrejski kalendar +Name[sv]=Insticksprogram för judisk kalender +Name[ta]=ஜூவிஷ் நாள்காட்டி சொருகுப்பொருள் +Name[tg]=Тақвимоти яҳудӣ +Name[tr]=İbrani Takvimi Eklentisi +Name[uk]=Втулок єврейського календаря +Name[zh_CN]=犹太教日历插件 +Name[zh_TW]=猶太行事曆外掛程式 +Comment=Shows all dates in korganizer also in the Jewish calendar system. +Comment[af]=Vertoon alle datums in KOrganizer ook volgens die Joodse kalender. +Comment[bg]=Приставката служи за показване на датите според еврейския календар. +Comment[ca]=Mostra totes les dates del korganizer també en el sistema del calendari jueu. +Comment[cs]=Zobrazení všech dat v korganizeru také v židovském kalendáři. +Comment[da]=Viser alle datoer i korganizer også i det jødiske kalendersystem. +Comment[de]=Zeigt alle Daten in KOrganizer auch im jüdischen Kalendarium an. +Comment[el]=Εμφανίζει όλες τις ημερομηνίες στο korganizer και στο εβραϊκό ημερολογιακό σύστημα. +Comment[es]=Muestra todas las fechas de korganizer también en el sistema de calendario judío. +Comment[et]=Näitab KOrganizeris kõiki kuupäevi ka juudi kalendri järgi. +Comment[eu]=korganizer-en data guztiak egutegi judutar sisteman ere erakusten ditu. +Comment[fa]=همۀ تاریخهای korganizer، همچنین سیستم تقویم یهودی را نمایش میدهد. +Comment[fi]=Näyttää kaikki päivät KOrganizerissa myös Juutalaisen kalenterijärjestelmän mukaan. +Comment[fr]=Affiche toutes les dates de KOrganizer selon le calendrier Juif +Comment[fy]=Lit alle datums yn KOrganizer ek yn it Joadske kalinderssysteem sjen. +Comment[gl]=Amosa todas as datas en korganizer, tamén o sistema de calendario xudeu. +Comment[he]=מציג את כל התאריכים בארגונית גם בלוח השנה העברי +Comment[hu]=A KOrganizer dátumait kiírja a hagyományos zsidó naptár szerint is. +Comment[is]=Sýna alla dagsetningar í KOrganizer sem eru einnig í dagatali gyðinga. +Comment[it]=Mostra tutte le date in korganizer secondo il calendario ebraico. +Comment[ja]=korganizer のすべての日付をユダヤ暦でも表示します。 +Comment[ka]=ყველა თარიღს ებრაული კალენდრის მიხედვითაც აჩვენებს +Comment[kk]=Яһуди күнтізбе күндерін korganizer-де көрсететін модулі. +Comment[km]=បង្ហាញកាលបរិច្ឆេទទាំងអស់ក្នុង korganizer នៅក្នុងប្រព័ន្ធប្រតិទិន Jewish ។ +Comment[lt]=Rodo visas dienas kalendoriuje taip pat ir žydų kalendoriaus sistema. +Comment[mk]=Ги прикажува сите датуми во КОрганизатор и според еврејскиот календар. +Comment[ms]=Memaparkan semua tarikh dalam korganizer dan juga dalam sistem kalendar Yahudi. +Comment[nb]=Viser alle datoer i korganizer også i det jødiske kalendersystemet. +Comment[nds]=Wiest all Daten binnen KOrganizer ok in den juudschen Kalenner. +Comment[ne]=केडीई आयोजकमा पनि सबै मिति यहूदि क्यालेन्डर प्रणालीमा देखाउछ । +Comment[nl]=Toont alle data in KOrganizer ook in het Joodse kalendersysteem. +Comment[nn]=Viser alle datoane i KOrganizer i den jødiske kalenderen. +Comment[pl]=Pokazuje wszystkie daty w KOrganizerze również w kalendarzu żydowskim. +Comment[pt]=Mostra todas as datas no KOrganizer também no sistema de calendários Judeu. +Comment[pt_BR]=Mostra todas as datas no KOrganizer também no sistema de calendário judaico +Comment[ru]=Показывать все даты по еврейскому календарю. +Comment[sk]=Zobrazí všetky dátumy v korganizer tiež aj židovskom kalendári. +Comment[sl]=Prikaže vse datume v KOrganizerju; tudi v židovskem koledarskem sistemu. +Comment[sr]=Приказује све датуме у KOrganizer-у и по јеврејском календарском систему. +Comment[sr@Latn]=Prikazuje sve datume u KOrganizer-u i po jevrejskom kalendarskom sistemu. +Comment[sv]=Visar också alla datum i Korganizer enligt den judiska kalendern. +Comment[ta]=korganizer மற்றும் ஜேவிஷ் நாட்காட்டி அமைப்பில் ல் உள்ள எல்லா தேதிகளையும் காட்டுகிறது. +Comment[tr]=KOrganizer'da tüm tarihleri İbrani takvimine göre gösterir. +Comment[uk]=Показує всі дати в korganizer також і в системі єврейського календаря. +Comment[zh_CN]=在 KOrganizer 中显示犹太教日历系统的全部日期。 +Comment[zh_TW]=顯示所有猶太行事曆的日期 +Type=Service +ServiceTypes=Calendar/Plugin,Calendar/Decoration +X-KDE-KOrganizer-HasSettings=true +X-KDE-PluginInterfaceVersion=2 diff --git a/korganizer/plugins/hebrew/hebrew.h b/korganizer/plugins/hebrew/hebrew.h new file mode 100644 index 000000000..1153c1012 --- /dev/null +++ b/korganizer/plugins/hebrew/hebrew.h @@ -0,0 +1,47 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2003 Jonathan Singer <jsinger@leeta.net> + + 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. +*/ +#ifndef KORG_HEBREW_H +#define KORG_HEBREW_H + +#include <qstring.h> +#include <qstringlist.h> +#include <calendar/calendardecoration.h> + +using namespace KOrg; + +class Hebrew:public CalendarDecoration +{ +public: + Hebrew() + { + } + ~Hebrew() + { + } + void configure(QWidget * parent); + QString shortText(const QDate &); + + QString info(); + static bool IsraelP; + +private: + +}; + +#endif diff --git a/korganizer/plugins/hebrew/holiday.cpp b/korganizer/plugins/hebrew/holiday.cpp new file mode 100644 index 000000000..732a00447 --- /dev/null +++ b/korganizer/plugins/hebrew/holiday.cpp @@ -0,0 +1,431 @@ +/*************************************************************************** + * Copyright (C) 2003 by Jonathan Singer * + * jsinger@leeta.net * + * Calendar routines from Hebrew Calendar by Frank Yellin * + * * + * 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. * + ***************************************************************************/ +#include "holiday.h" +#include <klocale.h> + +bool Holiday::CholP; +bool Holiday::OmerP; +bool Holiday::ParshaP; + +QStringList Holiday::holidays; +int Holiday::HolidayFlags; + +Holiday::Holiday() +{ + +} + +Holiday::~Holiday() +{ +} + +/* Given a day of the Hebrew month, figuring out all the interesting holidays that +* correspond to that date. ParshaP, OmerP, and CholP determine whether we should +* given info about the Parsha of the week, the Sfira, or Chol Hamoed. +* +* We are also influenced by the IsraelP flag +*/ + +QStringList + Holiday::FindHoliday(int month, int day, int weekday, int kvia, + bool leap_year_p, bool israel_p, + int day_number, int year) +{ + + enum + { Sunday = 1, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday + }; + + holidays.clear(); + bool shabbat_p = (weekday == Saturday); // Is it a Saturday? + + // Treat Adar in a non-leap year as if it were Adar II. + if ((month == 12) && !leap_year_p) + month = 13; + switch (month) + { + case 1: /* Nissan */ + switch (day) + { + case 1: + if (shabbat_p) + holidays << + i18n + ("These are Jewish holidays and mostly do not have translations. They may have different spellings in your language; otherwise, just translate the sound to your characters", + "Sh. HaHodesh"); + break; + case 14: + if (!shabbat_p) + // If it's Shabbat, we have three pieces of info. + // This is the least important. + holidays << i18n("Erev Pesach"); + /* Fall thru */ + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + // The Saturday before Pesach (8th-14th) + if (shabbat_p) + holidays << i18n("Sh. HaGadol"); + break; + case 15: + case 16: + case 21: + case 22: + if (!israel_p || (day == 15) || (day == 21)) + { + holidays << i18n("Pesach"); + break; + } + else if (day == 22) + break; + /* else fall through */ + case 17: + case 18: + case 19: + case 20: + if (CholP) + holidays << i18n("Chol Hamoed"); + break; + case 27: + // Yom HaShoah only exists since Israel was established. + if (year > 1948 + 3760) + holidays << i18n("Yom HaShoah"); + break; + } + if ((day > 15) && OmerP) + // Count the Omer, starting after the first day of Pesach. + holidays << Sfirah(day - 15); + break; + + case 2: /* Iyar */ + switch (day) + { + case 2: + case 3: + case 4: + case 5: + // Yom HaAtzmaut is on the 5th, unless that's a Saturday, in which + // case it is moved back two days to Thursday. Yom HaZikaron is + // the day before Yom HaAtzmaut. + if (year >= 1948 + 3760) + { // only after Israel established. + switch (weekday) + { + case Wednesday: + if (day == 5) + holidays << i18n("Yom HaAtzmaut"); + else + holidays << i18n("Yom HaZikaron"); + break; + case Thursday: + // This can't be 2 Iyar. + holidays << i18n("Yom HaAtzmaut"); + break; + case Friday: + case Saturday: + // These are never either of them. + break; + default: + // All other days follow the normal rules. + if (day == 4) + holidays << i18n("Yom HaZikaron"); + else if (day == 5) + holidays << i18n("Yom HaAtzmaut"); + } + } + break; + case 28: + // only since the 1967 war + if (year > 1967 + 3760) + holidays << i18n("Yom Yerushalayim"); + break; + case 18: + holidays << i18n("Lag BaOmer"); + break; + } + if ((day != 18) && OmerP) + // Sfirah the whole month. But Lag BaOmer is already mentioned. + holidays << Sfirah(day + 15); + + break; + + case 3: /* Sivan */ + switch (day) + { + case 1: + case 2: + case 3: + case 4: + // Sfirah until Shavuot + if (OmerP) + holidays << Sfirah(day + 44); + break; + case 5: + // Don't need to mention Sfira(49) if there's already two other + // pieces of information + if (OmerP && !shabbat_p) + holidays << Sfirah(49); + holidays << i18n("Erev Shavuot"); + break; + case 6: + case 7: + if (!israel_p || (day == 6)) + holidays << i18n("Shavuot"); + break; + } + break; + + case 4: /* Tamuz */ + // 17th of Tamuz, except Shabbat pushes it to Sunday. + if ((!shabbat_p && (day == 17)) + || ((weekday == 1) && (day == 18))) + holidays << i18n("Tzom Tammuz"); + break; + + case 5: /* Ab */ + if (shabbat_p && (3 <= day) && (day <= 16)) + // The shabbat before and after Tisha B'Av are special + if (day <= 9) + holidays << i18n("Sh. Hazon"); + else + holidays << i18n("Sh. Nahamu"); + else if ((!shabbat_p && (day == 9)) + || ((weekday == 1) && (day == 10))) + // 9th of Av, except Shabbat pushes it to Sunday. + holidays << i18n("Tisha B'Av"); + break; + + case 6: /* Elul */ + if ((day >= 20) && (day <= 26) && shabbat_p) + holidays << i18n("S'lichot"); + else if (day == 29) + holidays << i18n("Erev R.H."); + break; + + case 7: /* Tishrei */ + switch (day) + { + case 1: + case 2: + holidays << i18n("Rosh Hashana"); + break; + case 3: + if (shabbat_p) + holidays << i18n("Sh. Shuvah"); + else + holidays << i18n("Tzom Gedalia"); + break; + case 4: + if (weekday == 1) + holidays << i18n("Tzom Gedalia"); + /* fall through */ + case 5: + case 6: + case 7: + case 8: + if (shabbat_p) + holidays << i18n("Sh. Shuvah"); + break; + case 9: + holidays << i18n("Erev Y.K."); + break; + case 10: + holidays << i18n("Yom Kippur"); + break; + case 14: + holidays << i18n("Erev Sukkot"); + break; + case 15: + case 16: + if (!israel_p || (day == 15)) + { + holidays << i18n("Sukkot"); + break; + } + /* else fall through */ + case 17: + case 18: + case 19: + case 20: + if (CholP) + holidays << i18n("Chol Hamoed"); + break; + case 21: + holidays << i18n("Hoshana Rabah"); + break; + case 22: + holidays << i18n("Shmini Atzeret"); + break; + case 23: + if (!israel_p) + holidays << i18n("Simchat Torah"); + break; + } + break; + case 8: /* Cheshvan */ + break; + + case 9: /* Kislev */ + if (day == 24) + holidays << i18n("Erev Hanukah"); + else if (day >= 25) + holidays << i18n("Hanukah"); + break; + + case 10: /* Tevet */ + if (day <= (kvia == 0 ? 3 : 2)) + // Need to know length of Kislev to determine last day of Chanukah + holidays << i18n("Hanukah"); + else if (((day == 10) && !shabbat_p) + || ((day == 11) && (weekday == 1))) + // 10th of Tevet. Shabbat pushes it to Sunday + holidays << i18n("Tzom Tevet"); + break; + + case 11: /* Shvat */ + switch (day) + { + // The info for figuring out Shabbat Shirah is from the Gnu code. I + // assume it's correct. +// static char *song = i18n("Sh. Shirah"; + case 10: + if ((kvia != 0) && shabbat_p) + holidays << i18n("Sh. Shirah"); + break; + case 11: + case 12: + case 13: + case 14: + case 16: + if (shabbat_p) + holidays << i18n("Sh. Shirah"); + break; + case 15: + if (shabbat_p) + holidays << i18n("Sh. Shirah"); + holidays << i18n("Tu B'Shvat"); + case 17: + if ((kvia == 0) && shabbat_p) + holidays << i18n("Sh. Shirah"); + break; + case 25: + case 26: + case 27: + case 28: + case 29: + case 30: + // The last shabbat on or before 1 Adar or 1 AdarII + if (shabbat_p && !leap_year_p) + holidays << i18n("Sh. Shekalim"); + break; + } + break; + + case 12: /* Adar I */ + if (day == 14) + // Eat Purim Katan Candy + holidays << i18n("Purim Katan"); + else if ((day >= 25) && shabbat_p) + // The last shabbat on or before 1 Adar II. + holidays << i18n("Sh. Shekalim"); + break; + + case 13: /* Adar II or Adar */ + switch (day) + { + case 1: + if (shabbat_p) + holidays << i18n("Sh. Shekalim"); + break; + case 11: + case 12: + // Ta'anit ester is on the 13th. But shabbat moves it back to + // Thursday. + if (weekday == Thursday) + holidays << i18n("Ta'anit Ester"); + /* Fall thru */ + case 7: + case 8: + case 9: + case 10: + // The Shabbat before purim is Shabbat Zachor + if (shabbat_p) + holidays << i18n("Sh. Zachor"); + break; + case 13: + if (shabbat_p) + holidays << i18n("Sh. Zachor"); + else + holidays << i18n("Erev Purim"); + // It's Ta'anit Esther, unless it's a Friday or Saturday + if (weekday < Friday) + holidays << i18n("Ta'anit Ester"); + break; + case 14: + holidays << i18n("Purim"); + break; + case 15: + if (!shabbat_p) + holidays << i18n("Shushan Purim"); + break; + case 16: + if (weekday == 1) + holidays << i18n("Shushan Purim"); + break; + case 17: + case 18: + case 19: + case 20: + case 21: + case 22: + case 23: + if (shabbat_p) + holidays << i18n("Sh. Parah"); + break; + case 24: + case 25: + case 26: + case 27: + case 28: + case 29: + if (shabbat_p) + holidays << i18n("Sh. HaHodesh"); + break; + } + break; + } + if (shabbat_p && ParshaP) + // Find the Parsha on Shabbat. + holidays << Parsha::FindParshaName(day_number, kvia, leap_year_p, + israel_p); + return holidays; +} + +/* Return a string corresponding to the nth day of the Omer */ +QString Holiday::Sfirah(int day) +{ + /*static char buffer[40]; + char *endings[] = {"th", "st", "nd", "rd"}; + int remainder = day % 10; + // 11-19 and anything not ending with 1, 2, or 3 uses -th as suffix. + if ( ((day >= 11) && (day <= 19)) || (remainder > 3)) remainder = 0; + sprintf(buffer, "%d%s day Omer", day, endings[remainder]); + return buffer; */ + QString buffer; + + buffer.setNum(day); + buffer + i18n(" Omer"); // Fix this to original function + return buffer; + +} diff --git a/korganizer/plugins/hebrew/holiday.h b/korganizer/plugins/hebrew/holiday.h new file mode 100644 index 000000000..6c8c61d9d --- /dev/null +++ b/korganizer/plugins/hebrew/holiday.h @@ -0,0 +1,46 @@ +/*************************************************************************** + * Copyright (C) 2003 by Jonathan Singer * + * jsinger@leeta.net * + * Calendar routines from Hebrew Calendar by Frank Yellin * + * * + * 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. * + ***************************************************************************/ +#ifndef HOLIDAY_H +#define HOLIDAY_H + +#include <qstring.h> +#include <qstringlist.h> +#include <parsha.h> +/** +@author Jonathan Singer +*/ +class Holiday +{ +public: + + Holiday(); + ~Holiday(); + + static QStringList FindHoliday(int month, int day, int weekday, + int kvia, bool leap_year_p, + bool israel_p, int day_number, + int year); + + static QString Sfirah(int); + + static bool CholP; + static bool OmerP; + static bool ParshaP; + +private: + + static QStringList holidays; + static int HolidayFlags; //supposed to be extern + +//parsha Parsha_lookup; +}; + +#endif diff --git a/korganizer/plugins/hebrew/parsha.cpp b/korganizer/plugins/hebrew/parsha.cpp new file mode 100644 index 000000000..21fdf8a4e --- /dev/null +++ b/korganizer/plugins/hebrew/parsha.cpp @@ -0,0 +1,273 @@ +/*************************************************************************** + * Copyright (C) 2003 by Jonathan Singer * + * jsinger@leeta.net * + * Calendar routines from Hebrew Calendar by Frank Yellin * + * * + * 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. * + ***************************************************************************/ +#include "parsha.h" +#include <klocale.h> + +QStringList Parsha::parshiot_names; + +Parsha::Parsha() +{ + +} + +Parsha::~Parsha() +{ +} + +QString + Parsha::FindParshaName(int daynumber, int kvia, bool leap_p, + bool israel_p) +{ +// The names of the Parshiot. + parshiot_names << + i18n + ("These are weekly readings and do not have translations. They may have different spellings in your language; otherwise, just translate the sound to your characters", + "Bereshit") << i18n("Noach") << i18n("Lech L'cha") << + i18n("Vayera") << i18n("Chaye Sarah") << i18n("Toldot") << + i18n("Vayetze") << i18n("Vayishlach") << i18n("Vayeshev") << + i18n("Miketz") << i18n("Vayigash") << i18n("Vayechi") << + i18n("Shemot") << i18n("Vaera") << i18n("Bo") << i18n("Beshalach") + << i18n("Yitro") << i18n("Mishpatim") << i18n("Terumah") << + i18n("Tetzaveh") << i18n("Ki Tisa") << i18n("Vayakhel") << + i18n("Pekudei") << i18n("Vayikra") << i18n("Tzav") << + i18n("Shemini") << i18n("Tazria") << i18n("Metzora") << + i18n("Acharei Mot") << i18n("Kedoshim") << i18n("Emor") << + i18n("Behar") << i18n("Bechukotai") << i18n("Bemidbar") << + i18n("Naso") << i18n("Behaalotcha") << i18n("Shelach") << + i18n("Korach") << i18n("Chukat") << i18n("Balak") << + i18n("Pinchas") << i18n("Matot") << i18n("Masei") << + i18n("Devarim") << i18n("Vaetchanan") << i18n("Ekev") << + i18n("Reeh") << i18n("Shoftim") << i18n("Ki Tetze") << + i18n("Ki Tavo") << i18n("Nitzavim") << i18n("Vayelech") << + i18n("Haazinu"); + +// Tables for each of the year types. XX indicates that it is a Holiday, and +// a special parsha is read that week. For some year types, Israel is different +// than the diaspora. +// +// The names indicate the day of the week on which Rosh Hashanah fell, whether +// it is a short/normal/long year (kvia=0,1,2), and whether it is a leap year. +// Some year types also have an _Israel version. +// +// Numbers are indices into the table above for a given week. Numbers > 100 indicate +// a double parsha. E.g. 150 means read both table entries 50 and 51. +// +// These tables were stolen (with some massaging) from the GNU code. + +#define XX 255 + static unsigned const char Sat_short[] = + { XX, 52, XX, XX, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 121, 23, 24, XX, 25, + 126, 128, 30, 131, 33, 34, 35, 36, 37, 38, 39, 40, 141, 43, 44, + 45, 46, 47, 48, 49, 50, + }; + + static unsigned const char Sat_long[] = + { XX, 52, XX, XX, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 121, 23, 24, XX, 25, + 126, 128, 30, 131, 33, 34, 35, 36, 37, 38, 39, 40, 141, 43, 44, + 45, 46, 47, 48, 49, 150, + }; + + static unsigned const char Mon_short[] = + { 51, 52, XX, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 121, 23, 24, XX, 25, 126, + 128, 30, 131, 33, 34, 35, 36, 37, 38, 39, 40, 141, 43, 44, 45, + 46, 47, 48, 49, 150, + }; + + static unsigned const char Mon_long[] = /* split */ + { 51, 52, XX, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 121, 23, 24, XX, 25, 126, + 128, 30, 131, 33, XX, 34, 35, 36, 37, 138, 40, 141, 43, 44, 45, + 46, 47, 48, 49, 150, + }; + +#define Mon_long_Israel Mon_short + +#define Tue_normal Mon_long +#define Tue_normal_Israel Mon_short + + static unsigned const char Thu_normal[] = + { 52, XX, XX, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 121, 23, 24, XX, XX, 25, + 126, 128, 30, 131, 33, 34, 35, 36, 37, 38, 39, 40, 141, 43, 44, + 45, 46, 47, 48, 49, 50, + }; + static unsigned const char Thu_normal_Israel[] = + { 52, XX, XX, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 121, 23, 24, XX, 25, 126, + 128, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 141, 43, 44, + 45, 46, 47, 48, 49, 50, + }; + + static unsigned const char Thu_long[] = + { 52, XX, XX, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, XX, 25, + 126, 128, 30, 131, 33, 34, 35, 36, 37, 38, 39, 40, 141, 43, 44, + 45, 46, 47, 48, 49, 50, + }; + + static unsigned const char Sat_short_leap[] = + { XX, 52, XX, XX, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, XX, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 141, 43, 44, 45, 46, 47, 48, 49, 150, + }; + + static unsigned const char Sat_long_leap[] = + { XX, 52, XX, XX, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, XX, 28, 29, 30, 31, 32, 33, XX, 34, 35, 36, 37, 138, + 40, 141, 43, 44, 45, 46, 47, 48, 49, 150, + }; + +#define Sat_long_leap_Israel Sat_short_leap + + static unsigned const char Mon_short_leap[] = + { 51, 52, XX, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, XX, 28, 29, 30, 31, 32, 33, XX, 34, 35, 36, 37, 138, 40, + 141, 43, 44, 45, 46, 47, 48, 49, 150, + }; + static unsigned const char Mon_short_leap_Israel[] = + { 51, 52, XX, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, XX, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 141, 43, 44, 45, 46, 47, 48, 49, 150, + }; + + static unsigned const char Mon_long_leap[] = + { 51, 52, XX, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, XX, XX, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 141, 43, 44, 45, 46, 47, 48, 49, 50, + }; + static unsigned const char Mon_long_leap_Israel[] = + { 51, 52, XX, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, XX, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + }; + +#define Tue_normal_leap Mon_long_leap +#define Tue_normal_leap_Israel Mon_long_leap_Israel + + static unsigned const char Thu_short_leap[] = + { 52, XX, XX, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, XX, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + }; + + static unsigned const char Thu_long_leap[] = + { 52, XX, XX, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, XX, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 150, + }; + +/* Find the parsha for a given day of the year. daynumber is the day of the year. + * kvia and leap_p refer to the year type. + */ + + int week = daynumber / 7; // week of the year + unsigned const char *array = NULL; + int index; + + // get the appropriate array by exhaustive search into the 14 year types. Since we + // know it's a Shabbat, we can find out what day Rosh Hashanah was on by looking + // at daynumber %7. + if (!leap_p) + { + switch (daynumber % 7) + { + case 1: /* RH was on a Saturday */ + if (kvia == 0) + array = Sat_short; + else if (kvia == 2) + array = Sat_long; + break; + case 6: /* RH was on a Monday */ + if (kvia == 0) + array = Mon_short; + else if (kvia == 2) + array = israel_p ? Mon_long_Israel : Mon_long; + break; + case 5: /* RH was on a Tueday */ + if (kvia == 1) + array = israel_p ? Tue_normal_Israel : Tue_normal; + break; + case 3: /* RH was on a Thu */ + if (kvia == 1) + array = israel_p ? Thu_normal_Israel : Thu_normal; + else if (kvia == 2) + array = Thu_long; + break; + } + } + else /* leap year */ + switch (daynumber % 7) + { + case 1: /* RH was on a Sat */ + if (kvia == 0) + array = Sat_short_leap; + else if (kvia == 2) + array = israel_p ? Sat_long_leap_Israel : Sat_long_leap; + break; + case 6: /* RH was on a Mon */ + if (kvia == 0) + array = israel_p ? Mon_short_leap_Israel : Mon_short_leap; + else if (kvia == 2) + array = israel_p ? Mon_long_leap_Israel : Mon_long_leap; + break; + case 5: /* RH was on a Tue */ + if (kvia == 1) + array = + israel_p ? Tue_normal_leap_Israel : Tue_normal_leap; + break; + case 3: /* RH was on a Thu */ + if (kvia == 0) + array = Thu_short_leap; + else if (kvia == 2) + array = Thu_long_leap; + break; + + } + + QString buffer; + + if (array == NULL) + /* Something is terribly wrong. */ + { + buffer = "??Parsha??"; + return buffer; + } + index = array[week]; + if (index == XX) // no Parsha this week. + { + buffer = ""; + return buffer; + } + else if (index < 100) + { + buffer = parshiot_names[index]; + return buffer; + } + else + { // Create a double parsha + buffer = + parshiot_names[index - 100] + "-" + parshiot_names[index - + 99]; + return buffer; + + } +} diff --git a/korganizer/plugins/hebrew/parsha.h b/korganizer/plugins/hebrew/parsha.h new file mode 100644 index 000000000..aac2625ff --- /dev/null +++ b/korganizer/plugins/hebrew/parsha.h @@ -0,0 +1,33 @@ +/*************************************************************************** + * Copyright (C) 2003 by Jonathan Singer * + * jsinger@leeta.net * + * Calendar routines from Hebrew Calendar by Frank Yellin * + * * + * 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. * + ***************************************************************************/ +#ifndef PARSHA_H +#define PARSHA_H + +#include <qstring.h> +#include <qstringlist.h> + +/** +@author Jonathan Singer +*/ +class Parsha +{ +public: + + Parsha(); + ~Parsha(); + static QString FindParshaName(int daynumber, int kvia, bool leap_p, + bool israel_p); + +private: + static QStringList parshiot_names; +}; + +#endif diff --git a/korganizer/plugins/printing/Makefile.am b/korganizer/plugins/printing/Makefile.am new file mode 100644 index 000000000..5e53a9ff7 --- /dev/null +++ b/korganizer/plugins/printing/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = journal year diff --git a/korganizer/plugins/printing/journal/Makefile.am b/korganizer/plugins/printing/journal/Makefile.am new file mode 100644 index 000000000..6238b1f18 --- /dev/null +++ b/korganizer/plugins/printing/journal/Makefile.am @@ -0,0 +1,14 @@ +INCLUDES = -I$(top_srcdir)/korganizer/interfaces -I$(top_srcdir)/korganizer/printing -I$(top_srcdir) $(all_includes) + +kde_module_LTLIBRARIES = libkorg_journalprint.la + +libkorg_journalprint_la_SOURCES =calprintjournalconfig_base.ui journalprint.cpp +libkorg_journalprint_la_LDFLAGS = -module $(KDE_PLUGIN) $(KDE_RPATH) $(all_libraries) +libkorg_journalprint_la_LIBADD = $(LIB_KDECORE) $(LIB_KDEUI) $(top_builddir)/korganizer/printing/libkorg_stdprinting.la + +noinst_HEADERS = + +servicedir = $(kde_servicesdir)/korganizer +service_DATA = journalprint.desktop + +METASOURCES = AUTO diff --git a/korganizer/plugins/printing/journal/calprintjournalconfig_base.ui b/korganizer/plugins/printing/journal/calprintjournalconfig_base.ui new file mode 100644 index 000000000..bee91a368 --- /dev/null +++ b/korganizer/plugins/printing/journal/calprintjournalconfig_base.ui @@ -0,0 +1,201 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>CalPrintJournalConfig_Base</class> +<comment>Configuration page for the print journal mode.</comment> +<author>Reinhold Kainhofer <reinhold@kainhofer.com></author> +<widget class="QWidget"> + <property name="name"> + <cstring>CalPrintJournal_Base</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>337</width> + <height>247</height> + </rect> + </property> + <property name="caption"> + <string>CalPrintJournal_Base</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QButtonGroup"> + <property name="name"> + <cstring>mDateRangeGroup</cstring> + </property> + <property name="title"> + <string>Date && Time Range</string> + </property> + <property name="selectedId" stdset="0"> + <number>1</number> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton"> + <property name="name"> + <cstring>mAllJournals</cstring> + </property> + <property name="text"> + <string>&All journal entries</string> + </property> + <property name="buttonGroupId"> + <number>0</number> + </property> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>mRangeJournals</cstring> + </property> + <property name="focusPolicy"> + <enum>TabFocus</enum> + </property> + <property name="text"> + <string>Date &range:</string> + </property> + <property name="buttonGroupId"> + <number>1</number> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer6</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>15</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel"> + <property name="name"> + <cstring>mFromDateLabel</cstring> + </property> + <property name="text"> + <string>&Start date:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>mFromDate</cstring> + </property> + </widget> + <widget class="KDateEdit"> + <property name="name"> + <cstring>mFromDate</cstring> + </property> + <property name="focusPolicy"> + <enum>StrongFocus</enum> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>mToDateLabel</cstring> + </property> + <property name="text"> + <string>&End date:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>mToDate</cstring> + </property> + </widget> + <widget class="KDateEdit"> + <property name="name"> + <cstring>mToDate</cstring> + </property> + <property name="focusPolicy"> + <enum>StrongFocus</enum> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>324</width> + <height>21</height> + </size> + </property> + </spacer> + </hbox> + </widget> + </vbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer3</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>201</height> + </size> + </property> + </spacer> + </vbox> +</widget> +<customwidgets> + <customwidget> + <class>KDateEdit</class> + <header location="local">libkdepim/kdateedit.h</header> + <sizehint> + <width>-1</width> + <height>-1</height> + </sizehint> + <container>0</container> + <sizepolicy> + <hordata>5</hordata> + <verdata>5</verdata> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + <pixmap>image0</pixmap> + </customwidget> +</customwidgets> +<images> + <image name="image0"> + <data format="PNG" length="826">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000030149444154789cb59531681b5718c77f0e377c070e3c810a3a70e0041eac51852e0a19e45134830a1d9a4c69a04bc8928e990a693a640e1d0c8642b08742321894c1507991b484c890902bb8701a047760c3bd21701fe4201dde49b6a41a32b8df72dcbbeffdbefffbbfefbd5b1b0c07cce266ebe667ae2006c3c1dada0cdc3be87d6e6c35b0d692a409d9c7ec8b20d65ae29398d19b1114e7e3de4ce98b3f5e10dc0053cf0951b4506496e1b964bf7ce6c585d9054c62d01d617ca48be0596553cf496d8f2c8b01c5f795fc93904e85ec4c01a152857a5d9175d0b2805c872080f18595ccc1499a10a225d4e2fbc2877786fe81253ab6c04c8d106e09db5d43ab0d146e5c64d1a23938fb98a185cea1c33eecfd9eba49eb427dcb201e245365f2b7b2fb5b4a3a31dcb927178afe07d86901df870fefa4842aed6f6b74ba42e52b4014d580e1eb9cbd9d94de7e4aad16d2f9be02d805f0b5e532f927a1ffcacea1777f122a8105b164a7c25faf323a5d9f1f1fd600e1e5bec59e2d4b5c7ef5209d0ad17b8b31864e57c0b3e0815ac3ee33253ab664a770ff5185d1a1cb8d2267d3e58aa1dc7d2508cbe597d0e74fdd269aaaf0f52d414c4ea3e9762c996869e42560d7a72e41c4799a2586e74f95e8d8151481fa86efbe7b3398ac58b1a2b8527589f15451ad303ac2293542ad6648a796278f13a27185e4c4754310facb98c53a79e19a3fdc1426ff28c3d7399d1f7cb25343eb96106cf83c790ce9c4f2eb831855c55485663327992eb6dc8a6259874ed700b0b793323cccb9ffa842b30d6133e3e75fea989ac15a8b16ca76b746b0b92278d919774c5b6d48a78697fb29bbcf52468742a32120909c24e899ce67beed5be2db01e22d1e9485bb620e47f9ee9e606a21bd3f5d3744c7e7c54d55e87443867d8b554515ac5db4620e8e4f62263170fd1cdee90aad7640141992891b0f367c9adfe4049bb07d3b7022bd8c687c0978f46684ee084150b65ac1fcca94591b7a90a496e4c095164fb016a2b192a497795cc0f84817aebe25f7bf70ccc54a575c555c03f78ffa5fc0570d1f0c076bff0232285a0901e2257b0000000049454e44ae426082</data> + </image> +</images> +<tabstops> + <tabstop>mFromDate</tabstop> + <tabstop>mToDate</tabstop> +</tabstops> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kdateedit.h</includehint> + <includehint>kdateedit.h</includehint> +</includehints> +</UI> diff --git a/korganizer/plugins/printing/journal/journalprint.cpp b/korganizer/plugins/printing/journal/journalprint.cpp new file mode 100644 index 000000000..31b1b10b6 --- /dev/null +++ b/korganizer/plugins/printing/journal/journalprint.cpp @@ -0,0 +1,135 @@ +/* + This file is part of KOrganizer. + + Copyright (c) 2004 Reinhold Kainhofer <reinhold@kainhofer.com> + + 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 KORG_NOPRINTER + +#include "journalprint.h" + +#include "calprintpluginbase.h" +#include <libkcal/journal.h> +#include <libkcal/calendar.h> +#include <libkdepim/kdateedit.h> +#include <kconfig.h> +#include <kdebug.h> + +#include <qbuttongroup.h> + +#include "calprintjournalconfig_base.h" + + +class JournalPrintFactory : public KOrg::PrintPluginFactory { + public: + KOrg::PrintPlugin *create() { return new CalPrintJournal; } +}; + +K_EXPORT_COMPONENT_FACTORY( libkorg_journalprint, JournalPrintFactory ) + + +/************************************************************** + * Print Journal + **************************************************************/ + +QWidget *CalPrintJournal::createConfigWidget( QWidget *w ) +{ + return new CalPrintJournalConfig_Base( w ); +} + +void CalPrintJournal::readSettingsWidget() +{ + CalPrintJournalConfig_Base *cfg = + dynamic_cast<CalPrintJournalConfig_Base*>( mConfigWidget ); + if ( cfg ) { + mFromDate = cfg->mFromDate->date(); + mToDate = cfg->mToDate->date(); + mUseDateRange = (cfg->mDateRangeGroup->selectedId() == 1); + } +} + +void CalPrintJournal::setSettingsWidget() +{ + CalPrintJournalConfig_Base *cfg = + dynamic_cast<CalPrintJournalConfig_Base*>( mConfigWidget ); + if ( cfg ) { + cfg->mFromDate->setDate( mFromDate ); + cfg->mToDate->setDate( mToDate ); + + cfg->mDateRangeGroup->setButton( (mUseDateRange)?1:0 ); + } +} + +void CalPrintJournal::loadConfig() +{ + if ( mConfig ) { + mUseDateRange = mConfig->readBoolEntry( "JournalsInRange", false ); + } + setSettingsWidget(); +} + +void CalPrintJournal::saveConfig() +{ + kdDebug(5850) << "CalPrintJournal::saveConfig()" << endl; + + readSettingsWidget(); + if ( mConfig ) { + mConfig->writeEntry( "JournalsInRange", mUseDateRange ); + } +} + +void CalPrintJournal::setDateRange( const QDate& from, const QDate& to ) +{ + CalPrintPluginBase::setDateRange( from, to ); + CalPrintJournalConfig_Base *cfg = + dynamic_cast<CalPrintJournalConfig_Base*>( mConfigWidget ); + if ( cfg ) { + cfg->mFromDate->setDate( from ); + cfg->mToDate->setDate( to ); + } +} + +void CalPrintJournal::print( QPainter &p, int width, int height ) +{ + int x=0, y=0; + Journal::List journals( mCalendar->journals() ); + if ( mUseDateRange ) { + Journal::List allJournals = journals; + journals.clear(); + Journal::List::Iterator it = allJournals.begin(); + for ( ; it != allJournals.end(); ++it ) { + QDate dt = (*it)->dtStart().date(); + if ( mFromDate <= dt && dt <= mToDate ) { + journals.append( *it ); + } + } + } + + drawHeader( p, i18n("Journal entries"), QDate(), QDate(), QRect( 0, 0, width, headerHeight() ) ); + y = headerHeight() + 15; + + Journal::List::Iterator it = journals.begin(); + for ( ; it != journals.end(); ++it ) { + drawJournal( *it, p, x, y, width, height ); + } +} + +#endif diff --git a/korganizer/plugins/printing/journal/journalprint.desktop b/korganizer/plugins/printing/journal/journalprint.desktop new file mode 100644 index 000000000..081f73d6d --- /dev/null +++ b/korganizer/plugins/printing/journal/journalprint.desktop @@ -0,0 +1,95 @@ +[Desktop Entry] +X-KDE-Library=libkorg_journalprint +Name=Journal Print Style +Name[af]=Joernaal druk styl +Name[bg]=Стил на отпечатване на календар +Name[ca]=Estil d'impressió del diari +Name[cs]=Tiskový styl deníku +Name[da]=Journal udskriftsstil +Name[de]=Journal Druckstil +Name[el]=Στυλ εκτύπωσης χρονικού +Name[eo]=Ĵurnal-Presostilo +Name[es]=Estilo de impresión del diario +Name[et]=Päeviku trükkimise stiil +Name[eu]=Egunkariak inprimatzeko estiloa +Name[fa]=سبک چاپ نشریه +Name[fi]=Päiväkirjan tulostustyyli +Name[fr]=Impression en journal +Name[fy]=Printstyl foar journaals +Name[gl]=Imprimir en Estilo Xornal +Name[hu]=Naplónyomtatási stílus +Name[is]=Dagbókarprentstíll +Name[it]=Stile di stampa a diario +Name[ja]=ジャーナル印刷スタイル +Name[ka]=ჟურნალის ბეჭდვის სტილი +Name[kk]=Күнделікті басу стилі +Name[km]=រចនាប័ទ្មបោះពុម្ពទិនានុប្បវត្តិ +Name[lt]=Dienyno spausdinimo stilius +Name[ms]=Gaya Cetak Jurnal +Name[nb]=Utskriftsstil for dagbok +Name[nds]=Daagbook-Druckstil +Name[ne]=जर्नल मुद्रण शैली +Name[nl]=Printstijl voor journaals +Name[nn]=Utskriftsstil for dagbok +Name[pl]=Styl drukowania dziennika +Name[pt]=Estilo de Impressão em Diário +Name[pt_BR]=Estilo de Impressão de Diário +Name[ru]=Журнал +Name[sk]=Štýl tlače žurnálu +Name[sl]=Dnevniški slog tiskanja +Name[sr]=Дневнички стил штампе +Name[sr@Latn]=Dnevnički stil štampe +Name[sv]=Journal-utskriftsstil +Name[ta]=செய்தி அச்சுப்பாணி +Name[tr]=Günlük Yazdırma Tarzı +Name[uk]=Стиль друку журналом +Name[zh_CN]=日记打印样式 +Name[zh_TW]=日誌列印風格 +Comment=This plugin allows you to print out journal entries (diary entries). +Comment[af]=Hierdie inprop module maak dit moontlik om joernaal inskrywings (dagboek inskrywings) te druk. +Comment[bg]=Приставката служи за печат на дневника. +Comment[ca]=Aquest endollable us permet imprimir entrades del diari. +Comment[cs]=tento modul umožňuje tisk položek deníku. +Comment[da]=Dette plugin gør at du kan udskrive journalindgange (dagbogsindgange). +Comment[de]=Mit diesem Modul können Journaleinträge (Tagebucheinträge) gedruckt werden. +Comment[el]=Αυτό το πρόσθετο σας επιτρέπει να εκτυπώνετε καταχωρήσεις χρονικού. +Comment[es]=Esta extensión le permite imprimir entradas del diario. +Comment[et]=See plugin võimaldab trükkida päeviku sissekandeid. +Comment[eu]=Plugin honek egunkarien sarrerak (eguneroko sarrerak) inprimatzeko aukera ematen dizu. +Comment[fa]=این وصله، به شما اجازه میدهد که مدخلهای نشریه )مدخلهای روزانه( را چاپ کنید. +Comment[fi]=Tämä liitännäinen mahdollistaa päiväkirjan tulostuksen. +Comment[fr]=Ce module vous permet d'imprimer l'ensemble de vos journaux personnels +Comment[fy]=Dizze plugin makket it mooglik journalen út te printsjen (deiboekitems). +Comment[gl]=Este engadido permítelle imprimir as entradas do xornal (entradas do diario). +Comment[hu]=Ez a modul naplóbejegyzések kinyomtatását teszi lehetővé. +Comment[is]=Þetta íforrit gerir þér kleyft að prenta út dagbókarfærslur. +Comment[it]=Questo plugin ti permette di stampare le registrazioni del diario. +Comment[ja]=このプラグインにより、ジャーナル (日誌) のエントリを印刷できるようになります。 +Comment[ka]=ეს მოდული საშუალებას გაძლევთ ამობეჭდოთ ჟურნალის შემადგენლობა (დღიურის ელემენტები) +Comment[kk]=Бұл күнделіктің жазуларын басып шығаратын модулі. +Comment[km]=កម្មវិធីជំនួយនេះអនុញ្ញាតឲ្យអ្នកបោះពុម្ពធាតុទិនានុប្បវត្តិ (ធាតុកំណត់ហេតុប្រចាំថ្ងៃ) ។ +Comment[lt]=Šis priedas leidžia spausdinti dienyno įrašus. +Comment[ms]=Plugin ini membenarkan anda mencetak entri jurnal (entri diari). +Comment[nb]=Med dette programtillegget kan du skrive ut oppføringer i dagboka. +Comment[nds]=Mit dit Moduul köönt Daagbook-Indrääg utdruckt warrn. +Comment[ne]=यो प्लगइनले तपाईँलाई जर्नल प्रविष्टि मुद्रण गर्न अनुमति दिन्छ (दैनिक विवरण प्रविष्टि) । +Comment[nl]=Deze plugin maakt het mogelijk om journalen uit te printen (dagboekitems). +Comment[nn]=Dette programtillegget lèt deg skriva ut dagboksoppføringar. +Comment[pl]=Ta wtyczka pozwala drukować wpisy dziennika. +Comment[pt]=Este diário permite-lhe imprimir os itens de diário. +Comment[pt_BR]=Esse estilo lhe permite imprimir entradas de diário +Comment[ru]=Этот модуль позволяет печатать журнал в виде дневника. +Comment[sk]=Tento modul umožní vytlačiť položky žurnálu (denníkové položky). +Comment[sl]=Ta vstavek vam omogoča natis vnosov v dnevnik. +Comment[sr]=Овај прикључак вам омогућава да одштампате уносе из дневника. +Comment[sr@Latn]=Ovaj priključak vam omogućava da odštampate unose iz dnevnika. +Comment[sv]=Det här insticksprogrammet gör att du kan skriva ut journalanteckningar (dagboksanteckningar). +Comment[ta]=இந்த சொருகுப்பொருள் இதழ் உள்ளீடுகளை அச்சிட உங்களை அனுமதிக்கிறது (நாள் குறிப்பேடு உள்ளீடுகள்). +Comment[tr]=Bu eklenti, günlük girişlerinizi yazıcıdan çıkartmanızı sağlar. +Comment[uk]=Цей журнал надає можливість друкувати записи журналу (записи щоденника). +Comment[zh_CN]=此插件允许您打印日记项目。 +Comment[zh_TW]=此外掛程式讓您印出日誌項目。 +Type=Service +ServiceTypes=Calendar/Plugin,KOrganizer/PrintPlugin +X-KDE-KOrganizer-HasSettings=false +X-KDE-PluginInterfaceVersion=2 diff --git a/korganizer/plugins/printing/journal/journalprint.h b/korganizer/plugins/printing/journal/journalprint.h new file mode 100644 index 000000000..fb91759f1 --- /dev/null +++ b/korganizer/plugins/printing/journal/journalprint.h @@ -0,0 +1,63 @@ +/* + This file is part of KOrganizer. + + Copyright (c) 2004 Reinhold Kainhofer <reinhold@kainhofer.com> + + 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 JOURNALPRINT_H +#define JOURNALPRINT_H + +#include <klocale.h> +#include "calprintpluginbase.h" + +#ifndef KORG_NOPRINTER +namespace KCal { +class Calendar; +} + +using namespace KCal; +using namespace KOrg; + +class CalPrintJournal : public CalPrintPluginBase +{ + public: + CalPrintJournal():CalPrintPluginBase() {} + virtual ~CalPrintJournal() {} + virtual QString description() { return i18n("Print &journal"); } + virtual QString info() { return i18n("Prints all journals for a given date range"); } + virtual int sortID() { return CalPrinterBase::Journallist; } + virtual bool enabled() { return true; } + virtual QWidget *createConfigWidget( QWidget* ); + + public: + virtual void print(QPainter &p, int width, int height); + virtual void readSettingsWidget(); + virtual void setSettingsWidget(); + virtual void loadConfig(); + virtual void saveConfig(); + virtual void setDateRange( const QDate& from, const QDate& to ); + + protected: + bool mUseDateRange; +}; + + +#endif +#endif diff --git a/korganizer/plugins/printing/list/Makefile.am b/korganizer/plugins/printing/list/Makefile.am new file mode 100644 index 000000000..cd41be7ed --- /dev/null +++ b/korganizer/plugins/printing/list/Makefile.am @@ -0,0 +1,14 @@ +INCLUDES = -I$(top_srcdir)/korganizer/interfaces -I$(top_srcdir)/korganizer/printing -I$(top_srcdir) $(all_includes) + +kde_module_LTLIBRARIES = libkorg_listprint.la + +libkorg_listprint_la_SOURCES = calprintlistconfig_base.ui listprint.cpp +libkorg_listprint_la_LDFLAGS = -module $(KDE_PLUGIN) $(KDE_RPATH) $(all_libraries) +libkorg_listprint_la_LIBADD = $(LIB_KDECORE) $(LIB_KDEUI) $(top_builddir)/korganizer/printing/libkorg_stdprinting.la + +noinst_HEADERS = + +servicedir = $(kde_servicesdir)/korganizer +service_DATA = listprint.desktop + +METASOURCES = AUTO diff --git a/korganizer/plugins/printing/list/calprintlistconfig_base.ui b/korganizer/plugins/printing/list/calprintlistconfig_base.ui new file mode 100644 index 000000000..cea873e6a --- /dev/null +++ b/korganizer/plugins/printing/list/calprintlistconfig_base.ui @@ -0,0 +1,186 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>CalPrintListConfig_Base</class> +<comment>Configuration page for the print list mode.</comment> +<author>Reinhold Kainhofer <reinhold@kainhofer.com></author> +<widget class="QWidget"> + <property name="name"> + <cstring>CalPrintList_Base</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>427</width> + <height>171</height> + </rect> + </property> + <property name="caption"> + <string>CalPrintList_Base</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QButtonGroup"> + <property name="name"> + <cstring>mDateRangeGroup</cstring> + </property> + <property name="title"> + <string>Date && Time Range</string> + </property> + <property name="selectedId" stdset="0"> + <number>-1</number> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer6</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>15</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel"> + <property name="name"> + <cstring>mFromDateLabel</cstring> + </property> + <property name="text"> + <string>&Start date:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>mFromDate</cstring> + </property> + </widget> + <widget class="KDateEdit"> + <property name="name"> + <cstring>mFromDate</cstring> + </property> + <property name="focusPolicy"> + <enum>StrongFocus</enum> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>mToDateLabel</cstring> + </property> + <property name="text"> + <string>&End date:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>mToDate</cstring> + </property> + </widget> + <widget class="KDateEdit"> + <property name="name"> + <cstring>mToDate</cstring> + </property> + <property name="focusPolicy"> + <enum>StrongFocus</enum> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>324</width> + <height>21</height> + </size> + </property> + </spacer> + </hbox> + </widget> + </vbox> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox1</cstring> + </property> + <property name="title"> + <string>Print Incidences of Type</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>mEvents</cstring> + </property> + <property name="text"> + <string>&Events</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>mTodos</cstring> + </property> + <property name="text"> + <string>&To-dos</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>mJournals</cstring> + </property> + <property name="text"> + <string>&Journals</string> + </property> + </widget> + </hbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer3</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>40</height> + </size> + </property> + </spacer> + </vbox> +</widget> +<tabstops> + <tabstop>mFromDate</tabstop> + <tabstop>mToDate</tabstop> +</tabstops> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/korganizer/plugins/printing/list/listprint.cpp b/korganizer/plugins/printing/list/listprint.cpp new file mode 100644 index 000000000..0221f1c67 --- /dev/null +++ b/korganizer/plugins/printing/list/listprint.cpp @@ -0,0 +1,116 @@ +/* + This file is part of KOrganizer. + + Copyright (c) 2004 Reinhold Kainhofer <reinhold@kainhofer.com> + + 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 KORG_NOPRINTER + +#include "listprint.h" + +#include "calprintpluginbase.h" +#include <libkcal/event.h> +#include <libkcal/todo.h> +#include <libkcal/calendar.h> +#include <libkdepim/kdateedit.h> +#include <kconfig.h> +#include <kdebug.h> + +#include <qbuttongroup.h> + +#include "calprintlistconfig_base.h" + + +class ListPrintFactory : public KOrg::PrintPluginFactory { + public: + KOrg::PrintPlugin *create() { return new CalPrintList; } +}; + +K_EXPORT_COMPONENT_FACTORY( libkorg_listprint, ListPrintFactory ) + + + +/************************************************************** + * Print Day + **************************************************************/ + +QWidget *CalPrintList::createConfigWidget( QWidget *w ) +{ + return new CalPrintListConfig_Base( w ); +} + +void CalPrintList::readSettingsWidget() +{ + CalPrintListConfig_Base *cfg = + dynamic_cast<CalPrintListConfig_Base*>( mConfigWidget ); + if ( cfg ) { + mFromDate = cfg->mFromDate->date(); + mToDate = cfg->mToDate->date(); + mUseDateRange = (cfg->mDateRangeGroup->selectedId() == 1); + } +} + +void CalPrintList::setSettingsWidget() +{ + CalPrintListConfig_Base *cfg = + dynamic_cast<CalPrintListConfig_Base*>( mConfigWidget ); + if ( cfg ) { + cfg->mFromDate->setDate( mFromDate ); + cfg->mToDate->setDate( mToDate ); + + cfg->mDateRangeGroup->setButton( (mUseDateRange)?1:0 ); + } +} + +void CalPrintList::loadConfig() +{ + if ( mConfig ) { + mUseDateRange = mConfig->readBoolEntry( "ListsInRange", false ); + } + setSettingsWidget(); +} + +void CalPrintList::saveConfig() +{ + kdDebug(5850) << "CalPrintList::saveConfig()" << endl; + + readSettingsWidget(); + if ( mConfig ) { + mConfig->writeEntry( "ListsInRange", mUseDateRange ); + } +} + +void CalPrintList::setDateRange( const QDate& from, const QDate& to ) +{ + CalPrintPluginBase::setDateRange( from, to ); + CalPrintListConfig_Base *cfg = + dynamic_cast<CalPrintListConfig_Base*>( mConfigWidget ); + if ( cfg ) { + cfg->mFromDate->setDate( from ); + cfg->mToDate->setDate( to ); + } +} + +void CalPrintList::print( QPainter &p, int width, int height ) +{ +} + +#endif diff --git a/korganizer/plugins/printing/list/listprint.desktop b/korganizer/plugins/printing/list/listprint.desktop new file mode 100644 index 000000000..7688a2c52 --- /dev/null +++ b/korganizer/plugins/printing/list/listprint.desktop @@ -0,0 +1,95 @@ +[Desktop Entry] +X-KDE-Library=libkorg_listprint +Name=List Print Style +Name[af]=Lys druk styl +Name[bg]=Печат като списък +Name[ca]=Estil d'impressió en llista +Name[cs]=Styl deníku - seznam +Name[da]=Listeudskriftsstil +Name[de]=Listen Druckstil +Name[el]=Στυλ εκτύπωσης λίστας +Name[eo]=List-Presostilo +Name[es]=Estilo de impresión de la lista +Name[et]=Nimekirja trükkimise stiil +Name[eu]=Zerrenda inprimatzeko estiloa +Name[fa]=سبک چاپ فهرست +Name[fi]=Listatulostustyyli +Name[fr]=Impression en liste +Name[fy]=Printstyl foar listen +Name[gl]=Imprimir en Estilo de Lista +Name[hu]=Eseménylista kinyomtatása +Name[is]=Listaprentstíll +Name[it]=Stile di stampa ad elenco +Name[ja]=リスト印刷スタイル +Name[ka]=ბეჭდვის სტილის სია +Name[kk]=Тізімді басу стилі +Name[km]=រចនាប័ទ្មបោះពុម្ពបញ្ជី +Name[lt]=Sąrašo spausdinimo stilius +Name[ms]=Gaya Cetakan Senarai +Name[nb]=Utskriftsstil for liste +Name[nds]=Listen-Druckstil +Name[ne]=सूची मुद्रण शैली +Name[nl]=Printstijl voor lijsten +Name[nn]=Utskriftsstil for dagbøker +Name[pl]=Styl drukowania listy +Name[pt]=Estilo de Impressão em Lista +Name[pt_BR]=Estilo de Impressão em Lista +Name[ru]=Список +Name[sk]=Štýl tlače zoznamu +Name[sl]=Slog tiskanja v obliki list +Name[sr]=Листајући стил штампе +Name[sr@Latn]=Listajući stil štampe +Name[sv]=List-utskriftsstil +Name[ta]=அச்சு பாணியை பட்டியலிடு +Name[tr]=Liste Yazdırma Tarzı +Name[uk]=Стиль друку списком +Name[zh_CN]=列表打印样式 +Name[zh_TW]=清單列印風格 +Comment=This plugin allows you to print out events and to-dos in list form. +Comment[af]=Hierdie inprop module druk afsprake en te-doen items in lys vorm. +Comment[bg]=Приставката служи за печат на събитията и задачите в списъчна форма. +Comment[ca]=Aquest endollable permet imprimir esdeveniments i tasques pendents en forma de llista. +Comment[cs]=tento modul umožňuje tisknout události a úlohy do seznamu. +Comment[da]=Dette plugin gør at du kan udskrive begivenheder og opgaver på en liste. +Comment[de]=Mit diesem Modul können Ereignisse und Aufgaben in Listenform ausgedruckt werden. +Comment[el]=Αυτό το πρόσθετο σας επιτρέπει να εκτυπώνετε λίστες γεγονότων και προς υλοποίηση λίστες σε μορφή λίστας. +Comment[es]=Esta extensión le permite imprimir eventos y tareas pendientes en forma de lista. +Comment[et]=See plugin võimaldab trükkida sündmusi ja ülesandeid nimekirjana. +Comment[eu]=Plugin honek gertaerak eta egitekoak zerrenda moduan inprimatzeko aukera ematen dizu. +Comment[fa]=این وصله به شما اجازه میدهد که رویدادها و کارهای انجامی را در برگۀ فهرست چاپ کنید. +Comment[fi]=Tämä liitännäinen mahdollistaa tapahtumien ja tehtävien tulostuksen listana. +Comment[fr]=Ce module vous permet d'imprimer les évènements et les tâches sous forme de liste +Comment[fy]=Dizze plugin makket it mooglik om eveneminten en taken yn list foar út te printen. +Comment[gl]=Este plugin permítelle imprimir os eventos e as tarefas e forma de lista. +Comment[hu]=Ezzel a modullal listaként kinyomtathatók a feladatok és események. +Comment[is]=Þetta íforrit gerir þér kleyft að prenta út lista með atburðum og verkþáttum. +Comment[it]=Questo plugin ti permette di stampare eventi e cose da fare in modalità elenco. +Comment[ja]=このプラグインにより、リストフォーム内のイベントや To-Do を印刷できるようになります。 +Comment[ka]=ეს მოდული საშუალებას გაძლევთ სიის ფორმით ამობეჭდოთ მოვლენები და დავალებები. +Comment[kk]=Бұл оқиғалар мен жоспарларды тізім түрінде басатын модулі. +Comment[km]=កម្មវិធីជំនួយនេះអនុញ្ញាតឲ្យអ្នកបោះពុម្ពព្រឹត្តិការណ៍ និងការងារត្រូវធ្វើក្នុងទម្រង់ជាបញ្ជី ។ +Comment[lt]=Šis priedas leidžia spausdinti įvykius ir darbus sąrašo forma. +Comment[ms]=Plugin ini membenarkan anda mencetak peristiwa dan tugasan dalam borang senarai. +Comment[nb]=Med dette programtillegget kan du skrive ut hendelser og gjørelister på liste-form. +Comment[nds]=Mit dit Moduul köönt Begeefnissen un Opgaven as Listen utdruckt warrn. +Comment[ne]=यो प्लगइनले तपाईँलाई घटना मुद्रण गर्न र सूची फारममा गर्नुपर्ने कार्यहरू गर्न अनुमति दिन्छ । +Comment[nl]=Deze plugin maakt het mogelijk om evenementen en taken in lijstvorm uit te printen. +Comment[nn]=Dette programtillegget lèt deg skriva ut hendingar og hugselister på listeform. +Comment[pl]=Ta wtyczka pozwala drukować zdarzenia i zadania w postaci listy. +Comment[pt]=Este 'plugin' permite-lhe imprimir os eventos e os itens por-fazer no formato de uma lista. +Comment[pt_BR]=Este plug-in permite que você imprima eventos e pendências em forma de lista. +Comment[ru]=Этот модуль позволяет печатать список событий и задач. +Comment[sk]=Tento modul umožní vytlačiť udalosti a úlohy vo forme zoznamu. +Comment[sl]=Ta vstavek vam omogoča natis dogodkov in čakajočih opravil v obliki seznama. +Comment[sr]=Овај прикључак вам омогућава да одштампате догађаје и обавезе у облику листе. +Comment[sr@Latn]=Ovaj priključak vam omogućava da odštampate događaje i obaveze u obliku liste. +Comment[sv]=Det här insticksprogrammet gör att du kan skriva ut händelser och uppgifter i en lista. +Comment[ta]=இந்த சொருகுப்பொருள் பட்டியல் படிவத்தில் உள்ள செய்திகள் மற்றும் செய்யவேண்டியவைகளை அச்சிட உங்களை அனுமதிக்கிறது. +Comment[tr]=Bu eklenti, olayları ve yapılacaklar listesini bir liste biçiminde yazdırmanızı sağlar. +Comment[uk]=Цей втулок дозволяє друкувати події і завдання у вигляді списку. +Comment[zh_CN]=此插件允许您以列表格式打印事件和待办事宜。 +Comment[zh_TW]=此外掛程式允許您以清單格式印出事件與待辦事項。 +Type=Service +ServiceTypes=Calendar/Plugin,KOrganizer/PrintPlugin +X-KDE-KOrganizer-HasSettings=false +X-KDE-PluginInterfaceVersion=2 diff --git a/korganizer/plugins/printing/list/listprint.h b/korganizer/plugins/printing/list/listprint.h new file mode 100644 index 000000000..dc370ba86 --- /dev/null +++ b/korganizer/plugins/printing/list/listprint.h @@ -0,0 +1,61 @@ +/* + This file is part of KOrganizer. + + Copyright (c) 2004 Reinhold Kainhofer <reinhold@kainhofer.com> + + 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 LISTPRINT_H +#define LISTPRINT_H + +#include <klocale.h> +#include "calprintpluginbase.h" + +#ifndef KORG_NOPRINTER +namespace KCal { +class Calendar; +} + +using namespace KCal; + +class CalPrintList : public CalPrintPluginBase +{ + public: + CalPrintList():CalPrintPluginBase() {} + virtual ~CalPrintList() {} + virtual QString description() { return i18n("Print list"); } + virtual QString info() { return i18n("Prints a list of events and to-dos"); } + virtual int sortID() { return 950; } + virtual QWidget *createConfigWidget( QWidget* ); + + public: + virtual void print(QPainter &p, int width, int height); + virtual void readSettingsWidget(); + virtual void setSettingsWidget(); + virtual void loadConfig(); + virtual void saveConfig(); + virtual void setDateRange( const QDate& from, const QDate& to ); + + protected: + bool mUseDateRange; +}; + + +#endif +#endif diff --git a/korganizer/plugins/printing/whatsnext/Makefile.am b/korganizer/plugins/printing/whatsnext/Makefile.am new file mode 100644 index 000000000..f1b1d5aab --- /dev/null +++ b/korganizer/plugins/printing/whatsnext/Makefile.am @@ -0,0 +1,14 @@ +INCLUDES = -I$(top_srcdir)/korganizer/interfaces -I$(top_srcdir)/korganizer/printing -I$(top_srcdir) $(all_includes) + +kde_module_LTLIBRARIES = libkorg_whatsnextprint.la + +libkorg_whatsnextprint_la_SOURCES = calprintwhatsnextconfig_base.ui whatsnextprint.cpp +libkorg_whatsnextprint_la_LDFLAGS = -module $(KDE_PLUGIN) $(KDE_RPATH) $(all_libraries) +libkorg_whatsnextprint_la_LIBADD = $(LIB_KDECORE) $(LIB_KDEUI) $(top_builddir)/korganizer/printing/libkorg_stdprinting.la + +noinst_HEADERS = + +servicedir = $(kde_servicesdir)/korganizer +service_DATA = whatsnextprint.desktop + +METASOURCES = AUTO diff --git a/korganizer/plugins/printing/whatsnext/calprintwhatsnextconfig_base.ui b/korganizer/plugins/printing/whatsnext/calprintwhatsnextconfig_base.ui new file mode 100644 index 000000000..c93e48ed6 --- /dev/null +++ b/korganizer/plugins/printing/whatsnext/calprintwhatsnextconfig_base.ui @@ -0,0 +1,176 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>CalPrintWhatsNextConfig_Base</class> +<comment>Configuration page for the print whatsnext mode.</comment> +<author>Reinhold Kainhofer <reinhold@kainhofer.com></author> +<widget class="QWidget"> + <property name="name"> + <cstring>CalPrintWhatsNext_Base</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>337</width> + <height>247</height> + </rect> + </property> + <property name="caption"> + <string>CalPrintWhatsNext_Base</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QButtonGroup"> + <property name="name"> + <cstring>mDateRangeGroup</cstring> + </property> + <property name="title"> + <string>Date && Time Range</string> + </property> + <property name="selectedId" stdset="0"> + <number>-1</number> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer6</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>15</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel"> + <property name="name"> + <cstring>mFromDateLabel</cstring> + </property> + <property name="text"> + <string>&Start date:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>mFromDate</cstring> + </property> + </widget> + <widget class="KDateEdit"> + <property name="name"> + <cstring>mFromDate</cstring> + </property> + <property name="focusPolicy"> + <enum>StrongFocus</enum> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>mToDateLabel</cstring> + </property> + <property name="text"> + <string>&End date:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>mToDate</cstring> + </property> + </widget> + <widget class="KDateEdit"> + <property name="name"> + <cstring>mToDate</cstring> + </property> + <property name="focusPolicy"> + <enum>StrongFocus</enum> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>324</width> + <height>21</height> + </size> + </property> + </spacer> + </hbox> + </widget> + </vbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer3</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>201</height> + </size> + </property> + </spacer> + </vbox> +</widget> +<customwidgets> + <customwidget> + <class>KDateEdit</class> + <header location="local">libkdepim/kdateedit.h</header> + <sizehint> + <width>-1</width> + <height>-1</height> + </sizehint> + <container>0</container> + <sizepolicy> + <hordata>5</hordata> + <verdata>5</verdata> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + <pixmap>image0</pixmap> + </customwidget> +</customwidgets> +<images> + <image name="image0"> + <data format="PNG" length="826">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000030149444154789cb59531681b5718c77f0e377c070e3c810a3a70e0041eac51852e0a19e45134830a1d9a4c69a04bc8928e990a693a640e1d0c8642b08742321894c1507991b484c890902bb8701a047760c3bd21701fe4201dde49b6a41a32b8df72dcbbeffdbefffbbfefbd5b1b0c07cce266ebe667ae2006c3c1dada0cdc3be87d6e6c35b0d692a409d9c7ec8b20d65ae29398d19b1114e7e3de4ce98b3f5e10dc0053cf0951b4506496e1b964bf7ce6c585d9054c62d01d617ca48be0596553cf496d8f2c8b01c5f795fc93904e85ec4c01a152857a5d9175d0b2805c872080f18595ccc1499a10a225d4e2fbc2877786fe81253ab6c04c8d106e09db5d43ab0d146e5c64d1a23938fb98a185cea1c33eecfd9eba49eb427dcb201e245365f2b7b2fb5b4a3a31dcb927178afe07d86901df870fefa4842aed6f6b74ba42e52b4014d580e1eb9cbd9d94de7e4aad16d2f9be02d805f0b5e532f927a1ffcacea1777f122a8105b164a7c25faf323a5d9f1f1fd600e1e5bec59e2d4b5c7ef5209d0ad17b8b31864e57c0b3e0815ac3ee33253ab664a770ff5185d1a1cb8d2267d3e58aa1dc7d2508cbe597d0e74fdd269aaaf0f52d414c4ea3e9762c996869e42560d7a72e41c4799a2586e74f95e8d8151481fa86efbe7b3398ac58b1a2b8527589f15451ad303ac2293542ad6648a796278f13a27185e4c4754310facb98c53a79e19a3fdc1426ff28c3d7399d1f7cb25343eb96106cf83c790ce9c4f2eb831855c55485663327992eb6dc8a6259874ed700b0b793323cccb9ffa842b30d6133e3e75fea989ac15a8b16ca76b746b0b92278d919774c5b6d48a78697fb29bbcf52468742a32120909c24e899ce67beed5be2db01e22d1e9485bb620e47f9ee9e606a21bd3f5d3744c7e7c54d55e87443867d8b554515ac5db4620e8e4f62263170fd1cdee90aad7640141992891b0f367c9adfe4049bb07d3b7022bd8c687c0978f46684ee084150b65ac1fcca94591b7a90a496e4c095164fb016a2b192a497795cc0f84817aebe25f7bf70ccc54a575c555c03f78ffa5fc0570d1f0c076bff0232285a0901e2257b0000000049454e44ae426082</data> + </image> +</images> +<tabstops> + <tabstop>mFromDate</tabstop> + <tabstop>mToDate</tabstop> +</tabstops> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kdateedit.h</includehint> + <includehint>kdateedit.h</includehint> +</includehints> +</UI> diff --git a/korganizer/plugins/printing/whatsnext/whatsnextprint.cpp b/korganizer/plugins/printing/whatsnext/whatsnextprint.cpp new file mode 100644 index 000000000..48dd30436 --- /dev/null +++ b/korganizer/plugins/printing/whatsnext/whatsnextprint.cpp @@ -0,0 +1,115 @@ +/* + This file is part of KOrganizer. + + Copyright (c) 2004 Reinhold Kainhofer <reinhold@kainhofer.com> + + 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 KORG_NOPRINTER + +#include "whatsnextprint.h" + +#include "calprintpluginbase.h" +#include <libkcal/event.h> +#include <libkcal/todo.h> +#include <libkcal/calendar.h> +#include <libkdepim/kdateedit.h> +#include <kconfig.h> +#include <kdebug.h> + +#include <qbuttongroup.h> + +#include "calprintwhatsnextconfig_base.h" + + +class WhatsNextPrintFactory : public KOrg::PrintPluginFactory { + public: + KOrg::PrintPlugin *create() { return new CalPrintWhatsNext; } +}; + +K_EXPORT_COMPONENT_FACTORY( libkorg_whatsnextprint, WhatsNextPrintFactory ) + + +/************************************************************** + * Print What's Next + **************************************************************/ + +QWidget *CalPrintWhatsNext::createConfigWidget( QWidget *w ) +{ + return new CalPrintWhatsNextConfig_Base( w ); +} + +void CalPrintWhatsNext::readSettingsWidget() +{ + CalPrintWhatsNextConfig_Base *cfg = + dynamic_cast<CalPrintWhatsNextConfig_Base*>( mConfigWidget ); + if ( cfg ) { + mFromDate = cfg->mFromDate->date(); + mToDate = cfg->mToDate->date(); + mUseDateRange = (cfg->mDateRangeGroup->selectedId() == 1); + } +} + +void CalPrintWhatsNext::setSettingsWidget() +{ + CalPrintWhatsNextConfig_Base *cfg = + dynamic_cast<CalPrintWhatsNextConfig_Base*>( mConfigWidget ); + if ( cfg ) { + cfg->mFromDate->setDate( mFromDate ); + cfg->mToDate->setDate( mToDate ); + + cfg->mDateRangeGroup->setButton( (mUseDateRange)?1:0 ); + } +} + +void CalPrintWhatsNext::loadConfig() +{ + if ( mConfig ) { + mUseDateRange = mConfig->readBoolEntry( "WhatsNextsInRange", false ); + } + setSettingsWidget(); +} + +void CalPrintWhatsNext::saveConfig() +{ + kdDebug(5850) << "CalPrintWhatsNext::saveConfig()" << endl; + + readSettingsWidget(); + if ( mConfig ) { + mConfig->writeEntry( "WhatsNextsInRange", mUseDateRange ); + } +} + +void CalPrintWhatsNext::setDateRange( const QDate& from, const QDate& to ) +{ + CalPrintPluginBase::setDateRange( from, to ); + CalPrintWhatsNextConfig_Base *cfg = + dynamic_cast<CalPrintWhatsNextConfig_Base*>( mConfigWidget ); + if ( cfg ) { + cfg->mFromDate->setDate( from ); + cfg->mToDate->setDate( to ); + } +} + +void CalPrintWhatsNext::print( QPainter &p, int width, int height ) +{ +} + +#endif diff --git a/korganizer/plugins/printing/whatsnext/whatsnextprint.desktop b/korganizer/plugins/printing/whatsnext/whatsnextprint.desktop new file mode 100644 index 000000000..50131734e --- /dev/null +++ b/korganizer/plugins/printing/whatsnext/whatsnextprint.desktop @@ -0,0 +1,95 @@ +[Desktop Entry] +X-KDE-Library=libkorg_whatsnextprint +Name=What's Next Print Style +Name[af]=Wat is volgende - druk styl +Name[bg]=Стил за отпечатване на "Какво следва" +Name[ca]=Estil d'impressió Què toca ara? +Name[cs]=Styl deníku - co je nového +Name[da]=Hvad er det næste-udskriftsstil +Name[de]=Was-kommt-als-nächstes Druckstil +Name[el]=Στυλ εκτύπωσης 'Τί νέο υπάρχει' +Name[eo]="Kio postsekvas"-Presostilo +Name[es]=Estilo de impresión de «Qué es lo siguiente» +Name[et]="Mis järgmiseks?" trükkimise stiil +Name[eu]="Zer da hurrengoa" inprimatzeko estiloa +Name[fa]=سبک چاپ بعدی چیست +Name[fi]=Mitä seuraavaksi -tulostustyyli +Name[fr]=Impression de la suite du programme +Name[fy]=Printstyl foar Wat komt der no +Name[gl]=Imprimir en Estilo Qué Vén Agora +Name[hu]=A közeljövő eseményeinek kinyomtatása +Name[is]=Hvað er næst prentstíll +Name[it]=Stile di stampa "cosa viene dopo" +Name[ja]=次は何? 印刷スタイル +Name[ka]=ბეჭდვის სტილი "შემდეგი რა არის?" +Name[kk]="Не істеу?" бетін басу стилі +Name[km]=រចនាប័ទ្មបោះពុម្ពការងារបន្តបន្ទាប់ +Name[lt]=Ateinančių įvykių spausdinimo stilius +Name[ms]=Gaya Cetak Apa Seterusnya +Name[nb]=Utskriftsstil for Hva Nå +Name[nds]=Druckstil för "Wat kummt nu"-Indrääg +Name[ne]=पछिल्लो मुद्रण शैली कुन हो +Name[nl]=Printstijl voor Wat komt er nu +Name[nn]=Utskriftsstil for «Kva no» +Name[pl]=Styl drukowania "Do dalej" +Name[pt]=Estilo de Impressão "O Que Se Segue" +Name[pt_BR]=Estilo de impressão "A Seguir" +Name[ru]=Предстоящие задачи +Name[sk]=Štýl tlače Čo nasleduje +Name[sl]=Slog tiskanja v obliki »Kaj je naslednje« +Name[sr]=Стил штампе „Шта је следеће“ +Name[sr@Latn]=Stil štampe „Šta je sledeće“ +Name[sv]=Vad står på tur-utskriftsstil +Name[ta]=அடுத்டு என்ன அச்சுப் பாணி +Name[tr]=Sıradaki Nedir Yazdırma Tarzı +Name[uk]=Стиль друку "Що далі?" +Name[zh_CN]=下步安排打印样式 +Name[zh_TW]=「下一個是什麼」列印風格 +Comment=This plugin allows you to print out a list of all upcoming events and to-dos. +Comment[af]=Hierdie inprop module druk 'n lys van al die opkomende afsprake en te-doen itemme. +Comment[bg]=Приставката служи за печат на бъдещи събития и задачи в списъчна форма. +Comment[ca]=Aquest endollable us permet imprimir una llista de tots els esdeveniments i tasques pendents propers. +Comment[cs]=Tento modul umožňuje tisk seznamu všech budoucích událostí a úkolů. +Comment[da]=Dette plugin gør at du kan udskrive en liste med alle kommende begivenheder og opgaver. +Comment[de]=Mit diesem Modul kann eine Liste der als nächstes anliegenden Ereignisse und Aufgaben gedruckt werden +Comment[el]=Αυτό το πρόσθετο σας επιτρέπει να εκτυπώνετε μία λίστα γεγονότων ή προς υλοποίηση εργασιών. +Comment[es]=Esta extensión le permite imprimir una lista de todos los eventos y tareas pendientes futuros. +Comment[et]=See plugin võimaldab trükkida kõigi eelseisvate sündmuste ja ülesannete nimekirja. +Comment[eu]=Plugin honek gertatuko diren gertaera eta egitekoen zerrenda bat inprimatzeko aukera ematen dizu. +Comment[fa]=این وصله به شما اجازه میدهد که فهرستی از همۀ رویدادها و کارهای انجامی که بالا میآیند را چاپ کنید. +Comment[fi]=Tämä liitännäinen mahdollistaa tulevien tapahtumien ja tehtävien tulostuksen listana. +Comment[fr]=Ce module vous permet d'imprimer la liste des prochaines évènements et des prochaines tâches. +Comment[fy]=Dizze plugin makket it mooglik om in list fan alle kommende eveneminten en taken út te printsjen. +Comment[gl]=Este engadido permítelle imprimir unha lista de todos os eventos e tarefas por vir. +Comment[hu]=Ezzel a modullal kinyomtathatók a rövidesen aktuálissá váló feladatok és események. +Comment[is]=Þetta íforrit gerir þér kleyft að prenta út lista yfir alla væntanlega atburði og verkþætti. +Comment[it]=Questo plugin vi permette di stampare una lista dei prossimi eventi e cose da fare. +Comment[ja]=このプラグインにより、将来のすべてのイベントや To-Do のリストを印刷できるようになります。 +Comment[ka]=ეს მოდული საშუალებას გაძლევთ ამობეჭდოთ მომავალი მოვლენები და დავალებები. +Comment[kk]=Бұл келер оқиғалар мен жоспарлар тізімін басып шығаратын модулі. +Comment[km]=កម្មវិធីជំនួយនេះអនុញ្ញាតឲ្យអ្នកបោះពុម្ពបញ្ជីនៃព្រឹត្តិការណ៍ និងការងារត្រូវធ្វើបន្តបន្ទាប់ +Comment[lt]=Šis priedas leidžia spausdinti sąrašą visų artėjančių įvykių ir darbų. +Comment[ms]=Plugin ini membenarkan anda mencetak senarai semua peristiwa dan tugasan mendatang. +Comment[nb]=Med dette programtillegget kan du skrive ut en liste over kommende hendelser og ting som skal gjøres. +Comment[nds]=Mit dit Moduul kann en List vun de direktemang nakamen Begeefnissen un Opgaven utdruckt warrn. +Comment[ne]=यो प्लगइनले तपाईँलाई सबै पछि हुने घटना र गर्नुपर्ने कार्यहरुको सूचीको मुद्रण गर्न अनुमति दिन्छ । +Comment[nl]=Deze plugin maakt het mogelijk om een lijst van alle komende evenementen en taken uit te printen. +Comment[nn]=Dette programtillegget lèt deg skriva ut ei liste over alle dei komande hendingane og oppføringane i hugselista. +Comment[pl]=Ta wtyczka pozwala wydrukować wszystkie przyszłe zdarzenia i zadania. +Comment[pt]=Este 'plugin' permite-lhe imprimir uma lista com todos os eventos e itens por-fazer próximos. +Comment[pt_BR]=Este plug-in permite que você imprima uma lista de todos os eventos e pendências que estão por vir. +Comment[ru]=Этот модуль позволяет печатать список будущих событий и задач. +Comment[sk]=Tento modul umožní vytlačiť zoznam všetkých nadchádzajúcich udalostí a úloh. +Comment[sl]=Ta vstavek vam omogoča natis seznama vseh prihahajočih dogodkov in čakajočih opravil. +Comment[sr]=Овај прикључак вам омогућава да одштампате листу свих наступајућих догађаја и обавеза. +Comment[sr@Latn]=Ovaj priključak vam omogućava da odštampate listu svih nastupajućih događaja i obaveza. +Comment[sv]=Det här insticksprogrammet gör att du kan skriva ut en lista med alla kommande händelser och uppgifter. +Comment[ta]=இந்த சொருகுப்பொருள் ஒரு வரப்போகும் நிகழ்வுகளின் பட்டியல் மற்றும் செய்யவேண்டியவைகளை அச்சிட உங்களை அனுமதிக்கிறது. +Comment[tr]=Bu eklenti, sıradaki olayları ve yapılacaklar listesini bir liste biçiminde yazdırmanızı sağlar. +Comment[uk]=Цей втулок дозволяє друкувати список всіх майбутніх подій та завдань. +Comment[zh_CN]=此插件允许您打印所有即将到达的事件和代办事宜。 +Comment[zh_TW]=此外掛程式允許您印出即將發生的事件與待辦事項清單。 +Type=Service +ServiceTypes=Calendar/Plugin,KOrganizer/PrintPlugin +X-KDE-KOrganizer-HasSettings=false +X-KDE-PluginInterfaceVersion=2 diff --git a/korganizer/plugins/printing/whatsnext/whatsnextprint.h b/korganizer/plugins/printing/whatsnext/whatsnextprint.h new file mode 100644 index 000000000..bdba1f71b --- /dev/null +++ b/korganizer/plugins/printing/whatsnext/whatsnextprint.h @@ -0,0 +1,61 @@ +/* + This file is part of KOrganizer. + + Copyright (c) 2004 Reinhold Kainhofer <reinhold@kainhofer.com> + + 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 WHATSNEXTPRINT_H +#define WHATSNEXTPRINT_H + +#include <klocale.h> +#include "calprintpluginbase.h" + +#ifndef KORG_NOPRINTER +namespace KCal { +class Calendar; +} + +using namespace KCal; + +class CalPrintWhatsNext : public CalPrintPluginBase +{ + public: + CalPrintWhatsNext():CalPrintPluginBase() {} + virtual ~CalPrintWhatsNext() {} + virtual QString description() { return i18n("Print What's Next"); } + virtual QString info() { return i18n("Prints a list of all upcoming events and todos."); } + virtual int sortID() { return 50; } + virtual QWidget *createConfigWidget( QWidget* ); + + public: + virtual void print(QPainter &p, int width, int height); + virtual void readSettingsWidget(); + virtual void setSettingsWidget(); + virtual void loadConfig(); + virtual void saveConfig(); + virtual void setDateRange( const QDate& from, const QDate& to ); + + protected: + bool mUseDateRange; +}; + + +#endif +#endif diff --git a/korganizer/plugins/printing/year/Makefile.am b/korganizer/plugins/printing/year/Makefile.am new file mode 100644 index 000000000..f51e29e61 --- /dev/null +++ b/korganizer/plugins/printing/year/Makefile.am @@ -0,0 +1,14 @@ +INCLUDES = -I$(top_srcdir)/korganizer/interfaces -I$(top_srcdir)/korganizer/printing -I$(top_srcdir) $(all_includes) + +kde_module_LTLIBRARIES = libkorg_yearlyprint.la + +libkorg_yearlyprint_la_SOURCES =calprintyearconfig_base.ui yearprint.cpp +libkorg_yearlyprint_la_LDFLAGS = -module $(KDE_PLUGIN) $(KDE_RPATH) $(all_libraries) +libkorg_yearlyprint_la_LIBADD = $(LIB_KDECORE) $(LIB_KDEUI) $(top_builddir)/korganizer/printing/libkorg_stdprinting.la + +noinst_HEADERS = + +servicedir = $(kde_servicesdir)/korganizer +service_DATA = yearprint.desktop + +METASOURCES = AUTO diff --git a/korganizer/plugins/printing/year/calprintyearconfig_base.ui b/korganizer/plugins/printing/year/calprintyearconfig_base.ui new file mode 100644 index 000000000..43d906d6c --- /dev/null +++ b/korganizer/plugins/printing/year/calprintyearconfig_base.ui @@ -0,0 +1,200 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>CalPrintYearConfig_Base</class> +<comment>Configuration page for the yearly print mode.</comment> +<author>Reinhold Kainhofer <reinhold@kainhofer.com></author> +<widget class="QWidget"> + <property name="name"> + <cstring>CalPrintYear_Base</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>340</width> + <height>237</height> + </rect> + </property> + <property name="caption"> + <string>CalPrintYear_Base</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QButtonGroup"> + <property name="name"> + <cstring>mDateRangeGroup</cstring> + </property> + <property name="title"> + <string>Yearly print options</string> + </property> + <property name="selectedId" stdset="0"> + <number>-1</number> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>mYearLabel</cstring> + </property> + <property name="text"> + <string>Print &Year:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>mYear</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>mPagesLabel</cstring> + </property> + <property name="text"> + <string>Number of &pages:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>mPages</cstring> + </property> + </widget> + <widget class="QSpinBox" row="0" column="1"> + <property name="name"> + <cstring>mYear</cstring> + </property> + <property name="maxValue"> + <number>2500</number> + </property> + <property name="minValue"> + <number>0</number> + </property> + <property name="value"> + <number>2007</number> + </property> + </widget> + <spacer row="0" column="2"> + <property name="name"> + <cstring>spacer4</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>120</width> + <height>21</height> + </size> + </property> + </spacer> + <widget class="QComboBox" row="1" column="1"> + <property name="name"> + <cstring>mPages</cstring> + </property> + </widget> + <spacer row="1" column="2"> + <property name="name"> + <cstring>spacer5</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>131</width> + <height>21</height> + </size> + </property> + </spacer> + </grid> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>mDisplayOptionsGroup</cstring> + </property> + <property name="title"> + <string>Display Options</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>mSubDaysLabel</cstring> + </property> + <property name="text"> + <string>Show sub-day events as:</string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>mHolidaysLabel</cstring> + </property> + <property name="text"> + <string>Show holidays as:</string> + </property> + </widget> + <widget class="QComboBox" row="0" column="1"> + <item> + <property name="text"> + <string>Text</string> + </property> + </item> + <item> + <property name="text"> + <string>Time Boxes</string> + </property> + </item> + <property name="name"> + <cstring>mSubDays</cstring> + </property> + <property name="currentItem"> + <number>1</number> + </property> + </widget> + <widget class="QComboBox" row="1" column="1"> + <item> + <property name="text"> + <string>Text</string> + </property> + </item> + <item> + <property name="text"> + <string>Time Boxes</string> + </property> + </item> + <property name="name"> + <cstring>mHolidays</cstring> + </property> + </widget> + </grid> + </widget> + <spacer> + <property name="name"> + <cstring>spacer3</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>40</height> + </size> + </property> + </spacer> + </vbox> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/korganizer/plugins/printing/year/yearprint.cpp b/korganizer/plugins/printing/year/yearprint.cpp new file mode 100644 index 000000000..d71cd9f08 --- /dev/null +++ b/korganizer/plugins/printing/year/yearprint.cpp @@ -0,0 +1,204 @@ +/* + This file is part of KOrganizer. + + Copyright (c) 2004 Reinhold Kainhofer <reinhold@kainhofer.com> + + 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 KORG_NOPRINTER + +#include "calprintyearconfig_base.h" +#include "yearprint.h" + +#include <libkcal/calendar.h> + +#include <kconfig.h> +#include <kdebug.h> +#include <kcalendarsystem.h> +#include <klocale.h> + +#include <qcheckbox.h> +#include <qspinbox.h> +#include <qcombobox.h> +#include <qpainter.h> + +class YearPrintFactory : public KOrg::PrintPluginFactory { + public: + KOrg::PrintPlugin *create() { return new CalPrintYear; } +}; + +K_EXPORT_COMPONENT_FACTORY( libkorg_yearlyprint, YearPrintFactory ) + + +/************************************************************** + * Print Year + **************************************************************/ + +QWidget *CalPrintYear::createConfigWidget( QWidget *w ) +{ + return new CalPrintYearConfig_Base( w ); +} + +void CalPrintYear::readSettingsWidget() +{ + CalPrintYearConfig_Base *cfg = + dynamic_cast<CalPrintYearConfig_Base*>( mConfigWidget ); + if ( cfg ) { + mYear = cfg->mYear->value(); + mPages = cfg->mPages->currentText().toInt(); + mSubDaysEvents = (cfg->mSubDays->currentItem()==0)?Text:TimeBoxes; + mHolidaysEvents = (cfg->mHolidays->currentItem()==0)?Text:TimeBoxes; + } +} + +void CalPrintYear::setSettingsWidget() +{ + CalPrintYearConfig_Base *cfg = + dynamic_cast<CalPrintYearConfig_Base*>( mConfigWidget ); + if ( cfg ) { + const KCalendarSystem *calsys = calendarSystem(); + QDate start; + calsys->setYMD( start, mYear, 1, 1 ); + int months = calsys->monthsInYear( start ); + int pages=0, prevPages=0; + for ( int i=1; i<= months; ++i ) { + pages = (months-1)/i + 1; + if ( pages != prevPages ) { + prevPages = pages; + cfg->mPages->insertItem( QString::number( pages ), 0 ); + } + } + + cfg->mYear->setValue( mYear ); + cfg->mPages->setCurrentText( QString::number( mPages ) ); + + cfg->mSubDays->setCurrentItem( (mSubDaysEvents==Text)?0:1 ); + cfg->mHolidays->setCurrentItem( (mHolidaysEvents==Text)?0:1 ); + } +} + +void CalPrintYear::loadConfig() +{ + if ( mConfig ) { + mYear = mConfig->readNumEntry( "Year", 2007 ); + mPages = mConfig->readNumEntry( "Pages", 1 ); + mSubDaysEvents = mConfig->readNumEntry( "ShowSubDayEventsAs", TimeBoxes ); + mHolidaysEvents = mConfig->readNumEntry( "ShowHolidaysAs", Text ); + } + setSettingsWidget(); +} + +void CalPrintYear::saveConfig() +{ + kdDebug(5850) << "CalPrintYear::saveConfig()" << endl; + + readSettingsWidget(); + if ( mConfig ) { + mConfig->writeEntry( "Year", mYear ); + mConfig->writeEntry( "Pages", mPages ); + mConfig->writeEntry( "Pages", mPages ); + mConfig->writeEntry( "ShowSubDayEventsAs", mSubDaysEvents ); + mConfig->writeEntry( "ShowHolidaysAs", mHolidaysEvents ); + } +} + +KPrinter::Orientation CalPrintYear::defaultOrientation() +{ + return ( mPages == 1 )?(KPrinter::Landscape):(KPrinter::Portrait); +} + + +void CalPrintYear::setDateRange( const QDate& from, const QDate& to ) +{ + CalPrintPluginBase::setDateRange( from, to ); + CalPrintYearConfig_Base *cfg = + dynamic_cast<CalPrintYearConfig_Base*>( mConfigWidget ); + if ( cfg ) { + cfg->mYear->setValue( from.year() ); + } +} + +void CalPrintYear::print( QPainter &p, int width, int height ) +{ +kdDebug()<<"CalPrintYear::print, width: "<<width<<", height: "<<height<<endl; + QRect headerBox( 0, 0, width, headerHeight() ); +kdDebug()<<"headerBox: "<<headerBox<<endl; + const KCalendarSystem *calsys = calendarSystem(); + KLocale *locale = KGlobal::locale(); + if ( !calsys || !locale ) return; + + QDate start; + calsys->setYMD( start, mYear, 1, 1 ); + + // Determine the nr of months and the max nr of days per month (dependent on + // calendar system!!!!) + QDate temp( start ); + int months = calsys->monthsInYear( start ); + int maxdays = 1; + for ( int i = 1; i< months; ++i ) { + maxdays = QMAX( maxdays, temp.daysInMonth() ); + temp = calsys->addMonths( temp, 1 ); + } + + // Now determine the months per page so that the printout fits on + // exactly mPages pages + int monthsPerPage = (months-1) / mPages + 1; + int pages = (months-1) / monthsPerPage + 1; + int thismonth = 0; + temp = start; + for ( int page = 0; page < pages; ++page ) { + if ( page > 0 ) { + mPrinter->newPage(); + } + QDate end( calsys->addMonths( start, monthsPerPage ) ); + end = calsys->addDays( end, -1 ); + QString title; + if ( orientation() == KPrinter::Landscape ) { + title = i18n("date from - to", "%1 - %2"); + } else { + title = i18n("date from -\nto", "%1 -\n%2"); + } + drawHeader( p, title + .arg( locale->formatDate( start ) ) + .arg( locale->formatDate( end ) ), + calsys->addMonths( start, -1), calsys->addMonths( start, monthsPerPage ), + headerBox ); + + QRect monthesBox( headerBox ); + monthesBox.setTop( monthesBox.bottom() + padding() ); + monthesBox.setBottom( height ); + + drawBox( p, BOX_BORDER_WIDTH, monthesBox ); + float monthwidth = float(monthesBox.width()) / float( monthsPerPage ); + + for ( int j=0; j<monthsPerPage; ++j ) { + if ( ++thismonth > months ) break; + int xstart = int(j*monthwidth + 0.5); + int xend = int((j+1)*monthwidth + 0.5); + QRect monthBox( xstart, monthesBox.top(), xend-xstart, monthesBox.height() ); + drawMonth( p, temp, monthBox, maxdays, mSubDaysEvents, mHolidaysEvents ); + + temp = calsys->addMonths( temp, 1 ); + } + start = calsys->addMonths( start, monthsPerPage ); + } +} + +#endif diff --git a/korganizer/plugins/printing/year/yearprint.desktop b/korganizer/plugins/printing/year/yearprint.desktop new file mode 100644 index 000000000..5edafedc2 --- /dev/null +++ b/korganizer/plugins/printing/year/yearprint.desktop @@ -0,0 +1,84 @@ +[Desktop Entry] +X-KDE-Library=libkorg_yearlyprint +Name=Yearly Print Style +Name[af]=Druk styl: Jaarliks +Name[bg]=Стил за отпечатване на годишно разписание +Name[ca]=Estil d'impressió anual +Name[cs]=Roční tiskový styl +Name[da]=Yearly udskriftsstil +Name[de]=Jahres-Druckstil +Name[el]=Στυλ ετήσιας εκτύπωσης +Name[eo]=Pojara Presostilo +Name[es]=Estilo de impresión del diario +Name[et]=Aastakalendri trükkimise stiil +Name[fa]=سبک چاپ نشریه +Name[fr]=Impression annuelle +Name[fy]=Printstyl foar jierkalinder +Name[gl]=Estilo de impresión anual +Name[hu]=Éves naptár nyomtatási stílus +Name[is]=Ársyfirlitsprentstíll +Name[it]=Stile di stampa annuale +Name[ja]=年毎印刷スタイル +Name[kk]=Жылдық басу стилі +Name[km]=រចនាប័ទ្មបោះពុម្ពប្រចាំឆ្នាំ +Name[lt]=Metų spausdinimo stilius +Name[nb]=Utskriftsstil for kalender +Name[nds]=Johrkalenner-Druckstil +Name[ne]=वार्षिक मुद्रण शैली +Name[nl]=Printstijl voor jaarkalender +Name[pl]=Styl drukowania roku +Name[pt]=Estilo de Impressão em Anuário +Name[pt_BR]=Estilo de Impressão de Calendário Anual +Name[ru]=Календарь на год +Name[sk]=Štýl tlače pre rok +Name[sl]=Letni slog tiskanja +Name[sr]=Годишњи стил штампе +Name[sr@Latn]=Godišnji stil štampe +Name[sv]=Årlig utskriftsstil +Name[tr]=Yıllık Yazdırma Stili +Name[uk]=Стиль друку щорічником +Name[zh_CN]=按年打印样式 +Name[zh_TW]=年度列印風格 +Comment=This plugin allows you to print out a yearly calendar. +Comment[af]=Hierdie inprop module maak dit moontlik om 'n kalender vir 'n hele jaar te druk. +Comment[bg]=Приставката служи за печат на годишния календар. +Comment[ca]=Aquest endollable us permet imprimir un calendari anual. +Comment[cs]=Tento modul umožňuje tisk ročního kalendáře. +Comment[da]=Dette plugin gør at du kan udskrive en årlig kalender +Comment[de]=Mit diesem Modul können Jahresübersichten gedruckt werden. +Comment[el]=Αυτό το πρόσθετο σας επιτρέπει να εκτυπώσετε ένα ετήσιο ημερολόγιο. +Comment[es]=Este plugin le permite imprimir entradas del diario. +Comment[et]=See plugin võimaldab trükkida terve aasta kalendri. +Comment[fa]=این وصله، به شما اجازه میدهد که مدخلهای نشریه )مدخلهای روزانه( را چاپ کنید. +Comment[fr]=Ce module vous permet d'imprimer l'ensemble de l'année +Comment[fy]=Dizze plugin makket it mooglik om in jierkalinder út te printsjen. +Comment[gl]=Este engadido permítelle imprimir un calendario anual. +Comment[hu]=Ez a modul egy egész éves naptár kinyomtatását teszi lehetővé. +Comment[is]=Þetta íforrit gerir þér kleyft að prenta út dagbókarfærslur fyrir allt árið. +Comment[it]=Questo plugin ti permette di stampare un calendario annuale. +Comment[ja]=このプラグインにより、年毎のカレンダーを印刷できるようになります。 +Comment[kk]=Бұл жылдық күнтізбені басып шығаратын модулі. +Comment[km]=កម្មវិធីជំនួយនេះអនុញ្ញាតឲ្យអ្នកបោះពុម្ពប្រតិទិនប្រចាំឆ្នាំ ។ +Comment[lt]=Šis priedas leidžia spausdinti metų kalendorių. +Comment[mk]=Овој приклучок Ви овозможува да испечатите годишен календар. +Comment[nb]=Med dette programtillegget kan du skrive ut en årskalender. +Comment[nds]=Mit dit Moduul kannst Du en Kalenner för't hele Johr utdrucken. +Comment[ne]=यो प्लगइनले तपाईँलाई वार्षिक पात्रो मुद्रण गर्न अनुमति दिन्छ । +Comment[nl]=Deze plugin maakt het mogelijk om een jaarkalender af te drukken. +Comment[pl]=Ta wtyczka pozwala drukować roczny kalendarz. +Comment[pt]=Este 'plugin' permite-lhe imprimir um calendário anual. +Comment[pt_BR]=Este plug-in permite imprimir um calendário anual. +Comment[ru]=Этот модуль позволяет печатать календарь на год. +Comment[sk]=Tento modul vám umožní vytlačiť kalendár na rok. +Comment[sl]=Ta vstavek vam omogoča natis letnega koledarja. +Comment[sr]=Овај прикључак вам омогућава да одштампате годишњи календар. +Comment[sr@Latn]=Ovaj priključak vam omogućava da odštampate godišnji kalendar. +Comment[sv]=Det här insticksprogrammet gör att du kan skriva ut en årlig kalender. +Comment[tr]=Bu eklenti, yıllık takvimi yazıcıdan çıkartmanızı sağlar. +Comment[uk]=Цей журнал надає можливість друкувати щорічний календар. +Comment[zh_CN]=此插件允许您打印年历。 +Comment[zh_TW]=此外掛程式讓您印出年曆。 +Type=Service +ServiceTypes=Calendar/Plugin,KOrganizer/PrintPlugin +X-KDE-KOrganizer-HasSettings=false +X-KDE-PluginInterfaceVersion=2 diff --git a/korganizer/plugins/printing/year/yearprint.h b/korganizer/plugins/printing/year/yearprint.h new file mode 100644 index 000000000..3191150b2 --- /dev/null +++ b/korganizer/plugins/printing/year/yearprint.h @@ -0,0 +1,65 @@ +/* + This file is part of KOrganizer. + + Copyright (c) 2004 Reinhold Kainhofer <reinhold@kainhofer.com> + + 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 YEARPRINT_H +#define YEARPRINT_H + +#include <klocale.h> +#include "calprintpluginbase.h" + +#ifndef KORG_NOPRINTER +namespace KCal { +class Calendar; +} + +using namespace KCal; + +class CalPrintYear : public CalPrintPluginBase +{ + public: + CalPrintYear():CalPrintPluginBase() {} + virtual ~CalPrintYear() {} + virtual QString description() { return i18n("Print &Year"); } + virtual QString info() { return i18n("Prints a calendar for an entire year"); } + virtual int sortID() { return 900; } + virtual bool enabled() { return true; } + virtual QWidget *createConfigWidget( QWidget* ); + virtual KPrinter::Orientation defaultOrientation(); + + public: + virtual void print(QPainter &p, int width, int height); + virtual void readSettingsWidget(); + virtual void setSettingsWidget(); + virtual void loadConfig(); + virtual void saveConfig(); + virtual void setDateRange( const QDate& from, const QDate& to ); + + protected: + int mYear; + int mPages; + int mSubDaysEvents, mHolidaysEvents; +}; + + +#endif +#endif diff --git a/korganizer/plugins/projectview/Makefile.am b/korganizer/plugins/projectview/Makefile.am new file mode 100644 index 000000000..f84cf7089 --- /dev/null +++ b/korganizer/plugins/projectview/Makefile.am @@ -0,0 +1,20 @@ +# $Id$ + +METASOURCES = AUTO + +INCLUDES = -I$(top_srcdir)/korganizer/interfaces \ + -I$(top_srcdir) -I$(top_srcdir)/kgantt/kgantt $(all_includes) + +kde_module_LTLIBRARIES = libkorg_projectview.la + +libkorg_projectview_la_SOURCES = projectview.cpp koprojectview.cpp +libkorg_projectview_la_LDFLAGS = -module $(KDE_PLUGIN) $(KDE_RPATH) $(all_libraries) +libkorg_projectview_la_LIBADD = $(top_builddir)/kgantt/kgantt/libkgantt.la $(top_builddir)/korganizer/libkorganizer.la $(LIB_KPARTS) + +noinst_HEADERS = projectview.h koprojectview.h + +servicedir = $(kde_servicesdir)/korganizer +service_DATA = projectview.desktop + +rcdir = $(kde_datadir)/korganizer/plugins +rc_DATA = projectviewui.rc diff --git a/korganizer/plugins/projectview/koprojectview.cpp b/korganizer/plugins/projectview/koprojectview.cpp new file mode 100644 index 000000000..0f2601954 --- /dev/null +++ b/korganizer/plugins/projectview/koprojectview.cpp @@ -0,0 +1,366 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2001 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. +*/ + +#include <qlayout.h> +#include <qheader.h> +#include <qpushbutton.h> +#include <qfont.h> +#include <qlabel.h> +#include <qlineedit.h> +#include <qlistbox.h> +#include <qpopupmenu.h> +#include <qstrlist.h> +#include <qlistview.h> + +#include <kapplication.h> +#include <kdebug.h> +#include <klocale.h> +#include <kglobal.h> +#include <kiconloader.h> +#include <kmessagebox.h> +#include <kconfig.h> +#include <kstandarddirs.h> + +#include <libkcal/vcaldrag.h> + +#include "KGantt.h" + +#include "koprojectview.h" + +using namespace KOrg; + +KOProjectViewItem::KOProjectViewItem(Todo *event,KGanttItem* parentTask, + const QString& text, + const QDateTime& start, + const QDateTime& end) : + KGanttItem(parentTask,text,start,end) +{ + mEvent = event; +} + +KOProjectViewItem::~KOProjectViewItem() +{ +} + +Todo *KOProjectViewItem::event() +{ + return mEvent; +} + + +KOProjectView::KOProjectView(Calendar *calendar,QWidget* parent, + const char* name) : + KOrg::BaseView(calendar,parent,name) +{ + QBoxLayout *topLayout = new QVBoxLayout(this); + + QBoxLayout *topBar = new QHBoxLayout; + topLayout->addLayout(topBar); + + QLabel *title = new QLabel(i18n("Project View"),this); + title->setFrameStyle(QFrame::Panel|QFrame::Raised); + topBar->addWidget(title,1); + + QPushButton *zoomIn = new QPushButton(i18n("Zoom In"),this); + topBar->addWidget(zoomIn,0); + connect(zoomIn,SIGNAL(clicked()),SLOT(zoomIn())); + + QPushButton *zoomOut = new QPushButton(i18n("Zoom Out"),this); + topBar->addWidget(zoomOut,0); + connect(zoomOut,SIGNAL(clicked()),SLOT(zoomOut())); + + QPushButton *menuButton = new QPushButton(i18n("Select Mode"),this); + topBar->addWidget(menuButton,0); + connect(menuButton,SIGNAL(clicked()),SLOT(showModeMenu())); + + createMainTask(); + + mGantt = new KGantt(mMainTask,this); + topLayout->addWidget(mGantt,1); + +#if 0 + mGantt->addHoliday(2000, 10, 3); + mGantt->addHoliday(2001, 10, 3); + mGantt->addHoliday(2000, 12, 24); + + for(int i=1; i<7; ++i) + mGantt->addHoliday(2001, 1, i); +#endif +} + +void KOProjectView::createMainTask() +{ + mMainTask = new KGanttItem(0,i18n("main task"), + QDateTime::currentDateTime(), + QDateTime::currentDateTime()); + mMainTask->setMode(KGanttItem::Rubberband); + mMainTask->setStyle(KGanttItem::DrawBorder | KGanttItem::DrawText | + KGanttItem::DrawHandle); +} + +void KOProjectView::readSettings() +{ + kdDebug(5850) << "KOProjectView::readSettings()" << endl; + + //KConfig *config = kapp->config(); + KConfig config( "korganizerrc", true, false); // Open read-only, no kdeglobals + config.setGroup("Views"); + + QValueList<int> sizes = config.readIntListEntry("Separator ProjectView"); + if (sizes.count() == 2) { + mGantt->splitter()->setSizes(sizes); + } +} + +void KOProjectView::writeSettings(KConfig *config) +{ + kdDebug(5850) << "KOProjectView::writeSettings()" << endl; + + config->setGroup("Views"); + + QValueList<int> list = mGantt->splitter()->sizes(); + config->writeEntry("Separator ProjectView",list); +} + + +void KOProjectView::updateView() +{ + kdDebug(5850) << "KOProjectView::updateView()" << endl; + + // Clear Gantt view + QPtrList<KGanttItem> subs = mMainTask->getSubItems(); + KGanttItem *t=subs.first(); + while(t) { + KGanttItem *nt=subs.next(); + delete t; + t = nt; + } + +#if 0 + KGanttItem* t1 = new KGanttItem(mGantt->getMainTask(), "task 1, no subtasks", + QDateTime::currentDateTime().addDays(10), + QDateTime::currentDateTime().addDays(20) ); + + KGanttItem* t2 = new KGanttItem(mGantt->getMainTask(), "task 2, subtasks, no rubberband", + QDateTime(QDate(2000,10,1)), + QDateTime(QDate(2000,10,31)) ); +#endif + + Todo::List todoList = calendar()->todos(); + +/* + kdDebug(5850) << "KOProjectView::updateView(): Todo List:" << endl; + Event *t; + for(t = todoList.first(); t; t = todoList.next()) { + kdDebug(5850) << " " << t->getSummary() << endl; + + if (t->getRelatedTo()) { + kdDebug(5850) << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; + } + + QPtrList<Event> l = t->getRelations(); + Event *c; + for(c=l.first();c;c=l.next()) { + kdDebug(5850) << " - relation: " << c->getSummary() << endl; + } + } +*/ + + // Put for each Event a KOProjectViewItem in the list view. Don't rely on a + // specific order of events. That means that we have to generate parent items + // recursively for proper hierarchical display of Todos. + mTodoMap.clear(); + Todo::List::ConstIterator it; + for( it = todoList.begin(); it != todoList.end(); ++it ) { + if ( !mTodoMap.contains( *it ) ) { + insertTodoItem( *it ); + } + } +} + +QMap<Todo *,KGanttItem *>::ConstIterator + KOProjectView::insertTodoItem(Todo *todo) +{ +// kdDebug(5850) << "KOProjectView::insertTodoItem(): " << todo->getSummary() << endl; + Todo *relatedTodo = dynamic_cast<Todo *>(todo->relatedTo()); + if (relatedTodo) { +// kdDebug(5850) << " has Related" << endl; + QMap<Todo *,KGanttItem *>::ConstIterator itemIterator; + itemIterator = mTodoMap.find(relatedTodo); + if (itemIterator == mTodoMap.end()) { +// kdDebug(5850) << " related not yet in list" << endl; + itemIterator = insertTodoItem (relatedTodo); + } + KGanttItem *task = createTask(*itemIterator,todo); + return mTodoMap.insert(todo,task); + } else { +// kdDebug(5850) << " no Related" << endl; + KGanttItem *task = createTask(mMainTask,todo); + return mTodoMap.insert(todo,task); + } +} + +KGanttItem *KOProjectView::createTask(KGanttItem *parent,Todo *todo) +{ + QDateTime startDt; + QDateTime endDt; + + if (todo->hasStartDate() && !todo->hasDueDate()) { + // start date but no due date + startDt = todo->dtStart(); + endDt = QDateTime::currentDateTime(); + } else if (!todo->hasStartDate() && todo->hasDueDate()) { + // due date but no start date + startDt = todo->dtDue(); + endDt = todo->dtDue(); + } else if (!todo->hasStartDate() || !todo->hasDueDate()) { + startDt = QDateTime::currentDateTime(); + endDt = QDateTime::currentDateTime(); + } else { + startDt = todo->dtStart(); + endDt = todo->dtDue(); + } + + KGanttItem *task = new KOProjectViewItem(todo,parent,todo->summary(),startDt, + endDt); + connect(task,SIGNAL(changed(KGanttItem*, KGanttItem::Change)), + SLOT(taskChanged(KGanttItem*,KGanttItem::Change))); + if (todo->relations().count() > 0) { + task->setBrush(QBrush(QColor(240,240,240), QBrush::Dense4Pattern)); + } + + return task; +} + +void KOProjectView::updateConfig() +{ + // FIXME: to be implemented. +} + +Incidence::List KOProjectView::selectedIncidences() +{ + Incidence::List selected; + +/* + KOProjectViewItem *item = (KOProjectViewItem *)(mTodoListView->selectedItem()); + if (item) selected.append(item->event()); +*/ + + return selected; +} + +DateList KOProjectView::selectedDates() +{ + DateList selected; + return selected; +} + +void KOProjectView::changeIncidenceDisplay(Incidence *, int) +{ + updateView(); +} + +void KOProjectView::showDates(const QDate &, const QDate &) +{ + updateView(); +} + +void KOProjectView::showIncidences( const Incidence::List & ) +{ + kdDebug(5850) << "KOProjectView::showIncidences( const Incidence::List & ): not yet implemented" << endl; +} + +#if 0 +void KOProjectView::editItem(QListViewItem *item) +{ + emit editIncidenceSignal(((KOProjectViewItem *)item)->event()); +} + +void KOProjectView::showItem(QListViewItem *item) +{ + emit showIncidenceSignal(((KOProjectViewItem *)item)->event()); +} + +void KOProjectView::popupMenu(QListViewItem *item,const QPoint &,int) +{ + mActiveItem = (KOProjectViewItem *)item; + if (item) mItemPopupMenu->popup(QCursor::pos()); + else mPopupMenu->popup(QCursor::pos()); +} + +void KOProjectView::newTodo() +{ + emit newTodoSignal(); +} + +void KOProjectView::newSubTodo() +{ + if (mActiveItem) { + emit newSubTodoSignal(mActiveItem->event()); + } +} + +void KOProjectView::itemClicked(QListViewItem *item) +{ + if (!item) return; + + KOProjectViewItem *todoItem = (KOProjectViewItem *)item; + int completed = todoItem->event()->isCompleted(); // Completed or not? + + if (todoItem->isOn()) { + if (!completed) { + todoItem->event()->setCompleted(true); + } + } else { + if (completed) { + todoItem->event()->setCompleted(false); + } + } +} +#endif + +void KOProjectView::showModeMenu() +{ + mGantt->menu()->popup(QCursor::pos()); +} + +void KOProjectView::taskChanged(KGanttItem *task,KGanttItem::Change change) +{ + if (task == mMainTask) return; + + KOProjectViewItem *item = (KOProjectViewItem *)task; + + if (change == KGanttItem::StartChanged) { + item->event()->setDtStart(task->getStart()); + } else if (change == KGanttItem::EndChanged) { + item->event()->setDtDue(task->getEnd()); + } +} + +void KOProjectView::zoomIn() +{ + mGantt->zoom(2); +} + +void KOProjectView::zoomOut() +{ + mGantt->zoom(0.5); +} + +#include "koprojectview.moc" diff --git a/korganizer/plugins/projectview/koprojectview.h b/korganizer/plugins/projectview/koprojectview.h new file mode 100644 index 000000000..a356fe024 --- /dev/null +++ b/korganizer/plugins/projectview/koprojectview.h @@ -0,0 +1,118 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2001 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. +*/ +#ifndef KOPROJECTVIEW_H +#define KOPROJECTVIEW_H +/* $Id$ */ + +#include <qptrlist.h> +#include <qfontmetrics.h> + +#include <qmap.h> + +#include <libkcal/calendar.h> +#include <libkcal/event.h> + +#include "korganizer/baseview.h" +#include "KGanttItem.h" + +class KGantt; +class QLineEdit; +class QFont; +class QLabel; +class QPopupMenu; +class QListBox; +class QStrList; +class QListView; + +/** + This class provides an item of the project view. It is a xQTask with + an additional Event attribute. +*/ +class KOProjectViewItem : public KGanttItem { + public: + KOProjectViewItem(Todo *,KGanttItem* parentTask, const QString& text, + const QDateTime& start, const QDateTime& end); + ~KOProjectViewItem(); + + Todo *event(); + + private: + Todo *mEvent; +}; + + +/** + * This class provides a Gantt-like project view on todo items + * + * @short project view on todo items. + * @author Cornelius Schumacher <schumacher@kde.org> + */ +class KOProjectView : public KOrg::BaseView +{ + Q_OBJECT + public: + KOProjectView(Calendar *, QWidget* parent=0, const char* name=0 ); + ~KOProjectView() {} + + Incidence::List selectedIncidences(); + DateList selectedDates(); + + /** Return number of shown dates. */ + int currentDateCount() { return 0; } + + void readSettings(); + void writeSettings(KConfig *); + + public slots: + void updateView(); + void updateConfig(); + + void changeIncidenceDisplay(Incidence *, int); + + void showDates(const QDate &start, const QDate &end); + void showIncidences( const Incidence::List &incidenceList ); + +/* + void editItem(QListViewItem *item); + void showItem(QListViewItem *item); + void popupMenu(QListViewItem *item,const QPoint &,int); + void newTodo(); + void newSubTodo(); + void itemClicked(QListViewItem *); +*/ + + protected slots: + void showModeMenu(); + void zoomIn(); + void zoomOut(); + void taskChanged(KGanttItem *task,KGanttItem::Change change); + + private: + void createMainTask(); + KGanttItem *createTask(KGanttItem *,Todo *); + + KGantt *mGantt; + KGanttItem *mMainTask; + + QMap<Todo *,KGanttItem *>::ConstIterator insertTodoItem(Todo *todo); + + QMap<Todo *,KGanttItem *> mTodoMap; +}; + +#endif diff --git a/korganizer/plugins/projectview/projectview.cpp b/korganizer/plugins/projectview/projectview.cpp new file mode 100644 index 000000000..3fdf84b43 --- /dev/null +++ b/korganizer/plugins/projectview/projectview.cpp @@ -0,0 +1,81 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2001 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. +*/ + +#include <qfile.h> + +#include <kapplication.h> +#include <kconfig.h> +#include <kstandarddirs.h> +#include <klocale.h> +#include <kdebug.h> +#include <kaction.h> +#include <kglobal.h> + +#include "koprojectview.h" + +#include "projectview.h" +using namespace KOrg; +#include "projectview.moc" + +class ProjectViewFactory : public KOrg::PartFactory { + public: + KOrg::Part *create(KOrg::MainWindow *parent, const char *name) + { + KGlobal::locale()->insertCatalogue( "kgantt" ); + return new ProjectView(parent,name); + } +}; + +K_EXPORT_COMPONENT_FACTORY( libkorg_projectview, ProjectViewFactory ) + + +ProjectView::ProjectView(KOrg::MainWindow *parent, const char *name) : + KOrg::Part(parent,name), mView(0) +{ + setInstance( new KInstance( "korganizer" ) ); + + setXMLFile("plugins/projectviewui.rc"); + + new KAction(i18n("&Project"), "project", 0, this, SLOT(showView()), + actionCollection(), "view_project"); +} + +ProjectView::~ProjectView() +{ +} + +QString ProjectView::info() +{ + return i18n("This plugin provides a Gantt diagram as project view."); +} + +QString ProjectView::shortInfo() +{ + return i18n("Project View Plugin"); +} + +void ProjectView::showView() +{ + if (!mView) { + mView = new KOProjectView(mainWindow()->view()->calendar(), + mainWindow()->view()); + mainWindow()->view()->addView(mView); + } + mainWindow()->view()->showView(mView); +} diff --git a/korganizer/plugins/projectview/projectview.desktop b/korganizer/plugins/projectview/projectview.desktop new file mode 100644 index 000000000..e6c3bef7a --- /dev/null +++ b/korganizer/plugins/projectview/projectview.desktop @@ -0,0 +1,110 @@ +[Desktop Entry] +X-KDE-Library=libkorg_projectview +Name=Project View Plugin for KOrganizer +Name[af]=Projek Besigtig Inplak vir Korganizer +Name[az]=KOrganizer Layihə Nümayiş Əlavəsi +Name[bg]=Приставка на организатора за преглед на проекти +Name[br]=Lugent gwell raktres evit KOrganizer +Name[bs]=Preglednik projekata, dodatak za KOrganizer +Name[ca]=Endollable de vista de projectes per a KOrganizer +Name[cs]=Modul projektového pohledu pro KOrganizer +Name[cy]=Ategyn Golwg Cywaith ar gyfer KTrefnydd +Name[da]=Projektvisning-plugin for KOrganizer +Name[de]=Projektbetrachter-Modul für KOrganizer +Name[el]=Πρόσθετο προβολής έργου του KOrganizer +Name[eo]=Projektrigardo-kromaĵo por Organizilo +Name[es]=Plugin de visor de proyectos para KOrganizer +Name[et]=KOrganizeri projektivaate plugin +Name[eu]=KOrganizer-en proiektu ikuspegi plugin-a +Name[fa]=وصلۀ نمای پروژه برای KOrganizer +Name[fi]=Projektinäkymäliitännäinen KOrganizeriin +Name[fr]=Module afficheur de projet pour KOrganizer +Name[fy]=Projektwerjefteplugin foar KOrganizer +Name[gl]=Extensión para Vista de Proxecto para KOrganizer +Name[he]=תוסף תצוגת פרוייקט ל-KOrganizer +Name[hi]=के-आर्गेनाइज़र के लिए परियोजना दृश्य प्लगइन +Name[hr]=KOrganizer dodatak za pogled na projekt +Name[hu]=Projektnézegető bővítőmodul a KOrganizerhez +Name[is]=Verkefnasýnaríforrit fyrir KOrganizer +Name[it]=Plugin di vista dei progetti per KOrganizer +Name[ja]=KOrganizer プロジェクトビュー プラグイン +Name[ka]= KOrganizer-ის პროექტის ხედის მოდული +Name[kk]=KOrganizer-дің жоба көрінісінің модулі +Name[km]=កម្មវិធីជំនួយទិដ្ឋភាពគម្រោងសម្រាប់ KOrganizer +Name[lt]=Projekto peržiūros priedas, skirtas KOrganizer +Name[lv]=Projekta Skatījuma Iespraudnis KOrganaizeram +Name[ms]=Plugin Paparan Projek untuk KOrganizer +Name[nb]=Programtillegg for prosjektvisning i KOrganizer +Name[nds]=Projektkieker-Moduul för KOrganizer +Name[ne]=केडीई आयोजकका लागि परियोजना दृश्य प्लगइन +Name[nl]=Projectenweergaveplugin voor KOrganizer +Name[nn]=Programtillegg for prosjektvising i KOrganizer +Name[nso]=Plugin ya Pono ya Porojeke ya KMmeakanyi +Name[pl]=Wtyczka przeglądania projektów dla Organizatora +Name[pt]='Plugin' de Gestão de Projectos para o KOrganizer +Name[pt_BR]=Plug-in de Visualização de Projetos para o KOrganizer +Name[ro]=Modul vizualizare proiect pentru KOrganizer +Name[ru]=Просмотр проекта +Name[sk]=KOrganizer modul pre projektový pohľad +Name[sl]=Vstavek za projektni prikaz za KOrganizer +Name[sr]=Прикључак KOrganizer-а за приказ пројекта +Name[sr@Latn]=Priključak KOrganizer-a za prikaz projekta +Name[sv]=Projektvyinsticksprogram för Korganizer +Name[ta]=கேஅமைப்பாளருக்கான திட்டக் காட்சி சொருகுப்பொருள் +Name[tg]=Намоиши нақшот +Name[tr]=KOrganizer için Proje Görüntüleme eklentisi +Name[uk]=Втулок перегляду проектів для KOrganizer +Name[ven]=Plugin ya mbonalelo ya phurodzhekiti ya mudzudzanyi wa K +Name[vi]=Plugin xem dự án cho KOrganizer +Name[xh]=Iprojekthi Ijongela KOrganize i Plugin +Name[zh_CN]=KOrganizer 的项目查看插件 +Name[zh_TW]=KOrganizer 專案檢視外掛程式 +Name[zu]=Project Khombisa Iplagi ye KUmgqugquzeli +Comment=This plugin provides a project planning view for KOrganizer (like the to-do or month views). If you enable this plugin, you can switch to the project view and view your to-do list like in a project planner. +Comment[af]=Hierdie inprop module verskaf 'n projek beplanning aansig vir KOrganizer. Dit lyk baie soos die te-doen of maand aansig. As hierdie inprop module geaktiveer is, kan jy na die projek aansig wissel en na jou te-doen in projek beplanner formaat kyk. +Comment[bg]=Приставката служи за планиране и управление на проекти. +Comment[ca]=Aquest endollable proporciona una vista de planificació de projectes per a KOrganizer (com ara les vistes de pendents o mensual). Si habiliteu aquest endollable, podeu canviar a la vista de projecte i veure la llista de tasques pendents com en un planificador de projectes. +Comment[cs]=Tento modul poskytuje projektový pohled pro KOrganizer (podobnějako úkoly nebo měsíční pohled). Pokud jej povolíte, může přepnout do projektového pohledu a prohlížet si úkoly jako v projektovém plánovači. +Comment[da]=Dette plugin sørger for en projektplanvisning i Korganizer (som ligner gøremål eller månedsvisning). Hvis du aktiverer dette plugin kan du skifte til projektvisning og vise din gøremålsliste som i et projektplan-værktøj. +Comment[de]=Mit diesem Modul wird KOrganizer um eine Projektplanungsansicht (ähnlich der Aufgaben- und Monatsansicht) erweitert. Wenn Sie es einschalten, können Sie zur Projektansicht wechseln und sich Ihre Aufgaben wie in einem Projektplaner ansehen. +Comment[el]=Αυτό το πρόσθετο παρέχει μία προβολή σχεδιασμού έργου για το KOrganizer (όπως η προβολή προς υλοποίηση εργασιών και μηνών). Αν το ενεργοποιήσετε, μπορείτε να αλλάξετε στην προβολή έργου και να δείτε τη λίστα των προς υλοποίηση εργασιών σας σαν σε ένα προγραμματιστή έργου. +Comment[es]=Esta extensión proporciona una vista de planificación de proyectos para KOrganizer (como las vistas de tareas pendientes o de mes). Si activa esta extensión, puede pasar a la vista del proyecto y ver la lista de tareas pendientes como en un planificador de proyectos. +Comment[et]=See plugin lisab KOrganizerile projekti planeerimise vaate (nagu ülesannete või kuuvaade). Selle lubamisel saab lülituda projektivaatele ning näha oma ülesannete nimekirja projektiplaneerija moodi. +Comment[eu]=Plugin honek KOrganizer-en proiektuaren plangintza ikuspegi bat eskeintzen du (egiteko edo hilabete ikupegien antzera). Plugin hau gaitzen baduzu, proiektuaren ikuspegira alda zaitezke eta egitekoak proiektu plangintza batean bezala ikus dezakezu. +Comment[fa]=این وصله، برای KOrganizer یک نمای طراحی پروژه )مثل نماهای کارهای انجامی یا ماهانه( فراهم میکند. اگر این وصله را فعال کنید، میتوانید به نمای پروژه سودهی کرده و مانند طراح پروژه، فهرست کارهای انجامی خود را مشاهده کنید. +Comment[fi]=Tämä liitännäinen mahdollistaa projektin suunnittelunäkymän KOrganizeriin (kuten tehtävälista- tai kuukausinäkymän). Jos kytket tämän päälle, voit vaihtaa projektinäkymään ja katsoa tehtävälistaa kuten projektin suunnittelussa. +Comment[fr]=Ce module propose une vue en projet pour KOrganizer. Si vous activez ce module, vous pourrez afficher vos tâches sous la forme d'un planning projet. +Comment[fy]=Dizze plugin jout jo in projektwerjefte foar KOrganizer (krekt as in takenlist of moannewerjefte). Wannear jo dizze plugin ynskeakelje, kinne jo dizze werjefte oansette om jo takenlist te besjen as projektplanner. +Comment[gl]=Este engadido fornece unha vista planificadora de proxectos para KOrganizer (como as vistas de tarefas ou mensuais). Se habilita este engadid, pode trocar á vista de proxecto e ver a súa lista de tarefas nun planificador de proxectos. +Comment[hu]=Ezzel a modullal projekttervező nézet alakítható ki a KOrganizerben (például a feladatokhoz vagy a havi nézetekhez). Ha aktiválja ezt a modult, átválthat projektnézetbe, hogy a feladatok projekttervként legyenek megtekinthetők. +Comment[is]=Þetta íforrit veitir verkskipulagssýn fyrir KOrganizer (svipað og verkþátta eða mánaðarsýn). Ef þú virkjar þetta íforrit, getur þú á einfaldan hátt skipt yfir í verkefnasýn og skoðað verkþáttalistann þinn í skipuleggjara. +Comment[it]=Questo plugin fornisce una vista di pianificazione progetto per KOrganizer (come la vista delle cose da fare o quella mensile). Se abiliti questo plugin, puoi passare dalla vista progetto alla vista delle cose da fare come in un pianificatore di progetti. +Comment[ja]=このプラグインは KOrganizer にプロジェクト計画ビューを提供します (To-Do ビューや月ビューなど)。このプラグインを有効にすると、プロジェクトビューに切り替えて、スケジュール管理ソフトのように To-Do リストを見ることができます。 +Comment[ka]=ეს მოდული უზრუნველყოფს პროექტის დაგეგმარების ხედს KOrganizer-სთვის(მაგ.: დავალებები ან თვიური მიმოხილვა). თუ ამ მოდულს გაააქტიურებთ,შეგიძლიათ გადართოთ პროექტის ხედზე და იხილოთ თქვენი დავალებათა სია პროექტის მგეგმავის სახით. +Comment[kk]=Бұл KOrganizer-нің жобаны жоспарлау көрінісінің модулі. Модулін орнатсаңыз, осы көрініске ауысып жоспар тізімініңізді жоба жоспарлағышындағы түріне келтіре аласыз. +Comment[km]=កម្មវិធីជំនួយនេះផ្ដល់នូវទិដ្ឋភាពរៀបចំគម្រោងសម្រាប់ korganizer (ដូចជា ទិដ្ឋភាពការងារត្រូវធ្វើ ឬ ទិដ្ឋភាពខែជាដើម) ។ បើអ្នកធ្វើឲ្យកម្មវិធីជំនួយនេះប្រើបាន អ្នកនឹងអាចប្ដូរទិដ្ឋភាពគម្រោង ហើយមើលព្រឹត្តិការណ៍របស់អ្នកដូចជានៅក្នុងកម្មវិធីរៀបចំគម្រោងអញ្ចឹងដែរ ។ +Comment[lt]=Šis priedas pateikia KOrganizaer projekto planavimo vaizdą (panašiai kaip darbų ar mėnesio vaizdai). Jei įjungsite šį įskiepį, galėsite peršokti į projekto vaizdą ir peržiūrėti savo darbų sąrašą kaip projektą. +Comment[ms]=Plugin ini menyediakan paparan perancangan projek untuk KOrganizer (seperti tugasan atau paparan bulan). Jika plugin ini diaktifkan, anda boleh beralih ke paparan projek dan paparkan senarai tugasan seperti dalam perancang projek. +Comment[nb]=Dette programtillegget lager en prosjektplan-visning for KOrganizer (som i gjørelister og månedsvisninger). Slår du på dette programtillegget kan du bytte til prosjektvisning og se på gjørelista som i en prosjektplan. +Comment[nds]=Mit dit Moduul kannst Du in KOrganizer en Projektplaan-Ansicht opropen (jüst as de Opgaven- oder Maandansichten). Wenn Du dit Moduul aktiveerst, kannst Du na de Projektansicht wesseln un Dien Opgavenlist as mit en Projektplaner ankieken. +Comment[ne]=यो प्लगइनले केडीई आयोजकका लागि परियोजना योजना दृश्य उपलब्ध गराउछ (जस्तै: कार्य गर्न वा महिना हेर्न) । तपाईँले यो प्लगइन सक्षम पारेमा, परियोजना दृश्यमा स्विच गर्न र परियोजना योजनाकारमा जस्तै तपाईँको कार्य गर्ने सूची हेर्न सक्नुहुन्छ । +Comment[nl]=Deze plugin biedt een projectweergave voor KOrganizer (net zoals een takenlijst of maandweergave). Wanneer u deze plugin aanzet, kunt u deze weergave aanzetten om uw takenlijst te bekijken als een projectplanner. +Comment[nn]=Dette programtillegget lagar ei prosjektplanvising for KOrganizer (slik som oppgåve- eller månadsvisingane). Dersom du brukar dette programtillegget, kan du visa oppgåvelista som i ein prosjektplanleggjar. +Comment[pl]=Ta wtyczka tworzy widok planowania projektu w KOrganizerze (tak jak widok zadań do zrobienia lub widok miesiąca). Po włączeniu tej wtyczki możliwe jest przełączenie się na widok projektu zadań do zrobienia. +Comment[pt]=Este 'plugin' oferece uma vista de planeamento de projectos para o KOrganizer (como as vistas de itens por-fazer ou mensais). Se activar este 'plugin', poderá mudar para a vista de projecto e ver a sua lista de itens por-fazer como num planeador de projectos. +Comment[pt_BR]=Este plug-in fornece uma visão de planejamento de projeto para o KOrganizer (como as visões de pendências ou de mês). Se você ativar este plugin, você pode mudar para a visão de projeto e ver a sua lista de pendências como num software de planejamento de projetos. +Comment[ru]=Этот модуль показывает проект для органайзера KDE. Если вы подключите этот модуль, вы можете посмотреть ваши задачи в виде проекта. +Comment[sk]=Tento modul poskytuje pohľad na plánovanie projektu pre KOrganizer (ako sú úlohy alebo mesačné pohľady). Ak povolíte tento modul, môžete prepínať projektový pohľad a pohľad na zoznam úloh ako plánovač projektu. +Comment[sl]=Ta vstavek prikazuje projektno načrtovanje za KOrganizer (kot prikaz opravil ali mesečni prikaz). Če omogočite ta vstavek, lahko preklopite na projektni prikaz in si ogledate seznam opravil kot v projektnem prikazu. +Comment[sr]=Овај прикључак пружа приказ планирања пројекта за KOrganizer (као месечни или прикази обавеза). Ако укључите овај прикључак, можете се пребацити на приказ пројекта и разгледати своју листу послова у планеру пројекта. +Comment[sr@Latn]=Ovaj priključak pruža prikaz planiranja projekta za KOrganizer (kao mesečni ili prikazi obaveza). Ako uključite ovaj priključak, možete se prebaciti na prikaz projekta i razgledati svoju listu poslova u planeru projekta. +Comment[sv]=Insticksprogrammet tillhandahåller en projektplaneringsvy i Korganizer (som liknar uppgifts- eller månadsvyn). Om du aktiverar insticksprogrammet kan du byta till projektvyn och visa din uppgiftslista som i ett projektplaneringsverktyg. +Comment[ta]=இந்த சொருகுப்பொருள் KOrganizer-க்கான ஒரு திட்டப்பணி செய்யும் காட்சியை வழங்குகிறது. (செய்யவேண்டியது அல்லது மாத காட்சிகள் போன்ற). இது செயலில் இருந்தால், நீங்கள் திட்டக்காட்சிக்கு செல்லலாம் திட்ட அமைப்பான் போன்ற திட்டக் காட்சிக்கும் செல்லலாம். +Comment[tr]=Bu eklenti, KOrganizer için bir proje planı görünümü sağlar (yapılacaklar ve aylık görünüm gibi). Eğer bu eklentiyi aktif hale getirirseniz, proje görünümüne geçebilir ve yapılacaklar listenizi proje planlayıcısı şeklinde görüntüleyebilirsiniz. +Comment[uk]=Цей втулок показує вигляд планування проектів у KOrganizer (подібно до виглядів завдань або місячного). Якщо увімкнути цей втулок, то можна переглядати ваш список завдань у вигляді плановика проектів. +Comment[zh_CN]=此插件为 KOrganizer 提供了项目规划视图(类似于待办或月视图)。如果您启用了此插件,您可以像项目规划程序那样切换到项目视图并查看您的待办清单。 +Comment[zh_TW]=此外掛程式提供 KOrganizer 專案計畫檢視。如果您開啟此外掛程式,您可以切換專案檢視與待辦事項清單。 +Type=Service +ServiceTypes=KOrganizer/Part +X-KDE-KOrganizer-HasSettings=false +X-KDE-PluginInterfaceVersion=2 diff --git a/korganizer/plugins/projectview/projectview.h b/korganizer/plugins/projectview/projectview.h new file mode 100644 index 000000000..acc9a604f --- /dev/null +++ b/korganizer/plugins/projectview/projectview.h @@ -0,0 +1,42 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2001 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. +*/ +#ifndef KORG_PROJECTVIEW_H +#define KORG_PROJECTVIEW_H +// $Id$ + +#include <korganizer/part.h> +#include <korganizer/calendarviewbase.h> + +class ProjectView : public KOrg::Part { + Q_OBJECT + public: + ProjectView(KOrg::MainWindow *, const char *); + ~ProjectView(); + + QString info(); + QString shortInfo(); + + private slots: + void showView(); + + private: + KOrg::BaseView *mView; +}; + +#endif diff --git a/korganizer/plugins/projectview/projectviewui.rc b/korganizer/plugins/projectview/projectviewui.rc new file mode 100644 index 000000000..50eb28f37 --- /dev/null +++ b/korganizer/plugins/projectview/projectviewui.rc @@ -0,0 +1,15 @@ +<!DOCTYPE kpartgui> +<kpartgui name="projectview" version="2"> + + <MenuBar> + <Menu name="view"><text>&View</text> + <Action name="view_project"/> + </Menu> + </MenuBar> + <ToolBar name="korganizer_toolbar"> + <Action name="view_project"/> + </ToolBar> + + +</kpartgui> + diff --git a/korganizer/plugins/timespanview/Makefile.am b/korganizer/plugins/timespanview/Makefile.am new file mode 100644 index 000000000..a4431c6a5 --- /dev/null +++ b/korganizer/plugins/timespanview/Makefile.am @@ -0,0 +1,20 @@ +# $Id$ + +METASOURCES = AUTO + +INCLUDES = -I$(top_srcdir)/korganizer/interfaces \ + -I$(top_srcdir) -I$(top_srcdir)/korganizer $(all_includes) + +kde_module_LTLIBRARIES = libkorg_timespanview.la + +libkorg_timespanview_la_SOURCES = lineview.cpp timeline.cpp timespanview.cpp timespanwidget.cpp kotimespanview.cpp +libkorg_timespanview_la_LDFLAGS = -module $(KDE_PLUGIN) $(KDE_RPATH) $(all_libraries) +libkorg_timespanview_la_LIBADD = $(top_builddir)/korganizer/libkorganizer.la $(LIB_KPARTS) + +noinst_HEADERS = timespanview.h timespanwidget.h kotimespanview.h + +servicedir = $(kde_servicesdir)/korganizer +service_DATA = timespanview.desktop + +rcdir = $(kde_datadir)/korganizer/plugins +rc_DATA = timespanviewui.rc diff --git a/korganizer/plugins/timespanview/cr22-action-timespan.png b/korganizer/plugins/timespanview/cr22-action-timespan.png Binary files differnew file mode 100644 index 000000000..cee81a7c8 --- /dev/null +++ b/korganizer/plugins/timespanview/cr22-action-timespan.png diff --git a/korganizer/plugins/timespanview/kotimespanview.cpp b/korganizer/plugins/timespanview/kotimespanview.cpp new file mode 100644 index 000000000..507438a6a --- /dev/null +++ b/korganizer/plugins/timespanview/kotimespanview.cpp @@ -0,0 +1,128 @@ +/* + This file is part of KOrganizer. + + Copyright (c) 2001 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 <qlayout.h> + +#include <kconfig.h> +#include <kstandarddirs.h> +#include <kconfig.h> +#include <libkcal/calendar.h> + +#include "timespanwidget.h" +#include "koglobals.h" + +#include "kotimespanview.h" +#include "kotimespanview.moc" + +KOTimeSpanView::KOTimeSpanView(Calendar *calendar, QWidget *parent, + const char *name) : + KOEventView( calendar, parent, name ) +{ + QBoxLayout *topLayout = new QVBoxLayout( this ); + + mTimeSpanWidget = new TimeSpanWidget( this ); + topLayout->addWidget( mTimeSpanWidget ); + + connect( mTimeSpanWidget, SIGNAL( dateRangeChanged() ), SLOT( updateView() ) ); +} + +KOTimeSpanView::~KOTimeSpanView() +{ +} + +void KOTimeSpanView::readSettings() +{ + kdDebug(5850) << "KOTimeSpanView::readSettings()" << endl; + + KConfig config( "korganizerrc", true, false); // Open read-only, no kdeglobals + config.setGroup("Views"); + + QValueList<int> sizes = config.readIntListEntry("Separator TimeSpanView"); + if (sizes.count() == 2) { + mTimeSpanWidget->setSplitterSizes(sizes); + } +} + +void KOTimeSpanView::writeSettings(KConfig *config) +{ +// kdDebug(5850) << "KOTimeSpanView::writeSettings()" << endl; + + config->setGroup("Views"); + + QValueList<int> list = mTimeSpanWidget->splitterSizes(); + config->writeEntry("Separator TimeSpanView",list); +} + +int KOTimeSpanView::maxDatesHint() +{ + return 0; +} + +int KOTimeSpanView::currentDateCount() +{ + return 0; +} + +Incidence::List KOTimeSpanView::selectedIncidences() +{ + Incidence::List selected; + + return selected; +} + +void KOTimeSpanView::updateView() +{ + insertItems( mTimeSpanWidget->startDateTime().date(), + mTimeSpanWidget->endDateTime().date() ); +} + +void KOTimeSpanView::showDates(const QDate &start, const QDate &end) +{ + QDate s = start.addDays( -2 ); + QDate e = end.addDays( 2 ); + + insertItems( s, e ); +} + +void KOTimeSpanView::insertItems(const QDate &start, const QDate &end) +{ + mTimeSpanWidget->clear(); + mTimeSpanWidget->setDateRange( start, end ); + + Event::List events = calendar()->events( start, end ); + Event::List::ConstIterator it; + for( it = events.begin(); it != events.end(); ++it ) { + mTimeSpanWidget->addItem( *it ); + } + + mTimeSpanWidget->updateView(); +} + +void KOTimeSpanView::showIncidences( const Incidence::List & ) +{ +} + +void KOTimeSpanView::changeIncidenceDisplay(Incidence *, int) +{ +} diff --git a/korganizer/plugins/timespanview/kotimespanview.h b/korganizer/plugins/timespanview/kotimespanview.h new file mode 100644 index 000000000..142ba75f4 --- /dev/null +++ b/korganizer/plugins/timespanview/kotimespanview.h @@ -0,0 +1,61 @@ +/* + This file is part of KOrganizer. + + Copyright (c) 2001 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 KOTIMESPANVIEW_H +#define KOTIMESPANVIEW_H + +#include "koeventview.h" + +class KConfig; +class TimeSpanWidget; + +class KOTimeSpanView : public KOEventView +{ + Q_OBJECT + public: + KOTimeSpanView( Calendar *calendar, QWidget *parent = 0, + const char *name = 0 ); + ~KOTimeSpanView(); + + virtual int maxDatesHint(); + virtual int currentDateCount(); + virtual Incidence::List selectedIncidences(); + DateList selectedDates() { return DateList(); } + + void readSettings(); + void writeSettings( KConfig * ); + + public slots: + virtual void updateView(); + virtual void showDates( const QDate &start, const QDate &end ); + virtual void showIncidences( const Incidence::List &incidenceList ); + + void changeIncidenceDisplay(Incidence *, int); + + private: + void insertItems( const QDate &start, const QDate & end ); + + TimeSpanWidget *mTimeSpanWidget; +}; + +#endif diff --git a/korganizer/plugins/timespanview/lineview.cpp b/korganizer/plugins/timespanview/lineview.cpp new file mode 100644 index 000000000..26779bdb3 --- /dev/null +++ b/korganizer/plugins/timespanview/lineview.cpp @@ -0,0 +1,118 @@ +/* + This file is part of KOrganizer. + + Copyright (c) 2001 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 <qpainter.h> + +#include <kdebug.h> + +#include "koprefs.h" + +#include "lineview.h" +#include "lineview.moc" + +LineView::LineView( QWidget *parent, const char *name ) : + QScrollView( parent, name ) +{ + mPixelWidth = 1000; + + mLines.setAutoDelete( true ); + + resizeContents( mPixelWidth, contentsHeight() ); + + viewport()->setBackgroundColor(KOPrefs::instance()->mAgendaBgColor); +} + +LineView::~LineView() +{ +} + +int LineView::pixelWidth() +{ + return mPixelWidth; +} + +void LineView::addLine( int start, int end ) +{ + int count = mLines.count(); + + if( start < 0 ) start = 0; + if( end > mPixelWidth) end = mPixelWidth; + + kdDebug(5850) << "LineView::addLine() col: " << count << " start: " << start + << " end: " << end << endl; + + mLines.append( new Line( count, start, end ) ); +} + +void LineView::clear() +{ + mLines.clear(); + update(); +} + +void LineView::drawContents(QPainter* p, int cx, int cy, int cw, int ch) +{ +// kdDebug(5850) << "LineView::drawContents()" << endl; + +// int mGridSpacingX = 10; + int mGridSpacingY = 20; + +#if 0 + // Draw vertical lines of grid + // kdDebug(5850) << "drawContents cx: " << cx << " cy: " << cy << " cw: " << cw << " ch: " << ch << endl; + int x = ((int)(cx/mGridSpacingX))*mGridSpacingX; + while (x < cx + cw) { + p->drawLine(x,cy,x,cy+ch); + x+=mGridSpacingX; + } +#endif + + // Draw horizontal lines of grid + int y = ((int)(cy/mGridSpacingY))*mGridSpacingY + 10; + while (y < cy + ch) { +// kdDebug(5850) << " y: " << y << endl; + p->drawLine(cx,y,cx+cw,y); + y+=mGridSpacingY; + } + + Line *line; + for( line = mLines.first(); line; line = mLines.next() ) { + int ctop = line->column * 20 + 10 - 5; + int cbottom = line->column * 20 + 10 + 5; + int s = line->start; + int e = line->end; +// kdDebug(5850) << " LineView::drawContents(): ctop: " << ctop << " cbottom: " +// << cbottom << " s: " << s << " e: " << e << endl; + if ( ctop <= (cy+ch) && cbottom >= cy && + s <= (cx+cw) && e >= cx ) { + if ( s < cx ) s = cx; + if ( e > (cx+cw) ) e = cx+cw; + if ( ctop < cy ) ctop = cy; + if ( cbottom > (cy+ch) ) cbottom = cy+ch; +// kdDebug(5850) << " drawContents(): ctop: " << ctop << " cbottom: " +// << cbottom << " s: " << s << " e: " << e << endl; + p->fillRect( s, ctop, e - s + 1, cbottom - ctop + 1, QBrush("red") ); + } + } +} diff --git a/korganizer/plugins/timespanview/lineview.h b/korganizer/plugins/timespanview/lineview.h new file mode 100644 index 000000000..0bb1788a7 --- /dev/null +++ b/korganizer/plugins/timespanview/lineview.h @@ -0,0 +1,59 @@ +/* + This file is part of KOrganizer. + + Copyright (c) 2001 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 LINEVIEW_H +#define LINEVIEW_H + +#include <qscrollview.h> +#include <qptrlist.h> + +class LineView : public QScrollView +{ + Q_OBJECT + public: + LineView( QWidget *parent = 0, const char *name = 0 ); + virtual ~LineView(); + + int pixelWidth(); + + void addLine( int start, int end ); + + void clear(); + + protected: + void drawContents(QPainter* p, int cx, int cy, int cw, int ch); + + private: + struct Line { + Line( int c, int s, int e ) : column( c ), start( s ), end( e ) {} + int column; + int start; + int end; + }; + + QPtrList<Line> mLines; + int mPixelWidth; +}; + +#endif + diff --git a/korganizer/plugins/timespanview/timeline.cpp b/korganizer/plugins/timespanview/timeline.cpp new file mode 100644 index 000000000..0d679e192 --- /dev/null +++ b/korganizer/plugins/timespanview/timeline.cpp @@ -0,0 +1,87 @@ +/* + This file is part of KOrganizer. + + Copyright (c) 2001 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 <qpainter.h> + +#include <kdebug.h> + +#include "timeline.h" +#include "timeline.moc" + +TimeLine::TimeLine( QWidget *parent, const char *name ) : + QScrollView( parent, name ) +{ + mPixelWidth = 1000; + + resizeContents( mPixelWidth, 20 ); + + viewport()->setBackgroundMode( PaletteBackground ); + + setHScrollBarMode(AlwaysOff); + setVScrollBarMode(AlwaysOff); +} + +TimeLine::~TimeLine() +{ +} + +void TimeLine::drawContents(QPainter* p, int cx, int cy, int cw, int ch) +{ + int spacingX = mDaySpacing; + int offsetX = mDayOffset; + + // Draw vertical lines of grid +// kdDebug(5850) << "drawContents cx: " << cx << " cy: " << cy << " cw: " << cw << " ch: " << ch << endl; + int cell = int( (cx - ( spacingX - offsetX ) ) / spacingX ); + int x = cell * spacingX + ( spacingX - offsetX ); +// kdDebug(5850) << " x: " << x << endl; + while (x < cx + cw) { +// kdDebug(5850) << " x: " << x << endl; + p->drawLine(x,cy,x,cy+ch); + p->drawText( x + 5, 15, QString::number( mStartDate.addDays( cell + 1 ).date().day() ) ); + + x += spacingX; + cell++; + } +} + +void TimeLine::setDateRange( const QDateTime &start, const QDateTime &end ) +{ + mStartDate = start; + mEndDate = end; + + mSecsPerPixel = mStartDate.secsTo( mEndDate ) / mPixelWidth; + + mDaySpacing = 60 * 60 * 24 / mSecsPerPixel; + + mDayOffset = QDateTime( mStartDate.date() ).secsTo( mStartDate ) / mSecsPerPixel; + + kdDebug(5850) << "TimeLines::setDateRange(): mDaySpacing: " << mDaySpacing << " mDayOffset: " + << mDayOffset << " mSecsPerPixel: " << mSecsPerPixel << endl; +} + +void TimeLine::setContentsPos( int pos ) +{ + QScrollView::setContentsPos ( pos, 0 ); +} diff --git a/korganizer/plugins/timespanview/timeline.h b/korganizer/plugins/timespanview/timeline.h new file mode 100644 index 000000000..7c9bd8689 --- /dev/null +++ b/korganizer/plugins/timespanview/timeline.h @@ -0,0 +1,56 @@ +/* + This file is part of KOrganizer. + + Copyright (c) 2001 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 TIMELINE_H +#define TIMELINE_H + +#include <qscrollview.h> +#include <qdatetime.h> + +class TimeLine : public QScrollView +{ + Q_OBJECT + public: + TimeLine( QWidget *parent = 0, const char *name = 0 ); + virtual ~TimeLine(); + + void setDateRange( const QDateTime &start, const QDateTime &end ); + + public slots: + void setContentsPos( int pos ); + + protected: + void drawContents(QPainter* p, int cx, int cy, int cw, int ch); + + private: + QDateTime mStartDate; + QDateTime mEndDate; + + int mPixelWidth; + int mDaySpacing; + int mDayOffset; + int mSecsPerPixel; +}; + +#endif + diff --git a/korganizer/plugins/timespanview/timespanview.cpp b/korganizer/plugins/timespanview/timespanview.cpp new file mode 100644 index 000000000..be95a2c8d --- /dev/null +++ b/korganizer/plugins/timespanview/timespanview.cpp @@ -0,0 +1,80 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2004 Reinhold Kainhofer <reinhold@kainhofer.com> + + 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. +*/ + +#include <qfile.h> + +#include <kapplication.h> +#include <kconfig.h> +#include <kstandarddirs.h> +#include <klocale.h> +#include <kdebug.h> +#include <kaction.h> +#include <kglobal.h> + +#include "kotimespanview.h" + +#include "timespanview.h" +using namespace KOrg; +#include "timespanview.moc" + +class TimespanViewFactory : public KOrg::PartFactory { + public: + KOrg::Part *create( KOrg::MainWindow *parent, const char *name ) + { + return new TimespanView( parent, name ); + } +}; + +K_EXPORT_COMPONENT_FACTORY( libkorg_timespanview, TimespanViewFactory ) + + +TimespanView::TimespanView(KOrg::MainWindow *parent, const char *name) : + KOrg::Part(parent,name), mView(0) +{ + setInstance( new KInstance( "korganizer" ) ); + + setXMLFile( "plugins/timespanviewui.rc" ); + + new KAction( i18n("&Timespan"), "timespan", 0, this, SLOT( showView() ), + actionCollection(), "view_timespan" ); +} + +TimespanView::~TimespanView() +{ +} + +QString TimespanView::info() +{ + return i18n("This plugin provides a Gantt-like Timespan view."); +} + +QString TimespanView::shortInfo() +{ + return i18n( "Timespan View Plugin" ); +} + +void TimespanView::showView() +{ + if (!mView) { + mView = new KOTimeSpanView( mainWindow()->view()->calendar(), + mainWindow()->view() ); + mainWindow()->view()->addView( mView ); + } + mainWindow()->view()->showView( mView ); +} diff --git a/korganizer/plugins/timespanview/timespanview.desktop b/korganizer/plugins/timespanview/timespanview.desktop new file mode 100644 index 000000000..13654b46a --- /dev/null +++ b/korganizer/plugins/timespanview/timespanview.desktop @@ -0,0 +1,94 @@ +[Desktop Entry] +X-KDE-Library=libkorg_timespanview +Name=Timespan View Plugin for KOrganizer +Name[af]=Tydlyn aansig inprop module vir KOrganizer +Name[bg]=Приставка за разпределението на времето в организатора +Name[ca]=Endollable de vista de període temporal per a KOrganizer +Name[cs]=Modul časového pohledu pro KOrganizer +Name[da]=Timespan-visning-plugin for KOrganizer +Name[de]=Zeitspannenansicht-Modul für KOrganizer +Name[el]=Πρόσθετο προβολής εργασιών του KOrganizer +Name[eo]=Tempgamrigardo-kromaĵo por Organizilo +Name[es]=Extensión de visor de Timespan para KOrganizer +Name[et]=KOrganizeri perioodivaate plugin +Name[eu]=KOrganizer-rako denbora-barruti ukuspegi plugin-a +Name[fa]=وصلۀ نمای گسترۀ زمان برای KOrganizer +Name[fi]=Ajankulkunäkymäliitännäinen Korganizeriin +Name[fr]=Module d'affichage de planification pour KOrganizer +Name[fy]=Tiidspanneplugin foar KOrganizer +Name[gl]=Extensión de Vista en Unidades de Tempo para KOrganizer +Name[hu]=Időszakáttekintő bővítőmodul a KOrganizerhez +Name[is]=Tímabilsskoðunar íforrit fyrir KOrganizer +Name[it]=Plugin vista intervalli temporali per KOrganizer +Name[ja]=KOrganizer タイムスパンビュー プラグイン +Name[ka]=დროის დიაგრამიანი ხედის მოდული KOrganizer-სთვის +Name[kk]=KOrganizer-дің уақыт аралығы көрініс модулі +Name[km]=កម្មវិធីជំនួយទិដ្ឋភាពរយៈពេលសម្រាប់ KOrganizer +Name[lt]=Laiko tarpsnio vaizdo KOrganizer priedas +Name[ms]=Plugin Paparan Kitar Waktu untuk KOrganizer +Name[nb]=Programtillegg for periodevisning i KOrganizer +Name[nds]=Tietbruuk-Moduul för KOrganizer +Name[ne]=केडीई आयोजकका लागि समयावधि दृश्य प्लगइन +Name[nl]=Tijdspanneplugin voor KOrganizer +Name[nn]=Programtillegg for tidsromsvising i KOrganizer +Name[pl]=Wtyczka widoku zakresu czasu dla KOrganizera +Name[pt]='Plugin' de Vista de Intervalo de Tempo para o KOrganizer +Name[pt_BR]=Plug-in de Visualização de Período de Tempo Para o KOrganizer +Name[ru]=Диаграмма Ганта для KOrganizer +Name[sk]=KOrganizer modul pre projektový pohľad +Name[sl]=Vstavek za časovni prikaz za KOrganizer +Name[sr]=Прикључак KOrganizer-а за приказ временског распона +Name[sr@Latn]=Priključak KOrganizer-a za prikaz vremenskog raspona +Name[sv]=Tidsintervallvyinsticksprogram för Korganizer +Name[ta]=கேஅமைப்பாளருக்கான திட்டக் காட்சி சொருகுப்பொருள் +Name[tr]=KOrganizer için Zaman Dilimi Görünümü Eklentisi +Name[uk]=Втулок перегляду періоду часу для KOrganizer +Name[zh_CN]=KOrganizer 的时间跨度查看插件 +Name[zh_TW]=KOrganizer 時間檢視外掛程式 +Comment=This plugin provides a timespan view for korganizer (like the to-do or month views). If you enable this plugin, you can switch to the timespan view and view your events like in a Gantt diagram. +Comment[af]=Hierdie inprop module verskaf 'n tydlyn aansig vir KOrganizer. Dit lyk baie soos die te-doen of maand aansig. As hierdie inprop module geaktiveer is, kan jy na die tydlyn aansig wissel en na jou te-doen lys in tydlyn formaat kyk. +Comment[bg]=Приставката служи за преглед на събитията и задачите в зададен период от време. +Comment[ca]=Aquest endollable proporciona una vista d'un període temporal per a KOrganizer (com ara les vistes de pendents o mensual). Si habiliteu aquest endollable, podeu canviar a la vista de període temporal i veure els esdeveniments com en un diagrama de Gantt. +Comment[cs]=Tento modul umožňuje časový pohled pro korganizer (podobně jako úkoly nebo měsíční pohled). Pokud ho povolíte, můžete se přepnout na časový pohled a prohlížet si události v Ganttově diagramu. +Comment[da]=Pluginnet sørger for en tidsintervalsvisning i Korganizer (som ligner gøremål eller månedsvisning). Hvis du aktiverer dette plugin kan du skifte til tidsintervalvisning og vise dine begivenheder som i et Gantt-diagram. +Comment[de]=Mit diesem Modul wird KOrganizer um eine Zeitspannenansicht (ähnlich der Aufgaben- und Monatsansicht) erweitert. Wenn Sie es einschalten, können Sie zur Zeitspannenansicht wechseln und sich Ihre Ereignisse wie in einem Gantt-Diagramm ansehen. +Comment[el]=Αυτό το πρόσθετο παρέχει μία προβολή 'ανοίγματος' χρόνου για το korganizer (όπως οι μηνιαίες προβολές των προς υλοποίηση εργασιών). Αν το ενεργοποιήσετε, μπορείτε να αλλάξετε σε προβολή 'ανοίγματος' χρόνου και να δείτε τα γεγονότα σας όπως ένα διάγραμμα του Gantt. +Comment[es]=Esta extensión proporciona una vista de timespan para korganizer (como la vista de tareas pendientes o la mensual). Si activa esta extensión, puede pasar a la vista de timespan y ver sus eventos como un diagrama de Gantt. +Comment[et]=See plugin lisab KOrganizerile perioodivaate (nagu ülesannete või kuuvaade). Selle lubamisel saab lülituda perioodivaatele ning näha oma sündmusi Gantti diagrammina. +Comment[eu]=Plugin honek KOrganizer-entzat denbora barruti ikuspegi bat eskeintzen du. Plugin hau gaitzen baduzu denbora-barruti ikuspegira alda zaitezke gertaerak Gantt diagrama batean bezala ikusi. +Comment[fa]=این وصله، برای KOrganizer یک نمای گسترۀ زمان )مثل نماهای کارهای انجامی یا ماهانه( فراهم میکند. اگر این وصله را فعال کنید، میتوانید به گسترۀ زمان سودهی کرده و مانند نمودار Gantt، رویدادهای خود را مشاهده کنید. +Comment[fi]=Tämä liitännäinen mahdollistaa ajankulkunäkymän KOrganizeriin (kuten tehtävälista- tai kuukausinäkymän). Jos kytket tämän päälle, voit vaihtaa ajankulkunäkymään ja katsoa tapahtumia kuten Gantt-diagrammissa. +Comment[fr]=Ce module vous permet d'avoir une vue de KOrganizer qui affiche les évènements selon l'axe temporel. Si vous activez cette vue, vous verrez vos évènements comme un diagramme de Gantt. +Comment[fy]=Dizze plugin jout in werjefte foar KOrganizer (lykas de takenlist en de moannewerjefte). Wannear jo dizze plugin ynskeakelje kinne jo kieze foar in werjefte wêryn jo eveneminten yn in Gantt-diagram besjen kinne. +Comment[gl]=Esta extensión fornece unha vista en unidades de tempo (como as vistas mensuais e a vista de tarefas). Se habilita esta extensión, pode trocar a vista en unidades de tempo e ver os seus eventos como un diagrama Gantt. +Comment[hu]=Ezzel modullal egy időszakot lehet áttekinteni a KOrganizerben (például a feladatokat vagy a havi nézeteket). Ha aktiválja ezt a modult, átválthat időszakos nézetbe, hogy az események Gantt-diagramon legyenek megtekinthetők. +Comment[is]=Þetta íforrit veitir tímabilssýn fyrir KOrganizer (svipað og verkþátta eða mánaðarsýn). Ef þú virkjar þetta íforrit getur þú skipt yfir í tímabilssýn og skoðað atburðina þína eins og á Gantt skýringarmynd. +Comment[it]=Questo plugin fornisce una vista a intervalli temporali. Se abiliti questo plugin, potrai passare alla vista a intervalli temporali e vedere i tuoi eventi come in un diagramma di Gantt. +Comment[ja]=このプラグインは KOrganizer にタイムスパンビューを提供します (To-Do ビューや月ビューなど)。このプラグインを有効にすると、タイムスパンビューに切り替えて、ガントチャートのようにイベントを見ることができます。 +Comment[ka]=ეს მოდული უზრუნველჰყოფს korganizer-ს დროის დიაგრამიანი ხედით (მაგ.:დავალებები ან თვიური მიმოხილვა). თუ ამ მოდულს გაააქტიურებთ,თქვენ შეგიძლიათ გადართოთ დროის დიაგრამიან ხედზე და იხილოთ მოვლენები განტის დიაგრამის სახით. +Comment[kk]=Бұл KOrganizer-нің уақыт аралығы көрінісінің модулі. Модулін орнатсаңыз, осы көрініске ауысып оқиғаларыңызды Гант диаграмма түріне келтре аласыз. +Comment[km]=កម្មវិធីជំនួយនេះផ្ដល់នូវទិដ្ឋភាពរយៈពេលសម្រាប់ korganizer (ដូចជា ទិដ្ឋភាពការងារត្រូវធ្វើ ឬ ទិដ្ឋភាពខែជាដើម) ។ បើអ្នកធ្វើឲ្យកម្មវិធីជំនួយនេះប្រើបាន អ្នកនឹងអាចប្ដូរទិដ្ឋភាពរយៈពេល ហើយមើលព្រឹត្តិការណ៍របស់អ្នកដូចជានៅក្នុងដ្យាក្រាម Gantt អញ្ចឹងដែរ ។ +Comment[lt]=Šis priedas korganizer programoje sudaro galimybę apžvelgti laiko tarpą (pvz., darbų arba mėnesio peržiūra). Įgalinus šį priedą galėsite persijungti į laiko tarpo peržiūrą ir žiūrėti įvykius tarsi Gantt diagramoje. +Comment[ms]=Plugin ini menyediakan paparan kitar waktu untuk korganizer (seperti tugasan atau paparan bulan). Jika plugin ini diaktifkan,anda boleh beralih ke paparan kitar masa dan paparkan peristiwa seperti dalam diagram Gantt. +Comment[nb]=Dette programtillegget lager en periodevisning for korganizer (slik som gjøreliste og månedsvisning). Hvis du slår på dette programtillegget kan du bytte til periodevisning og se hendelser som i et Gantt-diagram. +Comment[nds]=Mit dit Moduul kannst Du in KOrganizer en Tietbruuk-Ansicht opropen (jüst as de Opgaven- oder Maandansichten). Wenn Du dit Moduul aktiveerst, kannst Du na de Tietbruukansicht wesseln un Dien Begeefnissen as Ganntt-Diagramm ankieken. +Comment[ne]=यो प्लगइनले केडीई आयोजकका लागि समयावधि उपलब्ध गराउछ (गर्नुपर्ने कार्य वा महिना दृश्य जस्तो) । तपाईँले यो प्लगइन सक्षम पारेमा, तपाईँले समयावधि दृश्यमा स्वीच गर्न र गान्ट रेखाचित्र जस्तोमा घटना हेर्न सक्नुहुन्छ । +Comment[nl]=Deze plugin biedt een weergave voor KOrganizer (zoals de takenlijst en de maandweergave). Wanneer u deze plugin inschakelt kunt u kiezen voor een weergave waarin u uw evenementen in een Gantt-diagram kunt bekijken. +Comment[pl]=Ta wtyczka tworzy widok zakresu czasu w KOrganizerze (tak jak widok zadań do zrobienia lub widok miesiąca). Po włączeniu tej wtyczki możliwe jest przełączenie się na widok zakresu czasu i przeglądanie zdarzeń jak na diagramie Gantta. +Comment[pt]=Este 'plugin' oferece uma vista de distribuição temporal para o KOrganizer (como as vistas de itens por-fazer ou mensais). Se activar este 'plugin', poderá mudar para a vista de distribuição temporal e ver os seus eventos como num diagrama de Gantt. +Comment[pt_BR]=Este plug-in fornece uma visão de período de tempo para o KOrganizer (como a visão de pendências e do mês). Se você ativar este plugin, você pode mudar para a visão de período de tempo e ver seus eventos como num diagrama de Gantt. +Comment[ru]=Этот модуль показывает диаграмму Ганта для органайзера KDE. Если вы подключите этот модуль, вы можете посмотреть ваши события в виде диаграммы Ганта. +Comment[sk]=Tento modul poskytuje projektový pohľad pre korganizer (ako sú úlohy alebo mesačné pohľady). Ak povolíte tento modul, môžete prepínať projektový pohľad a pohľad na udalosti ako je Gantt diagram. +Comment[sl]=Ta vstavek ponuja časovni prikaz za KOrganizer (kot prikaz opravil ali mesečni prikaz). Če omogočite ta vstavek, lahko preklopite na časovni prikaz in si ogledate dogodke kot v Ganttovem diagramu. +Comment[sr]=Овај прикључак пружа приказ временског распона за KOrganizer (као месечни или прикази обавеза). Ако укључите овај прикључак, можете се пребацити на приказ временског распона и разгледати своје догађаје као у Гантовом дијаграму. +Comment[sr@Latn]=Ovaj priključak pruža prikaz vremenskog raspona za KOrganizer (kao mesečni ili prikazi obaveza). Ako uključite ovaj priključak, možete se prebaciti na prikaz vremenskog raspona i razgledati svoje događaje kao u Gantovom dijagramu. +Comment[sv]=Insticksprogrammet tillhandahåller en tidsintervallvy i Korganizer (som liknar uppgifts- eller månadsvyn). Om du aktiverar insticksprogrammet kan du byta till idsintervallvyn och visa dina händelser som i ett Gantt-diagram. +Comment[ta]=இந்த சொருகுப்பொருள் korganizerக்கான ஒரு குறுகிய நேரத்தை வழங்குகிறது. lசெய்யவேண்டியவை அல்ல்து மாதக் காட்சிகள் போன்ற). இந்த சொருகுப்பொருள் செயலில் இருந்தால், நீங்கள் குறுகிய நேரக் காட்சி மற்ரும் Gantt விளக்க வரைபடத்தில் உள்ளது போன்ற நிகழ்வுகளை பார்க்கலாம். +Comment[tr]=Bu eklenti, KOrganizer için zaman dilimi görünümü sağlar (yapılacaklar listesi ya da aylık görünüm gibi). Eğer bu eklentiyi aktif hale getirirseniz, zaman dilimi görünümüne geçebilir ve olayları Gantt diyagramı şeklinde görüntüleyebilirsiniz. +Comment[uk]=Цей втулок показує вигляд діаграми Ганта для korganizer (подібно до вигляду завдань та місячного). Якщо увімкнути цей втулок, то можна переглядати ваші події у вигляді діаграми Ганта. +Comment[zh_CN]=此插件为 KOrganizer 提供了时间跨度视图(类似于待办或月视图)。如果您启用了此插件,您可以像甘特图程序那样切换到时间跨度视图并查看您的事件。 +Comment[zh_TW]=此外掛程式提供時間檢視模式。如果您開啟此外掛程式,您可以切換時間檢視,讓您使用類似甘特圖的圖形來檢視事件。 +Type=Service +ServiceTypes=KOrganizer/Part +X-KDE-KOrganizer-HasSettings=false +X-KDE-PluginInterfaceVersion=2 diff --git a/korganizer/plugins/timespanview/timespanview.h b/korganizer/plugins/timespanview/timespanview.h new file mode 100644 index 000000000..e88e140c5 --- /dev/null +++ b/korganizer/plugins/timespanview/timespanview.h @@ -0,0 +1,42 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2004 Reinhold Kainhofer <reinhold@kainhofer.com> + + 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. +*/ +#ifndef KORG_PROJECTVIEW_H +#define KORG_PROJECTVIEW_H +// $Id$ + +#include <korganizer/part.h> +#include <korganizer/calendarviewbase.h> + +class TimespanView : public KOrg::Part { + Q_OBJECT + public: + TimespanView(KOrg::MainWindow *, const char *); + ~TimespanView(); + + QString info(); + QString shortInfo(); + + private slots: + void showView(); + + private: + KOrg::BaseView *mView; +}; + +#endif diff --git a/korganizer/plugins/timespanview/timespanviewui.rc b/korganizer/plugins/timespanview/timespanviewui.rc new file mode 100644 index 000000000..62053159b --- /dev/null +++ b/korganizer/plugins/timespanview/timespanviewui.rc @@ -0,0 +1,15 @@ +<!DOCTYPE kpartgui> +<kpartgui name="timespanview" version="2"> + + <MenuBar> + <Menu name="view"> + <Action name="view_timespan"/> + </Menu> + </MenuBar> + + <ToolBar name="korganizer_toolbar"> + <Action name="view_timespan"/> + </ToolBar> + +</kpartgui> + diff --git a/korganizer/plugins/timespanview/timespanwidget.cpp b/korganizer/plugins/timespanview/timespanwidget.cpp new file mode 100644 index 000000000..23d781f45 --- /dev/null +++ b/korganizer/plugins/timespanview/timespanwidget.cpp @@ -0,0 +1,175 @@ +/* + This file is part of KOrganizer. + + Copyright (c) 2001 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 <qsplitter.h> +#include <qlistview.h> +#include <qlayout.h> +#include <qheader.h> +#include <qpushbutton.h> + +#include <klocale.h> +#include <kdebug.h> + +#include <libkcal/event.h> + +#include "lineview.h" +#include "timeline.h" + +#include "timespanwidget.h" +#include "timespanwidget.moc" + +TimeSpanWidget::TimeSpanWidget( QWidget *parent, const char *name ) : + QWidget( parent, name ) +{ + QBoxLayout *topLayout = new QVBoxLayout( this ); + + mSplitter = new QSplitter( this ); + topLayout->addWidget( mSplitter ); + + mList = new QListView( mSplitter ); + mList->addColumn( i18n("Summary") ); + + QWidget *rightPane = new QWidget( mSplitter ); + QBoxLayout *rightPaneLayout = new QVBoxLayout( rightPane ); + + mTimeLine = new TimeLine( rightPane ); + mTimeLine->setFixedHeight( mList->header()->height() ); + rightPaneLayout->addWidget( mTimeLine ); + + mLineView = new LineView( rightPane ); + rightPaneLayout->addWidget( mLineView ); + + QBoxLayout *buttonLayout = new QHBoxLayout( rightPaneLayout ); + + QPushButton *zoomInButton = new QPushButton( i18n("Zoom In"), rightPane ); + connect( zoomInButton, SIGNAL( clicked() ), SLOT( zoomIn() ) ); + buttonLayout->addWidget( zoomInButton ); + + QPushButton *zoomOutButton = new QPushButton( i18n("Zoom Out"), rightPane ); + connect( zoomOutButton, SIGNAL( clicked() ), SLOT( zoomOut() ) ); + buttonLayout->addWidget( zoomOutButton ); + + QPushButton *centerButton = new QPushButton( i18n("Center View"), rightPane ); + connect( centerButton, SIGNAL( clicked() ), SLOT( centerView() ) ); + buttonLayout->addWidget( centerButton ); + + connect(mLineView->horizontalScrollBar(),SIGNAL(valueChanged(int)), + mTimeLine,SLOT(setContentsPos(int))); +} + +TimeSpanWidget::~TimeSpanWidget() +{ +} + +QValueList<int> TimeSpanWidget::splitterSizes() +{ + return mSplitter->sizes(); +} + +void TimeSpanWidget::setSplitterSizes( QValueList<int> sizes ) +{ + mSplitter->setSizes( sizes ); +} + +void TimeSpanWidget::addItem( KCal::Event *event ) +{ + new QListViewItem( mList, event->summary() ); + + QDateTime startDt = event->dtStart(); + QDateTime endDt = event->dtEnd(); + +// kdDebug(5850) << "TimeSpanWidget::addItem(): start: " << startDt.toString() +// << " end: " << endDt.toString() << endl; + +// int startSecs = mStartDate.secsTo( startDt ); +// int durationSecs = startDt.secsTo( endDt ); + +// kdDebug(5850) << "--- startSecs: " << startSecs << " dur: " << durationSecs << endl; + + int startX = mStartDate.secsTo( startDt ) / mSecsPerPixel; + int endX = startX + startDt.secsTo( endDt ) / mSecsPerPixel; + +// kdDebug(5850) << "TimeSpanWidget::addItem(): s: " << startX << " e: " << endX << endl; + + mLineView->addLine( startX, endX ); +} + +void TimeSpanWidget::clear() +{ + mList->clear(); + mLineView->clear(); +} + +void TimeSpanWidget::updateView() +{ +#if QT_VERSION >= 300 + mLineView->updateContents(); + mTimeLine->updateContents(); +#else +#endif +} + +void TimeSpanWidget::setDateRange( const QDateTime &start, const QDateTime &end ) +{ + mStartDate = start; + mEndDate = end; + + mTimeLine->setDateRange( start, end ); + + mSecsPerPixel = mStartDate.secsTo( mEndDate ) / mLineView->pixelWidth(); +} + +QDateTime TimeSpanWidget::startDateTime() +{ + return mStartDate; +} + +QDateTime TimeSpanWidget::endDateTime() +{ + return mEndDate; +} + +void TimeSpanWidget::zoomIn() +{ + int span = mStartDate.daysTo( mEndDate ); + setDateRange( mStartDate.addDays( span / 4 ), mEndDate.addDays( span / -4 ) ); + + emit dateRangeChanged(); +} + +void TimeSpanWidget::zoomOut() +{ + int span = mStartDate.daysTo( mEndDate ); + setDateRange( mStartDate.addDays( span / -4 ), mEndDate.addDays( span / 4 ) ); + + emit dateRangeChanged(); +} + +void TimeSpanWidget::centerView() +{ + QScrollBar *scrollBar = mLineView->horizontalScrollBar(); + int min = scrollBar->minValue(); + int max = scrollBar->maxValue(); + scrollBar->setValue( min + (max-min) / 2 ); +} diff --git a/korganizer/plugins/timespanview/timespanwidget.h b/korganizer/plugins/timespanview/timespanwidget.h new file mode 100644 index 000000000..316437023 --- /dev/null +++ b/korganizer/plugins/timespanview/timespanwidget.h @@ -0,0 +1,78 @@ +/* + This file is part of KOrganizer. + + Copyright (c) 2001 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 TimeSpanWidget_H +#define TimeSpanWidget_H + +#include <qwidget.h> + +namespace KCal { +class Event; +} + +class QSplitter; +class QListView; +class LineView; +class TimeLine; + +class TimeSpanWidget : public QWidget +{ + Q_OBJECT + public: + TimeSpanWidget( QWidget *parent=0, const char *name=0 ); + virtual ~TimeSpanWidget(); + + void addItem( KCal::Event * ); + + QValueList<int> splitterSizes(); + void setSplitterSizes( QValueList<int> ); + + void clear(); + + void setDateRange( const QDateTime &start, const QDateTime &end ); + + QDateTime startDateTime(); + QDateTime endDateTime(); + + public slots: + void updateView(); + + void zoomIn(); + void zoomOut(); + void centerView(); + + signals: + void dateRangeChanged(); + + private: + QSplitter *mSplitter; + QListView *mList; + TimeLine *mTimeLine; + LineView *mLineView; + + QDateTime mStartDate; + QDateTime mEndDate; + int mSecsPerPixel; +}; + +#endif |