• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

korganizer

  • sources
  • kde-4.12
  • kdepim
  • korganizer
kitemiconcheckcombo.cpp
Go to the documentation of this file.
1 /*
2  This file is part of KOrganizer.
3 
4  Copyright (C) 2011 Sérgio Martins <iamsergio@gmail.com>
5 
6  This library is free software; you can redistribute it and/or modify it
7  under the terms of the GNU Library General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or (at your
9  option) any later version.
10 
11  This library is distributed in the hope that it will be useful, but WITHOUT
12  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
14  License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to the
18  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  02110-1301, USA.
20 */
21 
22 #include "kitemiconcheckcombo.h"
23 #include "koglobals.h"
24 
25 #include <KLocale>
26 
27 class KItemIconCheckCombo::Private
28 {
29  public:
30  Private( ViewType viewType ) : mViewType( viewType )
31  {
32  }
33 
34  KItemIconCheckCombo::ViewType mViewType;
35 };
36 
37 KItemIconCheckCombo::KItemIconCheckCombo( ViewType viewType, QWidget *parent )
38  : KPIM::KCheckComboBox( parent ), d( new Private( viewType ) )
39 {
40  addItem( i18n("Calendar's custom icon") );
41  addItem( KOGlobals::self()->smallIcon( QLatin1String("view-calendar-tasks") ), i18n( "To-do" ) );
42  addItem( KOGlobals::self()->smallIcon( QLatin1String("view-pim-journal") ), i18n( "Journal" ) );
43  addItem( KOGlobals::self()->smallIcon( QLatin1String("appointment-recurring") ), i18n( "Recurring" ) );
44  addItem( KOGlobals::self()->smallIcon( QLatin1String("appointment-reminder") ), i18n( "Alarm" ) );
45  addItem( KOGlobals::self()->smallIcon( QLatin1String("object-locked") ), i18n( "Read Only" ) );
46  addItem( KOGlobals::self()->smallIcon( QLatin1String("mail-reply-sender") ), i18n( "Needs Reply" ) );
47  addItem( KOGlobals::self()->smallIcon( QLatin1String("meeting-attending") ), i18n( "Attending" ) );
48  addItem( KOGlobals::self()->smallIcon( QLatin1String("meeting-attending-tentative") ),
49  i18n( "Maybe Attending" ) );
50  addItem( KOGlobals::self()->smallIcon( QLatin1String("meeting-organizer") ), i18n( "Organizer" ) );
51 
52  // Agenda view doesn't support journals yet
53  setItemEnabled( EventViews::EventView::JournalIcon, viewType != AgendaType );
54  setItemEnabled( EventViews::EventView::ReplyIcon, viewType == AgendaType );
55  setItemEnabled( EventViews::EventView::AttendingIcon, viewType == AgendaType );
56  setItemEnabled( EventViews::EventView::TentativeIcon, viewType == AgendaType );
57  setItemEnabled( EventViews::EventView::OrganizerIcon, viewType == AgendaType );
58 
59  setDefaultText( i18nc( "@item:inlistbox", "Icons to use" ) );
60  setAlwaysShowDefaultText( true );
61 }
62 
63 KItemIconCheckCombo::~KItemIconCheckCombo()
64 {
65  delete d;
66 }
67 
68 void KItemIconCheckCombo::setCheckedIcons( const QSet<EventViews::EventView::ItemIcon> &icons )
69 {
70  const int itemCount = count();
71  for ( int i=0; i<itemCount; ++i ) {
72  if ( itemEnabled( i ) ) {
73  setItemCheckState(
74  i,
75  icons.contains( static_cast<EventViews::EventView::ItemIcon>( i ) ) ?
76  Qt::Checked :
77  Qt::Unchecked );
78  } else {
79  setItemCheckState( i, Qt::Unchecked );
80  }
81  }
82 }
83 
84 QSet<EventViews::EventView::ItemIcon> KItemIconCheckCombo::checkedIcons() const
85 {
86  QSet<EventViews::EventView::ItemIcon> icons;
87  const int itemCount = count();
88  for ( int i=0; i<itemCount; ++i ) {
89  const QVariant value = itemCheckState( i );
90  if ( value.toBool() ) {
91  icons.insert( static_cast<EventViews::EventView::ItemIcon>( i ) );
92  }
93  }
94  return icons;
95 }
96 
97 #include "kitemiconcheckcombo.moc"
kitemiconcheckcombo.h
koglobals.h
QWidget
KItemIconCheckCombo::setCheckedIcons
void setCheckedIcons(const QSet< EventViews::EventView::ItemIcon > &icons)
Definition: kitemiconcheckcombo.cpp:68
KItemIconCheckCombo::~KItemIconCheckCombo
~KItemIconCheckCombo()
Definition: kitemiconcheckcombo.cpp:63
KItemIconCheckCombo::ViewType
ViewType
Definition: kitemiconcheckcombo.h:33
KItemIconCheckCombo::AgendaType
Definition: kitemiconcheckcombo.h:34
KItemIconCheckCombo::KItemIconCheckCombo
KItemIconCheckCombo(ViewType viewType, QWidget *parent=0)
Definition: kitemiconcheckcombo.cpp:37
KOGlobals::self
static KOGlobals * self()
Definition: koglobals.cpp:43
KItemIconCheckCombo::checkedIcons
QSet< EventViews::EventView::ItemIcon > checkedIcons() const
Definition: kitemiconcheckcombo.cpp:84
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:56:19 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

korganizer

Skip menu "korganizer"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal