summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--gammu/emb/common/service/gsmcal.c15
-rw-r--r--gammu/emb/common/service/gsmcal.h1
-rw-r--r--kaddressbook/kabcore.cpp6
-rw-r--r--korganizer/calendarview.cpp12
-rw-r--r--microkde/kapplication.cpp22
-rw-r--r--microkde/kapplication.h1
6 files changed, 50 insertions, 7 deletions
diff --git a/gammu/emb/common/service/gsmcal.c b/gammu/emb/common/service/gsmcal.c
index 0ea8e06..0375fee 100644
--- a/gammu/emb/common/service/gsmcal.c
+++ b/gammu/emb/common/service/gsmcal.c
@@ -47,48 +47,51 @@ void GSM_CalendarFindDefaultTextTimeAlarmPhoneRecurrance(GSM_CalendarEntry *entr
47 47
48 *Text = -1; 48 *Text = -1;
49 *Time = -1; 49 *Time = -1;
50 *Alarm = -1; 50 *Alarm = -1;
51 *Phone = -1; 51 *Phone = -1;
52 *Recurrance= -1; 52 *Recurrance= -1;
53 *EndTime= -1; 53 *EndTime= -1;
54 *Location= -1; 54 *Location= -1;
55 for (i = 0; i < entry->EntriesNum; i++) { 55 for (i = 0; i < entry->EntriesNum; i++) {
56 switch (entry->Entries[i].EntryType) { 56 switch (entry->Entries[i].EntryType) {
57 case CAL_START_DATETIME : 57 case CAL_START_DATETIME :
58 if (*Time == -1) *Time = i; 58 if (*Time == -1) *Time = i;
59 break; 59 break;
60 case CAL_END_DATETIME : 60 case CAL_END_DATETIME :
61 if (*EndTime == -1) *EndTime = i; 61 if (*EndTime == -1) *EndTime = i;
62 break; 62 break;
63 case CAL_ALARM_DATETIME : 63 case CAL_ALARM_DATETIME :
64 case CAL_SILENT_ALARM_DATETIME: 64 case CAL_SILENT_ALARM_DATETIME:
65 if (*Alarm == -1) *Alarm = i; 65 if (*Alarm == -1) *Alarm = i;
66 break; 66 break;
67 case CAL_RECURRANCE: 67 case CAL_RECURRANCE:
68 if (*Recurrance == -1) *Recurrance = i; 68 if (*Recurrance == -1) *Recurrance = i;
69 break; 69 break;
70 case CAL_TEXT: 70 case CAL_TEXT:
71 *Text = i;
72 break;
73 case CAL_DESCRIPTION:
71 if (*Text == -1) *Text = i; 74 if (*Text == -1) *Text = i;
72 break; 75 break;
73 case CAL_PHONE: 76 case CAL_PHONE:
74 if (*Phone == -1) *Phone = i; 77 if (*Phone == -1) *Phone = i;
75 break; 78 break;
76 case CAL_LOCATION: 79 case CAL_LOCATION:
77 if (*Location == -1) *Location = i; 80 if (*Location == -1) *Location = i;
78 break; 81 break;
79 default: 82 default:
80 break; 83 break;
81 } 84 }
82 } 85 }
83} 86}
84 87
85GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note, bool header, GSM_VCalendarVersion Version) 88GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note, bool header, GSM_VCalendarVersion Version)
86{ 89{
87 int Text, Time, Alarm, Phone, Recurrance, EndTime, Location; 90 int Text, Time, Alarm, Phone, Recurrance, EndTime, Location;
88 char buffer[2000]; 91 char buffer[2000];
89 92
90 GSM_CalendarFindDefaultTextTimeAlarmPhoneRecurrance(note, &Text, &Time, &Alarm, &Phone, &Recurrance, &EndTime, &Location); 93 GSM_CalendarFindDefaultTextTimeAlarmPhoneRecurrance(note, &Text, &Time, &Alarm, &Phone, &Recurrance, &EndTime, &Location);
91 94
92 if (header) { 95 if (header) {
93 *Length+=sprintf(Buffer, "BEGIN:VCALENDAR%c%c",13,10); 96 *Length+=sprintf(Buffer, "BEGIN:VCALENDAR%c%c",13,10);
94 *Length+=sprintf(Buffer+(*Length), "VERSION:1.0%c%c",13,10); 97 *Length+=sprintf(Buffer+(*Length), "VERSION:1.0%c%c",13,10);
@@ -176,51 +179,51 @@ GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note
176 if (Time == -1) return ERR_UNKNOWN; 179 if (Time == -1) return ERR_UNKNOWN;
177 SaveVCALDateTime(Buffer, Length, &note->Entries[Time].Date, "DTSTART"); 180 SaveVCALDateTime(Buffer, Length, &note->Entries[Time].Date, "DTSTART");
178 181
179 if (Alarm != -1) { 182 if (Alarm != -1) {
180 SaveVCALDateTime(Buffer, Length, &note->Entries[Alarm].Date, "DALARM"); 183 SaveVCALDateTime(Buffer, Length, &note->Entries[Alarm].Date, "DALARM");
181 } 184 }
182 185
183 if (Recurrance != -1) { 186 if (Recurrance != -1) {
184 switch(note->Entries[Recurrance].Number/24) { 187 switch(note->Entries[Recurrance].Number/24) {
185 case 1 : *Length+=sprintf(Buffer+(*Length), "RRULE:D1%c%c",13,10);break; 188 case 1 : *Length+=sprintf(Buffer+(*Length), "RRULE:D1%c%c",13,10);break;
186 case 7 : *Length+=sprintf(Buffer+(*Length), "RRULE:D7%c%c",13,10);break; 189 case 7 : *Length+=sprintf(Buffer+(*Length), "RRULE:D7%c%c",13,10);break;
187 case 30 : *Length+=sprintf(Buffer+(*Length), "RRULE:MD1%c%c",13,10);break; 190 case 30 : *Length+=sprintf(Buffer+(*Length), "RRULE:MD1%c%c",13,10);break;
188 case 365 : *Length+=sprintf(Buffer+(*Length), "RRULE:YD1%c%c",13,10);break; 191 case 365 : *Length+=sprintf(Buffer+(*Length), "RRULE:YD1%c%c",13,10);break;
189 } 192 }
190 } 193 }
191 194
192 if (note->Type == GSM_CAL_CALL) { 195 if (note->Type == GSM_CAL_CALL) {
193 buffer[0] = 0; 196 buffer[0] = 0;
194 buffer[1] = 0; 197 buffer[1] = 0;
195 if (Phone != -1) CopyUnicodeString(buffer,note->Entries[Phone].Text); 198 if (Phone != -1) CopyUnicodeString(buffer,note->Entries[Phone].Text);
196 if (Text != -1) { 199 if (Text != -1) {
197 if (Phone != -1) EncodeUnicode(buffer+UnicodeLength(buffer)*2," ",1); 200 if (Phone != -1) EncodeUnicode(buffer+UnicodeLength(buffer)*2," ",1);
198 CopyUnicodeString(buffer+UnicodeLength(buffer)*2,note->Entries[Text].Text); 201 CopyUnicodeString(buffer+UnicodeLength(buffer)*2,note->Entries[Text].Text);
199 } 202 }
200 SaveVCALText(Buffer, Length, buffer, "DESCRIPTION"); 203 SaveVCALText(Buffer, Length, buffer, "SUMMARY");
201 } else { 204 } else {
202 SaveVCALText(Buffer, Length, note->Entries[Text].Text, "DESCRIPTION"); 205 SaveVCALText(Buffer, Length, note->Entries[Text].Text, "SUMMARY");
203 } 206 }
204 } else if (Version == SonyEricsson_VCalendar) { 207 } else if (Version == SonyEricsson_VCalendar) {
205 *Length+=sprintf(Buffer+(*Length), "CATEGORIES:"); 208 *Length+=sprintf(Buffer+(*Length), "CATEGORIES:");
206 switch (note->Type) { 209 switch (note->Type) {
207 case GSM_CAL_MEETING: 210 case GSM_CAL_MEETING:
208 *Length+=sprintf(Buffer+(*Length), "Meeting%c%c",13,10); 211 *Length+=sprintf(Buffer+(*Length), "Meeting%c%c",13,10);
209 break; 212 break;
210 case GSM_CAL_REMINDER: 213 case GSM_CAL_REMINDER:
211 *Length+=sprintf(Buffer+(*Length), "Date%c%c",13,10); 214 *Length+=sprintf(Buffer+(*Length), "Date%c%c",13,10);
212 break; 215 break;
213 case GSM_CAL_TRAVEL: 216 case GSM_CAL_TRAVEL:
214 *Length+=sprintf(Buffer+(*Length), "Travel%c%c",13,10); 217 *Length+=sprintf(Buffer+(*Length), "Travel%c%c",13,10);
215 break; 218 break;
216 case GSM_CAL_VACATION: 219 case GSM_CAL_VACATION:
217 *Length+=sprintf(Buffer+(*Length), "Vacation%c%c",13,10); 220 *Length+=sprintf(Buffer+(*Length), "Vacation%c%c",13,10);
218 break; 221 break;
219 case GSM_CAL_BIRTHDAY: 222 case GSM_CAL_BIRTHDAY:
220 *Length+=sprintf(Buffer+(*Length), "Anninversary%c%c",13,10); 223 *Length+=sprintf(Buffer+(*Length), "Anninversary%c%c",13,10);
221 break; 224 break;
222 case GSM_CAL_MEMO: 225 case GSM_CAL_MEMO:
223 default: 226 default:
224 *Length+=sprintf(Buffer+(*Length), "Miscellaneous%c%c",13,10); 227 *Length+=sprintf(Buffer+(*Length), "Miscellaneous%c%c",13,10);
225 break; 228 break;
226 } 229 }
@@ -395,53 +398,59 @@ GSM_Error GSM_DecodeVCALENDAR_VTODO(unsigned char *Buffer, int *Pos, GSM_Calenda
395 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; 398 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE;
396 Calendar->Entries[Calendar->EntriesNum].Number = 1*24; 399 Calendar->Entries[Calendar->EntriesNum].Number = 1*24;
397 Calendar->EntriesNum++; 400 Calendar->EntriesNum++;
398 } 401 }
399 if ((strstr(Line,"RRULE:W1")) || (strstr(Line,"RRULE:D7"))) { 402 if ((strstr(Line,"RRULE:W1")) || (strstr(Line,"RRULE:D7"))) {
400 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; 403 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE;
401 Calendar->Entries[Calendar->EntriesNum].Number = 7*24; 404 Calendar->Entries[Calendar->EntriesNum].Number = 7*24;
402 Calendar->EntriesNum++; 405 Calendar->EntriesNum++;
403 } 406 }
404 if (strstr(Line,"RRULE:W2")) { 407 if (strstr(Line,"RRULE:W2")) {
405 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; 408 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE;
406 Calendar->Entries[Calendar->EntriesNum].Number = 14*24; 409 Calendar->Entries[Calendar->EntriesNum].Number = 14*24;
407 Calendar->EntriesNum++; 410 Calendar->EntriesNum++;
408 } 411 }
409 if (strstr(Line,"RRULE:MD1")) { 412 if (strstr(Line,"RRULE:MD1")) {
410 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; 413 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE;
411 Calendar->Entries[Calendar->EntriesNum].Number = 30*24; 414 Calendar->Entries[Calendar->EntriesNum].Number = 30*24;
412 Calendar->EntriesNum++; 415 Calendar->EntriesNum++;
413 } 416 }
414 if (strstr(Line,"RRULE:YD1")) { 417 if (strstr(Line,"RRULE:YD1")) {
415 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; 418 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE;
416 Calendar->Entries[Calendar->EntriesNum].Number = 365*24; 419 Calendar->Entries[Calendar->EntriesNum].Number = 365*24;
417 Calendar->EntriesNum++; 420 Calendar->EntriesNum++;
418 } 421 }
419 if ((ReadVCALText(Line, "SUMMARY", Buff)) || (ReadVCALText(Line, "DESCRIPTION", Buff))) { 422 // LR
423 if ((ReadVCALText(Line, "SUMMARY", Buff)) ) {
420 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_TEXT; 424 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_TEXT;
421 CopyUnicodeString(Calendar->Entries[Calendar->EntriesNum].Text,Buff); 425 CopyUnicodeString(Calendar->Entries[Calendar->EntriesNum].Text,Buff);
422 Calendar->EntriesNum++; 426 Calendar->EntriesNum++;
423 } 427 }
428 if (ReadVCALText(Line, "DESCRIPTION", Buff)) {
429 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_DESCRIPTION;
430 CopyUnicodeString(Calendar->Entries[Calendar->EntriesNum].Text,Buff);
431 Calendar->EntriesNum++;
432 }
424 if (ReadVCALText(Line, "LOCATION", Buff)) { 433 if (ReadVCALText(Line, "LOCATION", Buff)) {
425 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_LOCATION; 434 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_LOCATION;
426 CopyUnicodeString(Calendar->Entries[Calendar->EntriesNum].Text,Buff); 435 CopyUnicodeString(Calendar->Entries[Calendar->EntriesNum].Text,Buff);
427 Calendar->EntriesNum++; 436 Calendar->EntriesNum++;
428 } 437 }
429 if (ReadVCALText(Line, "DTSTART", Buff)) { 438 if (ReadVCALText(Line, "DTSTART", Buff)) {
430 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_START_DATETIME; 439 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_START_DATETIME;
431 ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date); 440 ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date);
432 Calendar->EntriesNum++; 441 Calendar->EntriesNum++;
433 } 442 }
434 if (ReadVCALText(Line, "DTEND", Buff)) { 443 if (ReadVCALText(Line, "DTEND", Buff)) {
435 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_END_DATETIME; 444 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_END_DATETIME;
436 ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date); 445 ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date);
437 Calendar->EntriesNum++; 446 Calendar->EntriesNum++;
438 } 447 }
439 if (ReadVCALText(Line, "DALARM", Buff)) { 448 if (ReadVCALText(Line, "DALARM", Buff)) {
440 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_SILENT_ALARM_DATETIME; 449 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_SILENT_ALARM_DATETIME;
441 ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date); 450 ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date);
442 Calendar->EntriesNum++; 451 Calendar->EntriesNum++;
443 } 452 }
444 if (ReadVCALText(Line, "AALARM", Buff)) { 453 if (ReadVCALText(Line, "AALARM", Buff)) {
445 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_ALARM_DATETIME; 454 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_ALARM_DATETIME;
446 ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date); 455 ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date);
447 Calendar->EntriesNum++; 456 Calendar->EntriesNum++;
diff --git a/gammu/emb/common/service/gsmcal.h b/gammu/emb/common/service/gsmcal.h
index 0a41b7b..c69fdbe 100644
--- a/gammu/emb/common/service/gsmcal.h
+++ b/gammu/emb/common/service/gsmcal.h
@@ -136,48 +136,49 @@ typedef enum {
136 /** 136 /**
137 * Date and time of event start. 137 * Date and time of event start.
138 */ 138 */
139 CAL_START_DATETIME = 1, 139 CAL_START_DATETIME = 1,
140 /** 140 /**
141 * Date and time of event end. 141 * Date and time of event end.
142 */ 142 */
143 CAL_END_DATETIME, 143 CAL_END_DATETIME,
144 /** 144 /**
145 * Alarm date and time. 145 * Alarm date and time.
146 */ 146 */
147 CAL_ALARM_DATETIME, 147 CAL_ALARM_DATETIME,
148 /** 148 /**
149 * Date and time of silent alarm. 149 * Date and time of silent alarm.
150 */ 150 */
151 CAL_SILENT_ALARM_DATETIME, 151 CAL_SILENT_ALARM_DATETIME,
152 /** 152 /**
153 * Recurrance. 153 * Recurrance.
154 */ 154 */
155 CAL_RECURRANCE, 155 CAL_RECURRANCE,
156 /** 156 /**
157 * Text. 157 * Text.
158 */ 158 */
159 CAL_TEXT, 159 CAL_TEXT,
160 CAL_DESCRIPTION, // LR added
160 /** 161 /**
161 * Location. 162 * Location.
162 */ 163 */
163 CAL_LOCATION, 164 CAL_LOCATION,
164 /** 165 /**
165 * Phone number. 166 * Phone number.
166 */ 167 */
167 CAL_PHONE, 168 CAL_PHONE,
168 /** 169 /**
169 * Whether this entry is private. 170 * Whether this entry is private.
170 */ 171 */
171 CAL_PRIVATE, 172 CAL_PRIVATE,
172 /** 173 /**
173 * Related contact id. 174 * Related contact id.
174 */ 175 */
175 CAL_CONTACTID, 176 CAL_CONTACTID,
176 /** 177 /**
177 * Repeat each x'th day of week. 178 * Repeat each x'th day of week.
178 */ 179 */
179 CAL_REPEAT_DAYOFWEEK, 180 CAL_REPEAT_DAYOFWEEK,
180 /** 181 /**
181 * Repeat each x'th day of month. 182 * Repeat each x'th day of month.
182 */ 183 */
183 CAL_REPEAT_DAY, 184 CAL_REPEAT_DAY,
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 47ed858..dae9cd2 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -792,67 +792,69 @@ void KABCore::beamVCard(const QStringList& uids)
792 792
793 QString vcard; 793 QString vcard;
794 converter.addresseeToVCard( a, vcard ); 794 converter.addresseeToVCard( a, vcard );
795 int start = 0; 795 int start = 0;
796 int next; 796 int next;
797 while ( (next = vcard.find("TYPE=", start) )>= 0 ) { 797 while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
798 int semi = vcard.find(";", next); 798 int semi = vcard.find(";", next);
799 int dopp = vcard.find(":", next); 799 int dopp = vcard.find(":", next);
800 int sep; 800 int sep;
801 if ( semi < dopp && semi >= 0 ) 801 if ( semi < dopp && semi >= 0 )
802 sep = semi ; 802 sep = semi ;
803 else 803 else
804 sep = dopp; 804 sep = dopp;
805 datastream +=vcard.mid( start, next - start); 805 datastream +=vcard.mid( start, next - start);
806 datastream +=vcard.mid( next+5,sep -next -5 ).upper(); 806 datastream +=vcard.mid( next+5,sep -next -5 ).upper();
807 start = sep; 807 start = sep;
808 } 808 }
809 datastream += vcard.mid( start,vcard.length() ); 809 datastream += vcard.mid( start,vcard.length() );
810 } 810 }
811#ifndef DESKTOP_VERSION 811#ifndef DESKTOP_VERSION
812 QFile outFile(fileName); 812 QFile outFile(fileName);
813 if ( outFile.open(IO_WriteOnly) ) { 813 if ( outFile.open(IO_WriteOnly) ) {
814 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); 814 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
815 QTextStream t( &outFile ); // use a text stream 815 QTextStream t( &outFile ); // use a text stream
816 t.setEncoding( QTextStream::UnicodeUTF8 ); 816 //t.setEncoding( QTextStream::UnicodeUTF8 );
817 t <<datastream; 817 t.setEncoding( QTextStream::Latin1 );
818 t <<datastream.latin1();
818 outFile.close(); 819 outFile.close();
819 Ir *ir = new Ir( this ); 820 Ir *ir = new Ir( this );
820 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); 821 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
821 ir->send( fileName, description, "text/x-vCard" ); 822 ir->send( fileName, description, "text/x-vCard" );
822 } else { 823 } else {
823 qDebug("Error open temp beam file "); 824 qDebug("Error open temp beam file ");
824 return; 825 return;
825 } 826 }
826#endif 827#endif
827 828
828} 829}
829 830
830void KABCore::beamDone( Ir *ir ) 831void KABCore::beamDone( Ir *ir )
831{ 832{
832#ifndef DESKTOP_VERSION 833#ifndef DESKTOP_VERSION
833 delete ir; 834 delete ir;
834#endif 835#endif
836 topLevelWidget()->raise();
835} 837}
836 838
837 839
838void KABCore::browse( const QString& url ) 840void KABCore::browse( const QString& url )
839{ 841{
840#ifndef KAB_EMBEDDED 842#ifndef KAB_EMBEDDED
841 kapp->invokeBrowser( url ); 843 kapp->invokeBrowser( url );
842#else //KAB_EMBEDDED 844#else //KAB_EMBEDDED
843 qDebug("KABCore::browse must be fixed"); 845 qDebug("KABCore::browse must be fixed");
844#endif //KAB_EMBEDDED 846#endif //KAB_EMBEDDED
845} 847}
846 848
847void KABCore::selectAllContacts() 849void KABCore::selectAllContacts()
848{ 850{
849 mViewManager->setSelected( QString::null, true ); 851 mViewManager->setSelected( QString::null, true );
850} 852}
851 853
852void KABCore::deleteContacts() 854void KABCore::deleteContacts()
853{ 855{
854 QStringList uidList = mViewManager->selectedUids(); 856 QStringList uidList = mViewManager->selectedUids();
855 deleteContacts( uidList ); 857 deleteContacts( uidList );
856} 858}
857 859
858void KABCore::deleteContacts( const QStringList &uids ) 860void KABCore::deleteContacts( const QStringList &uids )
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 1f2c6da..3e0a27d 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2302,78 +2302,86 @@ void CalendarView::beamFilteredCalendar()
2302void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) 2302void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
2303{ 2303{
2304 if ( beamDialog->exec () == QDialog::Rejected ) 2304 if ( beamDialog->exec () == QDialog::Rejected )
2305 return; 2305 return;
2306 2306
2307 QString fn = "/tmp/kopibeamfile"; 2307 QString fn = "/tmp/kopibeamfile";
2308 QString mes; 2308 QString mes;
2309 bool createbup = true; 2309 bool createbup = true;
2310 if ( createbup ) { 2310 if ( createbup ) {
2311 QString description = "\n"; 2311 QString description = "\n";
2312 CalendarLocal* cal = new CalendarLocal(); 2312 CalendarLocal* cal = new CalendarLocal();
2313 if ( beamDialog->beamLocal() ) 2313 if ( beamDialog->beamLocal() )
2314 cal->setLocalTime(); 2314 cal->setLocalTime();
2315 else 2315 else
2316 cal->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 2316 cal->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
2317 Incidence *incidence = delSel.first(); 2317 Incidence *incidence = delSel.first();
2318 bool addText = false; 2318 bool addText = false;
2319 if ( delSel.count() < 10 ) 2319 if ( delSel.count() < 10 )
2320 addText = true; 2320 addText = true;
2321 else { 2321 else {
2322 description.sprintf(i18n(" %d items?"),delSel.count() ); 2322 description.sprintf(i18n(" %d items?"),delSel.count() );
2323 } 2323 }
2324 while ( incidence ) { 2324 while ( incidence ) {
2325 Incidence *in = incidence->clone(); 2325 Incidence *in = incidence->clone();
2326 if ( ! in->summary().isEmpty() ) {
2327 in->setDescription("");
2328 } else {
2329 in->setSummary( in->description().left(20));
2330 in->setDescription("");
2331 }
2326 if ( addText ) 2332 if ( addText )
2327 description += in->summary() + "\n"; 2333 description += in->summary() + "\n";
2328 cal->addIncidence( in ); 2334 cal->addIncidence( in );
2329 incidence = delSel.next(); 2335 incidence = delSel.next();
2330 } 2336 }
2331 if ( beamDialog->beamVcal() ) { 2337 if ( beamDialog->beamVcal() ) {
2332 fn += ".vcs"; 2338 fn += ".vcs";
2333 FileStorage storage( cal, fn, new VCalFormat ); 2339 FileStorage storage( cal, fn, new VCalFormat );
2334 storage.save(); 2340 storage.save();
2335 } else { 2341 } else {
2336 fn += ".ics"; 2342 fn += ".ics";
2337 FileStorage storage( cal, fn, new ICalFormat( ) ); 2343 FileStorage storage( cal, fn, new ICalFormat( ) );
2338 storage.save(); 2344 storage.save();
2339 } 2345 }
2340 delete cal; 2346 delete cal;
2341 mes = i18n("KO/Pi: Ready for beaming"); 2347 mes = i18n("KO/Pi: Ready for beaming");
2342 setCaption(mes); 2348 topLevelWidget()->setCaption(mes);
2343 2349 KApplication::convert2latin1( fn );
2344#ifndef DESKTOP_VERSION 2350#ifndef DESKTOP_VERSION
2345 Ir *ir = new Ir( this ); 2351 Ir *ir = new Ir( this );
2346 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 2352 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
2347 ir->send( fn, description, "text/x-vCalendar" ); 2353 ir->send( fn, description, "text/x-vCalendar" );
2348#endif 2354#endif
2349 } 2355 }
2350} 2356}
2351void CalendarView::beamDone( Ir *ir ) 2357void CalendarView::beamDone( Ir *ir )
2352{ 2358{
2353#ifndef DESKTOP_VERSION 2359#ifndef DESKTOP_VERSION
2354 delete ir; 2360 delete ir;
2355#endif 2361#endif
2362 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") );
2363 topLevelWidget()->raise();
2356} 2364}
2357 2365
2358void CalendarView::moveIncidence(Incidence * inc ) 2366void CalendarView::moveIncidence(Incidence * inc )
2359{ 2367{
2360 if ( !inc ) return; 2368 if ( !inc ) return;
2361 // qDebug("showDatePickerForIncidence( ) "); 2369 // qDebug("showDatePickerForIncidence( ) ");
2362 if ( mDateFrame->isVisible() ) 2370 if ( mDateFrame->isVisible() )
2363 mDateFrame->hide(); 2371 mDateFrame->hide();
2364 else { 2372 else {
2365 int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; 2373 int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ;
2366 int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; 2374 int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ;
2367 int dw = QApplication::desktop()->width(); 2375 int dw = QApplication::desktop()->width();
2368 int dh = QApplication::desktop()->height(); 2376 int dh = QApplication::desktop()->height();
2369 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2377 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2370 mDateFrame->show(); 2378 mDateFrame->show();
2371 } 2379 }
2372 mDatePickerMode = 2; 2380 mDatePickerMode = 2;
2373 mMoveIncidence = inc ; 2381 mMoveIncidence = inc ;
2374 QDate da; 2382 QDate da;
2375 if ( mMoveIncidence->type() == "Todo" ) { 2383 if ( mMoveIncidence->type() == "Todo" ) {
2376 Todo * to = (Todo *) mMoveIncidence; 2384 Todo * to = (Todo *) mMoveIncidence;
2377 if ( to->hasDueDate() ) 2385 if ( to->hasDueDate() )
2378 da = to->dtDue().date(); 2386 da = to->dtDue().date();
2379 else 2387 else
diff --git a/microkde/kapplication.cpp b/microkde/kapplication.cpp
index 98ef2f2..56c01af 100644
--- a/microkde/kapplication.cpp
+++ b/microkde/kapplication.cpp
@@ -43,42 +43,64 @@ void KApplication::showLicence()
43 KApplication::showFile( "KDE-Pim/Pi licence", "kdepim/LICENCE.TXT" ); 43 KApplication::showFile( "KDE-Pim/Pi licence", "kdepim/LICENCE.TXT" );
44} 44}
45 45
46void KApplication::showFile(QString caption, QString fn) 46void KApplication::showFile(QString caption, QString fn)
47{ 47{
48 QString text; 48 QString text;
49 QString fileName; 49 QString fileName;
50#ifndef DESKTOP_VERSION 50#ifndef DESKTOP_VERSION
51 fileName = getenv("QPEDIR"); 51 fileName = getenv("QPEDIR");
52 fileName += "/pics/" + fn ; 52 fileName += "/pics/" + fn ;
53#else 53#else
54 fileName = qApp->applicationDirPath () + "/" + fn; 54 fileName = qApp->applicationDirPath () + "/" + fn;
55#endif 55#endif
56 QFile file( fileName ); 56 QFile file( fileName );
57 if (!file.open( IO_ReadOnly ) ) { 57 if (!file.open( IO_ReadOnly ) ) {
58 return ; 58 return ;
59 } 59 }
60 QTextStream ts( &file ); 60 QTextStream ts( &file );
61 text = ts.read(); 61 text = ts.read();
62 file.close(); 62 file.close();
63 KApplication::showText( caption, text ); 63 KApplication::showText( caption, text );
64 64
65} 65}
66 66
67bool KApplication::convert2latin1(QString fileName)
68{
69 QString text;
70 QFile file( fileName );
71 if (!file.open( IO_ReadOnly ) ) {
72 return false;
73
74 }
75 QTextStream ts( &file );
76 ts.setEncoding( QTextStream::UnicodeUTF8 );
77 text = ts.read();
78 file.close();
79 if (!file.open( IO_WriteOnly ) ) {
80 return false;
81 }
82 QTextStream tsIn( &file );
83 tsIn.setEncoding( QTextStream::Latin1 );
84 tsIn << text.latin1();
85 file.close();
86
87
88}
67void KApplication::showText(QString caption, QString text) 89void KApplication::showText(QString caption, QString text)
68{ 90{
69 QDialog dia( 0, "name", true ); ; 91 QDialog dia( 0, "name", true ); ;
70 dia.setCaption( caption ); 92 dia.setCaption( caption );
71 QVBoxLayout* lay = new QVBoxLayout( &dia ); 93 QVBoxLayout* lay = new QVBoxLayout( &dia );
72 lay->setSpacing( 3 ); 94 lay->setSpacing( 3 );
73 lay->setMargin( 3 ); 95 lay->setMargin( 3 );
74 QTextBrowser tb ( &dia ); 96 QTextBrowser tb ( &dia );
75 lay->addWidget( &tb ); 97 lay->addWidget( &tb );
76 tb.setText( text ); 98 tb.setText( text );
77#ifdef DESKTOP_VERSION 99#ifdef DESKTOP_VERSION
78 dia.resize( 640, 480); 100 dia.resize( 640, 480);
79#else 101#else
80 dia.showMaximized(); 102 dia.showMaximized();
81#endif 103#endif
82 dia.exec(); 104 dia.exec();
83 105
84} 106}
diff --git a/microkde/kapplication.h b/microkde/kapplication.h
index 79cdb33..41546a0 100644
--- a/microkde/kapplication.h
+++ b/microkde/kapplication.h
@@ -1,26 +1,27 @@
1#ifndef MINIKDE_KAPPLICATION_H 1#ifndef MINIKDE_KAPPLICATION_H
2#define MINIKDE_KAPPLICATION_H 2#define MINIKDE_KAPPLICATION_H
3 3
4#include "qstring.h" 4#include "qstring.h"
5#include <qdialog.h> 5#include <qdialog.h>
6 6
7class KApplication 7class KApplication
8{ 8{
9 public: 9 public:
10 static int random(); 10 static int random();
11 11
12//US 12//US
13 /** 13 /**
14 * Generates a random string. It operates in the range [A-Za-z0-9] 14 * Generates a random string. It operates in the range [A-Za-z0-9]
15 * @param length Generate a string of this length. 15 * @param length Generate a string of this length.
16 * @return the random string 16 * @return the random string
17 */ 17 */
18 static QString randomString(int length); 18 static QString randomString(int length);
19 static int execDialog( QDialog* ); 19 static int execDialog( QDialog* );
20 static void showLicence(); 20 static void showLicence();
21 static void showFile(QString caption, QString file); 21 static void showFile(QString caption, QString file);
22 static void showText(QString caption, QString text); 22 static void showText(QString caption, QString text);
23 static bool convert2latin1(QString file);
23}; 24};
24 25
25 26
26#endif 27#endif