From a67dd47d3ad2ae06369dffce833b3a8447b648d2 Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Sun, 9 Jan 2011 18:31:51 +0000 Subject: [PATCH] Added some setObjectName() for debugging purposes. Some debugging tools show the object name instead of the memory address, if available. KOrganizer has 10 or 15 models/proxy models/selection models/. Adding a name to each one makes it trivial to understand the codewhen using a tool to graphically represent the stack of proxy models. --- calendarsupport/calendar.cpp | 1 + incidenceeditor-ng/groupwareintegration.cpp | 2 ++ korganizer/actionmanager.cpp | 9 +++++++++ korganizer/akonadicollectionview.cpp | 3 +++ 4 files changed, 15 insertions(+) diff --git a/calendarsupport/calendar.cpp b/calendarsupport/calendar.cpp index b1cde9ce41..0712590dc8 100644 --- a/calendarsupport/calendar.cpp +++ b/calendarsupport/calendar.cpp @@ -44,6 +44,7 @@ Calendar::Private::Private( QAbstractItemModel *treeModel, QAbstractItemModel *m m_filterProxy = new CalFilterProxyModel( q ); m_filterProxy->setFilter( mDefaultFilter ); m_filterProxy->setSourceModel( model ); + m_filterProxy->setObjectName( "Implements KCalCore filtering functionality" ); // user information... mOwner.setName( i18n( "Unknown Name" ) ); diff --git a/incidenceeditor-ng/groupwareintegration.cpp b/incidenceeditor-ng/groupwareintegration.cpp index f737abeb6f..1e425ee3a0 100644 --- a/incidenceeditor-ng/groupwareintegration.cpp +++ b/incidenceeditor-ng/groupwareintegration.cpp @@ -58,9 +58,11 @@ class GroupwareUiDelegate : public QObject, public CalendarSupport::GroupwareUiD CalendarSupport::CalendarModel *calendarModel = new CalendarSupport::CalendarModel( monitor, this ); + calendarModel->setObjectName( "Groupware calendar model" ); mCalendar = new CalendarSupport::Calendar( calendarModel, calendarModel, KSystemTimeZones::local() ); + mCalendar->setObjectName( "Groupware calendar" ); mCalendar->setOwner( KCalCore::Person( CalendarSupport::KCalPrefs::instance()->fullName(), CalendarSupport::KCalPrefs::instance()->email() ) ); } diff --git a/korganizer/actionmanager.cpp b/korganizer/actionmanager.cpp index cda50596c1..738a8e8c8e 100644 --- a/korganizer/actionmanager.cpp +++ b/korganizer/actionmanager.cpp @@ -265,10 +265,12 @@ void ActionManager::createCalendarAkonadi() monitor->setMimeTypeMonitored( KCalCore::Todo::todoMimeType(), true ); monitor->setMimeTypeMonitored( KCalCore::Journal::journalMimeType(), true ); mCalendarModel = new CalendarSupport::CalendarModel( monitor, this ); + mCalendarModel->setObjectName( "KOrg CalendarModel" ); //mCalendarModel->setItemPopulationStrategy( Akonadi::EntityTreeModel::LazyPopulation ); // Our calendar tree must be sorted. QSortFilterProxyModel *sortFilterProxy = new QSortFilterProxyModel( this ); + sortFilterProxy->setObjectName( "Sort" ); sortFilterProxy->setDynamicSortFilter( true ); sortFilterProxy->setSortCaseSensitivity( Qt::CaseInsensitive ); sortFilterProxy->setSourceModel( mCalendarModel ); @@ -277,14 +279,17 @@ void ActionManager::createCalendarAkonadi() KColumnFilterProxyModel *columnFilterProxy = new KColumnFilterProxyModel( this ); columnFilterProxy->setSourceModel( sortFilterProxy ); columnFilterProxy->setVisibleColumn( CalendarSupport::CalendarModel::CollectionTitle ); + columnFilterProxy->setObjectName( "Remove columns" ); // Keep track of selected items. QItemSelectionModel* selectionModel = new QItemSelectionModel( columnFilterProxy ); + selectionModel->setObjectName( "Calendar Selection Model" ); // Make item selection work by means of checkboxes. KCheckableProxyModel *checkableProxy = new KCheckableProxyModel( this ); checkableProxy->setSelectionModel( selectionModel ); checkableProxy->setSourceModel( columnFilterProxy ); + checkableProxy->setObjectName( "Add checkboxes" ); KConfig *config = KOGlobals::self()->config(); mCollectionSelectionModelStateSaver = new KViewStateMaintainer( config->group( "GlobalCollectionSelection" ) ); @@ -293,6 +298,7 @@ void ActionManager::createCalendarAkonadi() AkonadiCollectionViewFactory factory( mCalendarView ); mCalendarView->addExtension( &factory ); mCollectionView = factory.collectionView(); + mCollectionView->setObjectName( "Resource View" ); connect( mCollectionView, SIGNAL(resourcesChanged(bool)), SLOT(slotResourcesChanged(bool))); connect( mCollectionView, SIGNAL(resourcesAddedRemoved()), SLOT(slotResourcesAddedRemoved())); connect( mCollectionView, SIGNAL(defaultResourceChanged(Akonadi::Collection)), @@ -308,6 +314,7 @@ void ActionManager::createCalendarAkonadi() CalendarSupport::CollectionSelection *colSel = new CalendarSupport::CollectionSelection( selectionModel ); EventViews::EventView::setGlobalCollectionSelection( colSel ); KSelectionProxyModel* selectionProxy = new KSelectionProxyModel( selectionModel ); + selectionProxy->setObjectName( "Only show items of selected collection" ); selectionProxy->setFilterBehavior( KSelectionProxyModel::ChildrenOfExactSelection ); selectionProxy->setSourceModel( mCalendarModel ); @@ -316,8 +323,10 @@ void ActionManager::createCalendarAkonadi() filterProxy2->setHeaderGroup( Akonadi::EntityTreeModel::ItemListHeaders ); filterProxy2->setSourceModel( selectionProxy ); filterProxy2->setSortRole( CalendarSupport::CalendarModel::SortRole ); + filterProxy2->setObjectName( "Show headers" ); mCalendar = new CalendarSupport::Calendar( mCalendarModel, filterProxy2, KSystemTimeZones::local() ); + mCalendar->setObjectName( "KOrg Calendar" ); mCalendarView->setCalendar( mCalendar ); mCalendarView->readSettings(); diff --git a/korganizer/akonadicollectionview.cpp b/korganizer/akonadicollectionview.cpp index f2cd4326e4..14c72f9379 100644 --- a/korganizer/akonadicollectionview.cpp +++ b/korganizer/akonadicollectionview.cpp @@ -169,11 +169,13 @@ AkonadiCollectionView::AkonadiCollectionView( CalendarView* view, bool hasContex Akonadi::CollectionFilterProxyModel *collectionproxymodel = new Akonadi::CollectionFilterProxyModel( this ); + collectionproxymodel->setObjectName( "Only show collections" ); collectionproxymodel->setDynamicSortFilter( true ); collectionproxymodel->addMimeTypeFilter( QString::fromLatin1( "text/calendar" ) ); //collectionproxymodel->addExcludedSpecialResources(Akonadi::Collection::SearchResource); ColorProxyModel* colorProxy = new ColorProxyModel( this ); + colorProxy->setObjectName( "Show calendar colors" ); colorProxy->setDynamicSortFilter( true ); colorProxy->setSourceModel( collectionproxymodel ); mBaseModel = collectionproxymodel; @@ -188,6 +190,7 @@ AkonadiCollectionView::AkonadiCollectionView( CalendarView* view, bool hasContex filterTreeViewModel->setDynamicSortFilter( true ); filterTreeViewModel->setSourceModel( colorProxy ); filterTreeViewModel->setFilterCaseSensitivity( Qt::CaseInsensitive ); + filterTreeViewModel->setObjectName( "Recursive filtering, for the search bar" ); mCollectionview->setModel( filterTreeViewModel ); connect( searchCol, SIGNAL( textChanged(QString) ), filterTreeViewModel, SLOT( setFilterFixedString(QString) ) ); -- 2.11.4.GIT