diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-01-27 01:05:15 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-01-27 01:05:15 -0600 |
commit | 64df902cf71a8ee258fb85f6be26248f399aa01f (patch) | |
tree | dba58f705042c22cea26b678d5b0e4e9a34bf202 /tdefile-plugins/ics | |
parent | de53c98cab07e9c4b0f5e25dab82830fb6fc67ec (diff) | |
download | tdepim-64df902cf71a8ee258fb85f6be26248f399aa01f.tar.gz tdepim-64df902cf71a8ee258fb85f6be26248f399aa01f.zip |
Rename a number of libraries and executables to avoid conflicts with KDE4
Diffstat (limited to 'tdefile-plugins/ics')
-rw-r--r-- | tdefile-plugins/ics/CMakeLists.txt | 40 | ||||
-rw-r--r-- | tdefile-plugins/ics/Makefile.am | 24 | ||||
-rw-r--r-- | tdefile-plugins/ics/tdefile_ics.cpp | 96 | ||||
-rw-r--r-- | tdefile-plugins/ics/tdefile_ics.desktop | 56 | ||||
-rw-r--r-- | tdefile-plugins/ics/tdefile_ics.h | 37 |
5 files changed, 253 insertions, 0 deletions
diff --git a/tdefile-plugins/ics/CMakeLists.txt b/tdefile-plugins/ics/CMakeLists.txt new file mode 100644 index 000000000..66c100712 --- /dev/null +++ b/tdefile-plugins/ics/CMakeLists.txt @@ -0,0 +1,40 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +tde_import( libkmime ) +tde_import( ktnef ) +tde_import( libkcal ) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/libtdepim + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES tdefile_ics.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) + + +##### tdefile_ics (module) ######################## + +tde_add_kpart( tdefile_ics AUTOMOC + SOURCES tdefile_ics.cpp + LINK kcal-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdefile-plugins/ics/Makefile.am b/tdefile-plugins/ics/Makefile.am new file mode 100644 index 000000000..96a1a7f74 --- /dev/null +++ b/tdefile-plugins/ics/Makefile.am @@ -0,0 +1,24 @@ +# Makefile.am for ics file meta info plugin + +# set the include path for X, tdepim, qt and KDE +INCLUDES = \ + -I$(top_srcdir) \ + $(all_includes) + +# these are the headers for your project +noinst_HEADERS = tdefile_ics.h + +kde_module_LTLIBRARIES = tdefile_ics.la + +tdefile_ics_la_SOURCES = tdefile_ics.cpp +tdefile_ics_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) $(LIB_QT) -ltdecore +tdefile_ics_la_LIBADD = $(top_builddir)/libkcal/libkcal.la $(LIB_KSYCOCA) + + +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) tdefile_ics.cpp -o $(podir)/tdefile_ics.pot + +services_DATA = tdefile_ics.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/ics/tdefile_ics.cpp b/tdefile-plugins/ics/tdefile_ics.cpp new file mode 100644 index 000000000..11a5384fb --- /dev/null +++ b/tdefile-plugins/ics/tdefile_ics.cpp @@ -0,0 +1,96 @@ +/* This file is part of the KDE project + * Copyright (C) 2004 Bram Schoenmakers <bramschoenmakers@kde.nl> + * + * 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 version 2. + * + * This program is distributed in the hope that +t 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; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include <tqdatetime.h> +#include <tqfile.h> + +#include <libkcal/calendarlocal.h> +#include <libkcal/todo.h> + +#include "tdefile_ics.h" + +#include <kgenericfactory.h> + +using namespace KCal; + +typedef KGenericFactory<ICSPlugin> ICSFactory; +K_EXPORT_COMPONENT_FACTORY(tdefile_ics, ICSFactory( "tdefile_ics" )) + +ICSPlugin::ICSPlugin( TQObject *parent, const char *name, const TQStringList& args ) + : KFilePlugin( parent, name, args ) +{ + KFileMimeTypeInfo* info = addMimeTypeInfo( "text/calendar" ); //TODO: vcs !! + + KFileMimeTypeInfo::GroupInfo* group = 0L; + group = addGroupInfo(info, "ICSInfo", i18n("Calendar Statistics")); + + addItemInfo( group, "ProductID", i18n("Product ID"), TQVariant::String ); + addItemInfo( group, "Events", i18n("Events"), TQVariant::Int ); + addItemInfo( group, "Todos", i18n("To-dos"), TQVariant::Int ); + addItemInfo( group, "TodoCompleted", i18n("Completed To-dos"), TQVariant::Int ); + addItemInfo( group, "TodoOverdue", i18n("Overdue To-dos"), TQVariant::Int ); + addItemInfo( group, "Journals", i18n("Journals"), TQVariant::Int ); +// addItemInfo( group, "Reminders", i18n("Reminders"), TQVariant::Int ); + +} + +/* +I chose to use libkcal instead of reading the calendar manually. It's easier to +maintain this way. +*/ +bool ICSPlugin::readInfo( KFileMetaInfo& info, uint /*what*/ ) +{ + KFileMetaInfoGroup group = appendGroup( info, "ICSInfo"); + + CalendarLocal cal ( TQString::fromLatin1( "UTC" ) ); + if( !cal.load( info.path() ) ) { + kdDebug() << "Could not load calendar" << endl; + return false; + } + + appendItem( group, "ProductID", TQVariant( cal.productId() ) ); + appendItem( group, "Events", TQVariant( int( cal.events().count() ) ) ); + appendItem( group, "Journals", TQVariant( int( cal.journals().count() ) ) ); + Todo::List todos = cal.todos(); + + // count completed and overdue + Todo::List::ConstIterator it = todos.begin(); + Todo::List::ConstIterator end = todos.end(); + + int completed = 0; + int overdue = 0; + for ( ; it != end ; ++it ) { + Todo *todo = *it; + if ( todo->isCompleted() ) + ++completed; + else if ( todo->hasDueDate() && todo->dtDue().date() < TQDate::currentDate() ) + ++overdue; + } + + appendItem( group, "Todos", TQVariant( int(todos.count() ) ) ); + appendItem( group, "TodoCompleted", TQVariant( completed ) ); + appendItem( group, "TodoOverdue", TQVariant( overdue ) ); + + cal.close(); + + return true; +} + +#include "tdefile_ics.moc" diff --git a/tdefile-plugins/ics/tdefile_ics.desktop b/tdefile-plugins/ics/tdefile_ics.desktop new file mode 100644 index 000000000..41d745aa4 --- /dev/null +++ b/tdefile-plugins/ics/tdefile_ics.desktop @@ -0,0 +1,56 @@ +[Desktop Entry] +Type=Service +Name=ICS information +Name[af]=ICS informasie +Name[be]=Інфармацыя аб ICS +Name[bg]=ICS информация +Name[br]=Titouroù ICS +Name[ca]=Informació ICS +Name[cs]=Informace o ICS +Name[da]=ICS-information +Name[de]=ICS-Information +Name[el]=Πληροφορίες ICS +Name[eo]=ICS-Informo +Name[es]=Información ICS +Name[et]=ICS info +Name[eu]=ICS informazioa +Name[fa]=اطلاعات ICS +Name[fi]=ICS-tiedot +Name[fr]=Information sur ICS +Name[fy]=ICS-ynformaasje +Name[gl]=Información ICS +Name[he]=מידע של ICS +Name[hu]=ICS-jellemzők +Name[is]=ICS upplýsingar +Name[it]=Informazioni ICS +Name[ja]=ICS 情報 +Name[kk]=ICS ақпараты +Name[km]=ព័ត៌មាន ICS +Name[lt]=ICS informacija +Name[mk]=Информација за ICS +Name[ms]=Maklumat ICS +Name[nb]=ICS-informasjon +Name[nds]=ICS-Informatschoon +Name[ne]=ICS सूचना +Name[nl]=ICS-informatie +Name[nn]=ICS-informasjon +Name[pa]=ICS ਜਾਣਕਾਰੀ +Name[pl]=Informacja ICS +Name[pt]=Informação ICS +Name[pt_BR]=Informações ICS +Name[ru]=Информация ICS +Name[sk]=Informácie o ICS +Name[sl]=Podatki ICS +Name[sr]=ICS информације +Name[sr@Latn]=ICS informacije +Name[sv]=ICS-information +Name[ta]=ICS தகவல் +Name[tr]=ICS bilgisi +Name[uk]=Інформація про ICS +Name[zh_CN]=ICS 信息 +Name[zh_TW]=ICS 資訊 +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_ics +MimeType=text/calendar +PreferredGroups=ICSInfo +PreferredItems=Events,Todos,Journals diff --git a/tdefile-plugins/ics/tdefile_ics.h b/tdefile-plugins/ics/tdefile_ics.h new file mode 100644 index 000000000..9f4a897eb --- /dev/null +++ b/tdefile-plugins/ics/tdefile_ics.h @@ -0,0 +1,37 @@ + /* This file is part of the KDE project + * Copyright (C) 2004 Bram Schoenmakers <bramschoenmakers@kde.nl> + * + * 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 version 2. + * + * 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; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef KFILE_ICS_H +#define KFILE_ICS_H + +#include <tdefilemetainfo.h> + +class TQStringList; + +class ICSPlugin : public KFilePlugin +{ + Q_OBJECT + +public: + ICSPlugin( TQObject *parent, const char *name, const TQStringList& args ); + + virtual bool readInfo( KFileMetaInfo& info, uint what ); +}; + +#endif |