[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-pim
Subject:    [Kde-pim] [PATCH] colored subresources for KOrganizer
From:       Tobias Koenig <tokoe () kde ! org>
Date:       2005-06-23 9:22:33
Message-ID: 20050623092232.GA3037 () ghostdog ! localnet
[Download RAW message or body]

[Attachment #2 (multipart/signed)]

[Attachment #4 (multipart/mixed)]


Hi,

the attached patch adds support for colored subresources in KOrganizer.
Ok for commit?

Ciao,
Tobias
-- 
Separate politics from religion and economy!
The Councile of the European Union is an undemocratic and illegal institution!

["korg_color_subresources.patch" (text/plain)]

Index: libkcal/resourcecalendar.h
===================================================================
--- libkcal/resourcecalendar.h	(Revision 425030)
+++ libkcal/resourcecalendar.h	(Arbeitskopie)
@@ -306,6 +306,14 @@
        return resource;
     };
 
+    /**
+      Get the identifier of the subresource associated with a specified
+      incidence.
+
+      @return the identifier of the subresource or an empty string.
+    */
+    virtual QString subresourceIdentifier( Incidence *incidence ) { return QString(); }
+
   public slots:
     /**
       (De-)activate a subresource.
Index: korganizer/koagenda.cpp
===================================================================
--- korganizer/koagenda.cpp	(Revision 425030)
+++ korganizer/koagenda.cpp	(Arbeitskopie)
@@ -1546,7 +1546,15 @@
 
   if ( calendarResource ) {
     ResourceCalendar *resourceCalendar = calendarResource->resource( incidence );
-    resourceColor = *KOPrefs::instance()->resourceColor( resourceCalendar->identifier() );
+
+    QString identifier = resourceCalendar->identifier();
+    if ( !resourceCalendar->subresources().isEmpty() ) {
+      identifier = resourceCalendar->subresourceIdentifier( incidence );
+      if ( identifier.isEmpty() )
+        identifier = resourceCalendar->identifier();
+    }
+
+    resourceColor = *KOPrefs::instance()->resourceColor( identifier );
 //  }else{
 //    kdDebug(5850) << "KOAgenda:insertItem: Calendar is not a CalendarResources" <<endl;
   }
Index: korganizer/resourceview.cpp
===================================================================
--- korganizer/resourceview.cpp	(Revision 425030)
+++ korganizer/resourceview.cpp	(Arbeitskopie)
@@ -108,8 +108,10 @@
     // This resource has subresources
     QStringList::ConstIterator it;
     for ( it=subresources.begin(); it!=subresources.end(); ++it ) {
-      ( void )new ResourceItem( mResource, *it, mResource->labelForSubresource( *it ),
-                                mView, this );
+      ResourceItem *item = new ResourceItem( mResource, *it, mResource->labelForSubresource( *it ),
+                                             mView, this );
+      QColor resourceColor = *KOPrefs::instance()->resourceColor( *it );
+      item->setResourceColor( resourceColor );
     }
   }
   mSubItemsCreated = true;
Index: korganizer/koprefsdialog.cpp
===================================================================
--- korganizer/koprefsdialog.cpp	(Revision 425030)
+++ korganizer/koprefsdialog.cpp	(Arbeitskopie)
@@ -823,9 +823,21 @@
   kdDebug(5850) << "Loading Calendar resources...:" << endl;
   KCal::CalendarResourceManager::Iterator it;
   for( it = manager->begin(); it != manager->end(); ++it ) {
+    if ( !(*it)->subresources().isEmpty() ) {
+      QStringList subresources = (*it)->subresources();
+      for ( uint i = 0; i < subresources.count(); ++i ) {
+        QString resource = subresources[ i ];
+        if ( (*it)->subresourceActive( resource ) ) {
+          mResourceCombo->insertItem( (*it)->labelForSubresource( resource ) );
+          mResourceIdentifier.append( resource );
+        }
+      }
+    }
+
     mResourceCombo->insertItem( (*it)->resourceName() );
     mResourceIdentifier.append( (*it)->identifier() );
   }
+
   updateResourceColor();
 }
 
Index: kresources/kolab/kcal/resourcekolab.cpp
===================================================================
--- kresources/kolab/kcal/resourcekolab.cpp	(Revision 425030)
+++ kresources/kolab/kcal/resourcekolab.cpp	(Arbeitskopie)
@@ -863,6 +863,15 @@
   return subresource;
 }
 
+QString ResourceKolab::subresourceIdentifier( Incidence *incidence )
+{
+  QString uid = incidence->uid();
+  if ( mUidMap.contains( uid ) )
+    return mUidMap[ uid ].resource();
+  else
+    return QString();
+}
+
 void ResourceKolab::fromKMailAsyncLoadResult( const QMap<Q_UINT32, QString>& map,
                                               const QString& type,
                                               const QString& folder )
Index: kresources/kolab/kcal/resourcekolab.h
===================================================================
--- kresources/kolab/kcal/resourcekolab.h	(Revision 425030)
+++ kresources/kolab/kcal/resourcekolab.h	(Arbeitskopie)
@@ -125,6 +125,8 @@
   /** What is the label for this subresource? */
   virtual const QString labelForSubresource( const QString& resource ) const;
 
+  virtual QString subresourceIdentifier( Incidence *incidence );
+
   KABC::Lock* lock();
 
 signals:

["signature.asc" (application/pgp-signature)]
___________________________________________________________ 
Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de


_______________________________________________
kde-pim mailing list
kde-pim@kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/
___________________________________________________________ 
Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic