36 #include <tqdatetime.h>
40 #include <kstandarddirs.h>
41 #include <tdelocale.h>
43 #include <libkcal/calendarlocal.h>
44 #include <libkcal/calendar.h>
45 #include <libkcal/event.h>
46 #include <libtdepim/kpimprefs.h>
70 kdDebug() <<
"konsolekalendaradd.cpp::addEvent()" << endl;
72 if ( m_variables->isDryRun() ) {
73 cout << i18n(
"Insert Event <Dry Run>:" ).local8Bit().data()
77 if ( m_variables->isVerbose() ) {
78 cout << i18n(
"Insert Event <Verbose>:" ).local8Bit().data()
83 Event *
event =
new Event();
85 event->setDtStart( m_variables->getStartDateTime() );
86 event->setDtEnd( m_variables->getEndDateTime() );
87 event->setSummary( m_variables->getSummary() );
88 event->setFloats( m_variables->getFloating() );
89 event->setDescription( m_variables->getDescription() );
90 event->setLocation( m_variables->getLocation() );
92 if ( m_variables->getCalendar()->addEvent( event ) ) {
93 cout << i18n(
"Success: \"%1\" inserted" ).
94 arg( m_variables->getSummary() ).local8Bit().data()
97 m_variables->getCalendar()->save();
100 cout << i18n(
"Failure: \"%1\" not inserted" ).
101 arg( m_variables->getSummary() ).local8Bit().data()
107 kdDebug() <<
"konsolekalendaradd.cpp::addEvent() | Done " << endl;
118 if ( m_variables->getCalendarFile().isEmpty() )
119 fileName = locateLocal(
"data",
"korganizer/std.ics" );
121 fileName = m_variables->getCalendarFile();
123 CalendarLocal *cal =
new CalendarLocal( KPimPrefs::timezone() );
124 if ( !cal->load( fileName ) ||
125 !cal->load( m_variables->getImportFile() ) ||
126 !cal->save( fileName ) ) {
128 <<
"konsolekalendaradd.cpp::importCalendar() | "
129 <<
"Can't import file: "
130 << m_variables->getImportFile()
135 <<
"konsolekalendaradd.cpp::importCalendar() | "
136 <<
"Successfully imported file: "
137 << m_variables->getImportFile()
142 void KonsoleKalendarAdd::printSpecs()
144 cout << i18n(
" What: %1" ).
145 arg( m_variables->getSummary() ).local8Bit().data()
148 cout << i18n(
" Begin: %1" ).
149 arg( m_variables->getStartDateTime().toString( TQt::TextDate ) ).local8Bit().data()
152 cout << i18n(
" End: %1" ).
153 arg( m_variables->getEndDateTime().toString( TQt::TextDate ) ).local8Bit().data()
156 if ( m_variables->getFloating() ==
true ) {
157 cout << i18n(
" No Time Associated with Event" ).local8Bit().data()
161 cout << i18n(
" Desc: %1" ).
162 arg( m_variables->getDescription() ).local8Bit().data()
165 cout << i18n(
" Location: %1" ).
166 arg( m_variables->getLocation() ).local8Bit().data()
bool addEvent()
Add the Event.
~KonsoleKalendarAdd()
Destructor.
KonsoleKalendarAdd(KonsoleKalendarVariables *vars)
Constructs a KonsoleKalendarAdd object from command line arguments.
bool addImportedCalendar()
Imports calendar file to current Calendar.
This class provides all the variables for the program.
Provides the KonsoleKalendarAdd class definition.