/****************************************************************************** * Return the alarm time text in the form "date time". */ QString AlarmListViewItem::alarmTimeText(const DateTime &dateTime) const { KLocale *locale = KGlobal::locale(); QString dateTimeText = locale->formatDate(dateTime.date(), true); if(!dateTime.isDateOnly()) { dateTimeText += ' '; QString time = locale->formatTime(dateTime.time()); if(mTimeHourPos == -2) { // Initialise the position of the hour within the time string, if leading // zeroes are omitted, so that displayed times can be aligned with each other. mTimeHourPos = -1; // default = alignment isn't possible/sensible if(!QApplication::reverseLayout()) // don't try to align right-to-left languages { QString fmt = locale->timeFormat(); int i = fmt.find(QRegExp("%[kl]")); // check if leading zeroes are omitted if(i >= 0 && i == fmt.find('%')) // and whether the hour is first mTimeHourPos = i; // yes, so need to align } } if(mTimeHourPos >= 0 && (int)time.length() > mTimeHourPos + 1 && time[mTimeHourPos].isDigit() && !time[mTimeHourPos + 1].isDigit()) dateTimeText += '~'; // improve alignment of times with no leading zeroes dateTimeText += time; } return dateTimeText + ' '; }
//------------------------------------ Part::Part( QWidget *parentWidget, QObject *parent, const QVariantList & /*args*/ ) : KParts::ReadWritePart( parent ), m_xmlLoader(), m_modified( false ), m_loadingFromProjectStore( false ), m_undostack( new QUndoStack( this ) ) { setComponentData( Factory::global() ); // Add library translation files KLocale *locale = KGlobal::locale(); if ( locale ) { locale->insertCatalog( "kplatolibs" ); locale->insertCatalog( "kabc" ); } if ( isReadWrite() ) { setXMLFile( "kplatowork.rc" ); } else { setXMLFile( "kplatowork_readonly.rc" ); } View *v = new View( this, parentWidget, actionCollection() ); setWidget( v ); connect( v, SIGNAL( viewDocument( Document* ) ), SLOT( viewWorkpackageDocument( Document* ) ) ); loadWorkPackages(); connect( m_undostack, SIGNAL( cleanChanged( bool ) ), SLOT( setDocumentClean( bool ) ) ); }
void KraftView::slotLanguageSettings() { kDebug() << "Language Settings" << endl; DocLocaleDialog dia( this ); KLocale *l = m_doc->locale(); if ( m_doc ) { dia.setLocale( l->country(), l->language() ); if ( dia.exec() == QDialog::Accepted ) { QString c = dia.locale().country(); if ( c != m_doc->locale()->country() ) { KConfig *cfg = KGlobal::config().data(); m_doc->locale()->setCountry( c, cfg ); m_doc->locale()->setLanguage( dia.locale().language(), cfg ); PositionViewWidgetListIterator it( mPositionWidgetList ); while( it.hasNext() ) { PositionViewWidget *w = it.next(); // = 0; w->setLocale( m_doc->locale() ); w->repaint(); } refreshPostCard(); } } } }
void KMoneyThingHomeView::doHTML() { KLocale *locale = new KLocale("KMoneyThing"); khtmlPart->begin(); khtmlPart->write("<html>"); khtmlPart->write("<head><style type='text/css'>th, tr { text-align: left; padding-right: 1em }</style></head>"); khtmlPart->write("<body><h1>"); khtmlPart->write(i18n("Welcome to KMoneyThing") + " pre0.1"); khtmlPart->write("</h1><hr><p>"); khtmlPart->write(i18n("This application is still under development, and is not yet suitable for general use.")); khtmlPart->write("</p>"); khtmlPart->write("<h2>" + i18n("Summary") + "</h2>"); khtmlPart->write("<table>"); khtmlPart->write("<tr><th>" + i18n("Account") + "</th><th>" + i18n("Balance") + "</th></tr>"); // TODO: International accounts // TODO: Adding up balances with suport for internationalisation for (Q_UINT32 i = 0; i < mCurrentFile->accounts(); i++) { locale->setCountry(mCurrentFile->getAccount(i)->locale()); QString accountName = mCurrentFile->getAccount(i)->name(); QString accountBalance = locale->formatMoney(mCurrentFile->getAccount(i)->balance()); khtmlPart->write(QString("<tr><td>%1</td><td>%2</td></tr>").arg(accountName).arg(accountBalance)); } locale->setCountry(mCurrentFile->locale()); QString totalBalance = locale->formatMoney(0.0); khtmlPart->write("<tr><th>" + i18n("Total:") + "</th><th>" + totalBalance + "</th></tr>"); khtmlPart->write("</table>"); khtmlPart->write("</body></html>"); khtmlPart->end(); delete locale; }
void KdeObservatory::engineError(const QString &source, const QString &error) { kDebug() << "Source:" << source << "Error:" << error; if (source == "fatal" && m_sourceCounter > 0) { m_viewTransitionTimer->stop(); foreach(QGraphicsWidget *widget, m_views) widget->hide(); m_views.clear(); graphicsWidget(); m_updateLabel->setStyleSheet(QString("QLabel{color:rgb(255, 0, 0);}")); m_updateLabel->setText(error); setBusy(false); return; } --m_sourceCounter; if (m_sourceCounter == 0) { KDateTime currentTime = KDateTime::currentLocalDateTime(); KLocale *locale = KGlobal::locale(); m_updateLabel->setStyleSheet(QString("QLabel{color:rgb(0, 0, 0);}")); m_updateLabel->setText(i18n("Last update: %1 %2", currentTime.toString(locale->dateFormatShort()), currentTime.toString(locale->timeFormat()))); setBusy(false); updateViews(); } }
void KdeObservatory::dataUpdated(const QString &sourceName, const Plasma::DataEngine::Data &data) { // Prevent for being updated from another instance update request if (data["appletId"].toUInt() != id()) return; QString project = data["project"].toString(); if (sourceName != "topActiveProjects" && !data.contains(project) && !data.contains("error")) return; if (sourceName == "topActiveProjects") m_viewProviders[i18n("Top Active Projects")]->updateViews(data); else if (sourceName == "topProjectDevelopers" && !project.isEmpty()) m_viewProviders[i18n("Top Developers")]->updateViews(data); else if (sourceName == "commitHistory" && !project.isEmpty()) m_viewProviders[i18n("Commit History")]->updateViews(data); else if (sourceName == "krazyReport" && !project.isEmpty()) m_viewProviders[i18n("Krazy Report")]->updateViews(data); --m_sourceCounter; m_collectorProgress->setValue(m_collectorProgress->maximum() - m_sourceCounter); if (m_sourceCounter == 0) { KDateTime currentTime = KDateTime::currentLocalDateTime(); KLocale *locale = KGlobal::locale(); m_updateLabel->setStyleSheet(QString("QLabel{color:rgb(0, 0, 0);}")); m_updateLabel->setText(i18n("Last update: %1 %2", currentTime.toString(locale->dateFormatShort()), currentTime.toString(locale->timeFormat()))); setBusy(false); updateViews(); } }
QString DoubleSpinBox::textFromValue(double value) const { DoubleSpinbox_qDebug() << Q_FUNC_INFO << " value = " << value; // int leftDigits = (int)floor( log10( abs( value ) ) ) + 1; // if ( leftDigits < 0 ) { // leftDigits = 0; // } else if ( leftDigits > 3 ) { // leftDigits = 3; // } double multiplier = Item::getMultiplier( value ); double toDisplayNr = value / multiplier; DoubleSpinbox_qDebug() << Q_FUNC_INFO << "toDisplayNr = " << toDisplayNr; KLocale * locale = KGlobal::locale(); QString numberStr = locale->formatNumber( toDisplayNr, 0 /* 3-leftDigits */ ); QString magStr = Item::getNumberMag( value ); QString toRet = numberStr + " " + magStr + m_unit; DoubleSpinbox_qDebug() << Q_FUNC_INFO << " text = " << toRet; return toRet; }
void KOEditorGeneralTodo::dateChanged() { KLocale *l = KGlobal::locale(); QString dateTimeStr = ""; if(mStartCheck->isChecked()) { dateTimeStr += i18n("Start: %1").arg( l->formatDate(mStartDateEdit->date())); if(mTimeButton->isChecked()) dateTimeStr += QString(" %1").arg( l->formatTime(mStartTimeEdit->getTime())); } if(mDueCheck->isChecked()) { dateTimeStr += i18n(" Due: %1").arg( l->formatDate(mDueDateEdit->date())); if(mTimeButton->isChecked()) dateTimeStr += QString(" %1").arg( l->formatTime(mDueTimeEdit->getTime())); } emit dateTimeStrChanged(dateTimeStr); QDateTime endDt(mDueDateEdit->date(), mDueTimeEdit->getTime()); emit signalDateTimeChanged(endDt, endDt); }
QStringList KSwitchLanguageDialogPrivate::applicationLanguageList() { KSharedConfigPtr config = KGlobal::config(); QStringList languagesList; if (config->hasGroup("Locale")) { KConfigGroup group(config, "Locale"); if (group.hasKey("Language")) { languagesList = group.readEntry("Language", QString()).split(':'); } } if (languagesList.isEmpty()) { languagesList = KGlobal::locale()->languageList(); } KLocale *locale = KGlobal::locale(); for (int i = 0; i < languagesList.count();) { if (!locale->isApplicationTranslatedInto(languagesList[i])) languagesList.removeAt(i); else ++i; } return languagesList; }
QString formatTime(time_t t) { KLocale *l = KGlobal::locale(); if ( l ) { return l->formatDateTime( QDateTime::fromTime_t(t) ); } return QDateTime::fromTime_t(t).toString(); }
QString BytesToString(Uint64 bytes,int precision) { KLocale* loc = KGlobal::locale(); if (bytes >= 1024 * 1024 * 1024) return i18n("%1 GB").arg(loc->formatNumber(bytes / TO_GIG,precision < 0 ? 2 : precision)); else if (bytes >= 1024*1024) return i18n("%1 MB").arg(loc->formatNumber(bytes / TO_MEG,precision < 0 ? 1 : precision)); else if (bytes >= 1024) return i18n("%1 KB").arg(loc->formatNumber(bytes / TO_KB,precision < 0 ? 1 : precision)); else return i18n("%1 B").arg(bytes); }
QString DurationToString(Uint32 nsecs) { KLocale* loc = KGlobal::locale(); QTime t; int ndays = nsecs / 86400; t = t.addSecs(nsecs % 86400); QString s = loc->formatTime(t,true,true); if (ndays > 0) s = i18n("1 day ","%n days ",ndays) + s; return s; }
PlanTJPlugin::PlanTJPlugin( QObject * parent, const QVariantList & ) : KPlato::SchedulerPlugin(parent) { KLocale *locale = KGlobal::locale(); if ( locale ) { locale->insertCatalog( "plantjplugin" ); } m_granularities << (long unsigned int) 5 * 60 * 1000 << (long unsigned int) 15 * 60 * 1000 << (long unsigned int) 30 * 60 * 1000 << (long unsigned int) 60 * 60 * 1000; }
void KSwitchLanguageDialogPrivate::fillApplicationLanguages(KLanguageButton *button) { KLocale *locale = KGlobal::locale(); const QStringList allLanguages = locale->allLanguagesList(); for ( int i = 0, count = allLanguages.count(); i < count; ++i ) { QString languageCode = allLanguages[i]; if (locale->isApplicationTranslatedInto(languageCode)) { button->insertLanguage(languageCode); } } }
KPlatoRCPSPlugin::KPlatoRCPSPlugin( QObject * parent, const QVariantList & ) : KPlato::SchedulerPlugin(parent) { kDebug(planDbg())<<rcps_version(); KLocale *locale = KGlobal::locale(); if ( locale ) { locale->insertCatalog( "planrcpsplugin" ); } m_granularities << (long unsigned int) 1 * 60 * 1000 << (long unsigned int) 15 * 60 * 1000 << (long unsigned int) 30 * 60 * 1000 << (long unsigned int) 60 * 60 * 1000; }
QVariant DocumentModel::data(const QModelIndex &idx, int role) const { if(role == Qt::DisplayRole) { if(idx.column() == Document_LastModified ) { KLocale *locale = KGlobal::locale(); QDateTime date = QSqlQueryModel::data(idx, role).toDateTime(); return locale->formatDateTime( date, KLocale::ShortDate ); } else if( idx.column() == Document_CreationDate ) { KLocale *locale = KGlobal::locale(); QDate date = QSqlQueryModel::data( idx, role ).toDate(); return locale->formatDate( date, KLocale::ShortDate ); } else if(idx.column() == Document_ClientId ) { const QString uid = QSqlQueryModel::data( idx, role ).toString(); return uid; } else if( idx.column() == Document_ClientName ) { QModelIndex uidIdx = idx.sibling( idx.row(), Document_ClientId ); const QString uid = QSqlQueryModel::data( uidIdx, role ).toString(); // kDebug() << "Checking for UID " << uid; if( uid.isEmpty() ) return ""; if( mAddresses.contains( uid ) ) { if( mAddresses.value(uid).isEmpty() ) { // empty address means that there is no valid entry in this addressbook return i18n("not found"); } const QString realName = mAddresses.value(uid).realName(); // kDebug() << "returning " << realName; return realName; } else { mAddressProvider->getAddressee( uid ); } return i18n("retrieving..."); } } else if( role == RawTypes ) { if(idx.column() == Document_LastModified ) { return QSqlQueryModel::data( idx, Qt::DisplayRole ).toDateTime(); } else if( idx.column() == Document_CreationDate ) { return QSqlQueryModel::data( idx, Qt::DisplayRole ).toDate(); } } else if( role == Qt::SizeHintRole ) { QFont f = QSqlQueryModel::data(idx, Qt::FontRole ).value<QFont>(); QFontMetrics fm(f); int h = fm.height(); return QSize( 0, h + 4 ); } return QSqlQueryModel::data(idx, role); }
KdePlatformDependent::KdePlatformDependent() : m_config(KSharedConfig::openConfig("atticarc")), m_accessManager(0), m_wallet(0) { // when a plain Qt application loads this plugin, it needs a valid KGlobal object if (!KGlobal::hasMainComponent()) { KComponentData componentData("attica_kde"); } KLocale* locale = KGlobal::locale(); if (locale) { locale->insertCatalog("attica_kde"); } m_accessManager = new KIO::Integration::AccessManager(this); }
void insertLibraryCatalogues() { static const char * const catalogs[] = { "libkdepim", "kabc", "libakonadi", "kabcakonadi", "akonadicontact", "libpimcommon" }; KLocale * l = KGlobal::locale(); for ( unsigned int i = 0 ; i < sizeof catalogs / sizeof *catalogs ; ++i ) { l->insertCatalog( catalogs[i] ); } }
void KWStatisticsDialog::calcGeneral( QLabel **resultLabel ) { KLocale *locale = KGlobal::locale(); resultLabel[0]->setText( locale->formatNumber( m_doc->pageCount(), 0) ); int table =0; int picture = 0; int part = 0; int nbFrameset = 0; int nbFormula = 0; QPtrListIterator<KWFrameSet> framesetIt( m_doc->framesetsIterator() ); for ( framesetIt.toFirst(); framesetIt.current(); ++framesetIt ) { KWFrameSet *frameSet = framesetIt.current(); if ( frameSet && frameSet->isVisible()) { if ( frameSet->type() == FT_TABLE) table++; else if ( frameSet->type() == FT_PICTURE) picture++; else if ( frameSet->type() == FT_PART ) part++; else if ( frameSet->type() == FT_FORMULA ) nbFormula++; nbFrameset++; } } resultLabel[1]->setText( locale->formatNumber( nbFrameset, 0 ) ); resultLabel[2]->setText( locale->formatNumber( picture, 0 ) ); resultLabel[3]->setText( locale->formatNumber( table, 0 ) ); resultLabel[4]->setText( locale->formatNumber( part, 0 ) ); resultLabel[5]->setText( locale->formatNumber( nbFormula, 0 ) ); }
void TrayIcon::maxSeedTimeReached(bt::TorrentInterface* tc) { if (!Settings::showPopups()) return; const TorrentStats & s = tc->getStats(); KLocale* loc = KGlobal::locale(); double speed_up = (double)s.bytes_uploaded; QString msg = i18n("<b>%1</b> has reached its maximum seed time of %2 hours and has been stopped." "<br>Uploaded %3 at an average speed of %4.", tc->getDisplayName(), loc->formatNumber(s.max_seed_time,2), BytesToString(s.bytes_uploaded), BytesPerSecToString(speed_up / tc->getRunningTimeUL())); KNotification::event("MaxSeedTimeReached",msg,QPixmap(),mwnd); }
void TrayIcon::maxSeedTimeReached(kt::TorrentInterface* tc) { if (!Settings::showPopups()) return; const TorrentStats & s = tc->getStats(); KLocale* loc = KGlobal::locale(); double speed_up = (double)s.bytes_uploaded / 1024.0; QString msg = i18n("<b>%1</b> has reached its maximum seed time of %2 hours and has been stopped." "<br>Uploaded %3 at an average speed of %4.") .arg(s.torrent_name) .arg(loc->formatNumber(s.max_seed_time,2)) .arg(BytesToString(s.bytes_uploaded)) .arg(KBytesPerSecToString(speed_up / tc->getRunningTimeUL())); showPassivePopup(msg,i18n("Seeding completed")); }
void insertLibraryCataloguesAndIcons() { static const char * const catalogs[] = { "libkdepim", "libksieve", "libkleopatra", "libkpgp", "libkmime", "libmessagelist", "libmessagecore" }; KLocale * l = KGlobal::locale(); KIconLoader * il = KIconLoader::global(); for ( unsigned int i = 0 ; i < sizeof catalogs / sizeof *catalogs ; ++i ) { l->insertCatalog( catalogs[i] ); il->addAppDir( catalogs[i] ); } }
void TrayIcon::queuingNotPossible(kt::TorrentInterface* tc) { if (!Settings::showPopups()) return; const TorrentStats & s = tc->getStats(); QString msg; KLocale* loc = KGlobal::locale(); if (tc->overMaxRatio()) msg = i18n("<b>%1</b> has reached its maximum share ratio of %2 and cannot be enqueued. Remove the limit manually if you want to continue seeding.") .arg(s.torrent_name).arg(loc->formatNumber(s.max_share_ratio,2)); else msg = i18n("<b>%1</b> has reached its maximum seed time of %2 hours and cannot be enqueued. Remove the limit manually if you want to continue seeding.") .arg(s.torrent_name).arg(loc->formatNumber(s.max_seed_time,2)); showPassivePopup(msg,i18n("Torrent cannot be enqueued.")); }
QString DateFormatter::localized( time_t t, bool shortFormat, bool includeSecs, const QString &lang ) const { QDateTime tmp; QString ret; KLocale *locale = KGlobal::locale(); tmp.setTime_t( t ); if ( !lang.isEmpty() ) { locale = new KLocale( lang, lang, lang ); ret = locale->formatDateTime( tmp, ( shortFormat ? KLocale::ShortDate : KLocale::LongDate ), includeSecs ); delete locale; } else { ret = locale->formatDateTime( tmp, ( shortFormat ? KLocale::ShortDate : KLocale::LongDate ), includeSecs ); } return ret; }
Autocorrect::Autocorrect() { /* setup actions for this plugin */ KAction *configureAction = new KAction(i18n("Configure &Autocorrection..."), this); connect(configureAction, SIGNAL(triggered(bool)), this, SLOT(configureAutocorrect())); addAction("configure_autocorrection", configureAction); m_enabled = new KAction(i18n("Autocorrection"), this); m_enabled->setCheckable(true); m_enabled->setChecked(true); addAction("enable_autocorrection", m_enabled); m_singleSpaces = true; m_uppercaseFirstCharOfSentence = false; m_fixTwoUppercaseChars = false; m_autoFormatURLs = false; m_trimParagraphs = true; m_autoBoldUnderline = false; m_autoFractions = true; m_autoNumbering = false; m_capitalizeWeekDays = false; m_autoFormatBulletList = false; m_replaceDoubleQuotes = false; m_replaceSingleQuotes = false; // TODO put this into configuration dialog // default double quote open 0x201c // default double quote close 0x201d // default single quote open 0x2018 // default single quote close 0x2019 m_typographicSingleQuotes.begin = QChar(0x2018); m_typographicSingleQuotes.end = QChar(0x2019); m_typographicDoubleQuotes.begin = QChar(0x201c); m_typographicDoubleQuotes.end = QChar(0x201d); readConfig(); KLocale *locale = KGlobal::locale(); for (int i = 1; i <=7; i++) m_cacheNameOfDays.append(locale->calendar()->weekDayName(i).toLower()); }
void WeekScene::updateStatusText(int up, int down, bool suspended, bool enabled) { KLocale* loc = KGlobal::locale(); QString msg; if (suspended) msg = i18n("Current schedule: suspended"); else if (up > 0 && down > 0) msg = i18n("Current schedule: %1/s download, %2/s upload", loc->formatByteSize(down * 1024), loc->formatByteSize(up * 1024)); else if (up > 0) msg = i18n("Current schedule: unlimited download, %1/s upload", loc->formatByteSize(up * 1024)); else if (down > 0) msg = i18n("Current schedule: %1/s download, unlimited upload", loc->formatByteSize(down * 1024)); else msg = i18n("Current schedule: unlimited upload and download"); if (!enabled) msg += i18n(" (scheduler disabled)"); status->setPlainText(msg); }
void TrayIcon::queuingNotPossible(bt::TorrentInterface* tc) { if (!Settings::showPopups()) return; const TorrentStats & s = tc->getStats(); QString msg; KLocale* loc = KGlobal::locale(); if (tc->overMaxRatio()) msg = i18n("<b>%1</b> has reached its maximum share ratio of %2 and cannot be enqueued. " "<br>Remove the limit manually if you want to continue seeding.", tc->getDisplayName(),loc->formatNumber(s.max_share_ratio,2)); else msg = i18n("<b>%1</b> has reached its maximum seed time of %2 hours and cannot be enqueued. " "<br>Remove the limit manually if you want to continue seeding.", tc->getDisplayName(),loc->formatNumber(s.max_seed_time,2)); KNotification::event("QueueNotPossible",msg,QPixmap(),mwnd); }
void SegmentTip::updateTip(const File* const file, const Directory* const root) { const QString s1 = file->fullPath(root); QString s2 = file->humanReadableSize(); KLocale *loc = KGlobal::locale(); const uint MARGIN = 3; const uint pc = 100 * file->size() / root->size(); uint maxw = 0; uint h = fontMetrics().height()*2 + 2*MARGIN; if (pc > 0) s2 += QString(" (%1%)").arg(loc->formatNumber(pc, 0)); m_text = s1; m_text += '\n'; m_text += s2; if (file->isDirectory()) { double files = static_cast<const Directory*>(file)->children(); const uint pc = uint((100 * files) / (double)root->children()); QString s3 = i18n("Files: %1", loc->formatNumber(files, 0)); if (pc > 0) s3 += QString(" (%1%)").arg(loc->formatNumber(pc, 0)); maxw = fontMetrics().width(s3); h += fontMetrics().height(); m_text += '\n'; m_text += s3; } uint w = fontMetrics().width(s1); if (w > maxw) maxw = w; w = fontMetrics().width(s2); if (w > maxw) maxw = w; resize(maxw + 2 * MARGIN, h); }
void kMyMoneyEdit::theTextChanged(const QString & theText) { QString d = QLocale().decimalPoint(); QString l_text = theText; QString nsign, psign; #if 0 KLocale * l = KLocale::global(); if (l->negativeMonetarySignPosition() == KLocale::ParensAround || l->positiveMonetarySignPosition() == KLocale::ParensAround) { nsign = psign = '('; } else { nsign = l->negativeSign(); psign = l->positiveSign(); } #else nsign = "-"; psign = ""; #endif int i = 0; if (isEnabled()) { QValidator::State state = m_edit->validator()->validate(l_text, i); if (state == QValidator::Intermediate) { if (l_text.length() == 1) { if (l_text != d && l_text != nsign && l_text != psign) state = QValidator::Invalid; } } if (state == QValidator::Invalid) m_edit->setText(previousText); else { previousText = l_text; emit textChanged(m_edit->text()); m_resetButton->setEnabled(true); } } }
QString DateFormatter::fancy( time_t t ) const { KLocale *locale = KGlobal::locale(); if ( t <= 0 ) { return i18nc( "invalid time specified", "unknown" ); } if ( mTodayOneSecondBeforeMidnight < time( 0 ) ) { // determine time_t value of today 23:59:59 const QDateTime today( QDate::currentDate(), QTime( 23, 59, 59 ) ); mTodayOneSecondBeforeMidnight = today.toTime_t(); } QDateTime old; old.setTime_t( t ); if ( mTodayOneSecondBeforeMidnight >= t ) { const time_t diff = mTodayOneSecondBeforeMidnight - t; if ( diff < 7 * 24 * 60 * 60 ) { if ( diff < 24 * 60 * 60 ) { return i18n( "Today %1", locale->formatTime( old.time(), true ) ); } if ( diff < 2 * 24 * 60 * 60 ) { return i18n( "Yesterday %1", locale->formatTime( old.time(), true ) ); } for ( int i = 3; i < 8; i++ ) { if ( diff < i * 24 * 60 * 60 ) { return i18nc( "1. weekday, 2. time", "%1 %2" , locale->calendar()->weekDayName( old.date() ) , locale->formatTime( old.time(), true ) ); } } } } return locale->formatDateTime( old ); }