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

List:       kde-pim
Subject:    Re: [Kde-pim] [PATCH] remove kdepimlibs/kcal "hidden" warnings
From:       David Jarvie <djarvie () kde ! org>
Date:       2007-11-30 22:21:11
Message-ID: 200711302221.11908.djarvie () kde ! org
[Download RAW message or body]

On Friday 30 November 2007 13:40:07 David Jarvie wrote:
> On Friday 30 November 2007 12:27, Allen Winter wrote:
> > On Friday 30 November 2007 04:00:16 David Jarvie wrote:
> >> Attached is a patch to fix some of the compile warnings in libkcal about
> >> hidden virtual methods. OK to commit?
> >
> > Yes please.
> >
> > There are other instances of these types of warnings, but I'm not sure
> > we can fix them without a change to the API.  Care to take a look?
>
> I've been looking at them as well. I've written a patch for todo.h (which
> does involve an API change), but I need to check tonight whether kdepim
> compiles with it. I'm also looking at other similar warnings in kcal, but
> some are not so straightforward to fix.

The patch has been committed. Attached is another patch which fixes most of 
the remaining hidden virtual method warnings for libkcal. OK to commit?

-- 
David Jarvie.
KAlarm author and maintainer.
http://www.astrojar.org.uk/kalarm

["kcal.diff" (text/x-diff)]

Index: resourcelocal.cpp
===================================================================
--- resourcelocal.cpp	(revision 742816)
+++ resourcelocal.cpp	(working copy)
@@ -171,6 +171,11 @@
   return success;
 }
 
+bool ResourceLocal::doSave( bool syncCache, Incidence * incidence )
+{
+  return ResourceCached::doSave( syncCache, incidence );
+}
+
 KABC::Lock *ResourceLocal::lock()
 {
   return d->mLock;
Index: resourcelocal.h
===================================================================
--- resourcelocal.h	(revision 742816)
+++ resourcelocal.h	(working copy)
@@ -134,6 +134,11 @@
       Actually saves the data to the local file.
     **/
     virtual bool doSave( bool syncCache );
+    /**
+      @copydoc
+      ResourceCached::doSave(bool, Incidence*)
+    */
+    virtual bool doSave( bool syncCache, Incidence * );
 
     /**
       Called by reload() to reload the resource, if it is already open.
@@ -165,6 +170,10 @@
     ResourceLocal &operator=( const ResourceLocal &other );
 
   private:
+    // Inherited virtual methods which should not be used by derived classes.
+    using ResourceCalendar::doLoad;
+    using ResourceCalendar::doSave;
+
     void init();
     //@cond PRIVATE
     class Private;
Index: todo.h
===================================================================
--- todo.h	(revision 742816)
+++ todo.h	(working copy)
@@ -153,13 +153,18 @@
     void setHasStartDate( bool hasStartDate );
 
     /**
+      @copydoc
+      IncidenceBase::dtStart()
+    */
+    virtual KDateTime dtStart() const  { return dtStart( false ); }
+    /**
       Returns the start date of the todo.
       @param first If true, the start date of the todo will be returned. If the
       todo recurs, the start date of the first occurrence will be returned.
       If false and the todo recurs, the relative start date will be returned,
       based on the date returned by dtRecurrence().
     */
-    KDateTime dtStart( bool first = false ) const;
+    KDateTime dtStart( bool first ) const;
 
     /**
       Sets the start date of the todo.
@@ -180,10 +185,17 @@
       @param spec If set, returns the time in the given spec, else use the
       todo's current spec.
     */
-    QString dtStartTimeStr( bool shortfmt = true, bool first = false,
+    QString dtStartTimeStr( bool shortfmt, bool first,
                             const KDateTime::Spec &spec = KDateTime::Spec() ) const;
 
     /**
+      @copydoc
+      IncidenceBase::dtStartTimeStr()
+    */
+    virtual QString dtStartTimeStr( bool shortfmt = true,
+                                    const KDateTime::Spec &spec = KDateTime::Spec() ) const;
+
+    /**
       Returns a todo's starting date as a string formatted according to the
       user's locale settings.
 
@@ -195,10 +207,17 @@
       @param spec If set, returns the date in the given spec, else use the
       todo's current spec.
     */
-    QString dtStartDateStr( bool shortfmt = true, bool first = false,
+    QString dtStartDateStr( bool shortfmt, bool first,
                             const KDateTime::Spec &spec = KDateTime::Spec() ) const;
 
     /**
+      @copydoc
+      IncidenceBase::dtStartDateStr()
+    */
+    virtual QString dtStartDateStr( bool shortfmt = true,
+                                    const KDateTime::Spec &spec = KDateTime::Spec() ) const;
+
+    /**
       Returns a todo's starting date and time as a string formatted according
       to the user's locale settings.
 
@@ -210,10 +229,17 @@
       @param spec If set, returns the date and time in the given spec, else
       use the todo's current spec.
     */
-    QString dtStartStr( bool shortfmt = true, bool first = false,
+    QString dtStartStr( bool shortfmt, bool first,
                         const KDateTime::Spec &spec = KDateTime::Spec() ) const;
 
     /**
+      @copydoc
+      IncidenceBase::dtStartStr()
+    */
+    virtual QString dtStartStr( bool shortfmt = true,
+                                const KDateTime::Spec &spec = KDateTime::Spec() ) const;
+
+    /**
       Returns true if the todo is 100% completed, otherwise return false.
 
       @see setCompleted(), percentComplete()
Index: resourcecached.h
===================================================================
--- resourcecached.h	(revision 743356)
+++ resourcecached.h	(working copy)
@@ -509,6 +509,7 @@
     // Inherited virtual methods which should not be used by derived classes.
     virtual bool doLoad();
     virtual bool doSave();
+    virtual bool doSave( Incidence * ) { return 0; }
 
     //@cond PRIVATE
     class Private;
Index: incidence.h
===================================================================
--- incidence.h	(revision 742816)
+++ incidence.h	(working copy)
@@ -89,6 +89,8 @@
         }
 
       private:
+	bool visit( FreeBusy * ) { return false; }   // prevent warning about hidden virtual method
+
         T *mResource;
     };
     //@endcond
@@ -122,6 +124,8 @@
         }
 
       private:
+	bool visit( FreeBusy * ) { return false; }   // prevent warning about hidden virtual method
+
         T *mResource;
     };
     //@endcond
Index: todo.cpp
===================================================================
--- todo.cpp	(revision 742816)
+++ todo.cpp	(working copy)
@@ -285,6 +285,11 @@
   }
 }
 
+QString Todo::dtStartTimeStr( bool shortfmt, const KDateTime::Spec &spec ) const
+{
+  return Incidence::dtStartTimeStr( shortfmt, spec );
+}
+
 QString Todo::dtStartDateStr( bool shortfmt, bool first, const KDateTime::Spec &spec ) const
 {
   if ( spec.isValid() ) {
@@ -305,6 +310,11 @@
   }
 }
 
+QString Todo::dtStartDateStr( bool shortfmt, const KDateTime::Spec &spec ) const
+{
+  return Incidence::dtStartDateStr( shortfmt, spec );
+}
+
 QString Todo::dtStartStr( bool shortfmt, bool first, const KDateTime::Spec &spec ) const
 {
   if ( spec.isValid() ) {
@@ -325,6 +335,11 @@
   }
 }
 
+QString Todo::dtStartStr( bool shortfmt, const KDateTime::Spec &spec ) const
+{
+  return Incidence::dtStartStr( shortfmt, spec );
+}
+
 bool Todo::isCompleted() const
 {
   if ( d->mPercentComplete == 100 ) {
Index: resourcelocaldir.h
===================================================================
--- resourcelocaldir.h	(revision 742816)
+++ resourcelocaldir.h	(working copy)
@@ -84,6 +84,10 @@
     virtual bool doFileLoad( CalendarLocal &cal, const QString &fileName );
 
   private:
+    // Inherited virtual methods which should not be used by derived classes.
+    using ResourceCalendar::doLoad;
+    using ResourceCalendar::doSave;
+
     //@cond PRIVATE
     class Private;
     Private *const d;


_______________________________________________
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/

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

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