summaryrefslogtreecommitdiffabout
path: root/libkcal/calformat.cpp
Unidiff
Diffstat (limited to 'libkcal/calformat.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/calformat.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/libkcal/calformat.cpp b/libkcal/calformat.cpp
index 8a3d069..359f65f 100644
--- a/libkcal/calformat.cpp
+++ b/libkcal/calformat.cpp
@@ -17,37 +17,37 @@
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21#include <klocale.h> 21#include <klocale.h>
22#include <kdebug.h> 22#include <kdebug.h>
23#include <kapplication.h> 23#include <kapplication.h>
24 24
25#include "calformat.h" 25#include "calformat.h"
26 26
27using namespace KCal; 27using namespace KCal;
28 28
29QString CalFormat::mApplication = QString::fromLatin1("libkcal"); 29QString CalFormat::mApplication = QString::fromLatin1("libkcal-pi");
30QString CalFormat::mProductId = QString::fromLatin1("-//K Desktop Environment//NONSGML libkcal 3.1//EN"); 30QString CalFormat::mProductId = QString::fromLatin1("-//KDE-Pim//Platform-independent 2.1.0");
31 31
32// An array containing the PRODID strings indexed against the calendar file format version used. 32// An array containing the PRODID strings indexed against the calendar file format version used.
33// Every time the calendar file format is changed, add an entry/entries to this list. 33// Every time the calendar file format is changed, add an entry/entries to this list.
34struct CalVersion { 34struct CalVersion {
35 int version; 35 int version;
36 QString prodId; 36 QString prodId;
37}; 37};
38static CalVersion prodIds[] = { 38static CalVersion prodIds[] = {
39 { 220, QString::fromLatin1("-//K Desktop Environment//NONSGML KOrganizer 2.2//EN") }, 39 { 220, QString::fromLatin1("-//KDE-Pim//Pi 2.2//EN") },
40 { 300, QString::fromLatin1("-//K Desktop Environment//NONSGML KOrganizer 3.0//EN") }, 40 { 300, QString::fromLatin1("-//KDE-Pim//Pi 3.0//EN") },
41 { 310, QString::fromLatin1("-//K Desktop Environment//NONSGML KOrganizer 3.1//EN") }, 41 { 310, QString::fromLatin1("-//KDE-Pim//Pi 3.1//EN") },
42 { 0 , QString() } 42 { 0 , QString() }
43}; 43};
44 44
45 45
46CalFormat::CalFormat() 46CalFormat::CalFormat()
47{ 47{
48 mException = 0; 48 mException = 0;
49} 49}
50 50
51CalFormat::~CalFormat() 51CalFormat::~CalFormat()
52{ 52{
53 delete mException; 53 delete mException;
@@ -69,30 +69,26 @@ ErrorFormat *CalFormat::exception()
69{ 69{
70 return mException; 70 return mException;
71} 71}
72 72
73void CalFormat::setApplication(const QString& application, const QString& productID) 73void CalFormat::setApplication(const QString& application, const QString& productID)
74{ 74{
75 mApplication = application; 75 mApplication = application;
76 mProductId = productID; 76 mProductId = productID;
77} 77}
78 78
79QString CalFormat::createUniqueId() 79QString CalFormat::createUniqueId()
80{ 80{
81 int hashTime = QTime::currentTime().hour() + 81 return QString("%1-%2-%3")
82 QTime::currentTime().minute() + QTime::currentTime().second() + 82 .arg("kopi")
83 QTime::currentTime().msec();
84 QString uidStr = QString("%1-%2.%3")
85 .arg(mApplication)
86 .arg(KApplication::random()) 83 .arg(KApplication::random())
87 .arg(hashTime); 84 .arg(QTime::currentTime().msec()+1);
88 return uidStr;
89} 85}
90 86
91int CalFormat::calendarVersion(const char* prodId) 87int CalFormat::calendarVersion(const char* prodId)
92{ 88{
93 for (const CalVersion* cv = prodIds; cv->version; ++cv) { 89 for (const CalVersion* cv = prodIds; cv->version; ++cv) {
94 if (!strcmp(prodId, cv->prodId.local8Bit())) 90 if (!strcmp(prodId, cv->prodId.local8Bit()))
95 return cv->version; 91 return cv->version;
96 } 92 }
97 return 0; 93 return 0;
98} 94}