Bug 282956 - korganizer doesn't enable the "assign color" dialog field on focusing/marking a calendar element but only when you change the selection
Summary: korganizer doesn't enable the "assign color" dialog field on focusing/marking...
Status: RESOLVED FIXED
Alias: None
Product: korganizer
Classification: Applications
Component: general (show other bugs)
Version: GIT (master)
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-28 08:47 UTC by Johannes K.
Modified: 2011-11-02 18:42 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
how I tried to fix it (2.03 KB, patch)
2011-10-03 21:37 UTC, Johannes K.
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Johannes K. 2011-09-28 08:47:00 UTC
Version:           GIT (master) (using Devel) 
OS:                Linux

Hi

Yesterday I added google calendars to akonadi and set their colors. Today...after reboot their colors were totally mixed up and changed. Than I wanted to test if it also happens with other akonadi calendar resources and added an "akonadi_gcal_resource" and and standard calender with file access. After a restart of Kontact the colors were still there...the same after a reboot. But now I can't assign a color anymore to any of the resources. "Assign Color ..." is just greyed out...

Reproducible: Sometimes

Steps to Reproduce:
added google calendars to akonadi and set their colors. Today...after reboot their colors were totally mixed up and changed. Than I wanted to test if it also happens with other akonadi calendar resources and added an "akonadi_gcal_resource" and and standard calender with file access. After a restart of Kontact the colors were still there...the same after a reboot. But now I can't assign a color anymore to any of the resources. "Assign Color ..." is just greyed out...


Expected Results:  
being able to add colors to calendars and they should stay even after reboot
Comment 1 Johannes K. 2011-10-02 20:56:44 UTC
I've tried to investigate the source of the bug myself and found out that the assign color field in the dialog of an calendar resource only gets highlighted when the selection of a calendar has been changed because there is only a connect between the Signal selectionChanged(QItemSelection,QItemSelection) of the class QItemSelectionModel (lives in mSelectionProxyModel->selectionModel()). This connection is created in the setter function setCollectionSelectionProxyModel in korganizer/akonadicollectionview.cpp. I tried to add another connect for the signals "currentChanged" and "currentRowChanged" of the class QItemSelectionModel but these Signals just don't get triggerd, when I change the focus to a different calendar element. I checked it via cgdb...
I'm not so experienced in c++ and qt programming and really would like to understand, why these signals are not called. Please help me :-) Here is the code I added:

void AkonadiCollectionView::setCollectionSelectionProxyModel( KCheckableProxyModel* m )                                                                                                                                                                                        
{                                                                                                                                                                                                                                                                              
  if ( mSelectionProxyModel == m )                                                                                                                                                                                                                                             
    return;                                                                                                                                                                                                                                                                    
  mSelectionProxyModel = m;                                                                                                                                                                                                                                                    
  if ( !mSelectionProxyModel )                                                                                                                                                                                                                                                 
    return;                                                                                                                                                                                                                                                                    
  mBaseModel->setSourceModel( mSelectionProxyModel );                                                                                                                                                                                                                          
  connect( mSelectionProxyModel->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(selectionChanged()) );                                                                                                                                  
  connect( mSelectionProxyModel->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), this, SLOT(currentRowChanged()) );                                                                                                                                      
  connect( mSelectionProxyModel->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(selectionChanged()) );                                                                                                                                          
} 

void AkonadiCollectionView::selectionChanged()                                                                                                                                                                                                                                 
{                                                                                                                                                                                                                                                                              
  updateMenu();                                                                                                                                                                                                                                                                
  updateView();                                                                                                                                                                                                                                                                
}                                                                                                                                                                                                                                                                              
                                                                                                                                                                                                                                                                               
void AkonadiCollectionView::currentRowChanged()                                                                                                                                                                                                                                
{                                                                                                                                                                                                                                                                              
  updateMenu();                                                                                                                                                                                                                                                                
}                                                                                                                                                                                                                                                                              
                                                                                                                                                                                                                                                                               
void AkonadiCollectionView::currentChanged()                                                                                                                                                                                                                                   
{                                                                                                                                                                                                                                                                              
  updateMenu();                                                                                                                                                                                                                                                                
}
Comment 2 Johannes K. 2011-10-03 21:37:22 UTC
Created attachment 64180 [details]
how I tried to fix it

The patch shows how I tried to fix this bug. Both signals somehow don't get called when change the focus to a different calendar.
Comment 3 Sergio Martins 2011-10-26 19:18:03 UTC
Add a breakpoint on updateMenu(), and select a calendar with the mouse, does the breakpoint get hit ?
Comment 4 Sergio Martins 2011-11-02 18:33:55 UTC
Git commit 4e8cbf49d8c230e1959a064eb4e2ec08e47a6b53 by Sergio Martins.
Committed on 02/11/2011 at 19:25.
Pushed by smartins into branch 'master'.

Fix "Use default calendar" and "Assign color" being disabled.

We were listening to the wrong selection model.

BUG: 282956
BUG: 246573

M  +4    -8    korganizer/akonadicollectionview.cpp
M  +1    -4    korganizer/akonadicollectionview.h

http://commits.kde.org/kdepim/4e8cbf49d8c230e1959a064eb4e2ec08e47a6b53
Comment 5 Sergio Martins 2011-11-02 18:42:37 UTC
Git commit 617ee9629e90caa037e0ac47dfecc87cf20fa8da by Sergio Martins.
Committed on 02/11/2011 at 19:25.
Pushed by smartins into branch 'KDE/4.7'.

Fix "Use default calendar" and "Assign color" being disabled.

We were listening to the wrong selection model.

BUG: 282956
BUG: 246573

Conflicts:

	korganizer/akonadicollectionview.cpp

M  +7    -7    korganizer/akonadicollectionview.cpp
M  +1    -4    korganizer/akonadicollectionview.h

http://commits.kde.org/kdepim/617ee9629e90caa037e0ac47dfecc87cf20fa8da