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

kontact

  • sources
  • kde-4.14
  • kdepim
  • kontact
  • plugins
  • knotes
kcmknotessummary.cpp
Go to the documentation of this file.
1 /*
2  Copyright (c) 2013-2015 Montel Laurent <montel@kde.org>
3 
4  This program is free software; you can redistribute it and/or modify it
5  under the terms of the GNU General Public License, version 2, as
6  published by the Free Software Foundation.
7 
8  This program is distributed in the hope that it will be useful, but
9  WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License along
14  with this program; if not, write to the Free Software Foundation, Inc.,
15  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 
18 #include "kcmknotessummary.h"
19 
20 #include <Akonadi/Notes/NoteUtils>
21 
22 #include "pimcommon/folderdialog/checkedcollectionwidget.h"
23 
24 #include <Akonadi/ETMViewStateSaver>
25 
26 #include <KAboutData>
27 #include <KAcceleratorManager>
28 #include <KCheckableProxyModel>
29 #include <KComponentData>
30 #include <KDebug>
31 #include <KDialog>
32 #include <KLocalizedString>
33 #include <KLineEdit>
34 
35 #include <QCheckBox>
36 #include <QTreeView>
37 #include <QVBoxLayout>
38 
39 extern "C"
40 {
41 KDE_EXPORT KCModule *create_knotessummary( QWidget *parent, const char * )
42 {
43  KComponentData inst( "kcmknotessummary" );
44  return new KCMKNotesSummary( inst, parent );
45 }
46 }
47 
48 KCMKNotesSummary::KCMKNotesSummary( const KComponentData &inst, QWidget *parent )
49  : KCModule( inst, parent )
50 {
51  initGUI();
52 
53  connect( mCheckedCollectionWidget->folderTreeView(), SIGNAL(clicked(QModelIndex)),
54  SLOT(modified()) );
55 
56  KAcceleratorManager::manage( this );
57 
58  load();
59 
60  KAboutData *about =
61  new KAboutData( I18N_NOOP( "kcmknotessummary" ), 0,
62  ki18n( "Notes Summary Configuration Dialog" ),
63  0, KLocalizedString(), KAboutData::License_GPL,
64  ki18n( "Copyright © 2013-2014 Laurent Montel <montel@kde.org>" ) );
65 
66  about->addAuthor( ki18n( "Laurent Montel" ),
67  KLocalizedString(), "montel@kde.org" );
68  setAboutData( about );
69 }
70 
71 void KCMKNotesSummary::modified()
72 {
73  emit changed( true );
74 }
75 
76 void KCMKNotesSummary::initGUI()
77 {
78  QVBoxLayout *layout = new QVBoxLayout( this );
79  layout->setSpacing( KDialog::spacingHint() );
80  layout->setMargin( 0 );
81 
82  mCheckedCollectionWidget = new PimCommon::CheckedCollectionWidget(Akonadi::NoteUtils::noteMimeType());
83  layout->addWidget( mCheckedCollectionWidget );
84 }
85 
86 void KCMKNotesSummary::initFolders()
87 {
88  KSharedConfigPtr _config = KSharedConfig::openConfig( QLatin1String("kcmknotessummaryrc") );
89 
90  mModelState =
91  new KViewStateMaintainer<Akonadi::ETMViewStateSaver>( _config->group( "CheckState" ), this );
92  mModelState->setSelectionModel( mCheckedCollectionWidget->selectionModel() );
93 }
94 
95 void KCMKNotesSummary::loadFolders()
96 {
97  mModelState->restoreState();
98 }
99 
100 void KCMKNotesSummary::storeFolders()
101 {
102  KConfig config( QLatin1String("kcmknotessummaryrc") );
103  mModelState->saveState();
104  config.sync();
105 }
106 
107 void KCMKNotesSummary::load()
108 {
109  initFolders();
110  loadFolders();
111 
112  emit changed( false );
113 }
114 
115 void KCMKNotesSummary::save()
116 {
117  storeFolders();
118 
119  emit changed( false );
120 }
121 
122 void KCMKNotesSummary::defaults()
123 {
124  emit changed( true );
125 }
QModelIndex
QWidget
KCMKNotesSummary::save
virtual void save()
Definition: kcmknotessummary.cpp:115
KCMKNotesSummary::KCMKNotesSummary
KCMKNotesSummary(const KComponentData &inst, QWidget *parent=0)
Definition: kcmknotessummary.cpp:48
QBoxLayout::addWidget
void addWidget(QWidget *widget, int stretch, QFlags< Qt::AlignmentFlag > alignment)
KCMKNotesSummary::defaults
virtual void defaults()
Definition: kcmknotessummary.cpp:122
KCMKNotesSummary::load
virtual void load()
Definition: kcmknotessummary.cpp:107
KCMKNotesSummary
Definition: kcmknotessummary.h:35
QVBoxLayout
kcmknotessummary.h
QLayout::setMargin
void setMargin(int margin)
QLatin1String
create_knotessummary
KCModule * create_knotessummary(QWidget *parent, const char *)
Definition: kcmknotessummary.cpp:41
KCModule
QBoxLayout::setSpacing
void setSpacing(int spacing)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:34:11 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kontact

Skip menu "kontact"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

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
  • pimprint

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