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

akregator

akregator_config_archive.cpp

Go to the documentation of this file.
00001 /*
00002     This file is part of Akregator.
00003     Copyright (c) 2008 Frank Osterfeld <osterfeld@kde.org>
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program; if not, write to the Free Software
00017     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00018 
00019     As a special exception, permission is given to link this program
00020     with any edition of Qt, and distribute the resulting executable,
00021     without including the source code for Qt in the source distribution.
00022 */
00023 
00024 #include "akregator_config_archive.h"
00025 #include "akregatorconfig.h"
00026 #include "ui_settings_archive.h"
00027 #include <KAboutData>
00028 #include <KConfigDialogManager>
00029 #include <KDebug>
00030 #include <KGenericFactory>
00031 #include <KLocalizedString>
00032 #include <kdemacros.h>
00033 
00034 #include <QButtonGroup>
00035 #include <QVBoxLayout>
00036 
00037 using namespace Akregator;
00038 
00039 K_PLUGIN_FACTORY(KCMAkregatorArchiveConfigFactory, registerPlugin<KCMAkregatorArchiveConfig>();)
00040 K_EXPORT_PLUGIN(KCMAkregatorArchiveConfigFactory( "kcmakrarchiveconfig" ))
00041 
00042 KCMAkregatorArchiveConfig::KCMAkregatorArchiveConfig( QWidget* parent, const QVariantList& args )
00043     : KCModule( KCMAkregatorArchiveConfigFactory::componentData(), parent, args ), m_widget( new QWidget )
00044 {
00045     Ui::SettingsArchive m_ui;
00046     m_ui.setupUi( m_widget );
00047     QVBoxLayout* layout = new QVBoxLayout( this );
00048     layout->addWidget( m_widget );
00049 
00050     connect( m_ui.rb_LimitArticleNumber, SIGNAL(toggled(bool)),
00051              m_ui.kcfg_MaxArticleNumber, SLOT(setEnabled( bool)) );
00052     connect( m_ui.rb_LimitArticleAge, SIGNAL(toggled(bool)),
00053              m_ui.kcfg_MaxArticleAge, SLOT(setEnabled(bool)) );
00054 
00055     m_archiveModeGroup = new QButtonGroup( this );
00056     m_archiveModeGroup->addButton( m_ui.rb_KeepAllArticles, Settings::EnumArchiveMode::keepAllArticles );
00057     m_archiveModeGroup->addButton( m_ui.rb_LimitArticleNumber, Settings::EnumArchiveMode::limitArticleNumber );
00058     m_archiveModeGroup->addButton( m_ui.rb_LimitArticleAge, Settings::EnumArchiveMode::limitArticleAge );
00059     m_archiveModeGroup->addButton( m_ui.rb_DisableArchiving, Settings::EnumArchiveMode::disableArchiving );
00060     connect( m_archiveModeGroup, SIGNAL(buttonClicked(int)), this, SLOT(changed()) );
00061     KAboutData *about = new KAboutData( I18N_NOOP( "kcmakrarchiveconfig" ), 0,
00062                                         ki18n( "Configure Feed Reader Archive" ),
00063                                         0, KLocalizedString(), KAboutData::License_GPL,
00064                                         ki18n( "(c), 2004 - 2008 Frank Osterfeld" ) );
00065 
00066     about->addAuthor( ki18n( "Frank Osterfeld" ), KLocalizedString(), "osterfeld@kde.org" );
00067     setAboutData( about );
00068 
00069     addConfig( Settings::self(), m_widget );
00070 }
00071 
00072 void KCMAkregatorArchiveConfig::load()
00073 {
00074     setArchiveMode( Settings::archiveMode() );
00075     KCModule::load();
00076 }
00077 
00078 void KCMAkregatorArchiveConfig::save()
00079 {
00080     Settings::setArchiveMode( archiveMode() );
00081     KCModule::save();
00082 }
00083 
00084 
00085 void KCMAkregatorArchiveConfig::setArchiveMode( int mode )
00086 {
00087     QAbstractButton* const b = m_archiveModeGroup->button( mode );
00088     if ( b )
00089         b->setChecked( true );
00090     else
00091         kWarning( "No button for %d registered, ignoring call", mode );
00092 }
00093 
00094 int KCMAkregatorArchiveConfig::archiveMode() const {
00095     const int id = m_archiveModeGroup->checkedId();
00096     if ( id < 0 || id >= Settings::EnumArchiveMode::COUNT )
00097         return Settings::EnumArchiveMode::keepAllArticles;
00098     return id;
00099 }
00100 
00101 #include "akregator_config_archive.moc"

akregator

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

kdepim

Skip menu "kdepim"
  • akonadi
  •   clients
  •   kabc
  •   kcal
  •   kcm
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • kmobiletools
  • knode
  • knotes
  • kontact
  • kontactinterfaces
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  • libkdepim
  • libkholidays
  • libkleo
  • libkpgp
  • maildir
Generated for kdepim by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal