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

akregator

  • sources
  • kde-4.12
  • kdepim
  • akregator
  • configuration
settings_advanced.cpp
Go to the documentation of this file.
1 /*
2  This file is part of Akregator.
3 
4  Copyright (C) 2005-2007 Frank Osterfeld <osterfeld@kde.org>
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 
20  As a special exception, permission is given to link this program
21  with any edition of Qt, and distribute the resulting executable,
22  without including the source code for Qt in the source distribution.
23 */
24 
25 #include "settings_advanced.h"
26 #include "akregatorconfig.h"
27 #include "storagefactory.h"
28 #include "storagefactoryregistry.h"
29 
30 #include <KComboBox>
31 
32 #include <QPushButton>
33 #include <QStringList>
34 #include <QWidget>
35 
36 #include <cassert>
37 
38 namespace Akregator {
39 
40 SettingsAdvanced::SettingsAdvanced(QWidget* parent, const char* name) : QWidget(parent)
41 {
42  setObjectName(QLatin1String(name));
43  setupUi(this);
44 
45  const QStringList backends = Backend::StorageFactoryRegistry::self()->list();
46  Q_FOREACH( const QString& i, backends)
47  {
48  Backend::StorageFactory* const factory = Backend::StorageFactoryRegistry::self()->getFactory( i );
49  if ( !factory )
50  continue;
51 
52  m_factories.insert( factory->key(), factory );
53  cbBackend->addItem( factory->name(), factory->key() );
54  }
55 
56  connect(pbBackendConfigure, SIGNAL(clicked()), this, SLOT(slotConfigureStorage()));
57  connect(cbBackend, SIGNAL(activated(int)), this, SLOT(slotFactorySelected(int)));
58  connect( kcfg_UseMarkReadDelay, SIGNAL(toggled(bool)),
59  kcfg_MarkReadDelay, SLOT(setEnabled(bool)) );
60 
61  kcfg_MarkReadDelay->setSuffix(ki18ncp("Mark selected article read after", " second", " seconds"));
62 }
63 
64 QString SettingsAdvanced::selectedFactory() const
65 {
66  return cbBackend->itemData( cbBackend->currentIndex() ).toString();
67 }
68 
69 void SettingsAdvanced::selectFactory( const QString& key )
70 {
71  const int idx = cbBackend->findData( key );
72  if ( idx < 0 )
73  return;
74  cbBackend->setCurrentIndex( idx );
75  const Backend::StorageFactory* const factory = m_factories.value( key );
76  assert( factory );
77  pbBackendConfigure->setEnabled( factory->isConfigurable() );
78 }
79 
80 void SettingsAdvanced::slotConfigureStorage()
81 {
82  const QString key = cbBackend->itemData( cbBackend->currentIndex() ).toString();
83  if( !key.isEmpty() ) {
84  Backend::StorageFactory* const factory = m_factories.value( key );
85  assert( factory );
86  factory->configure();
87  }
88 }
89 
90 void SettingsAdvanced::slotFactorySelected( int pos )
91 {
92  const QString key = cbBackend->itemData( pos ).toString();
93  const Backend::StorageFactory* const factory = m_factories.value( key );
94  assert( factory );
95  pbBackendConfigure->setEnabled( factory->isConfigurable() );
96 }
97 
98 } //namespace Akregator
99 #include "settings_advanced.moc"
storagefactoryregistry.h
Akregator::Backend::StorageFactoryRegistry::list
QStringList list() const
Definition: storagefactoryregistry.cpp:74
Akregator::SettingsAdvanced::slotFactorySelected
void slotFactorySelected(int)
Definition: settings_advanced.cpp:90
QWidget
Akregator::Backend::StorageFactory::configure
virtual void configure()=0
shows the plugin's configuration dialog
Akregator::Backend::StorageFactoryRegistry::self
static StorageFactoryRegistry * self()
Definition: storagefactoryregistry.cpp:43
Akregator::SettingsAdvanced::SettingsAdvanced
SettingsAdvanced(QWidget *parent=0, const char *name=0)
Definition: settings_advanced.cpp:40
Akregator::Backend::StorageFactory::name
virtual QString name() const =0
returns the (i18n'd) name of the storage type.
Akregator::Backend::StorageFactory
Definition: storagefactory.h:37
akregatorconfig.h
Akregator::SettingsAdvanced::selectedFactory
QString selectedFactory() const
returns the key of the currently selected factory
Definition: settings_advanced.cpp:64
storagefactory.h
Akregator::Backend::StorageFactoryRegistry::getFactory
StorageFactory * getFactory(const QString &typestr)
Definition: storagefactoryregistry.cpp:64
Akregator::Backend::StorageFactory::key
virtual QString key() const =0
identifier of the storage type, like "metakit", "postgres" etc.
Akregator::SettingsAdvanced::selectFactory
void selectFactory(const QString &key)
Definition: settings_advanced.cpp:69
Akregator::Backend::StorageFactory::isConfigurable
virtual bool isConfigurable() const =0
true if the plugin is configurable via a config dialog
Akregator::SettingsAdvanced::slotConfigureStorage
void slotConfigureStorage()
Definition: settings_advanced.cpp:80
settings_advanced.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:58:14 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akregator

Skip menu "akregator"
  • Main Page
  • Namespace List
  • Namespace Members
  • 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

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