Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:12.2:PowerPC
kdepim3
chakra-04_kmail-fancy-currenttime.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File chakra-04_kmail-fancy-currenttime.patch of Package kdepim3
diff -Naur kdepim-enterprise-20071116.orig/kmail/configuredialog.cpp kdepim-enterprise-20071116/kmail/configuredialog.cpp --- kdepim-enterprise-20071116.orig/kmail/configuredialog.cpp 2007-11-23 09:41:36.000000000 +0100 +++ kdepim-enterprise-20071116/kmail/configuredialog.cpp 2007-11-23 15:57:13.000000000 +0100 @@ -2228,6 +2228,9 @@ "Reader", "ShowExpandQuotesMark", I18N_NOOP("Show expand/collapse quote marks"), false }; +static const BoolConfigEntry showCurrentTime = { + "Reader", "ShowCurrentTime", I18N_NOOP("Show current sender time"), true +}; QString AppearancePage::ReaderTab::helpAnchor() const { return QString::fromLatin1("configure-appearance-reader"); @@ -2327,6 +2330,11 @@ hlay2->addWidget( label ); hlay2->addWidget( mOverrideCharsetCombo ); + populateCheckBox( mShowCurrentTimeCheck = new QCheckBox( this ), showCurrentTime ); + vlay->addWidget( mShowCurrentTimeCheck ); + connect( mShowCurrentTimeCheck, SIGNAL ( stateChanged( int ) ), + this, SLOT( slotEmitChanged() ) ); + vlay->addStretch( 100 ); // spacer } @@ -2397,6 +2405,7 @@ mCollapseQuoteLevelSpin->setValue( GlobalSettings::self()->collapseQuoteLevelSpin() ); readCurrentFallbackCodec(); readCurrentOverrideCodec(); + mShowCurrentTimeCheck->setChecked( GlobalSettings::self()->showCurrentTime() ); } void AppearancePage::ReaderTab::doLoadOther() @@ -2422,6 +2431,7 @@ mOverrideCharsetCombo->currentItem() == 0 ? QString() : KGlobal::charsets()->encodingForName( mOverrideCharsetCombo->currentText() ) ); + GlobalSettings::self()->setShowCurrentTime( mShowCurrentTimeCheck->isChecked() ); } @@ -2432,6 +2442,7 @@ loadProfile( mShowEmoticonsCheck, reader, showEmoticons ); loadProfile( mShrinkQuotesCheck, reader, shrinkQuotes ); loadProfile( mShowExpandQuotesMark, reader, showExpandQuotesMark); + loadProfile( mShowCurrentTimeCheck, reader, showCurrentTime ); } diff -Naur kdepim-enterprise-20071116.orig/kmail/configuredialog_p.h kdepim-enterprise-20071116/kmail/configuredialog_p.h --- kdepim-enterprise-20071116.orig/kmail/configuredialog_p.h 2007-11-23 09:41:36.000000000 +0100 +++ kdepim-enterprise-20071116/kmail/configuredialog_p.h 2007-11-23 15:49:10.000000000 +0100 @@ -539,6 +539,7 @@ QCheckBox *mShrinkQuotesCheck; QComboBox *mCharsetCombo; QComboBox *mOverrideCharsetCombo; + QCheckBox *mShowCurrentTimeCheck; }; diff -Naur kdepim-enterprise-20071116.orig/kmail/headerstyle.cpp kdepim-enterprise-20071116/kmail/headerstyle.cpp --- kdepim-enterprise-20071116.orig/kmail/headerstyle.cpp 2007-11-23 09:41:36.000000000 +0100 +++ kdepim-enterprise-20071116/kmail/headerstyle.cpp 2007-11-23 15:53:49.000000000 +0100 @@ -612,6 +612,122 @@ kdDebug( 5006 ) << "final presence: '" << presence << "'" << endl; #endif + QString timeHTML; + if ( GlobalSettings::self()->showCurrentTime() && strategy->showHeader( "date" ) ) { + DwHeaders& header = message->headers(); + if ( header.HasDate() ) { + DwDateTime& origDate = header.Date(); + int zone = origDate.Zone(); + // kdDebug() << "FancyHeaderStyle::format() zone offset (in minutes): " << zone << endl; + + // copyed fro mimelib -- code to determine local timezone + time_t t_now = time((time_t*) 0); +#if defined(HAVE_GMTIME_R) + struct tm utc; + gmtime_r(&t_now, &utc); + struct tm local; + localtime_r(&t_now, &local); +#else + struct tm utc = *gmtime(&t_now); + struct tm local = *localtime(&t_now); +#endif + DwUint32 t_local = 0; + t_local = 24 * t_local + local.tm_hour; + t_local = 60 * t_local + local.tm_min; + t_local = 60 * t_local + local.tm_sec; + DwUint32 t_utc = 0; + t_utc = 24 * t_utc + utc.tm_hour; + t_utc = 60 * t_utc + utc.tm_min; + t_utc = 60 * t_utc + utc.tm_sec; + int lzone = (int) (t_local - t_utc) / 60; + + // kdDebug() << "FancyHeaderStyle::format() local zone offset (in minutes): " << lzone << endl; + + QTime currTime = QTime::currentTime( Qt::UTC ); + + // kdDebug() << "FancyHeaderStyle::format() current time: " << currTime << endl; + + // now currTime contain message sender local time + currTime = currTime.addSecs( zone * 60 ); + + QString timeofday; + QString color; + QString bg_color; + QString bg_image; + if ( currTime > QTime( 0, 0, 0 ) && currTime <= QTime( 6, 0, 0 ) ) { + timeofday = i18n( "Night" ); + color = "white"; + bg_color = "#000B6B"; + bg_image = "url(data:image/png;base64," + "iVBORw0KGgoAAAANSUhEUgAAAAEAAAAyCAIAAAASmSbdAAAAS0lEQVQI11WOsRGAQAzDOG/LHoz9" + "kikIcF+kSBxbPs7LoNGVapAI0Zn+O+8NUwldozn6io7G7kdS/5zi7i+BvUM/5uSXlIfzMHx/bmWR" + "k++yj9rZAAAAAElFTkSuQmCC)"; + } + else if ( currTime > QTime( 6, 0, 0 ) && currTime <= QTime( 12, 0, 0 ) ) { + timeofday = i18n( "Morning" ); + color = "white"; + bg_color = "#00A6FF"; + bg_image = "url(data:image/png;base64," + "iVBORw0KGgoAAAANSUhEUgAAAAEAAAAyCAYAAACd+7GKAAAAWklEQVQI122OQQ7DMAzDaP3/dfuO" + "pWSHJgva7iZIBk3m/Ew5hexCHVCilewzFHKEbFZqgxJQWyzKhWKl9unqddJj8+L9sl0oR2gUim+o" + "zu4uSh7kn67/DNv+C4tsZOtjAWEHAAAAAElFTkSuQmCC)"; + } + else if ( currTime > QTime( 12, 0, 0 ) && currTime <= QTime( 18, 0, 0 ) ) { + timeofday = i18n( "Afternoon" ); + color = "black"; + bg_color = "#00A6FF"; + bg_image = "url(data:image/png;base64," + "iVBORw0KGgoAAAANSUhEUgAAAAEAAAAyCAYAAACd+7GKAAAAPUlEQVQI132OwQ0AIAwCSfcfw91c" + "QsCfRm399HFwoWjdDhMICQhxHSWMQPhkTCoqWRZU2h5i9tr4GZfmV5t3wWUI3h+NugAAAABJRU5E" + "rkJggg==)"; + } + else { + timeofday = i18n( "Evening" ); + color = "white"; + bg_color = "#0014CC"; + bg_image = "url(data:image/png;base64," + "iVBORw0KGgoAAAANSUhEUgAAAAEAAAAyCAYAAACd+7GKAAAAWklEQVQI11WOyRHAMAgDNQuUlBrS" + "fyFpAfKwje0PwyEt0vN+hVsJpzS6QML2ziWcFI6mZBZNSVDXYehyUgI1XsLI9eimHDH6kW0ddVIO" + "xx7JjrtshlbXlLDSD+WhJ+hwqWo8AAAAAElFTkSuQmCC)"; + } + + QString tformat; + if ( KGlobal::locale()->use12Clock() ) { + tformat = "h:mm AP"; + } + else { + tformat = "h:mm"; + } + + // kdDebug() << "FancyHeaderStyle::format() current time: " << currTime << " (" << timeofday << ")" << endl; + + timeHTML.append( QString( + "<div style=\"" + "border:1px solid %1;" + "color:%2;" + "background-image:%3;" + "background-position:center left;" + "background-repeat:repeat-x;" + "text-align:center;" + "font-size:12px;" + "padding:2px;" + "width:50px;" + "heigth:50px;" + "margin: 0px 0px 3px 0px;" + "\" class=\"curtime\">%4<br />%5<br />%6</div>" + ) + .arg( bg_color ) + .arg( color ) + .arg( bg_image ) + .arg( i18n( "Now:" ) ) + .arg( currTime.toString( tformat ) ) + .arg( timeofday ) + ); + } + else { + // kdDebug() << "FancyHeaderStyle::format() no date header to display" << endl; + } + } //case HdrFancy: // the subject line and box below for details @@ -716,7 +832,9 @@ */ headerStr.append( QString("<tr><td colspan=\"2\"><div id=\"attachmentInjectionPoint\"></div></td></tr>" ) ); headerStr.append( - QString( "</table></td><td align=\"center\">%1</td></tr></table>\n" ).arg(userHTML) ); + QString( "</table></td><td align=\"center\" valign=\"top\">%1%2</td></tr></table>\n" ) + .arg(timeHTML) + .arg(userHTML) ); if ( !spamHTML.isEmpty() ) headerStr.append( QString( "<div class=\"spamheader\" dir=\"%1\"><b>%2</b> <span style=\"padding-left: 20px;\">%3</span></div>\n") diff -Naur kdepim-enterprise-20071116.orig/kmail/kmail.kcfg kdepim-enterprise-20071116/kmail/kmail.kcfg --- kdepim-enterprise-20071116.orig/kmail/kmail.kcfg 2007-11-23 09:41:36.000000000 +0100 +++ kdepim-enterprise-20071116/kmail/kmail.kcfg 2007-11-23 15:54:34.000000000 +0100 @@ -548,6 +548,12 @@ <entry name="ChiasmusDecryptionOptions" type="String"> </entry> + <entry name="ShowCurrentTime" type="Bool"> + <default>true</default> + <label>Show current message sender time</label> + <whatsthis>Enable this if you like to know what time of day are now in sender location (calculated from sender time zone).</whatsthis> + </entry> + <entry name="ShowUserAgent" type="Bool"> <default>false</default> <label>Show user agent in fancy headers</label>
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor