author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (side-by-side diff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /kabc/vcard/DateValue.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
-rw-r--r-- | kabc/vcard/DateValue.cpp | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/kabc/vcard/DateValue.cpp b/kabc/vcard/DateValue.cpp index c5c5c85..87c7007 100644 --- a/kabc/vcard/DateValue.cpp +++ b/kabc/vcard/DateValue.cpp @@ -17,16 +17,18 @@ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include <qregexp.h> +//Added by qt3to4: +#include <Q3CString> #include <kdebug.h> #include <VCardDefines.h> #include <VCardDateValue.h> #include <VCardValue.h> using namespace VCARD; @@ -100,32 +102,32 @@ DateValue::DateValue(const DateValue & x) minute_ = x.minute_; second_ = x.second_; zoneHour_ = x.zoneHour_; zoneMinute_ = x.zoneMinute_; secFrac_ = x.secFrac_; hasTime_ = x.hasTime_; } -DateValue::DateValue(const QCString & s) +DateValue::DateValue(const Q3CString & s) : Value(s) { } DateValue & DateValue::operator = (DateValue & x) { if (*this == x) return *this; Value::operator = (x); return *this; } DateValue & -DateValue::operator = (const QCString & s) +DateValue::operator = (const Q3CString & s) { Value::operator = (s); return *this; } bool DateValue::operator == (DateValue & x) { @@ -149,18 +151,18 @@ DateValue::_parse() vDebug("DateValue::_parse()"); // date = date-full-year ["-"] date-month ["-"] date-mday // time = time-hour [":"] time-minute [":"] time-second [":"] // [time-secfrac] [time-zone] int timeSep = strRep_.find('T'); - QCString dateStr; - QCString timeStr; + Q3CString dateStr; + Q3CString timeStr; if (timeSep == -1) { dateStr = strRep_; vDebug("Has date string \"" + dateStr + "\""); } else { @@ -168,17 +170,17 @@ DateValue::_parse() vDebug("Has date string \"" + dateStr + "\""); timeStr = strRep_.mid(timeSep + 1); vDebug("Has time string \"" + timeStr + "\""); } /////////////////////////////////////////////////////////////// DATE - dateStr.replace(QRegExp("-"), ""); + dateStr.replace("-", ""); kdDebug(5710) << "dateStr: " << dateStr << endl; year_ = dateStr.left(4).toInt(); month_ = dateStr.mid(4, 2).toInt(); day_ = dateStr.right(2).toInt(); if (timeSep == -1) { @@ -191,66 +193,66 @@ DateValue::_parse() /////////////////////////////////////////////////////////////// TIME /////////////////////////////////////////////////////////////// ZONE int zoneSep = timeStr.find('Z'); if (zoneSep != -1 && timeStr.length() - zoneSep > 3) { - QCString zoneStr(timeStr.mid(zoneSep + 1)); + Q3CString zoneStr(timeStr.mid(zoneSep + 1)); vDebug("zoneStr == " + zoneStr); zonePositive_ = (zoneStr[0] == '+'); zoneHour_ = zoneStr.mid(1, 2).toInt(); zoneMinute_ = zoneStr.right(2).toInt(); timeStr.remove(zoneSep, timeStr.length() - zoneSep); } //////////////////////////////////////////////////// SECOND FRACTION int secFracSep = timeStr.findRev(','); if (secFracSep != -1 && zoneSep != -1) { // zoneSep checked to avoid errors. - QCString quirkafleeg = "0." + timeStr.mid(secFracSep + 1, zoneSep); + Q3CString quirkafleeg = "0." + timeStr.mid(secFracSep + 1, zoneSep); secFrac_ = quirkafleeg.toDouble(); } /////////////////////////////////////////////////////////////// HMS - timeStr.replace(QRegExp(":"), ""); + timeStr.replace(":", ""); hour_ = timeStr.left(2).toInt(); minute_ = timeStr.mid(2, 2).toInt(); second_ = timeStr.mid(4, 2).toInt(); } void DateValue::_assemble() { vDebug("DateValue::_assemble"); - QCString year; - QCString month; - QCString day; + Q3CString year; + Q3CString month; + Q3CString day; year.setNum( year_ ); month.setNum( month_ ); day.setNum( day_ ); if ( month.length() < 2 ) month.prepend( "0" ); if ( day.length() < 2 ) day.prepend( "0" ); strRep_ = year + '-' + month + '-' + day; if ( hasTime_ ) { - QCString hour; - QCString minute; - QCString second; + Q3CString hour; + Q3CString minute; + Q3CString second; hour.setNum( hour_ ); minute.setNum( minute_ ); second.setNum( second_ ); if ( hour.length() < 2 ) hour.prepend( "0" ); if ( minute.length() < 2 ) minute.prepend( "0" ); if ( second.length() < 2 ) second.prepend( "0" ); |