summaryrefslogtreecommitdiffabout
path: root/libkcal/vcalformat.cpp
Unidiff
Diffstat (limited to 'libkcal/vcalformat.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/vcalformat.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp
index 0ebd7d1..4727a7a 100644
--- a/libkcal/vcalformat.cpp
+++ b/libkcal/vcalformat.cpp
@@ -9,100 +9,103 @@
9 version 2 of the License, or (at your option) any later version. 9 version 2 of the License, or (at your option) any later version.
10 10
11 This library is distributed in the hope that it will be useful, 11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details. 14 Library General Public License for more details.
15 15
16 You should have received a copy of the GNU Library General Public License 16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to 17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. 19 Boston, MA 02111-1307, USA.
20*/ 20*/
21 21
22#include <qapplication.h> 22#include <qapplication.h>
23#include <qdatetime.h> 23#include <qdatetime.h>
24#include <qstring.h> 24#include <qstring.h>
25#include <qptrlist.h> 25#include <qptrlist.h>
26#include <qregexp.h> 26#include <qregexp.h>
27#include <qclipboard.h> 27#include <qclipboard.h>
28#include <qdialog.h> 28#include <qdialog.h>
29#include <qfile.h> 29#include <qfile.h>
30 30
31#include <kdebug.h> 31#include <kdebug.h>
32#include <kglobal.h> 32#include <kglobal.h>
33#include <kmessagebox.h> 33#include <kmessagebox.h>
34#include <kiconloader.h> 34#include <kiconloader.h>
35#include <klocale.h> 35#include <klocale.h>
36 36
37#include "vcc.h" 37#include "vcc.h"
38#include "vobject.h" 38#include "vobject.h"
39 39
40#include "vcaldrag.h" 40#include "vcaldrag.h"
41#include "calendar.h" 41#include "calendar.h"
42 42
43#include "vcalformat.h" 43#include "vcalformat.h"
44 44
45using namespace KCal; 45using namespace KCal;
46 46
47VCalFormat::VCalFormat() 47VCalFormat::VCalFormat()
48{ 48{
49 mCalendar = 0; 49 mCalendar = 0;
50 useLocalTime = false; 50 useLocalTime = false;
51} 51}
52 52
53VCalFormat::~VCalFormat() 53VCalFormat::~VCalFormat()
54{ 54{
55} 55}
56 56
57void VCalFormat::setLocalTime ( bool b )
58{
59 useLocalTime = b;
60}
57bool VCalFormat::load(Calendar *calendar, const QString &fileName) 61bool VCalFormat::load(Calendar *calendar, const QString &fileName)
58{ 62{
59 mCalendar = calendar; 63 mCalendar = calendar;
60
61 clearException(); 64 clearException();
62 65
63 kdDebug(5800) << "VCalFormat::load() " << fileName << endl; 66 kdDebug(5800) << "VCalFormat::load() " << fileName << endl;
64 67
65 VObject *vcal = 0; 68 VObject *vcal = 0;
66 69
67 // this is not necessarily only 1 vcal. Could be many vcals, or include 70 // this is not necessarily only 1 vcal. Could be many vcals, or include
68 // a vcard... 71 // a vcard...
69 vcal = Parse_MIME_FromFileName(const_cast<char *>(QFile::encodeName(fileName).data())); 72 vcal = Parse_MIME_FromFileName(const_cast<char *>(QFile::encodeName(fileName).data()));
70 73
71 if (!vcal) { 74 if (!vcal) {
72 setException(new ErrorFormat(ErrorFormat::CalVersionUnknown)); 75 setException(new ErrorFormat(ErrorFormat::CalVersionUnknown));
73 return FALSE; 76 return FALSE;
74 } 77 }
75 78
76 // any other top-level calendar stuff should be added/initialized here 79 // any other top-level calendar stuff should be added/initialized here
77 80
78 // put all vobjects into their proper places 81 // put all vobjects into their proper places
79 populate(vcal); 82 populate(vcal);
80 83
81 // clean up from vcal API stuff 84 // clean up from vcal API stuff
82 cleanVObjects(vcal); 85 cleanVObjects(vcal);
83 cleanStrTbl(); 86 cleanStrTbl();
84 87
85 return true; 88 return true;
86} 89}
87 90
88 91
89bool VCalFormat::save(Calendar *calendar, const QString &fileName) 92bool VCalFormat::save(Calendar *calendar, const QString &fileName)
90{ 93{
91 mCalendar = calendar; 94 mCalendar = calendar;
92 95
93 QString tmpStr; 96 QString tmpStr;
94 VObject *vcal, *vo; 97 VObject *vcal, *vo;
95 98
96 kdDebug(5800) << "VCalFormat::save(): " << fileName << endl; 99 kdDebug(5800) << "VCalFormat::save(): " << fileName << endl;
97 100
98 vcal = newVObject(VCCalProp); 101 vcal = newVObject(VCCalProp);
99 102
100 // addPropValue(vcal,VCLocationProp, "0.0"); 103 // addPropValue(vcal,VCLocationProp, "0.0");
101 addPropValue(vcal,VCProdIdProp, productId()); 104 addPropValue(vcal,VCProdIdProp, productId());
102 tmpStr = mCalendar->getTimeZoneStr(); 105 tmpStr = mCalendar->getTimeZoneStr();
103 //qDebug("mCalendar->getTimeZoneStr() %s",tmpStr.latin1() ); 106 //qDebug("mCalendar->getTimeZoneStr() %s",tmpStr.latin1() );
104 addPropValue(vcal,VCTimeZoneProp, tmpStr.local8Bit()); 107 addPropValue(vcal,VCTimeZoneProp, tmpStr.local8Bit());
105 addPropValue(vcal,VCVersionProp, _VCAL_VERSION); 108 addPropValue(vcal,VCVersionProp, _VCAL_VERSION);
106 109
107 // TODO STUFF 110 // TODO STUFF
108 QPtrList<Todo> todoList = mCalendar->rawTodos(); 111 QPtrList<Todo> todoList = mCalendar->rawTodos();