Bug 107005 - Deactivating default calendar in KOrganizer should not be possible
Summary: Deactivating default calendar in KOrganizer should not be possible
Status: RESOLVED NOT A BUG
Alias: None
Product: korganizer
Classification: Applications
Component: general (show other bugs)
Version: 3.4
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-08 02:12 UTC by Kde
Modified: 2011-02-05 07:14 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kde 2005-06-08 02:12:50 UTC
Version:           3.4 (using KDE 3.4.0 Level "b" , SUSE 9.3)
Compiler:          gcc version 3.3.5 20050117 (prerelease) (SUSE Linux)
OS:                Linux (i686) release 2.6.11.4-20a-default

In kcontrol it is not possible to deactivate the default calendar resource. This is correct.

However in KOrganizer, when using the "Resource view" I can deactivate the default resource without problems. This does not seem to be correct.
Comment 1 Bram Schoenmakers 2005-06-29 12:24:00 UTC
SVN commit 429906 by bram:

Fix for bug 107005: Don't allow the user to disable standard resources.

BUG: 107005



 M  +16 -4     resourceview.cpp  
 M  +5 -0      resourceview.h  


--- trunk/KDE/kdepim/korganizer/resourceview.cpp #429905:429906
@@ -89,7 +89,7 @@
   : QCheckListItem( parent, resource->resourceName(), CheckBox ),
     mResource( resource ), mView( view ), mBlockStateChange( false ),
     mIsSubresource( false ), mResourceIdentifier( QString::null ),
-    mSubItemsCreated( false )
+    mSubItemsCreated( false ), mStandard( false )
 {
   mResourceColor = QColor();
   setGuiState();
@@ -123,7 +123,7 @@
 
   : QCheckListItem( parent, label, CheckBox ), mResource( resource ),
     mView( view ), mBlockStateChange( false ), mIsSubresource( true ),
-    mSubItemsCreated( false )
+    mSubItemsCreated( false ), mStandard( false )
 {
   mResourceColor = QColor();
   mResourceIdentifier = sub;
@@ -153,9 +153,11 @@
         if ( !mSubItemsCreated )
           createSubresourceItems();
       }
-    } else {
+    } else if( !mStandard ) {
       if ( mResource->save() ) mResource->setActive( false );
       mView->requestClose( mResource );
+    } else { // user tried to deselect a standard resource
+      KMessageBox::information( mView, i18n("You can't disable a standard resource. If you still want to disable it, please mark another resource as standard.") );
     }
 
     setOpen( mResource->isActive() && childCount() > 0 );
@@ -197,7 +199,7 @@
 
 ResourceView::ResourceView( KCal::CalendarResources *calendar,
                             QWidget *parent, const char *name )
-  : CalendarViewExtension( parent, name ), mCalendar( calendar )
+  : CalendarViewExtension( parent, name ), mCalendar( calendar ), mStandard( 0 )
 {
   QBoxLayout *topLayout = new QVBoxLayout( this, 0, KDialog::spacingHint() );
 
@@ -296,8 +298,14 @@
 
 void ResourceView::addResourceItem( ResourceCalendar *resource )
 {
+  KCal::CalendarResourceManager *manager = mCalendar->resourceManager();
+  bool standard = ( resource == manager->standardResource() );
 
   ResourceItem *item=new ResourceItem( resource, this, mListView );
+  
+  if( standard )
+    mStandard = item;
+  item->setStandard( standard );
 
   QColor resourceColor;
 
@@ -558,12 +566,16 @@
 
 void ResourceView::setStandard()
 {
+  if( mStandard )
+    mStandard->setStandard( false );
   ResourceItem *item = currentItem();
   if ( !item ) return;
 
   ResourceCalendar *r = item->resource();
   KCal::CalendarResourceManager *manager = mCalendar->resourceManager();
   manager->setStandardResource( r );
+  mStandard = item;
+  item->setStandard( true );
 }
 
 void ResourceView::showButtons( bool visible )
--- trunk/KDE/kdepim/korganizer/resourceview.h #429905:429906
@@ -76,6 +76,9 @@
 //     */
     void setResourceColor(QColor& color); 
     QColor &resourceColor() {return mResourceColor;}
+    
+    /** Sets whether this item represents a standard resource. */
+    void setStandard( bool s ) { mStandard = s; }
   protected:
     void stateChange( bool active );
 
@@ -89,6 +92,7 @@
     bool mIsSubresource;
     QString mResourceIdentifier;
     bool mSubItemsCreated;
+    bool mStandard;
 };
 
 /**
@@ -153,6 +157,7 @@
     QPushButton *mDeleteButton;
     QPushButton *mEditButton;
     QPtrList<ResourceCalendar> mResourcesToClose;
+    ResourceItem *mStandard;
 };
 
 #endif
Comment 2 Reinhold Kainhofer 2005-06-29 13:20:38 UTC
On Wednesday 29 June 2005 12:24, Bram Schoenmakers wrote:
> Fix for bug 107005: Don't allow the user to disable standard resources.


Actually, I don't think we should do this. With this change, how can a 
secretary view only her boss' calendar, but not her own? 
With this change you can no longer view only one resource (unless it happens 
to be the standard resource)... E.g. what if I only want to see our choir's 
time table (because I want to print it for all member of the choir), which is 
a remote resource on our choir's homepage? Clearly, that shouldn't be my 
default resource, but I still might want to see only this resource and not my 
standard calendar.

If there is still a writable resource left, things are just fine. And if there 
is no writable resource left, the user simply can't create a new event, but 
he should be able to view a read-only resource alone.

Reinhold
Comment 3 Bram Schoenmakers 2005-07-05 16:49:57 UTC
I'll revert, I was too quick. Mark this as INVALID?
Comment 4 Bram Schoenmakers 2005-07-05 16:57:24 UTC
SVN commit 431925 by bram:

Re-re-re-wind.

I was too quick, trying to fix #107005.

CCBUG: 107005



 M  +4 -16     resourceview.cpp  
 M  +0 -5      resourceview.h  


--- trunk/KDE/kdepim/korganizer/resourceview.cpp #431924:431925
@@ -89,7 +89,7 @@
   : QCheckListItem( parent, resource->resourceName(), CheckBox ),
     mResource( resource ), mView( view ), mBlockStateChange( false ),
     mIsSubresource( false ), mResourceIdentifier( QString::null ),
-    mSubItemsCreated( false ), mStandard( false )
+    mSubItemsCreated( false )
 {
   mResourceColor = QColor();
   setGuiState();
@@ -123,7 +123,7 @@
 
   : QCheckListItem( parent, label, CheckBox ), mResource( resource ),
     mView( view ), mBlockStateChange( false ), mIsSubresource( true ),
-    mSubItemsCreated( false ), mStandard( false )
+    mSubItemsCreated( false )
 {
   mResourceColor = QColor();
   mResourceIdentifier = sub;
@@ -153,11 +153,9 @@
         if ( !mSubItemsCreated )
           createSubresourceItems();
       }
-    } else if( !mStandard ) {
+    } else {
       if ( mResource->save() ) mResource->setActive( false );
       mView->requestClose( mResource );
-    } else { // user tried to deselect a standard resource
-      KMessageBox::information( mView, i18n("You cannot disable a standard resource. If you still want to disable it, please mark another resource as standard.") );
     }
 
     setOpen( mResource->isActive() && childCount() > 0 );
@@ -199,7 +197,7 @@
 
 ResourceView::ResourceView( KCal::CalendarResources *calendar,
                             QWidget *parent, const char *name )
-  : CalendarViewExtension( parent, name ), mCalendar( calendar ), mStandard( 0 )
+  : CalendarViewExtension( parent, name ), mCalendar( calendar )
 {
   QBoxLayout *topLayout = new QVBoxLayout( this, 0, KDialog::spacingHint() );
 
@@ -298,14 +296,8 @@
 
 void ResourceView::addResourceItem( ResourceCalendar *resource )
 {
-  KCal::CalendarResourceManager *manager = mCalendar->resourceManager();
-  bool standard = ( resource == manager->standardResource() );
 
   ResourceItem *item=new ResourceItem( resource, this, mListView );
-  
-  if( standard )
-    mStandard = item;
-  item->setStandard( standard );
 
   QColor resourceColor;
 
@@ -566,16 +558,12 @@
 
 void ResourceView::setStandard()
 {
-  if( mStandard )
-    mStandard->setStandard( false );
   ResourceItem *item = currentItem();
   if ( !item ) return;
 
   ResourceCalendar *r = item->resource();
   KCal::CalendarResourceManager *manager = mCalendar->resourceManager();
   manager->setStandardResource( r );
-  mStandard = item;
-  item->setStandard( true );
 }
 
 void ResourceView::showButtons( bool visible )
--- trunk/KDE/kdepim/korganizer/resourceview.h #431924:431925
@@ -76,9 +76,6 @@
 //     */
     void setResourceColor(QColor& color); 
     QColor &resourceColor() {return mResourceColor;}
-    
-    /** Sets whether this item represents a standard resource. */
-    void setStandard( bool s ) { mStandard = s; }
   protected:
     void stateChange( bool active );
 
@@ -92,7 +89,6 @@
     bool mIsSubresource;
     QString mResourceIdentifier;
     bool mSubItemsCreated;
-    bool mStandard;
 };
 
 /**
@@ -157,7 +153,6 @@
     QPushButton *mDeleteButton;
     QPushButton *mEditButton;
     QPtrList<ResourceCalendar> mResourcesToClose;
-    ResourceItem *mStandard;
 };
 
 #endif
Comment 5 Reinhold Kainhofer 2005-07-05 17:05:10 UTC
On Tuesday 05 July 2005 16:49, Bram Schoenmakers wrote:
> I'll revert, I was too quick. 


Thanks!

> Mark this as INVALID? 


There is a problem (usability-wise), because there is inconsistent behavior:
1) The control center module doesn't let you deactivate the default resource, 
and there needs to be a default resource set
2) KOrganizer doesn't really care about the default resource being deselected, 
and you can even remove the default resource in korganizer!

The other inconsistency appears when you use "always add to default resource". 
When you de-select the default resource, to which resource shall new events 
be added? Shall we ask? Or shall the adding fail altogether? Or shall we 
simply add to the first writable resource?

Until these issues are not cleanly solved, I wouldn't mark this as invalid 
(but I'd rename the report to something that makes more sense in this 
respect).

Reinhold
Comment 6 Thomas Zander 2005-07-05 17:50:04 UTC
>The other inconsistency appears when you use "always add to default resource". 
> When you de-select the default resource, to which resource shall new events 
> be added? Shall we ask? Or shall the adding fail altogether? Or shall we 
> simply add to the first writable resource? 

You missed an option; add to the disabled resource (making it technically dissapear immediately, but a nice choice-dialog would fix that).
I'm under the impression that all resources are displayed in the tree and have a checkbox, which means they all are treated alike.  Consistency is good.
I see no compelling technical, nor usability reasons to disallow a user to do what he wants.

Naturally; removing instead of disabling is a different matter which indeed should be given extra attention on default resources.
Comment 7 Reinhold Kainhofer 2005-07-05 17:55:33 UTC
On Tuesday 05 July 2005 17:50, Thomas Zander wrote:
> >The other inconsistency appears when you use "always add to default
> > resource". When you de-select the default resource, to which resource
> > shall new events be added? Shall we ask? Or shall the adding fail
> > altogether? Or shall we simply add to the first writable resource?
>
> You missed an option; add to the disabled resource (making it technically
> dissapear immediately, but a nice choice-dialog would fix that). 


Actually, this is not possible technically, because disabled resources are not 
loaded. 

Reinhold
Comment 8 Thomas Zander 2005-07-05 20:19:33 UTC
> > You missed an option; add to the disabled resource (making it technically > > dissapear immediately, but a nice choice-dialog would fix that). 
  
 
> Actually, this is not possible technically, because disabled resources are not loaded.

My suggested dialog would give the user the option to enable it (loading it at the same time) or select another resource for the new entry.
Would that make sense?
Comment 9 Reinhold Kainhofer 2006-11-02 18:55:57 UTC
Reassigning all KOrganizer bug reports and wishes to the newly created 
korganizer-devel mailing list.
Comment 10 Sergio Martins 2011-02-05 07:14:10 UTC
This is conceptually different with akonadi now.

Resource view is only used as a filter, to condition what views show. There's no concept of deactivated calendars.