diff options
Diffstat (limited to 'korganizer/plugins/printing/journal')
5 files changed, 508 insertions, 0 deletions
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 <[email protected]></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 <[email protected]> + + 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 <[email protected]> + + 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 |