-rw-r--r-- | kaddressbook/views/contactlistview.cpp | 28 | ||||
-rw-r--r-- | microkde/kdecore/klocale.cpp | 4 | ||||
-rw-r--r-- | microkde/kdecore/klocale.h | 1 |
3 files changed, 32 insertions, 1 deletions
diff --git a/kaddressbook/views/contactlistview.cpp b/kaddressbook/views/contactlistview.cpp index 4cc22ea..c74f8cf 100644 --- a/kaddressbook/views/contactlistview.cpp +++ b/kaddressbook/views/contactlistview.cpp @@ -123,97 +123,123 @@ void DynamicTip::maybeTip( const QPoint &pos ) else i = QMAX( a, i-1 ); } if ( notes[i] == '\n' || doBreak ) { s += notes.mid( a, i - a + (doBreak?1:0) ) +"\n"; a = i + 1; lastSpace = a; linew = 0; } if ( notes[i].isSpace() ) { lastSpace = i; lastw = linew; } if ( lastSpace <= a ) { lastw = linew; } ++i; } } tip( r, s ); } else hide(); ishidden = !ishidden; } /////////////////////////// // ContactListViewItem Methods ContactListViewItem::ContactListViewItem(const KABC::Addressee &a, ContactListView *parent, KABC::AddressBook *doc, const KABC::Field::List &fields ) : KListViewItem(parent), mAddressee(a), mFields( fields ), parentListView( parent ), mDocument(doc) { refresh(); } QString ContactListViewItem::key(int column, bool ascending) const { - return QListViewItem::key(column, ascending).lower(); + int lan = KGlobal::locale()->language(); + //qDebug("language %d ", lan); + if ( lan == 1 ) { //GERMAN + QString ret = QListViewItem::key(column, ascending).utf8(); + int start = -1; + while ( (start = ret.find( 'ä', start+1)) > 0 ) { + ret.at(start-1) = 'a'; + } + start = -1; + while ( (start = ret.find( 'ö', start+1)) > 0 ) { + ret.at(start-1) = 'o'; + } + start = -1; + while ( (start = ret.find( 'ü', start+1)) > 0 ) { + ret.at(start-1) = 'o'; + } + start = -1; + while ( (start = ret.find( 'ß', start+1)) > 0 ) { + ret.at(start-1) = 's'; + } + //qDebug("conv string %s ", ret.latin1()); + + return ret; + + } + else + return QListViewItem::key(column, ascending).lower(); } void ContactListViewItem::paintCell(QPainter * p, const QColorGroup & cg, int column, int width, int align) { KListViewItem::paintCell(p, cg, column, width, align); if ( !p ) return; if (parentListView->singleLine()) { p->setPen( parentListView->alternateColor() ); p->drawLine( 0, height() - 1, width, height() - 1 ); } } ContactListView *ContactListViewItem::parent() { return parentListView; } void ContactListViewItem::refresh() { // Update our addressee, since it may have changed else were mAddressee = mDocument->findByUid(mAddressee.uid()); if (mAddressee.isEmpty()) return; int i = 0; KABC::Field::List::ConstIterator it; for( it = mFields.begin(); it != mFields.end(); ++it ) { setText( i++, (*it)->value( mAddressee ) ); } } /////////////////////////////// // ContactListView ContactListView::ContactListView(KAddressBookTableView *view, KABC::AddressBook* /* doc */, QWidget *parent, const char *name ) : KListView( parent, name ), diff --git a/microkde/kdecore/klocale.cpp b/microkde/kdecore/klocale.cpp index 673d845..3674f28 100644 --- a/microkde/kdecore/klocale.cpp +++ b/microkde/kdecore/klocale.cpp @@ -119,96 +119,100 @@ KLocale::KLocale() : mCalendarSystem( 0 ) << i18n (" Local Time"); mSouthDaylight = false; mTimeZoneOffset = 0; daylightEnabled = false; } void KLocale::setDateFormat( QString s ) { mDateFormat = s; } void KLocale::setDateFormatShort( QString s ) { mDateFormatShort = s; } void KLocale::setHore24Format ( bool b ) { mHourF24Format = b; } void KLocale::setWeekStartMonday( bool b ) { mWeekStartsMonday = b; } KLocale::IntDateFormat KLocale::getIntDateFormat( ) { return mIntDateFormat; } void KLocale::setIntDateFormat( KLocale::IntDateFormat i ) { mIntDateFormat = i; } KLocale::IntDateFormat KLocale::getIntTimeFormat( ) { return mIntTimeFormat; } void KLocale::setIntTimeFormat( KLocale::IntDateFormat i ) { mIntTimeFormat = i; } void KLocale::setLanguage( int i ) { mLanguage = i; } +int KLocale::language( ) +{ + return mLanguage; +} QString KLocale::translate( const char *index ) const { return i18n( index ); } QString KLocale::translate( const char *, const char *fallback) const { return i18n( fallback ); } QString KLocale::formatTime(const QTime &pTime, bool includeSecs, IntDateFormat intIntDateFormat) const { const QString rst = timeFormat(intIntDateFormat); // only "pm/am" here can grow, the rest shrinks, but // I'm rather safe than sorry QChar *buffer = new QChar[rst.length() * 3 / 2 + 30]; uint index = 0; bool escape = false; int number = 0; for ( uint format_index = 0; format_index < rst.length(); format_index++ ) { if ( !escape ) { if ( rst.at( format_index ).unicode() == '%' ) escape = true; else buffer[index++] = rst.at( format_index ); } else { switch ( rst.at( format_index ).unicode() ) { case '%': buffer[index++] = '%'; break; case 'H': put_it_in( buffer, index, pTime.hour() ); break; case 'I': put_it_in( buffer, index, ( pTime.hour() + 11) % 12 + 1 ); break; case 'M': put_it_in( buffer, index, pTime.minute() ); break; case 'S': diff --git a/microkde/kdecore/klocale.h b/microkde/kdecore/klocale.h index be9442c..14660d6 100644 --- a/microkde/kdecore/klocale.h +++ b/microkde/kdecore/klocale.h @@ -35,84 +35,85 @@ class KLocale QString decimalSymbol() const; QString thousandsSeparator() const; QString positiveSign() const; QString negativeSign() const; QString translate( const char *index ) const; QString translate( const char *index, const char *fallback) const; enum IntDateFormat { Undefined=-1, Default=0, Format1=1, ISODate=2, Userdefined=3 }; QString formatDate(const QDate &pDate, bool shortFormat = false, IntDateFormat intIntDateFormat = Undefined) const; QString formatTime(const QTime &pTime, bool includeSecs = false, IntDateFormat intIntDateFormat = Undefined) const; QString formatDateTime(const QDateTime &pDateTime, IntDateFormat intIntDateFormat = Undefined) const; QString formatDateTime(const QDateTime &pDateTime, bool shortFormat, bool includeSecs = false, IntDateFormat intIntDateFormat = Undefined) const; QDate readDate(const QString &str, bool* ok = 0) const; QDate readDate( const QString &intstr, const QString &fmt, bool* ok = 0) const; QTime readTime(const QString &str, bool* ok = 0) const; QDate readDate(const QString &intstr, IntDateFormat intIntDateFormat, bool* ok) const; QDateTime readDateTime(const QString &intstr, IntDateFormat intIntDateFormat, bool* ok) const; bool use12Clock() const; bool weekStartsMonday() const; int weekStartDay() const; QString weekDayName(int,bool=false) const; QString monthName(int,bool=false) const; QString country() const; QString dateFormat(IntDateFormat intIntDateFormat = Undefined) const; QString dateFormatShort(IntDateFormat intIntDateFormat = Undefined) const; QString timeFormat(IntDateFormat intIntDateFormat = Undefined) const; void insertCatalogue ( const QString & ); KCalendarSystem *calendar(); void setHore24Format ( bool ); void setWeekStartMonday( bool ); void setIntDateFormat( IntDateFormat ); void setIntTimeFormat( IntDateFormat ); IntDateFormat getIntDateFormat( ); IntDateFormat getIntTimeFormat( ); void setLanguage( int ); + int language(); void setDateFormat( QString ); void setDateFormatShort( QString ); QString m_decimalSymbol; QString m_thousandsSeparator; QString m_currencySymbol; QString m_monetaryDecimalSymbol; QString m_monetaryThousandsSeparator; QString m_positiveSign; QString m_negativeSign; int timezoneOffset( QString ); QStringList timeZoneList() const; void setDaylightSaving( bool, int , int ); int localTimeOffset(const QDateTime &); void setTimezone( const QString &timeZone , bool oddTZ); private: QTime readTime(const QString &str, bool seconds, bool *ok) const; QDate readDate(const QString &str, bool shortFormat, bool *ok) const; KCalendarSystem *mCalendarSystem; bool mWeekStartsMonday; bool mHourF24Format; IntDateFormat mIntDateFormat; IntDateFormat mIntTimeFormat; int mLanguage; QString mDateFormat; QString mDateFormatShort; QStringList mTimeZoneList; bool daylightEnabled; int mDaylightTZoffset; int mNondaylightTZoffset; bool mSouthDaylight; int daylightStart, daylightEnd, mTimeZoneOffset; }; #endif |