[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: proko2: kdepim/kresources/kolab/knotes
From: Bo Thorsen <bo () sonofthor ! dk>
Date: 2004-06-29 14:00:41
Message-ID: 20040629140041.D80899986 () office ! kde ! org
[Download RAW message or body]
CVS commit by thorsen:
Almost there with the notes resource now.
M +21 -37 resourcekolab.cpp 1.1.2.7
M +0 -2 resourcekolab.h 1.1.2.6
--- kdepim/kresources/kolab/knotes/resourcekolab.cpp #1.1.2.6:1.1.2.7
@@ -205,10 +205,13 @@ bool ResourceKolab::addNote( KCal::Journ
bool ResourceKolab::deleteNote( KCal::Journal* journal )
{
-#if 0
const QString uid = journal->uid();
- kmailDeleteIncidence( "Kolab/Note", mUidMap[ uid ] );
+ if ( !mUidMap.contains( uid ) )
+ // Odd
+ return false;
+
+ kmailDeleteIncidence( mUidMap[ uid ].resource(),
+ mUidMap[ uid ].serialNumber() );
mUidMap.remove( uid );
mCalendar.deleteJournal( journal );
-#endif
return true;
}
@@ -234,14 +237,9 @@ bool ResourceKolab::fromKMailAddIncidenc
{
// Check if this is a note
- if( type != "Kolab/Note" ) return false;
-
- // kdDebug(5500) << "ResourceKolab::addIncidence( " << type << ", "
- // << /*ical*/"..." << " )" << endl;
- KCal::Journal* journal = parseJournal( note );
- if ( !journal ) return false;
+ if( type != kmailResourceType ) return false;
const bool silent = mSilent;
mSilent = true;
- addNote( journal, resource, sernum );
+ addNote( note, resource, sernum );
mSilent = silent;
@@ -253,17 +251,21 @@ void ResourceKolab::fromKMailDelIncidenc
const QString& note )
{
-#if 0
// Check if this is a note
- if( type != "Kolab/Note" ) return;
+ if( type != kmailResourceType ) return;
// kdDebug(5500) << "ResourceKolab::deleteIncidence( " << type << ", " << uid
// << " )" << endl;
+ KCal::Journal* journal = Note::xmlToJournal( note );
+ if ( !journal )
+ return;
+
const bool silent = mSilent;
mSilent = true;
- KCal::Journal* j = mCalendar.journal( uid );
+ KCal::Journal* j = mCalendar.journal( journal->uid() );
if( j ) deleteNote( j );
mSilent = silent;
-#endif
+
+ delete journal;
}
@@ -271,5 +273,5 @@ void ResourceKolab::slotRefresh( const Q
const QString& /*resource*/ )
{
- if ( type == "Kolab/Note" )
+ if ( type == kmailResourceType )
load();
}
@@ -279,5 +281,5 @@ void ResourceKolab::fromKMailAddSubresou
bool writable )
{
- if ( type != "Kolab/Note" )
+ if ( type != kmailResourceType )
// Not ours
return;
@@ -288,5 +290,5 @@ void ResourceKolab::fromKMailAddSubresou
KConfig config( configFile() );
- config.setGroup( "Note" );
+ config.setGroup( configGroupName );
bool active = config.readBoolEntry( resource, true );
@@ -299,5 +301,5 @@ void ResourceKolab::fromKMailDelSubresou
const QString& resource )
{
- if ( type != "Kolab/Note" )
+ if ( type != configGroupName )
// Not ours
return;
@@ -311,5 +313,5 @@ void ResourceKolab::fromKMailDelSubresou
KConfig config( configFile() );
- config.setGroup( "Kolab/Note" );
+ config.setGroup( configGroupName );
config.deleteEntry( resource );
config.sync();
@@ -354,21 +356,3 @@ bool ResourceKolab::subresourceActive( c
-KCal::Journal* ResourceKolab::parseJournal( const QString& str )
-{
- KCal::ICalFormat format;
- KCal::Incidence* i = format.fromString( str );
- if ( i ) {
- if ( i->type() == "Journal" )
- return static_cast<KCal::Journal*>( i );
- else {
- kdDebug(5500) << "Unknown incidence type " << i->type() << endl;
- delete i;
- }
- } else
- kdDebug(5500) << "Parse error\n";
-
- return 0;
-}
-
-
#include "resourcekolab.moc"
--- kdepim/kresources/kolab/knotes/resourcekolab.h #1.1.2.5:1.1.2.6
@@ -110,6 +110,4 @@ private:
}
- // Parse a journal from a string
- KCal::Journal* parseJournal( const QString& str );
KCal::CalendarLocal mCalendar;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic