-rw-r--r-- | libkcal/calstorage.h | 2 | ||||
-rw-r--r-- | libkcal/filestorage.cpp | 4 | ||||
-rw-r--r-- | libkcal/filestorage.h | 2 | ||||
-rw-r--r-- | libkcal/icalformat.cpp | 24 | ||||
-rw-r--r-- | libkcal/icalformat.h | 3 |
5 files changed, 7 insertions, 28 deletions
diff --git a/libkcal/calstorage.h b/libkcal/calstorage.h index 72972ea..82c8682 100644 --- a/libkcal/calstorage.h +++ b/libkcal/calstorage.h @@ -30,23 +30,23 @@ class Calendar; class CalStorage { public: CalStorage( Calendar *calendar ) { mCalendar = calendar; } virtual ~CalStorage() {} Calendar *calendar() const { return mCalendar; } virtual bool open() = 0; - virtual bool load(bool = false ) = 0; + virtual bool load( ) = 0; virtual bool save() = 0; virtual bool close() = 0; private: Calendar *mCalendar; }; } #endif diff --git a/libkcal/filestorage.cpp b/libkcal/filestorage.cpp index 00c15d9..a139124 100644 --- a/libkcal/filestorage.cpp +++ b/libkcal/filestorage.cpp @@ -67,35 +67,35 @@ void FileStorage::setSaveFormat( CalFormat *format ) CalFormat *FileStorage::saveFormat()const { return mSaveFormat; } bool FileStorage::open() { return true; } -bool FileStorage::load( bool quick ) +bool FileStorage::load( ) { kdDebug(5800) << "FileStorage::load(): '" << mFileName << "'" << endl; // do we want to silently accept this, or make some noise? Dunno... // it is a semantical thing vs. a practical thing. if (mFileName.isEmpty()) return false; // Always try to load with iCalendar. It will detect, if it is actually a // vCalendar file. - ICalFormat iCal (quick ); + ICalFormat iCal; bool success = iCal.load( calendar(), mFileName); if ( !success ) { if ( iCal.exception() ) { // kdDebug(5800) << "---Error: " << mFormat->exception()->errorCode() << endl; if ( iCal.exception()->errorCode() == ErrorFormat::CalVersion1 ) { // Expected non vCalendar file, but detected vCalendar kdDebug(5800) << "FileStorage::load() Fallback to VCalFormat" << endl; VCalFormat vCal; success = vCal.load( calendar(), mFileName ); calendar()->setLoadedProductId( vCal.productId() ); diff --git a/libkcal/filestorage.h b/libkcal/filestorage.h index e9dc15e..17010ac 100644 --- a/libkcal/filestorage.h +++ b/libkcal/filestorage.h @@ -35,24 +35,24 @@ class FileStorage : public CalStorage virtual ~FileStorage(); void setFileName( const QString &mFileName ); QString fileName()const; /** FileStorage takes ownership of format object. */ void setSaveFormat( CalFormat * ); CalFormat *saveFormat()const; bool open(); - bool load(bool quick = false ); + bool load( ); bool save(); bool close(); private: QString mFileName; CalFormat *mSaveFormat; }; } #endif diff --git a/libkcal/icalformat.cpp b/libkcal/icalformat.cpp index f2e7dfc..3a2aac6 100644 --- a/libkcal/icalformat.cpp +++ b/libkcal/icalformat.cpp @@ -41,60 +41,50 @@ extern "C" { #include "calendar.h" #include "calendarlocal.h" #include "journal.h" #include "icalformat.h" #include "icalformatimpl.h" #define _ICAL_VERSION "2.0" using namespace KCal; -ICalFormat::ICalFormat(bool quick ) +ICalFormat::ICalFormat( ) { - mQuicksave = false; //quick; mImpl = new ICalFormatImpl( this ); tzOffsetMin = 0; //qDebug("new ICalFormat() "); } ICalFormat::~ICalFormat() { delete mImpl; //qDebug("delete ICalFormat "); } bool ICalFormat::load( Calendar *calendar, const QString &fileName) { clearException(); QFile file( fileName ); if (!file.open( IO_ReadOnly ) ) { setException(new ErrorFormat(ErrorFormat::LoadError)); return false; } QTextStream ts( &file ); QString text; -#if 0 - if ( !mQuicksave ) { - qDebug("KO: No quickload!"); - ts.setEncoding( QTextStream::Latin1 ); - text = ts.read(); - } else { - ts.setCodec( QTextCodec::codecForName("utf8") ); - text = ts.read(); - } -#endif + ts.setEncoding( QTextStream::Latin1 ); text = ts.read(); file.close(); return fromString( calendar, text ); } //#include <qdatetime.h> bool ICalFormat::save( Calendar *calendar, const QString &fileName ) { //kdDebug(5800) << "ICalFormat::save(): " << fileName << endl; //qDebug("ICalFormat::save "); @@ -105,34 +95,24 @@ bool ICalFormat::save( Calendar *calendar, const QString &fileName ) if ( text.isNull() ) return false; // TODO: write backup file //is.restart(); QFile file( fileName ); if (!file.open( IO_WriteOnly ) ) { setException(new ErrorFormat(ErrorFormat::SaveError, i18n("Could not open file '%1'").arg(fileName))); return false; } QTextStream ts( &file ); -// #ifdef DESKTOP_VERSION -// mQuicksave = false; -// #endif -// if ( mQuicksave ) { -// ts << text.utf8(); -// } else { -// ts.setEncoding( QTextStream::Latin1 ); -// ts << text; -// //ts << text.latin1(); -// } ts.setEncoding( QTextStream::Latin1 ); ts << text; file.close(); //qDebug("saving file takes ms: %d ", is.elapsed() ); return true; } bool ICalFormat::fromString( Calendar *cal, const QString &text ) { setTimeZone( cal->timeZoneId(), !cal->isLocalTime() ); // qDebug("ICalFormat::fromString tz: %s ", cal->timeZoneId().latin1()); // Get first VCALENDAR component. diff --git a/libkcal/icalformat.h b/libkcal/icalformat.h index 236efbf..485ab6e 100644 --- a/libkcal/icalformat.h +++ b/libkcal/icalformat.h @@ -31,25 +31,25 @@ namespace KCal { class ICalFormatImpl; /** This class implements the iCalendar format. It provides methods for loading/saving/converting iCalendar format data into the internal KOrganizer representation as Calendar and Events. @short iCalendar format implementation */ class ICalFormat : public CalFormat { public: /** Create new iCalendar format. */ - ICalFormat( bool quick = false ); + ICalFormat( ); virtual ~ICalFormat(); /** Loads a calendar on disk in iCalendar format into calendar. Returns true if successful, else returns false. Provides more error information by exception(). @param calendar Calendar object to be filled. @param fileName The name of the calendar file on disk. */ bool load( Calendar *, const QString &fileName ); /** Writes out the calendar to disk in iCalendar format. Returns true if @@ -95,22 +95,21 @@ class ICalFormat : public CalFormat { /** Parse scheduling message provided as string \s */ ScheduleMessage *parseScheduleMessage( Calendar *, const QString &s); /** Set id of used time zone and whether this time zone is UTC or not. */ void setTimeZone( const QString &id, bool utc ); QString timeZoneId() const; int timeOffset(); const char * tzString(); bool utc() const; private: ICalFormatImpl *mImpl; - bool mQuicksave; QString mTimeZoneId; QCString mTzString; int tzOffsetMin; bool mUtc; }; } #endif |