-rw-r--r-- | libkcal/calformat.cpp | 20 |
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 | ||
27 | using namespace KCal; | 27 | using namespace KCal; |
28 | 28 | ||
29 | QString CalFormat::mApplication = QString::fromLatin1("libkcal"); | 29 | QString CalFormat::mApplication = QString::fromLatin1("libkcal-pi"); |
30 | QString CalFormat::mProductId = QString::fromLatin1("-//K Desktop Environment//NONSGML libkcal 3.1//EN"); | 30 | QString 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. |
34 | struct CalVersion { | 34 | struct CalVersion { |
35 | int version; | 35 | int version; |
36 | QString prodId; | 36 | QString prodId; |
37 | }; | 37 | }; |
38 | static CalVersion prodIds[] = { | 38 | static 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 | ||
46 | CalFormat::CalFormat() | 46 | CalFormat::CalFormat() |
47 | { | 47 | { |
48 | mException = 0; | 48 | mException = 0; |
49 | } | 49 | } |
50 | 50 | ||
51 | CalFormat::~CalFormat() | 51 | CalFormat::~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 | ||
73 | void CalFormat::setApplication(const QString& application, const QString& productID) | 73 | void 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 | ||
79 | QString CalFormat::createUniqueId() | 79 | QString 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 | ||
91 | int CalFormat::calendarVersion(const char* prodId) | 87 | int 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 | } |