summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-14 06:42:01 (UTC)
committer zautrix <zautrix>2004-10-14 06:42:01 (UTC)
commita6dff815a9c6d3a91094573d23c28a8553fc7cc2 (patch) (unidiff)
treea8830e9adcd72faa8178d4ee2517bfc31cda8653
parent909d25797c50fc38c435834a68aaf60bf87e32f9 (diff)
downloadkdepimpi-a6dff815a9c6d3a91094573d23c28a8553fc7cc2.zip
kdepimpi-a6dff815a9c6d3a91094573d23c28a8553fc7cc2.tar.gz
kdepimpi-a6dff815a9c6d3a91094573d23c28a8553fc7cc2.tar.bz2
fixes umlaute in beaming
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
@@ -55,32 +55,35 @@ void GSM_CalendarFindDefaultTextTimeAlarmPhoneRecurrance(GSM_CalendarEntry *entr
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{
@@ -184,35 +187,35 @@ GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note
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;
@@ -403,37 +406,43 @@ GSM_Error GSM_DecodeVCALENDAR_VTODO(unsigned char *Buffer, int *Pos, GSM_Calenda
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)) {
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 {
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,
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)
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}
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 )
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 }
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)
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();
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 @@
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