author | zautrix <zautrix> | 2004-10-20 11:04:17 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-20 11:04:17 (UTC) |
commit | c45d38a1574bcb53e1b0fd0dc4987cb725d430c0 (patch) (side-by-side diff) | |
tree | 22f1ee07fc4002c49867d5dd36690e54cfe21276 | |
parent | f6f5f5cfcaa38f3e2bf36d8466b2b44ba7b3fb28 (diff) | |
download | kdepimpi-c45d38a1574bcb53e1b0fd0dc4987cb725d430c0.zip kdepimpi-c45d38a1574bcb53e1b0fd0dc4987cb725d430c0.tar.gz kdepimpi-c45d38a1574bcb53e1b0fd0dc4987cb725d430c0.tar.bz2 |
fixed umlaute sort order
-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 @@ -107,129 +107,155 @@ void DynamicTip::maybeTip( const QPoint &pos ) int lastSpace = -1; int a = 0; int lastw = 0; while ( i < int(notes.length()) ) { doBreak = FALSE; if ( notes[i] != '\n' ) linew += fm.width( notes[i] ); if ( lastSpace >= a && notes[i] != '\n' ) if (linew >= parentWidget()->width()) { doBreak = TRUE; if ( lastSpace > a ) { i = lastSpace; linew = lastw; } 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 ), pabWidget( view ), oldColumn( 0 ) { mABackground = true; mSingleLine = false; mToolTips = true; #ifndef KAB_EMBEDDED mAlternateColor = KGlobalSettings::alternateBackgroundColor(); #else //KAB_EMBEDDED mAlternateColor = QColor(240, 240, 240); #endif //KAB_EMBEDDED setAlternateBackgroundEnabled(mABackground); setAcceptDrops( true ); viewport()->setAcceptDrops( true ); setAllColumnsShowFocus( true ); 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 @@ -103,128 +103,132 @@ KLocale::KLocale() : mCalendarSystem( 0 ) << i18n ("-02:00 Brazil/DeNoronha") << i18n ("-01:00 Atlantic/Azores") << i18n (" 00:00 Europe/London(UTC)") << i18n ("+01:00 Europe/Oslo(CET)") << i18n ("+02:00 Europe/Helsinki") << i18n ("+03:00 Europe/Moscow") << i18n ("+04:00 Indian/Mauritius") << i18n ("+05:00 Indian/Maldives") << i18n ("+06:00 Indian/Chagos") << i18n ("+07:00 Asia/Bangkok") << i18n ("+08:00 Asia/Hongkong") << i18n ("+09:00 Asia/Tokyo") << i18n ("+10:00 Asia/Vladivostok") << i18n ("+11:00 Asia/Magadan") << i18n ("+12:00 Asia/Kamchatka") // << i18n (" xx:xx User defined offset") << 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': if (includeSecs) put_it_in( buffer, index, pTime.second() ); else { // we remove the seperator sign before the seconds and // assume that works everywhere --index; break; } break; case 'k': number = pTime.hour(); case 'l': // to share the code if ( rst.at( format_index ).unicode() == 'l' ) number = (pTime.hour() + 11) % 12 + 1; 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 @@ -19,100 +19,101 @@ QString i18n(const char *text1, const char *textn, int num); // Qt3's uic generates i18n( "msg", "comment" ) calls which conflict // with our i18n method. we use uic -tr tr2i18n to redirect // to the right i18n() function inline QString tr2i18n(const char* message, const char* =0) { return i18n( message); } class KLocale { public: KLocale(); QString formatNumber(double num, int precision = -1) const; QString formatNumber(const QString &numStr) const; double readNumber(const QString &numStr, bool * ok = 0) const; 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 |