28 #include "mailcommon/folderdialog/checkedcollectionwidget.h"
30 #include <Akonadi/EntityTreeModel>
31 #include <Akonadi/ETMViewStateSaver>
32 #include <Akonadi/ChangeRecorder>
33 #include <Akonadi/CollectionFilterProxyModel>
34 #include <KRecursiveFilterProxyModel>
36 #include <KMime/KMimeMessage>
39 #include <KAcceleratorManager>
40 #include <KCheckableProxyModel>
41 #include <KComponentData>
49 #include <QVBoxLayout>
55 KComponentData inst(
"kcmkmailsummary" );
65 connect( mCheckedCollectionWidget->folderTreeView(), SIGNAL(clicked(QModelIndex)),
67 connect( mFullPath, SIGNAL(toggled(
bool)), SLOT(modified()) );
69 KAcceleratorManager::manage(
this );
74 new KAboutData( I18N_NOOP(
"kcmkmailsummary" ), 0,
75 ki18n(
"Mail Summary Configuration Dialog" ),
76 0, KLocalizedString(), KAboutData::License_GPL,
77 ki18n(
"Copyright © 2004–2010 Tobias Koenig" ) );
79 about->addAuthor( ki18n(
"Tobias Koenig" ),
80 KLocalizedString(),
"tokoe@kde.org" );
81 setAboutData( about );
84 void KCMKMailSummary::modified()
89 void KCMKMailSummary::initGUI()
91 QVBoxLayout *layout =
new QVBoxLayout(
this );
92 layout->setSpacing( KDialog::spacingHint() );
93 layout->setMargin( 0 );
95 mCheckedCollectionWidget =
new MailCommon::CheckedCollectionWidget;
97 mFullPath =
new QCheckBox( i18n(
"Show full path for folders" ),
this );
98 mFullPath->setToolTip(
99 i18nc(
"@info:tooltip",
"Show full path for each folder" ) );
100 mFullPath->setWhatsThis(
101 i18nc(
"@info:whatsthis",
102 "Enable this option if you want to see the full path "
103 "for each folder listed in the summary. If this option is "
104 "not enabled, then only the base folder path will be shown." ) );
105 layout->addWidget( mCheckedCollectionWidget );
106 layout->addWidget( mFullPath );
109 void KCMKMailSummary::initFolders()
111 KSharedConfigPtr _config = KSharedConfig::openConfig( QLatin1String(
"kcmkmailsummaryrc") );
114 new KViewStateMaintainer<Akonadi::ETMViewStateSaver>( _config->group(
"CheckState" ), this );
115 mModelState->setSelectionModel( mCheckedCollectionWidget->selectionModel() );
118 void KCMKMailSummary::loadFolders()
120 KConfig _config( QLatin1String(
"kcmkmailsummaryrc") );
121 KConfigGroup config(&_config,
"General" );
122 mModelState->restoreState();
123 const bool showFolderPaths = config.readEntry(
"showFolderPaths",
false );
124 mFullPath->setChecked( showFolderPaths );
127 void KCMKMailSummary::storeFolders()
129 KConfig _config( QLatin1String(
"kcmkmailsummaryrc") );
130 KConfigGroup config(&_config,
"General" );
131 mModelState->saveState();
132 config.writeEntry(
"showFolderPaths", mFullPath->isChecked() );
141 emit changed(
false );
148 emit changed(
false );
153 mFullPath->setChecked(
true );
155 emit changed(
true );
158 #include "kcmkmailsummary.moc"
KCModule * create_kmailsummary(QWidget *parent, const char *)
KCMKMailSummary(const KComponentData &inst, QWidget *parent=0)