--Boundary-00=_fsGhDtOZfP4/3tC Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline hi. here are two patches based on 3.5rc1 (attached) for bug 114771. --Stefan -- Stefan Teleman 'Nobody Expects the Spanish Inquisition' steleman@nyc.rr.com -Monty Python --Boundary-00=_fsGhDtOZfP4/3tC Content-Type: text/x-diff; charset="us-ascii"; name="tzone.cpp.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="tzone.cpp.diff" --- tzone.cpp.kde.orig 2005-10-10 11:03:48.000000000 -0400 +++ tzone.cpp 2005-11-19 20:53:10.653170000 -0500 @@ -32,6 +32,7 @@ #include #include #include +#include #include //#include "xpm/world.xpm" @@ -44,7 +45,11 @@ #include #include #include + +#ifndef INITFILE +#define INITFILE "/etc/default/init" #endif +#endif // USE_SOLARIS Tzone::Tzone(QWidget * parent, const char *name) : QVGroupBox(parent, name) @@ -95,7 +100,7 @@ KTempFile tf( locateLocal( "tmp", "kde-tzone" ) ); tf.setAutoDelete( true ); - QTextStream *ts = tf.textStream(); + QStringList lines; QFile fTimezoneFile(INITFILE); bool updatedFile = false; @@ -105,24 +110,29 @@ bool found = false; QTextStream is(&fTimezoneFile); + QString line(""); - for (QString line = is.readLine(); !line.isNull(); - line = is.readLine()) + while ( !is.atEnd() ) { + line = is.readLine(); if (line.find("TZ=") == 0) { - *ts << "TZ=" << selectedzone << endl; + QString newTZ("TZ="); + newTZ += selectedzone; + lines.append(newTZ); found = true; } else { - *ts << line << endl; + lines.append(line); } } if (!found) { - *ts << "TZ=" << selectedzone << endl; + QString newTZ("TZ="); + newTZ += selectedzone; + lines.append(newTZ); } updatedFile = true; @@ -131,27 +141,48 @@ if (updatedFile) { - ts->device()->reset(); - fTimezoneFile.remove(); + QString backupName(INITFILE); + backupName += QString(".old"); - if (fTimezoneFile.open(IO_WriteOnly | IO_Truncate)) - { - QTextStream os(&fTimezoneFile); + ::rename(INITFILE, backupName.latin1()); + QFile newTimezoneFile(INITFILE); - for (QString line = ts->readLine(); !line.isNull(); - line = ts->readLine()) + if (newTimezoneFile.open(IO_WriteOnly | IO_Truncate)) { - os << line << endl; - } + QTextStream os(&newTimezoneFile); + QString line(""); + + for (QStringList::Iterator it = lines.begin(); it != lines.end(); ++it) + { + os << *it << "\n"; + } + + newTimezoneFile.flush(); + newTimezoneFile.close(); + ::fchmod(newTimezoneFile.handle(), + (S_IXUSR | S_IRUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)); +#if defined (i386) || defined (__i386) || defined (__i386__) + // Solaris x86 only. This is not necessary on SPARC. + KProcess rtcProcess; + QString rtc("/usr/sbin/rtc -z "); + rtcProcess << rtc << selectedzone.ascii(); + rtcProcess.start(KProcess::Block); + int rtcz = rtcProcess.exitStatus(); + + rtcProcess.clearArguments(); + rtc = "/usr/sbin/rtc -c"; + rtcProcess << rtc; + rtcProcess.start(KProcess::Block); + int rtcc = rtcProcess.exitStatus(); - fchmod(fTimezoneFile.handle(), - S_IXUSR | S_IRUSR | S_IRGRP | S_IXGRP | - S_IROTH | S_IXOTH); - fTimezoneFile.close(); + if ((0 == rtcz) && (0 == rtcc)) + KMessageBox::information(this, i18n("You must reboot the system for changes to take effect."), i18n("Reboot Required")); + else + KMessageBox::sorry(this, i18n("Could not set the real-time clock. Please run /usr/sbin/rtc manually as root, then reboot."), i18n("Manual Intervention Required")); +#endif // i386 } } - QString val = selectedzone; #else QFile fTimezoneFile("/etc/timezone"); --Boundary-00=_fsGhDtOZfP4/3tC Content-Type: text/x-diff; charset="us-ascii"; name="ktimezones.cpp.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="ktimezones.cpp.diff" --- ktimezones.cpp.kde.orig 2005-10-10 11:06:02.000000000 -0400 +++ ktimezones.cpp 2005-11-22 23:49:33.850938000 -0500 @@ -376,13 +376,22 @@ if (!f.open(IO_ReadOnly)) { kdDebug() << "Can't open " << f.name() << endl; +#if defined(SOLARIS) || defined(USE_SOLARIS) + m_zoneinfoDir = "/usr/share/lib/zoneinfo"; + f.setName(m_zoneinfoDir + "/tab/zone_sun.tab"); +#else m_zoneinfoDir = "/usr/lib/zoneinfo"; f.setName(m_zoneinfoDir + "/zone.tab"); +#endif if (!f.open(IO_ReadOnly)) { kdDebug() << "Can't open " << f.name() << endl; m_zoneinfoDir = ::getenv("TZDIR"); +#if defined(SOLARIS) || defined(USE_SOLARIS) + f.setName(m_zoneinfoDir + "/tab/zone_sun.tab"); +#endif f.setName(m_zoneinfoDir + "/zone.tab"); +#endif if (m_zoneinfoDir.isEmpty() || !f.open(IO_ReadOnly)) { kdDebug() << "Can't open " << f.name() << endl; @@ -396,8 +405,7 @@ m_zoneinfoDir = "/usr/share/lib/zoneinfo"; KTempFile temp; KShellProcess reader; - reader << "/bin/grep" << "-h" << "^Zone" << m_zoneinfoDir << "/src/*" << temp.name() << "|" << - "/bin/awk" << "'{print \"??\\t+9999+99999\\t\" $2}'"; + reader << "/usr/bin/egrep" << " -h" << " \"^Zone\" " << m_zoneinfoDir << "/src/* " << " | " << "/usr/bin/nawk " << "'{ print \"??\\t+9999+99999\\t\" $2 }' > " << temp.name(); // Note the use of blocking here...it is a trivial amount of data! temp.close(); reader.start(KProcess::Block); --Boundary-00=_fsGhDtOZfP4/3tC--