-rw-r--r-- | gammu/emb/common/service/gsmcal.c | 15 | ||||
-rw-r--r-- | gammu/emb/common/service/gsmcal.h | 1 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 6 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 12 | ||||
-rw-r--r-- | microkde/kapplication.cpp | 22 | ||||
-rw-r--r-- | microkde/kapplication.h | 1 |
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 @@ -55,32 +55,35 @@ void GSM_CalendarFindDefaultTextTimeAlarmPhoneRecurrance(GSM_CalendarEntry *entr for (i = 0; i < entry->EntriesNum; i++) { switch (entry->Entries[i].EntryType) { case CAL_START_DATETIME : if (*Time == -1) *Time = i; break; case CAL_END_DATETIME : if (*EndTime == -1) *EndTime = i; break; case CAL_ALARM_DATETIME : case CAL_SILENT_ALARM_DATETIME: if (*Alarm == -1) *Alarm = i; break; case CAL_RECURRANCE: if (*Recurrance == -1) *Recurrance = i; break; case CAL_TEXT: + *Text = i; + break; + case CAL_DESCRIPTION: if (*Text == -1) *Text = i; break; case CAL_PHONE: if (*Phone == -1) *Phone = i; break; case CAL_LOCATION: if (*Location == -1) *Location = i; break; default: break; } } } GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note, bool header, GSM_VCalendarVersion Version) { @@ -184,35 +187,35 @@ GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note switch(note->Entries[Recurrance].Number/24) { case 1 : *Length+=sprintf(Buffer+(*Length), "RRULE:D1%c%c",13,10); break; case 7 : *Length+=sprintf(Buffer+(*Length), "RRULE:D7%c%c",13,10); break; case 30 : *Length+=sprintf(Buffer+(*Length), "RRULE:MD1%c%c",13,10); break; case 365 : *Length+=sprintf(Buffer+(*Length), "RRULE:YD1%c%c",13,10); break; } } if (note->Type == GSM_CAL_CALL) { buffer[0] = 0; buffer[1] = 0; if (Phone != -1) CopyUnicodeString(buffer,note->Entries[Phone].Text); if (Text != -1) { if (Phone != -1) EncodeUnicode(buffer+UnicodeLength(buffer)*2," ",1); CopyUnicodeString(buffer+UnicodeLength(buffer)*2,note->Entries[Text].Text); } - SaveVCALText(Buffer, Length, buffer, "DESCRIPTION"); + SaveVCALText(Buffer, Length, buffer, "SUMMARY"); } else { - SaveVCALText(Buffer, Length, note->Entries[Text].Text, "DESCRIPTION"); + SaveVCALText(Buffer, Length, note->Entries[Text].Text, "SUMMARY"); } } else if (Version == SonyEricsson_VCalendar) { *Length+=sprintf(Buffer+(*Length), "CATEGORIES:"); switch (note->Type) { case GSM_CAL_MEETING: *Length+=sprintf(Buffer+(*Length), "Meeting%c%c",13,10); break; case GSM_CAL_REMINDER: *Length+=sprintf(Buffer+(*Length), "Date%c%c",13,10); break; case GSM_CAL_TRAVEL: *Length+=sprintf(Buffer+(*Length), "Travel%c%c",13,10); break; case GSM_CAL_VACATION: *Length+=sprintf(Buffer+(*Length), "Vacation%c%c",13,10); break; @@ -403,37 +406,43 @@ GSM_Error GSM_DecodeVCALENDAR_VTODO(unsigned char *Buffer, int *Pos, GSM_Calenda } if (strstr(Line,"RRULE:W2")) { Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; Calendar->Entries[Calendar->EntriesNum].Number = 14*24; Calendar->EntriesNum++; } if (strstr(Line,"RRULE:MD1")) { Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; Calendar->Entries[Calendar->EntriesNum].Number = 30*24; Calendar->EntriesNum++; } if (strstr(Line,"RRULE:YD1")) { Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; Calendar->Entries[Calendar->EntriesNum].Number = 365*24; Calendar->EntriesNum++; } - if ((ReadVCALText(Line, "SUMMARY", Buff)) || (ReadVCALText(Line, "DESCRIPTION", Buff))) { + // LR + if ((ReadVCALText(Line, "SUMMARY", Buff)) ) { Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_TEXT; CopyUnicodeString(Calendar->Entries[Calendar->EntriesNum].Text,Buff); Calendar->EntriesNum++; } + if (ReadVCALText(Line, "DESCRIPTION", Buff)) { + Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_DESCRIPTION; + CopyUnicodeString(Calendar->Entries[Calendar->EntriesNum].Text,Buff); + Calendar->EntriesNum++; + } if (ReadVCALText(Line, "LOCATION", Buff)) { Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_LOCATION; CopyUnicodeString(Calendar->Entries[Calendar->EntriesNum].Text,Buff); Calendar->EntriesNum++; } if (ReadVCALText(Line, "DTSTART", Buff)) { Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_START_DATETIME; ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date); Calendar->EntriesNum++; } if (ReadVCALText(Line, "DTEND", Buff)) { Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_END_DATETIME; ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date); Calendar->EntriesNum++; } if (ReadVCALText(Line, "DALARM", Buff)) { 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 @@ -144,32 +144,33 @@ typedef enum { /** * Alarm date and time. */ CAL_ALARM_DATETIME, /** * Date and time of silent alarm. */ CAL_SILENT_ALARM_DATETIME, /** * Recurrance. */ CAL_RECURRANCE, /** * Text. */ CAL_TEXT, + CAL_DESCRIPTION, // LR added /** * Location. */ CAL_LOCATION, /** * Phone number. */ CAL_PHONE, /** * Whether this entry is private. */ CAL_PRIVATE, /** * Related contact id. */ CAL_CONTACTID, diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 47ed858..dae9cd2 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -800,51 +800,53 @@ void KABCore::beamVCard(const QStringList& uids) int sep; if ( semi < dopp && semi >= 0 ) sep = semi ; else sep = dopp; datastream +=vcard.mid( start, next - start); datastream +=vcard.mid( next+5,sep -next -5 ).upper(); start = sep; } datastream += vcard.mid( start,vcard.length() ); } #ifndef DESKTOP_VERSION QFile outFile(fileName); if ( outFile.open(IO_WriteOnly) ) { datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); QTextStream t( &outFile ); // use a text stream - t.setEncoding( QTextStream::UnicodeUTF8 ); - t <<datastream; + //t.setEncoding( QTextStream::UnicodeUTF8 ); + t.setEncoding( QTextStream::Latin1 ); + t <<datastream.latin1(); outFile.close(); Ir *ir = new Ir( this ); connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); ir->send( fileName, description, "text/x-vCard" ); } else { qDebug("Error open temp beam file "); return; } #endif } void KABCore::beamDone( Ir *ir ) { #ifndef DESKTOP_VERSION delete ir; #endif + topLevelWidget()->raise(); } void KABCore::browse( const QString& url ) { #ifndef KAB_EMBEDDED kapp->invokeBrowser( url ); #else //KAB_EMBEDDED qDebug("KABCore::browse must be fixed"); #endif //KAB_EMBEDDED } void KABCore::selectAllContacts() { mViewManager->setSelected( QString::null, true ); } diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 1f2c6da..3e0a27d 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -2310,62 +2310,70 @@ void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) if ( createbup ) { QString description = "\n"; CalendarLocal* cal = new CalendarLocal(); if ( beamDialog->beamLocal() ) cal->setLocalTime(); else cal->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); Incidence *incidence = delSel.first(); bool addText = false; if ( delSel.count() < 10 ) addText = true; else { description.sprintf(i18n(" %d items?"),delSel.count() ); } while ( incidence ) { Incidence *in = incidence->clone(); + if ( ! in->summary().isEmpty() ) { + in->setDescription(""); + } else { + in->setSummary( in->description().left(20)); + in->setDescription(""); + } if ( addText ) description += in->summary() + "\n"; cal->addIncidence( in ); incidence = delSel.next(); } if ( beamDialog->beamVcal() ) { fn += ".vcs"; FileStorage storage( cal, fn, new VCalFormat ); storage.save(); } else { fn += ".ics"; FileStorage storage( cal, fn, new ICalFormat( ) ); storage.save(); } delete cal; mes = i18n("KO/Pi: Ready for beaming"); - setCaption(mes); - + topLevelWidget()->setCaption(mes); + KApplication::convert2latin1( fn ); #ifndef DESKTOP_VERSION Ir *ir = new Ir( this ); connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); ir->send( fn, description, "text/x-vCalendar" ); #endif } } void CalendarView::beamDone( Ir *ir ) { #ifndef DESKTOP_VERSION delete ir; #endif + topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); + topLevelWidget()->raise(); } void CalendarView::moveIncidence(Incidence * inc ) { if ( !inc ) return; // qDebug("showDatePickerForIncidence( ) "); if ( mDateFrame->isVisible() ) mDateFrame->hide(); else { int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; int dw = QApplication::desktop()->width(); int dh = QApplication::desktop()->height(); mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); mDateFrame->show(); } diff --git a/microkde/kapplication.cpp b/microkde/kapplication.cpp index 98ef2f2..56c01af 100644 --- a/microkde/kapplication.cpp +++ b/microkde/kapplication.cpp @@ -51,32 +51,54 @@ void KApplication::showFile(QString caption, QString fn) fileName = getenv("QPEDIR"); fileName += "/pics/" + fn ; #else fileName = qApp->applicationDirPath () + "/" + fn; #endif QFile file( fileName ); if (!file.open( IO_ReadOnly ) ) { return ; } QTextStream ts( &file ); text = ts.read(); file.close(); KApplication::showText( caption, text ); } +bool KApplication::convert2latin1(QString fileName) +{ + QString text; + QFile file( fileName ); + if (!file.open( IO_ReadOnly ) ) { + return false; + + } + QTextStream ts( &file ); + ts.setEncoding( QTextStream::UnicodeUTF8 ); + text = ts.read(); + file.close(); + if (!file.open( IO_WriteOnly ) ) { + return false; + } + QTextStream tsIn( &file ); + tsIn.setEncoding( QTextStream::Latin1 ); + tsIn << text.latin1(); + file.close(); + + +} void KApplication::showText(QString caption, QString text) { QDialog dia( 0, "name", true ); ; dia.setCaption( caption ); QVBoxLayout* lay = new QVBoxLayout( &dia ); lay->setSpacing( 3 ); lay->setMargin( 3 ); QTextBrowser tb ( &dia ); lay->addWidget( &tb ); tb.setText( text ); #ifdef DESKTOP_VERSION dia.resize( 640, 480); #else dia.showMaximized(); #endif dia.exec(); diff --git a/microkde/kapplication.h b/microkde/kapplication.h index 79cdb33..41546a0 100644 --- a/microkde/kapplication.h +++ b/microkde/kapplication.h @@ -7,20 +7,21 @@ class KApplication { public: static int random(); //US /** * Generates a random string. It operates in the range [A-Za-z0-9] * @param length Generate a string of this length. * @return the random string */ static QString randomString(int length); static int execDialog( QDialog* ); static void showLicence(); static void showFile(QString caption, QString file); static void showText(QString caption, QString text); + static bool convert2latin1(QString file); }; #endif |